From 3693bbdc6b65e68db10375d3eeab70f06708b729 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Thu, 9 May 2024 14:51:33 +0100 Subject: Use internals for getting block/entity counts For a long time I've been meaning to move some of this logic internally as this would allow us to avoid hitting systems like block state snapshots which can create issues as many of the spigot implementations of this stuff are increasingly broken, leading to unexpected crashes during ticking, even if the API cannot properly interact with these such states/items, it's generally more preferable to not crash the server in the course, and just let those interactions fail more gracefully. --- patches/api/0011-Timings-v2.patch | 84 +- patches/api/0015-Version-Command-2.0.patch | 6 +- ...llow-Blocks-to-be-accessed-via-a-long-key.patch | 184 ++ ...snapshots-for-Timings-Tile-Entity-reports.patch | 19 - ...llow-Blocks-to-be-accessed-via-a-long-key.patch | 184 -- patches/api/0136-Slime-Pathfinder-Events.patch | 228 +++ patches/api/0137-Add-PhantomPreSpawnEvent.patch | 72 + patches/api/0137-Slime-Pathfinder-Events.patch | 228 --- patches/api/0138-Add-More-Creeper-API.patch | 97 + patches/api/0138-Add-PhantomPreSpawnEvent.patch | 72 - patches/api/0139-Add-More-Creeper-API.patch | 97 - patches/api/0139-Inventory-removeItemAnySlot.patch | 61 + patches/api/0140-Inventory-removeItemAnySlot.patch | 61 - patches/api/0140-isChunkGenerated-API.patch | 62 + ...block-constructor-and-getChangedBlockData.patch | 55 + patches/api/0141-isChunkGenerated-API.patch | 62 - ...block-constructor-and-getChangedBlockData.patch | 55 - patches/api/0142-Async-Chunks-API.patch | 530 ++++++ ...3-Add-ray-tracing-methods-to-LivingEntity.patch | 182 ++ patches/api/0143-Async-Chunks-API.patch | 530 ------ ...4-Add-ray-tracing-methods-to-LivingEntity.patch | 182 -- ...Expose-attack-cooldown-methods-for-Player.patch | 39 + ...Expose-attack-cooldown-methods-for-Player.patch | 39 - patches/api/0145-Improve-death-events.patch | 204 +++ ...information-to-version-command-on-startup.patch | 101 ++ patches/api/0146-Improve-death-events.patch | 204 --- ...information-to-version-command-on-startup.patch | 101 -- patches/api/0147-Mob-Pathfinding-API.patch | 265 +++ patches/api/0148-Mob-Pathfinding-API.patch | 265 --- ...e-Concurrency-Improvements-to-Permissions.patch | 113 ++ .../0149-Add-ItemStackRecipeChoice-Draft-API.patch | 67 + ...e-Concurrency-Improvements-to-Permissions.patch | 113 -- .../0150-Add-ItemStackRecipeChoice-Draft-API.patch | 67 - ...plement-furnace-cook-speed-multiplier-API.patch | 61 + ...plement-furnace-cook-speed-multiplier-API.patch | 61 - patches/api/0151-Material-API-additions.patch | 41 + patches/api/0152-Add-Material-Tags.patch | 1239 +++++++++++++ patches/api/0152-Material-API-additions.patch | 41 - patches/api/0153-Add-Material-Tags.patch | 1239 ------------- patches/api/0153-PreSpawnerSpawnEvent.patch | 47 + .../0154-Add-LivingEntity-getTargetEntity.patch | 134 ++ patches/api/0154-PreSpawnerSpawnEvent.patch | 47 - .../0155-Add-LivingEntity-getTargetEntity.patch | 134 -- patches/api/0155-Add-sun-related-API.patch | 45 + patches/api/0156-Add-sun-related-API.patch | 45 - patches/api/0156-Turtle-API.patch | 291 +++ patches/api/0157-Add-spectator-target-events.patch | 148 ++ patches/api/0157-Turtle-API.patch | 291 --- patches/api/0158-Add-more-Witch-API.patch | 60 + patches/api/0158-Add-spectator-target-events.patch | 148 -- patches/api/0159-Add-more-Witch-API.patch | 60 - ...e-default-permission-message-configurable.patch | 84 + ...e-default-permission-message-configurable.patch | 84 - ...cellation-supression-of-EntityDismount-Ve.patch | 107 ++ patches/api/0161-Add-more-Zombie-API.patch | 71 + ...cellation-supression-of-EntityDismount-Ve.patch | 107 -- patches/api/0162-Add-more-Zombie-API.patch | 71 - ...the-reserved-channel-check-to-be-sensible.patch | 34 + .../api/0163-Add-PlayerConnectionCloseEvent.patch | 129 ++ ...the-reserved-channel-check-to-be-sensible.patch | 34 - ...Is-to-replace-OfflinePlayer-getLastPlayed.patch | 62 + .../api/0164-Add-PlayerConnectionCloseEvent.patch | 129 -- ...Is-to-replace-OfflinePlayer-getLastPlayed.patch | 62 - ...5-Add-ItemStack-Recipe-API-helper-methods.patch | 104 ++ ...6-Add-ItemStack-Recipe-API-helper-methods.patch | 104 -- patches/api/0166-BlockDestroyEvent.patch | 140 ++ patches/api/0167-Add-WhitelistToggleEvent.patch | 55 + patches/api/0167-BlockDestroyEvent.patch | 140 -- patches/api/0168-Add-GS4-Query-event.patch | 436 +++++ patches/api/0168-Add-WhitelistToggleEvent.patch | 55 - patches/api/0169-Add-GS4-Query-event.patch | 436 ----- patches/api/0169-Add-PlayerPostRespawnEvent.patch | 82 + patches/api/0170-Add-PlayerPostRespawnEvent.patch | 82 - patches/api/0170-Entity-getEntitySpawnReason.patch | 29 + patches/api/0171-Entity-getEntitySpawnReason.patch | 29 - .../api/0171-Fix-Spigot-annotation-mistakes.patch | 1899 ++++++++++++++++++++ .../api/0172-Fix-Spigot-annotation-mistakes.patch | 1899 -------------------- patches/api/0172-Server-Tick-Events.patch | 116 ++ .../api/0173-PlayerDeathEvent-getItemsToKeep.patch | 63 + patches/api/0173-Server-Tick-Events.patch | 116 -- patches/api/0174-Add-Heightmap-API.patch | 195 ++ .../api/0174-PlayerDeathEvent-getItemsToKeep.patch | 63 - patches/api/0175-Add-Heightmap-API.patch | 195 -- .../api/0175-Mob-Spawner-API-Enhancements.patch | 41 + .../api/0176-Add-BlockSoundGroup-interface.patch | 107 ++ .../api/0176-Mob-Spawner-API-Enhancements.patch | 41 - .../api/0177-Add-BlockSoundGroup-interface.patch | 107 -- ...rInteractAtEntityEvent-javadoc-for-ArmorS.patch | 20 + ...rInteractAtEntityEvent-javadoc-for-ArmorS.patch | 20 - ...et-true-custom-payload-channel-size-limit.patch | 20 + .../0179-Expose-the-internal-current-tick.patch | 38 + ...et-true-custom-payload-channel-size-limit.patch | 20 - .../0180-Expose-the-internal-current-tick.patch | 38 - .../0180-Improve-Block-breakNaturally-API.patch | 68 + .../0181-Improve-Block-breakNaturally-API.patch | 68 - ...181-PlayerDeathEvent-shouldDropExperience.patch | 80 + patches/api/0182-Add-ThrownEggHatchEvent.patch | 134 ++ ...182-PlayerDeathEvent-shouldDropExperience.patch | 80 - patches/api/0183-Add-ThrownEggHatchEvent.patch | 134 -- patches/api/0183-Entity-Jump-API.patch | 93 + patches/api/0184-Entity-Jump-API.patch | 93 - .../0184-add-hand-to-BlockMultiPlaceEvent.patch | 29 + patches/api/0185-Add-tick-times-API.patch | 62 + .../0185-add-hand-to-BlockMultiPlaceEvent.patch | 29 - patches/api/0186-Add-tick-times-API.patch | 62 - .../0186-Expose-MinecraftServer-isRunning.patch | 44 + ...0187-Add-Raw-Byte-ItemStack-Serialization.patch | 56 + .../0187-Expose-MinecraftServer-isRunning.patch | 44 - .../api/0188-Add-Player-Client-Options-API.patch | 250 +++ ...0188-Add-Raw-Byte-ItemStack-Serialization.patch | 56 - .../api/0189-Add-Player-Client-Options-API.patch | 250 --- ...-Add-PlayerAttackEntityCooldownResetEvent.patch | 89 + ...-Add-PlayerAttackEntityCooldownResetEvent.patch | 89 - .../0190-Add-item-slot-convenience-methods.patch | 330 ++++ .../0191-Add-item-slot-convenience-methods.patch | 330 ---- patches/api/0191-Villager-Restocks-API.patch | 31 + patches/api/0192-Expose-game-version.patch | 50 + patches/api/0192-Villager-Restocks-API.patch | 31 - patches/api/0193-Add-Mob-Goal-API.patch | 266 +++ patches/api/0193-Expose-game-version.patch | 50 - patches/api/0194-Add-Mob-Goal-API.patch | 266 --- patches/api/0194-Add-villager-reputation-API.patch | 175 ++ patches/api/0195-Add-villager-reputation-API.patch | 175 -- patches/api/0195-Spawn-Reason-API.patch | 44 + patches/api/0196-Potential-bed-API.patch | 33 + patches/api/0196-Spawn-Reason-API.patch | 44 - ...y-getHolder-method-without-block-snapshot.patch | 51 + patches/api/0197-Potential-bed-API.patch | 33 - ...-and-implement-PlayerRecipeBookClickEvent.patch | 116 ++ ...y-getHolder-method-without-block-snapshot.patch | 51 - ...-and-implement-PlayerRecipeBookClickEvent.patch | 116 -- .../api/0199-Support-components-in-ItemMeta.patch | 93 + .../api/0200-Support-components-in-ItemMeta.patch | 93 - ...2-new-TargetReasons-for-1.16-mob-behavior.patch | 25 + patches/api/0201-Add-entity-liquid-API.patch | 51 + ...2-new-TargetReasons-for-1.16-mob-behavior.patch | 25 - ...PrepareResultEvent-PrepareGrindstoneEvent.patch | 204 +++ patches/api/0202-Add-entity-liquid-API.patch | 51 - patches/api/0203-Add-BellRingEvent.patch | 36 + ...PrepareResultEvent-PrepareGrindstoneEvent.patch | 204 --- patches/api/0204-Add-BellRingEvent.patch | 36 - patches/api/0204-Brand-support.patch | 27 + patches/api/0205-Add-moon-phase-API.patch | 65 + patches/api/0205-Brand-support.patch | 27 - patches/api/0206-Add-moon-phase-API.patch | 65 - ...d-playPickupItemAnimation-to-LivingEntity.patch | 40 + patches/api/0207-Add-more-Evoker-API.patch | 30 + ...d-playPickupItemAnimation-to-LivingEntity.patch | 40 - .../0208-Add-methods-to-get-translation-keys.patch | 519 ++++++ patches/api/0208-Add-more-Evoker-API.patch | 30 - .../0209-Add-methods-to-get-translation-keys.patch | 519 ------ ...9-Create-HoverEvent-from-ItemStack-Entity.patch | 76 + ...itional-open-container-api-to-HumanEntity.patch | 103 ++ ...0-Create-HoverEvent-from-ItemStack-Entity.patch | 76 - ...itional-open-container-api-to-HumanEntity.patch | 103 -- ...Entity-Counter-to-allow-plugins-to-use-va.patch | 24 + patches/api/0212-Entity-isTicking.patch | 21 + ...Entity-Counter-to-allow-plugins-to-use-va.patch | 24 - patches/api/0213-Entity-isTicking.patch | 21 - patches/api/0213-Villager-resetOffers.patch | 22 + patches/api/0214-Player-elytra-boost-API.patch | 36 + patches/api/0214-Villager-resetOffers.patch | 22 - .../0215-Add-getOfflinePlayerIfCached-String.patch | 68 + patches/api/0215-Player-elytra-boost-API.patch | 36 - .../0216-Add-getOfflinePlayerIfCached-String.patch | 68 - patches/api/0216-Add-ignore-discounts-API.patch | 55 + patches/api/0217-Add-ignore-discounts-API.patch | 55 - .../api/0217-Item-no-age-no-player-pickup.patch | 45 + .../api/0218-Beacon-API-custom-effect-ranges.patch | 37 + .../api/0218-Item-no-age-no-player-pickup.patch | 45 - patches/api/0219-Add-API-for-quit-reason.patch | 79 + .../api/0219-Beacon-API-custom-effect-ranges.patch | 37 - patches/api/0220-Add-API-for-quit-reason.patch | 79 - patches/api/0220-Add-Destroy-Speed-API.patch | 77 + patches/api/0221-Add-Destroy-Speed-API.patch | 77 - .../0221-Add-LivingEntity-clearActiveItem.patch | 22 + .../0222-Add-LivingEntity-clearActiveItem.patch | 22 - patches/api/0222-Add-PlayerItemCooldownEvent.patch | 94 + patches/api/0223-Add-PlayerItemCooldownEvent.patch | 94 - patches/api/0223-More-lightning-API.patch | 73 + patches/api/0224-Add-PlayerShearBlockEvent.patch | 125 ++ patches/api/0224-More-lightning-API.patch | 73 - patches/api/0225-Add-PlayerShearBlockEvent.patch | 125 -- .../api/0225-Player-Chunk-Load-Unload-Events.patch | 106 ++ .../0226-Expose-LivingEntity-hurt-direction.patch | 54 + .../api/0226-Player-Chunk-Load-Unload-Events.patch | 106 -- ...7-Add-OBSTRUCTED-reason-to-BedEnterResult.patch | 23 + .../0227-Expose-LivingEntity-hurt-direction.patch | 54 - ...8-Add-OBSTRUCTED-reason-to-BedEnterResult.patch | 23 - patches/api/0228-Added-PlayerTradeEvent.patch | 166 ++ patches/api/0229-Add-TargetHitEvent-API.patch | 73 + patches/api/0229-Added-PlayerTradeEvent.patch | 166 -- patches/api/0230-Add-TargetHitEvent-API.patch | 73 - .../api/0230-Additional-Block-Material-API-s.patch | 57 + ...-to-get-Material-from-Boats-and-Minecarts.patch | 51 + .../api/0231-Additional-Block-Material-API-s.patch | 57 - ...-to-get-Material-from-Boats-and-Minecarts.patch | 51 - .../0232-Add-PlayerFlowerPotManipulateEvent.patch | 97 + .../0233-Add-PlayerFlowerPotManipulateEvent.patch | 97 - patches/api/0233-Zombie-API-breaking-doors.patch | 39 + patches/api/0234-Add-EntityLoadCrossbowEvent.patch | 108 ++ patches/api/0234-Zombie-API-breaking-doors.patch | 39 - patches/api/0235-Add-EntityLoadCrossbowEvent.patch | 108 -- .../api/0235-Added-WorldGameRuleChangeEvent.patch | 104 ++ .../0236-Added-ServerResourcesReloadedEvent.patch | 61 + .../api/0236-Added-WorldGameRuleChangeEvent.patch | 104 -- .../api/0237-Add-BlockFailedDispenseEvent.patch | 68 + .../0237-Added-ServerResourcesReloadedEvent.patch | 61 - .../api/0238-Add-BlockFailedDispenseEvent.patch | 68 - .../0238-Added-PlayerLecternPageChangeEvent.patch | 129 ++ .../0239-Added-PlayerLecternPageChangeEvent.patch | 129 -- .../0239-Added-PlayerLoomPatternSelectEvent.patch | 92 + ...get-exact-interaction-point-in-PlayerInte.patch | 48 + .../0240-Added-PlayerLoomPatternSelectEvent.patch | 92 - ...get-exact-interaction-point-in-PlayerInte.patch | 48 - patches/api/0241-Add-sendOpLevel-API.patch | 30 + ...dd-RegistryAccess-for-managing-registries.patch | 394 ++++ patches/api/0242-Add-sendOpLevel-API.patch | 30 - ...dd-RegistryAccess-for-managing-registries.patch | 394 ---- patches/api/0243-Add-StructuresLocateEvent.patch | 534 ++++++ patches/api/0244-Add-BlockPreDispenseEvent.patch | 77 + patches/api/0244-Add-StructuresLocateEvent.patch | 534 ------ patches/api/0245-Add-BlockPreDispenseEvent.patch | 77 - .../0245-Added-PlayerChangeBeaconEffectEvent.patch | 149 ++ .../0246-Added-PlayerChangeBeaconEffectEvent.patch | 149 -- ...-Added-PlayerStonecutterRecipeSelectEvent.patch | 72 + ...-dropLeash-variable-to-EntityUnleashEvent.patch | 78 + ...-Added-PlayerStonecutterRecipeSelectEvent.patch | 72 - ...-dropLeash-variable-to-EntityUnleashEvent.patch | 78 - patches/api/0248-add-DragonEggFormEvent.patch | 67 + patches/api/0249-EntityMoveEvent.patch | 162 ++ patches/api/0249-add-DragonEggFormEvent.patch | 67 - ...-Allow-adding-items-to-BlockDropItemEvent.patch | 19 + patches/api/0250-EntityMoveEvent.patch | 162 -- ...-getMainThreadExecutor-to-BukkitScheduler.patch | 26 + ...-Allow-adding-items-to-BlockDropItemEvent.patch | 19 - ...-getMainThreadExecutor-to-BukkitScheduler.patch | 26 - ...iving-entity-allow-attribute-registration.patch | 25 + patches/api/0253-Add-missing-effects.patch | 320 ++++ ...iving-entity-allow-attribute-registration.patch | 25 - patches/api/0254-Add-missing-effects.patch | 320 ---- patches/api/0254-Expose-Tracked-Players.patch | 25 + ...0255-Cache-the-result-of-Material-isBlock.patch | 38 + patches/api/0255-Expose-Tracked-Players.patch | 25 - patches/api/0256-Add-worldborder-events.patch | 316 ++++ ...0256-Cache-the-result-of-Material-isBlock.patch | 38 - patches/api/0257-Add-worldborder-events.patch | 316 ---- patches/api/0257-added-PlayerNameEntityEvent.patch | 122 ++ patches/api/0258-Add-recipe-to-cook-events.patch | 69 + patches/api/0258-added-PlayerNameEntityEvent.patch | 122 -- patches/api/0259-Add-Block-isValidTool.patch | 26 + patches/api/0259-Add-recipe-to-cook-events.patch | 69 - patches/api/0260-Add-Block-isValidTool.patch | 26 - patches/api/0260-Expand-world-key-API.patch | 189 ++ patches/api/0261-Expand-world-key-API.patch | 189 -- patches/api/0261-Improve-Item-Rarity-API.patch | 131 ++ patches/api/0262-Expose-protocol-version.patch | 23 + patches/api/0262-Improve-Item-Rarity-API.patch | 131 -- patches/api/0263-Expose-protocol-version.patch | 23 - .../0263-add-isDeeplySleeping-to-HumanEntity.patch | 26 + .../0264-add-consumeFuel-to-FurnaceBurnEvent.patch | 44 + .../0264-add-isDeeplySleeping-to-HumanEntity.patch | 26 - .../0265-add-consumeFuel-to-FurnaceBurnEvent.patch | 44 - ...dd-get-set-drop-chance-to-EntityEquipment.patch | 45 + patches/api/0266-Added-PlayerDeepSleepEvent.patch | 60 + ...dd-get-set-drop-chance-to-EntityEquipment.patch | 45 - patches/api/0267-Added-PlayerDeepSleepEvent.patch | 60 - patches/api/0267-More-World-API.patch | 133 ++ .../api/0268-Added-PlayerBedFailEnterEvent.patch | 131 ++ patches/api/0268-More-World-API.patch | 133 -- .../api/0269-Added-PlayerBedFailEnterEvent.patch | 131 -- ...uce-beacon-activation-deactivation-events.patch | 107 ++ ...uce-beacon-activation-deactivation-events.patch | 107 -- .../api/0270-PlayerMoveEvent-Improvements.patch | 64 + .../api/0271-PlayerMoveEvent-Improvements.patch | 64 - ...71-add-RespawnFlags-to-PlayerRespawnEvent.patch | 75 + .../api/0272-Add-more-WanderingTrader-API.patch | 41 + ...72-add-RespawnFlags-to-PlayerRespawnEvent.patch | 75 - ...0273-Add-EntityBlockStorage-clearEntities.patch | 22 + .../api/0273-Add-more-WanderingTrader-API.patch | 41 - ...ure-message-to-PlayerAdvancementDoneEvent.patch | 71 + ...0274-Add-EntityBlockStorage-clearEntities.patch | 22 - ...ure-message-to-PlayerAdvancementDoneEvent.patch | 71 - patches/api/0275-Inventory-close.patch | 26 + ...d-burn-in-sunlight-API-for-Phantoms-and-S.patch | 60 + patches/api/0276-Inventory-close.patch | 26 - ...d-burn-in-sunlight-API-for-Phantoms-and-S.patch | 60 - patches/api/0277-Add-basic-Datapack-API.patch | 160 ++ patches/api/0278-Add-basic-Datapack-API.patch | 160 -- ...78-additions-to-PlayerGameModeChangeEvent.patch | 121 ++ patches/api/0279-ItemStack-repair-check-API.patch | 58 + ...79-additions-to-PlayerGameModeChangeEvent.patch | 121 -- patches/api/0280-ItemStack-repair-check-API.patch | 58 - patches/api/0280-More-Enchantment-API.patch | 189 ++ patches/api/0281-Add-Mob-lookAt-API.patch | 99 + patches/api/0281-More-Enchantment-API.patch | 189 -- patches/api/0282-Add-Mob-lookAt-API.patch | 99 - patches/api/0282-ItemStack-editMeta.patch | 61 + patches/api/0283-Add-EntityInsideBlockEvent.patch | 98 + patches/api/0283-ItemStack-editMeta.patch | 61 - patches/api/0284-Add-EntityInsideBlockEvent.patch | 98 - .../0284-Attributes-API-for-item-defaults.patch | 33 + ...-Add-cause-to-Weather-ThunderChangeEvents.patch | 104 ++ .../0285-Attributes-API-for-item-defaults.patch | 33 - ...-Add-cause-to-Weather-ThunderChangeEvents.patch | 104 -- patches/api/0286-More-Lidded-Block-API.patch | 24 + patches/api/0287-Add-PlayerKickEvent-causes.patch | 144 ++ patches/api/0287-More-Lidded-Block-API.patch | 24 - patches/api/0288-Add-PlayerKickEvent-causes.patch | 144 -- .../api/0288-Add-PufferFishStateChangeEvent.patch | 99 + patches/api/0289-Add-BellRevealRaiderEvent.patch | 75 + .../api/0289-Add-PufferFishStateChangeEvent.patch | 99 - patches/api/0290-Add-BellRevealRaiderEvent.patch | 75 - .../0290-Add-ElderGuardianAppearanceEvent.patch | 79 + .../0291-Add-ElderGuardianAppearanceEvent.patch | 79 - .../api/0291-Add-more-line-of-sight-methods.patch | 48 + patches/api/0292-Add-WaterBottleSplashEvent.patch | 162 ++ .../api/0292-Add-more-line-of-sight-methods.patch | 48 - patches/api/0293-Add-WaterBottleSplashEvent.patch | 162 -- patches/api/0293-Add-more-LimitedRegion-API.patch | 161 ++ patches/api/0294-Add-more-LimitedRegion-API.patch | 161 -- patches/api/0294-Missing-Entity-API.patch | 1448 +++++++++++++++ patches/api/0295-Adds-PlayerArmSwingEvent.patch | 53 + patches/api/0295-Missing-Entity-API.patch | 1448 --------------- ...0296-Add-PlayerSignCommandPreprocessEvent.patch | 59 + patches/api/0296-Adds-PlayerArmSwingEvent.patch | 53 - ...0297-Add-PlayerSignCommandPreprocessEvent.patch | 59 - ...empty-array-elements-in-command-arguments.patch | 23 + patches/api/0298-Stinger-API.patch | 63 + ...empty-array-elements-in-command-arguments.patch | 23 - ...Events-to-contain-the-source-jars-in-stac.patch | 19 + patches/api/0299-Stinger-API.patch | 63 - patches/api/0300-Add-PlayerSetSpawnEvent.patch | 205 +++ ...Events-to-contain-the-source-jars-in-stac.patch | 19 - patches/api/0301-Add-PlayerSetSpawnEvent.patch | 205 --- patches/api/0301-Added-EntityDamageItemEvent.patch | 93 + patches/api/0302-Added-EntityDamageItemEvent.patch | 93 - .../0302-Make-EntityUnleashEvent-cancellable.patch | 49 + ...rEye-target-without-changing-other-things.patch | 28 + .../0303-Make-EntityUnleashEvent-cancellable.patch | 49 - patches/api/0304-Add-BlockBreakBlockEvent.patch | 73 + ...rEye-target-without-changing-other-things.patch | 28 - patches/api/0305-Add-BlockBreakBlockEvent.patch | 73 - ...dd-helpers-for-left-right-click-to-Action.patch | 37 + ...dd-helpers-for-left-right-click-to-Action.patch | 37 - ...revent-data-components-copy-in-smithing-r.patch | 122 ++ patches/api/0307-More-CommandBlock-API.patch | 96 + ...revent-data-components-copy-in-smithing-r.patch | 122 -- ...08-Add-missing-team-sidebar-display-slots.patch | 85 + patches/api/0308-More-CommandBlock-API.patch | 96 - ...09-Add-missing-team-sidebar-display-slots.patch | 85 - .../api/0309-add-back-EntityPortalExitEvent.patch | 21 + ...ods-to-find-targets-for-lightning-strikes.patch | 48 + .../api/0310-add-back-EntityPortalExitEvent.patch | 21 - ...ods-to-find-targets-for-lightning-strikes.patch | 48 - .../api/0311-Get-entity-default-attributes.patch | 63 + .../api/0312-Get-entity-default-attributes.patch | 63 - patches/api/0312-Left-handed-API.patch | 31 + patches/api/0313-Add-critical-damage-API.patch | 72 + patches/api/0313-Left-handed-API.patch | 31 - patches/api/0314-Add-critical-damage-API.patch | 72 - patches/api/0314-Add-more-advancement-API.patch | 270 +++ patches/api/0315-Add-more-advancement-API.patch | 270 --- .../api/0315-Fix-issues-with-mob-conversion.patch | 61 + ...dd-isCollidable-methods-to-various-places.patch | 82 + .../api/0316-Fix-issues-with-mob-conversion.patch | 61 - ...dd-isCollidable-methods-to-various-places.patch | 82 - patches/api/0317-Goat-ram-API.patch | 23 + ...0318-Add-API-for-resetting-a-single-score.patch | 26 + patches/api/0318-Goat-ram-API.patch | 23 - ...0319-Add-API-for-resetting-a-single-score.patch | 26 - .../0319-Add-Raw-Byte-Entity-Serialization.patch | 62 + .../api/0320-Add-PlayerItemFrameChangeEvent.patch | 116 ++ .../0320-Add-Raw-Byte-Entity-Serialization.patch | 62 - .../api/0321-Add-PlayerItemFrameChangeEvent.patch | 116 -- ...321-Allow-delegation-to-vanilla-chunk-gen.patch | 89 + patches/api/0322-Add-more-Campfire-API.patch | 51 + ...322-Allow-delegation-to-vanilla-chunk-gen.patch | 89 - patches/api/0323-Add-more-Campfire-API.patch | 51 - ...VehicleCollisionEvent-move-HandlerList-up.patch | 111 ++ ...VehicleCollisionEvent-move-HandlerList-up.patch | 111 -- patches/api/0324-Improve-scoreboard-entries.patch | 191 ++ patches/api/0325-Entity-powdered-snow-API.patch | 44 + patches/api/0325-Improve-scoreboard-entries.patch | 191 -- .../api/0326-Add-API-for-item-entity-health.patch | 35 + patches/api/0326-Entity-powdered-snow-API.patch | 44 - .../api/0327-Add-API-for-item-entity-health.patch | 35 - ...el-and-canSmelt-methods-to-FurnaceInvento.patch | 35 + patches/api/0328-Bucketable-API.patch | 77 + ...el-and-canSmelt-methods-to-FurnaceInvento.patch | 35 - patches/api/0329-Bucketable-API.patch | 77 - ...m-prop-for-default-config-comment-parsing.patch | 24 + ...pose-vanilla-BiomeProvider-from-WorldInfo.patch | 24 + ...m-prop-for-default-config-comment-parsing.patch | 24 - ...pose-vanilla-BiomeProvider-from-WorldInfo.patch | 24 - .../0331-Multiple-Entries-with-Scoreboards.patch | 128 ++ .../0332-Multiple-Entries-with-Scoreboards.patch | 128 -- ...Warn-on-strange-EventHandler-return-types.patch | 23 + patches/api/0333-Multi-Block-Change-API.patch | 40 + ...Warn-on-strange-EventHandler-return-types.patch | 23 - patches/api/0334-Fix-NotePlayEvent.patch | 36 + patches/api/0334-Multi-Block-Change-API.patch | 40 - patches/api/0335-Fix-NotePlayEvent.patch | 36 - patches/api/0335-Freeze-Tick-Lock-API.patch | 37 + patches/api/0336-Dolphin-API.patch | 64 + patches/api/0336-Freeze-Tick-Lock-API.patch | 37 - patches/api/0337-Dolphin-API.patch | 64 - patches/api/0337-More-PotionEffectType-API.patch | 159 ++ ...ating-command-sender-which-forwards-feedb.patch | 54 + patches/api/0338-More-PotionEffectType-API.patch | 159 -- ...ating-command-sender-which-forwards-feedb.patch | 54 - patches/api/0339-Implement-regenerateChunk.patch | 21 + patches/api/0340-Add-GameEvent-tags.patch | 36 + patches/api/0340-Implement-regenerateChunk.patch | 21 - patches/api/0341-Add-GameEvent-tags.patch | 36 - patches/api/0341-Furnace-RecipesUsed-API.patch | 51 + ...-Configurable-sculk-sensor-listener-range.patch | 30 + patches/api/0342-Furnace-RecipesUsed-API.patch | 51 - ...343-Add-missing-block-data-mins-and-maxes.patch | 87 + ...-Configurable-sculk-sensor-listener-range.patch | 30 - ...344-Add-missing-block-data-mins-and-maxes.patch | 87 - patches/api/0344-Custom-Potion-Mixes.patch | 271 +++ patches/api/0345-Custom-Potion-Mixes.patch | 271 --- .../0345-Expose-furnace-minecart-push-values.patch | 46 + .../0346-Expose-furnace-minecart-push-values.patch | 46 - patches/api/0346-More-Projectile-API.patch | 449 +++++ patches/api/0347-Add-getComputedBiome-API.patch | 79 + patches/api/0347-More-Projectile-API.patch | 449 ----- patches/api/0348-Add-enchantWithLevels-API.patch | 100 ++ patches/api/0348-Add-getComputedBiome-API.patch | 79 - .../api/0349-Add-TameableDeathMessageEvent.patch | 84 + patches/api/0349-Add-enchantWithLevels-API.patch | 100 -- .../api/0350-Add-TameableDeathMessageEvent.patch | 84 - ...w-to-change-the-podium-of-the-EnderDragon.patch | 33 + ...w-to-change-the-podium-of-the-EnderDragon.patch | 33 - ...ct-new-blockstate-in-EntityBreakDoorEvent.patch | 21 + ...nbreaking-amount-to-PlayerItemDamageEvent.patch | 52 + ...ct-new-blockstate-in-EntityBreakDoorEvent.patch | 21 - ...nbreaking-amount-to-PlayerItemDamageEvent.patch | 52 - .../api/0353-WorldCreator-keepSpawnLoaded.patch | 97 + ...ityDyeEvent-and-CollarColorable-interface.patch | 268 +++ .../api/0354-WorldCreator-keepSpawnLoaded.patch | 97 - ...ityDyeEvent-and-CollarColorable-interface.patch | 268 --- .../api/0355-Add-PlayerStopUsingItemEvent.patch | 67 + .../api/0356-Add-PlayerStopUsingItemEvent.patch | 67 - patches/api/0356-Expand-FallingBlock-API.patch | 108 ++ ...0357-Add-method-isTickingWorlds-to-Bukkit.patch | 117 ++ patches/api/0357-Expand-FallingBlock-API.patch | 108 -- patches/api/0358-Add-WardenAngerChangeEvent.patch | 122 ++ ...0358-Add-method-isTickingWorlds-to-Bukkit.patch | 117 -- patches/api/0359-Add-WardenAngerChangeEvent.patch | 122 -- patches/api/0359-Nameable-Banner-API.patch | 20 + patches/api/0360-Add-Player-getFishHook.patch | 24 + patches/api/0360-Nameable-Banner-API.patch | 20 - patches/api/0361-Add-Player-getFishHook.patch | 24 - patches/api/0361-More-Teleport-API.patch | 275 +++ patches/api/0362-Add-EntityPortalReadyEvent.patch | 106 ++ patches/api/0362-More-Teleport-API.patch | 275 --- patches/api/0363-Add-EntityPortalReadyEvent.patch | 106 -- ...63-Custom-Chat-Completion-Suggestions-API.patch | 42 + patches/api/0364-Collision-API.patch | 57 + ...64-Custom-Chat-Completion-Suggestions-API.patch | 42 - patches/api/0365-Block-Ticking-API.patch | 71 + patches/api/0365-Collision-API.patch | 57 - .../api/0366-Add-NamespacedKey-biome-methods.patch | 44 + patches/api/0366-Block-Ticking-API.patch | 71 - .../api/0367-Add-NamespacedKey-biome-methods.patch | 44 - ...67-Also-load-resources-from-LibraryLoader.patch | 48 + ...array-serialization-deserialization-for-P.patch | 51 + ...68-Also-load-resources-from-LibraryLoader.patch | 48 - ...mer-parameter-to-ProjectileSource-launchP.patch | 34 + ...array-serialization-deserialization-for-P.patch | 51 - ...mer-parameter-to-ProjectileSource-launchP.patch | 34 - ...point-limit-in-YamlConfigOptions-and-incr.patch | 61 + patches/api/0371-Add-getDrops-to-BlockState.patch | 54 + ...point-limit-in-YamlConfigOptions-and-incr.patch | 61 - .../0372-Add-PlayerInventorySlotChangeEvent.patch | 113 ++ patches/api/0372-Add-getDrops-to-BlockState.patch | 54 - .../0373-Add-PlayerInventorySlotChangeEvent.patch | 113 -- .../api/0373-Elder-Guardian-appearance-API.patch | 35 + ...74-Allow-changing-bed-s-occupied-property.patch | 26 + .../api/0374-Elder-Guardian-appearance-API.patch | 35 - ...375-Add-EquipmentSlot-convenience-methods.patch | 53 + ...75-Allow-changing-bed-s-occupied-property.patch | 26 - ...376-Add-EquipmentSlot-convenience-methods.patch | 53 - ...ntity-swingHand-EquipmentSlot-convenience.patch | 35 + ...ntity-swingHand-EquipmentSlot-convenience.patch | 35 - patches/api/0377-Add-entity-knockback-API.patch | 29 + patches/api/0378-Add-entity-knockback-API.patch | 29 - patches/api/0378-Added-EntityToggleSitEvent.patch | 67 + patches/api/0379-Add-Moving-Piston-API.patch | 55 + patches/api/0379-Added-EntityToggleSitEvent.patch | 67 - patches/api/0380-Add-Moving-Piston-API.patch | 55 - .../api/0380-Add-PrePlayerAttackEntityEvent.patch | 105 ++ .../api/0381-Add-Player-Warden-Warning-API.patch | 70 + .../api/0381-Add-PrePlayerAttackEntityEvent.patch | 105 -- .../api/0382-Add-Player-Warden-Warning-API.patch | 70 - ...vanilla-friendly-methods-to-update-trades.patch | 57 + .../api/0383-Add-paper-dumplisteners-command.patch | 177 ++ ...vanilla-friendly-methods-to-update-trades.patch | 57 - .../api/0384-Add-paper-dumplisteners-command.patch | 177 -- patches/api/0384-ItemStack-damage-API.patch | 91 + patches/api/0385-Add-Tick-TemporalUnit.patch | 156 ++ patches/api/0385-ItemStack-damage-API.patch | 91 - patches/api/0386-Add-Tick-TemporalUnit.patch | 156 -- patches/api/0386-Friction-API.patch | 73 + patches/api/0387-Friction-API.patch | 73 - .../api/0387-Player-Entity-Tracking-Events.patch | 128 ++ patches/api/0388-Add-missing-Fluid-type.patch | 23 + .../api/0388-Player-Entity-Tracking-Events.patch | 128 -- patches/api/0389-Add-missing-Fluid-type.patch | 23 - patches/api/0389-fix-Instruments.patch | 115 ++ patches/api/0390-Add-BlockLockCheckEvent.patch | 241 +++ patches/api/0390-fix-Instruments.patch | 115 -- patches/api/0391-Add-BlockLockCheckEvent.patch | 241 --- .../api/0391-Add-Sneaking-API-for-Entities.patch | 56 + .../api/0392-Add-Sneaking-API-for-Entities.patch | 56 - patches/api/0392-Improve-PortalEvents.patch | 128 ++ ...d-block-state-to-EntityDamageByBlockEvent.patch | 83 + patches/api/0393-Improve-PortalEvents.patch | 128 -- ...d-block-state-to-EntityDamageByBlockEvent.patch | 83 - patches/api/0394-Flying-Fall-Damage-API.patch | 34 + patches/api/0395-Flying-Fall-Damage-API.patch | 34 - ...0395-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch | 38 + ...0396-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch | 38 - patches/api/0396-Win-Screen-API.patch | 58 + patches/api/0397-Add-Entity-Body-Yaw-API.patch | 81 + patches/api/0397-Win-Screen-API.patch | 58 - patches/api/0398-Add-Entity-Body-Yaw-API.patch | 81 - ...List-for-InventoryBlockStartEvent-subclas.patch | 93 + patches/api/0399-Add-EntityFertilizeEggEvent.patch | 151 ++ ...List-for-InventoryBlockStartEvent-subclas.patch | 93 - ...mpostItemEvent-and-EntityCompostItemEvent.patch | 130 ++ patches/api/0400-Add-EntityFertilizeEggEvent.patch | 151 -- ...mpostItemEvent-and-EntityCompostItemEvent.patch | 130 -- patches/api/0401-Add-Shearable-API.patch | 94 + patches/api/0402-Add-Shearable-API.patch | 94 - .../0402-Fix-SpawnEggMeta-get-setSpawnedType.patch | 51 + .../api/0403-Add-Mob-Experience-reward-API.patch | 24 + .../0403-Fix-SpawnEggMeta-get-setSpawnedType.patch | 51 - .../api/0404-Add-Mob-Experience-reward-API.patch | 24 - patches/api/0404-Expand-PlayerItemMendEvent.patch | 71 + patches/api/0405-Add-transient-modifier-API.patch | 27 + patches/api/0405-Expand-PlayerItemMendEvent.patch | 71 - patches/api/0406-Add-transient-modifier-API.patch | 27 - ...move-the-experimental-smithing-inventory-.patch | 39 + ...ethod-to-remove-all-active-potion-effects.patch | 26 + ...move-the-experimental-smithing-inventory-.patch | 39 - ...ethod-to-remove-all-active-potion-effects.patch | 26 - ...0408-Folia-scheduler-and-owned-region-API.patch | 790 ++++++++ .../0409-Add-event-for-player-editing-sign.patch | 136 ++ ...0409-Folia-scheduler-and-owned-region-API.patch | 790 -------- .../api/0410-Add-Sign-getInteractableSideFor.patch | 45 + .../0410-Add-event-for-player-editing-sign.patch | 136 -- .../api/0411-Add-Sign-getInteractableSideFor.patch | 45 - patches/api/0411-Fix-BanList-API.patch | 162 ++ patches/api/0412-Add-whitelist-events.patch | 99 + patches/api/0412-Fix-BanList-API.patch | 162 -- .../0413-API-for-updating-recipes-on-clients.patch | 169 ++ patches/api/0413-Add-whitelist-events.patch | 99 - .../0414-API-for-updating-recipes-on-clients.patch | 169 -- patches/api/0414-Add-PlayerFailMoveEvent.patch | 130 ++ patches/api/0415-Add-PlayerFailMoveEvent.patch | 130 -- ...15-Fix-custom-statistic-criteria-creation.patch | 31 + ...16-Fix-custom-statistic-criteria-creation.patch | 31 - patches/api/0416-SculkCatalyst-bloom-API.patch | 25 + .../0417-API-for-an-entity-s-scoreboard-name.patch | 28 + patches/api/0417-SculkCatalyst-bloom-API.patch | 25 - .../0418-API-for-an-entity-s-scoreboard-name.patch | 28 - ...nd-replace-methods-with-old-StructureType.patch | 159 ++ patches/api/0419-Add-Listing-API-for-Player.patch | 43 + ...nd-replace-methods-with-old-StructureType.patch | 159 -- patches/api/0420-Add-Listing-API-for-Player.patch | 43 - ...clicked-BlockFace-during-BlockDamageEvent.patch | 52 + ...clicked-BlockFace-during-BlockDamageEvent.patch | 52 - patches/api/0421-Fix-NPE-on-Boat-getStatus.patch | 18 + patches/api/0422-Expand-Pose-API.patch | 53 + patches/api/0422-Fix-NPE-on-Boat-getStatus.patch | 18 - patches/api/0423-Expand-Pose-API.patch | 53 - .../0423-MerchantRecipe-add-copy-constructor.patch | 24 + .../0424-MerchantRecipe-add-copy-constructor.patch | 24 - patches/api/0424-More-DragonBattle-API.patch | 55 + patches/api/0425-Add-PlayerPickItemEvent.patch | 108 ++ patches/api/0425-More-DragonBattle-API.patch | 55 - patches/api/0426-Add-PlayerPickItemEvent.patch | 108 -- patches/api/0426-Allow-trident-custom-damage.patch | 34 + patches/api/0427-Allow-trident-custom-damage.patch | 34 - ...427-Expose-hand-during-BlockCanBuildEvent.patch | 54 + ...428-Expose-hand-during-BlockCanBuildEvent.patch | 54 - ...8-Limit-setBurnTime-to-valid-short-values.patch | 21 + .../api/0429-Add-OfflinePlayer-isConnected.patch | 38 + ...9-Limit-setBurnTime-to-valid-short-values.patch | 21 - .../api/0430-Add-OfflinePlayer-isConnected.patch | 38 - ...0-Add-titleOverride-to-InventoryOpenEvent.patch | 52 + ...1-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/0433-Add-player-idle-duration-API.patch | 41 + ...wapHandItemsEvent-throwing-exception-when.patch | 47 - ...get-the-collision-shape-of-a-block-before.patch | 31 + .../api/0434-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 -- .../api/0437-Add-UUID-attribute-modifier-API.patch | 34 + ...to-fish-event-for-all-player-interactions.patch | 22 - .../api/0438-Add-UUID-attribute-modifier-API.patch | 34 - patches/api/0438-Expand-LingeringPotion-API.patch | 45 + patches/api/0439-Expand-LingeringPotion-API.patch | 45 - ...cessary-durability-check-in-ItemStack-isS.patch | 23 + patches/api/0440-Add-Structure-check-API.patch | 41 + ...cessary-durability-check-in-ItemStack-isS.patch | 23 - patches/api/0441-Add-Structure-check-API.patch | 41 - ...0441-add-missing-Experimental-annotations.patch | 1152 ++++++++++++ patches/api/0442-Add-more-scoreboard-API.patch | 90 + ...0442-add-missing-Experimental-annotations.patch | 1152 ------------ patches/api/0443-Add-more-scoreboard-API.patch | 90 - patches/api/0443-Improve-Registry.patch | 173 ++ patches/api/0444-Add-experience-points-API.patch | 56 + patches/api/0444-Improve-Registry.patch | 173 -- patches/api/0445-Add-experience-points-API.patch | 56 - patches/api/0445-Add-missing-InventoryType.patch | 24 + patches/api/0446-Add-drops-to-shear-events.patch | 103 ++ patches/api/0446-Add-missing-InventoryType.patch | 24 - patches/api/0447-Add-HiddenPotionEffect-API.patch | 170 ++ patches/api/0447-Add-drops-to-shear-events.patch | 103 -- patches/api/0448-Add-HiddenPotionEffect-API.patch | 170 -- .../api/0448-Add-PlayerShieldDisableEvent.patch | 115 ++ .../api/0449-Add-PlayerShieldDisableEvent.patch | 115 -- ...-for-empty-String-in-NamespacedKey.fromSt.patch | 60 + .../0450-Add-BlockStateMeta-clearBlockState.patch | 24 + ...-for-empty-String-in-NamespacedKey.fromSt.patch | 60 - .../0451-Add-BlockStateMeta-clearBlockState.patch | 24 - .../0451-Expose-LootTable-of-DecoratedPot.patch | 19 + patches/api/0452-Add-ShulkerDuplicateEvent.patch | 83 + .../0452-Expose-LootTable-of-DecoratedPot.patch | 19 - patches/api/0453-Add-ShulkerDuplicateEvent.patch | 83 - ...0453-Add-api-for-spawn-egg-texture-colors.patch | 28 + patches/api/0454-Add-Lifecycle-Event-system.patch | 628 +++++++ ...0454-Add-api-for-spawn-egg-texture-colors.patch | 28 - patches/api/0455-Add-Lifecycle-Event-system.patch | 628 ------- patches/api/0455-ItemStack-Tooltip-API.patch | 146 ++ ...tChunkSnapshot-includeLightData-parameter.patch | 34 + patches/api/0456-ItemStack-Tooltip-API.patch | 146 -- patches/api/0457-Add-FluidState-API.patch | 164 ++ ...tChunkSnapshot-includeLightData-parameter.patch | 34 - patches/api/0458-Add-FluidState-API.patch | 164 -- patches/api/0458-add-number-format-api.patch | 229 +++ patches/api/0459-add-number-format-api.patch | 229 --- patches/api/0459-improve-BanList-types.patch | 131 ++ patches/api/0460-Suspicious-Effect-Entry-API.patch | 216 +++ patches/api/0460-improve-BanList-types.patch | 131 -- patches/api/0461-Fix-DamageSource-API.patch | 31 + patches/api/0461-Suspicious-Effect-Entry-API.patch | 216 --- patches/api/0462-Expanded-Hopper-API.patch | 32 + patches/api/0462-Fix-DamageSource-API.patch | 31 - ...one-mutables-to-prevent-unexpected-issues.patch | 151 ++ patches/api/0463-Expanded-Hopper-API.patch | 32 - .../0464-Add-BlockBreakProgressUpdateEvent.patch | 68 + ...one-mutables-to-prevent-unexpected-issues.patch | 151 -- .../0465-Add-BlockBreakProgressUpdateEvent.patch | 68 - patches/api/0465-Deprecate-ItemStack-setType.patch | 54 + patches/api/0466-Deprecate-ItemStack-setType.patch | 54 - patches/api/0466-Item-Mutation-Fixes.patch | 50 + .../api/0467-API-for-checking-sent-chunks.patch | 58 + patches/api/0467-Item-Mutation-Fixes.patch | 50 - .../api/0468-API-for-checking-sent-chunks.patch | 58 - patches/api/0468-Add-CartographyItemEvent.patch | 44 + patches/api/0469-Add-CartographyItemEvent.patch | 44 - patches/api/0469-More-Raid-API.patch | 62 + .../api/0470-Fix-SpawnerEntry-Equipment-API.patch | 46 + patches/api/0470-More-Raid-API.patch | 62 - patches/api/0471-Fix-ItemFlags.patch | 66 + .../api/0471-Fix-SpawnerEntry-Equipment-API.patch | 46 - ...ow-modifying-library-loader-jars-bytecode.patch | 34 + patches/api/0472-Fix-ItemFlags.patch | 66 - .../api/0473-Add-hook-to-remap-library-jars.patch | 38 + ...ow-modifying-library-loader-jars-bytecode.patch | 34 - patches/api/0474-Add-GameMode-isInvulnerable.patch | 27 + .../api/0474-Add-hook-to-remap-library-jars.patch | 38 - patches/api/0475-Add-GameMode-isInvulnerable.patch | 27 - .../0475-Expose-hasColor-to-leather-armor.patch | 25 + .../0476-Add-missing-wind-charge-damage-type.patch | 36 + .../0476-Expose-hasColor-to-leather-armor.patch | 25 - .../0477-Add-missing-wind-charge-damage-type.patch | 36 - ...-Added-API-to-get-player-ha-proxy-address.patch | 27 + ...-Added-API-to-get-player-ha-proxy-address.patch | 27 - patches/api/0478-More-Chest-Block-API.patch | 44 + patches/api/0479-More-Chest-Block-API.patch | 44 - patches/server/0023-Timings-v2.patch | 125 +- .../0035-Implement-Paper-VersionChecker.patch | 10 +- ...0335-Add-Raw-Byte-ItemStack-Serialization.patch | 4 +- ...Entity-Counter-to-allow-plugins-to-use-va.patch | 4 +- patches/server/0515-Expand-world-key-API.patch | 6 +- patches/server/0520-Expose-protocol-version.patch | 4 +- .../server/0547-ItemStack-repair-check-API.patch | 4 +- .../0602-Get-entity-default-attributes.patch | 4 +- ...dd-isCollidable-methods-to-various-places.patch | 4 +- .../0611-Add-Raw-Byte-Entity-Serialization.patch | 4 +- .../0753-Add-NamespacedKey-biome-methods.patch | 4 +- ...80-Fix-custom-statistic-criteria-creation.patch | 4 +- ...0952-Add-api-for-spawn-egg-texture-colors.patch | 4 +- .../server/0953-Add-Lifecycle-Event-system.patch | 6 +- patches/server/0954-ItemStack-Tooltip-API.patch | 4 +- .../server/0976-Rewrite-dataconverter-system.patch | 8 +- 707 files changed, 36871 insertions(+), 36843 deletions(-) create mode 100644 patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch delete mode 100644 patches/api/0135-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch delete mode 100644 patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch create mode 100644 patches/api/0136-Slime-Pathfinder-Events.patch create mode 100644 patches/api/0137-Add-PhantomPreSpawnEvent.patch delete mode 100644 patches/api/0137-Slime-Pathfinder-Events.patch create mode 100644 patches/api/0138-Add-More-Creeper-API.patch delete mode 100644 patches/api/0138-Add-PhantomPreSpawnEvent.patch delete mode 100644 patches/api/0139-Add-More-Creeper-API.patch create mode 100644 patches/api/0139-Inventory-removeItemAnySlot.patch delete mode 100644 patches/api/0140-Inventory-removeItemAnySlot.patch create mode 100644 patches/api/0140-isChunkGenerated-API.patch create mode 100644 patches/api/0141-Add-source-block-constructor-and-getChangedBlockData.patch delete mode 100644 patches/api/0141-isChunkGenerated-API.patch delete mode 100644 patches/api/0142-Add-source-block-constructor-and-getChangedBlockData.patch create mode 100644 patches/api/0142-Async-Chunks-API.patch create mode 100644 patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch delete mode 100644 patches/api/0143-Async-Chunks-API.patch delete mode 100644 patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch create mode 100644 patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch delete mode 100644 patches/api/0145-Expose-attack-cooldown-methods-for-Player.patch create mode 100644 patches/api/0145-Improve-death-events.patch create mode 100644 patches/api/0146-Add-Git-information-to-version-command-on-startup.patch delete mode 100644 patches/api/0146-Improve-death-events.patch delete mode 100644 patches/api/0147-Add-Git-information-to-version-command-on-startup.patch create mode 100644 patches/api/0147-Mob-Pathfinding-API.patch delete mode 100644 patches/api/0148-Mob-Pathfinding-API.patch create mode 100644 patches/api/0148-Performance-Concurrency-Improvements-to-Permissions.patch create mode 100644 patches/api/0149-Add-ItemStackRecipeChoice-Draft-API.patch delete mode 100644 patches/api/0149-Performance-Concurrency-Improvements-to-Permissions.patch delete mode 100644 patches/api/0150-Add-ItemStackRecipeChoice-Draft-API.patch create mode 100644 patches/api/0150-Implement-furnace-cook-speed-multiplier-API.patch delete mode 100644 patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch create mode 100644 patches/api/0151-Material-API-additions.patch create mode 100644 patches/api/0152-Add-Material-Tags.patch delete mode 100644 patches/api/0152-Material-API-additions.patch delete mode 100644 patches/api/0153-Add-Material-Tags.patch create mode 100644 patches/api/0153-PreSpawnerSpawnEvent.patch create mode 100644 patches/api/0154-Add-LivingEntity-getTargetEntity.patch delete mode 100644 patches/api/0154-PreSpawnerSpawnEvent.patch delete mode 100644 patches/api/0155-Add-LivingEntity-getTargetEntity.patch create mode 100644 patches/api/0155-Add-sun-related-API.patch delete mode 100644 patches/api/0156-Add-sun-related-API.patch create mode 100644 patches/api/0156-Turtle-API.patch create mode 100644 patches/api/0157-Add-spectator-target-events.patch delete mode 100644 patches/api/0157-Turtle-API.patch create mode 100644 patches/api/0158-Add-more-Witch-API.patch delete mode 100644 patches/api/0158-Add-spectator-target-events.patch delete mode 100644 patches/api/0159-Add-more-Witch-API.patch create mode 100644 patches/api/0159-Make-the-default-permission-message-configurable.patch delete mode 100644 patches/api/0160-Make-the-default-permission-message-configurable.patch create mode 100644 patches/api/0160-Support-cancellation-supression-of-EntityDismount-Ve.patch create mode 100644 patches/api/0161-Add-more-Zombie-API.patch delete mode 100644 patches/api/0161-Support-cancellation-supression-of-EntityDismount-Ve.patch delete mode 100644 patches/api/0162-Add-more-Zombie-API.patch create mode 100644 patches/api/0162-Change-the-reserved-channel-check-to-be-sensible.patch create mode 100644 patches/api/0163-Add-PlayerConnectionCloseEvent.patch delete mode 100644 patches/api/0163-Change-the-reserved-channel-check-to-be-sensible.patch create mode 100644 patches/api/0164-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch delete mode 100644 patches/api/0164-Add-PlayerConnectionCloseEvent.patch delete mode 100644 patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch create mode 100644 patches/api/0165-Add-ItemStack-Recipe-API-helper-methods.patch delete mode 100644 patches/api/0166-Add-ItemStack-Recipe-API-helper-methods.patch create mode 100644 patches/api/0166-BlockDestroyEvent.patch create mode 100644 patches/api/0167-Add-WhitelistToggleEvent.patch delete mode 100644 patches/api/0167-BlockDestroyEvent.patch create mode 100644 patches/api/0168-Add-GS4-Query-event.patch delete mode 100644 patches/api/0168-Add-WhitelistToggleEvent.patch delete mode 100644 patches/api/0169-Add-GS4-Query-event.patch create mode 100644 patches/api/0169-Add-PlayerPostRespawnEvent.patch delete mode 100644 patches/api/0170-Add-PlayerPostRespawnEvent.patch create mode 100644 patches/api/0170-Entity-getEntitySpawnReason.patch delete mode 100644 patches/api/0171-Entity-getEntitySpawnReason.patch create mode 100644 patches/api/0171-Fix-Spigot-annotation-mistakes.patch delete mode 100644 patches/api/0172-Fix-Spigot-annotation-mistakes.patch create mode 100644 patches/api/0172-Server-Tick-Events.patch create mode 100644 patches/api/0173-PlayerDeathEvent-getItemsToKeep.patch delete mode 100644 patches/api/0173-Server-Tick-Events.patch create mode 100644 patches/api/0174-Add-Heightmap-API.patch delete mode 100644 patches/api/0174-PlayerDeathEvent-getItemsToKeep.patch delete mode 100644 patches/api/0175-Add-Heightmap-API.patch create mode 100644 patches/api/0175-Mob-Spawner-API-Enhancements.patch create mode 100644 patches/api/0176-Add-BlockSoundGroup-interface.patch delete mode 100644 patches/api/0176-Mob-Spawner-API-Enhancements.patch delete mode 100644 patches/api/0177-Add-BlockSoundGroup-interface.patch create mode 100644 patches/api/0177-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch delete mode 100644 patches/api/0178-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch create mode 100644 patches/api/0178-Set-true-custom-payload-channel-size-limit.patch create mode 100644 patches/api/0179-Expose-the-internal-current-tick.patch delete mode 100644 patches/api/0179-Set-true-custom-payload-channel-size-limit.patch delete mode 100644 patches/api/0180-Expose-the-internal-current-tick.patch create mode 100644 patches/api/0180-Improve-Block-breakNaturally-API.patch delete mode 100644 patches/api/0181-Improve-Block-breakNaturally-API.patch create mode 100644 patches/api/0181-PlayerDeathEvent-shouldDropExperience.patch create mode 100644 patches/api/0182-Add-ThrownEggHatchEvent.patch delete mode 100644 patches/api/0182-PlayerDeathEvent-shouldDropExperience.patch delete mode 100644 patches/api/0183-Add-ThrownEggHatchEvent.patch create mode 100644 patches/api/0183-Entity-Jump-API.patch delete mode 100644 patches/api/0184-Entity-Jump-API.patch create mode 100644 patches/api/0184-add-hand-to-BlockMultiPlaceEvent.patch create mode 100644 patches/api/0185-Add-tick-times-API.patch delete mode 100644 patches/api/0185-add-hand-to-BlockMultiPlaceEvent.patch delete mode 100644 patches/api/0186-Add-tick-times-API.patch create mode 100644 patches/api/0186-Expose-MinecraftServer-isRunning.patch create mode 100644 patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch delete mode 100644 patches/api/0187-Expose-MinecraftServer-isRunning.patch create mode 100644 patches/api/0188-Add-Player-Client-Options-API.patch delete mode 100644 patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch delete mode 100644 patches/api/0189-Add-Player-Client-Options-API.patch create mode 100644 patches/api/0189-Add-PlayerAttackEntityCooldownResetEvent.patch delete mode 100644 patches/api/0190-Add-PlayerAttackEntityCooldownResetEvent.patch create mode 100644 patches/api/0190-Add-item-slot-convenience-methods.patch delete mode 100644 patches/api/0191-Add-item-slot-convenience-methods.patch create mode 100644 patches/api/0191-Villager-Restocks-API.patch create mode 100644 patches/api/0192-Expose-game-version.patch delete mode 100644 patches/api/0192-Villager-Restocks-API.patch create mode 100644 patches/api/0193-Add-Mob-Goal-API.patch delete mode 100644 patches/api/0193-Expose-game-version.patch delete mode 100644 patches/api/0194-Add-Mob-Goal-API.patch create mode 100644 patches/api/0194-Add-villager-reputation-API.patch delete mode 100644 patches/api/0195-Add-villager-reputation-API.patch create mode 100644 patches/api/0195-Spawn-Reason-API.patch create mode 100644 patches/api/0196-Potential-bed-API.patch delete mode 100644 patches/api/0196-Spawn-Reason-API.patch create mode 100644 patches/api/0197-Inventory-getHolder-method-without-block-snapshot.patch delete mode 100644 patches/api/0197-Potential-bed-API.patch create mode 100644 patches/api/0198-Add-and-implement-PlayerRecipeBookClickEvent.patch delete mode 100644 patches/api/0198-Inventory-getHolder-method-without-block-snapshot.patch delete mode 100644 patches/api/0199-Add-and-implement-PlayerRecipeBookClickEvent.patch create mode 100644 patches/api/0199-Support-components-in-ItemMeta.patch delete mode 100644 patches/api/0200-Support-components-in-ItemMeta.patch create mode 100644 patches/api/0200-added-2-new-TargetReasons-for-1.16-mob-behavior.patch create mode 100644 patches/api/0201-Add-entity-liquid-API.patch delete mode 100644 patches/api/0201-added-2-new-TargetReasons-for-1.16-mob-behavior.patch create mode 100644 patches/api/0202-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch delete mode 100644 patches/api/0202-Add-entity-liquid-API.patch create mode 100644 patches/api/0203-Add-BellRingEvent.patch delete mode 100644 patches/api/0203-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch delete mode 100644 patches/api/0204-Add-BellRingEvent.patch create mode 100644 patches/api/0204-Brand-support.patch create mode 100644 patches/api/0205-Add-moon-phase-API.patch delete mode 100644 patches/api/0205-Brand-support.patch delete mode 100644 patches/api/0206-Add-moon-phase-API.patch create mode 100644 patches/api/0206-Add-playPickupItemAnimation-to-LivingEntity.patch create mode 100644 patches/api/0207-Add-more-Evoker-API.patch delete mode 100644 patches/api/0207-Add-playPickupItemAnimation-to-LivingEntity.patch create mode 100644 patches/api/0208-Add-methods-to-get-translation-keys.patch delete mode 100644 patches/api/0208-Add-more-Evoker-API.patch delete mode 100644 patches/api/0209-Add-methods-to-get-translation-keys.patch create mode 100644 patches/api/0209-Create-HoverEvent-from-ItemStack-Entity.patch create mode 100644 patches/api/0210-Add-additional-open-container-api-to-HumanEntity.patch delete mode 100644 patches/api/0210-Create-HoverEvent-from-ItemStack-Entity.patch delete mode 100644 patches/api/0211-Add-additional-open-container-api-to-HumanEntity.patch create mode 100644 patches/api/0211-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch create mode 100644 patches/api/0212-Entity-isTicking.patch delete mode 100644 patches/api/0212-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch delete mode 100644 patches/api/0213-Entity-isTicking.patch create mode 100644 patches/api/0213-Villager-resetOffers.patch create mode 100644 patches/api/0214-Player-elytra-boost-API.patch delete mode 100644 patches/api/0214-Villager-resetOffers.patch create mode 100644 patches/api/0215-Add-getOfflinePlayerIfCached-String.patch delete mode 100644 patches/api/0215-Player-elytra-boost-API.patch delete mode 100644 patches/api/0216-Add-getOfflinePlayerIfCached-String.patch create mode 100644 patches/api/0216-Add-ignore-discounts-API.patch delete mode 100644 patches/api/0217-Add-ignore-discounts-API.patch create mode 100644 patches/api/0217-Item-no-age-no-player-pickup.patch create mode 100644 patches/api/0218-Beacon-API-custom-effect-ranges.patch delete mode 100644 patches/api/0218-Item-no-age-no-player-pickup.patch create mode 100644 patches/api/0219-Add-API-for-quit-reason.patch delete mode 100644 patches/api/0219-Beacon-API-custom-effect-ranges.patch delete mode 100644 patches/api/0220-Add-API-for-quit-reason.patch create mode 100644 patches/api/0220-Add-Destroy-Speed-API.patch delete mode 100644 patches/api/0221-Add-Destroy-Speed-API.patch create mode 100644 patches/api/0221-Add-LivingEntity-clearActiveItem.patch delete mode 100644 patches/api/0222-Add-LivingEntity-clearActiveItem.patch create mode 100644 patches/api/0222-Add-PlayerItemCooldownEvent.patch delete mode 100644 patches/api/0223-Add-PlayerItemCooldownEvent.patch create mode 100644 patches/api/0223-More-lightning-API.patch create mode 100644 patches/api/0224-Add-PlayerShearBlockEvent.patch delete mode 100644 patches/api/0224-More-lightning-API.patch delete mode 100644 patches/api/0225-Add-PlayerShearBlockEvent.patch create mode 100644 patches/api/0225-Player-Chunk-Load-Unload-Events.patch create mode 100644 patches/api/0226-Expose-LivingEntity-hurt-direction.patch delete mode 100644 patches/api/0226-Player-Chunk-Load-Unload-Events.patch create mode 100644 patches/api/0227-Add-OBSTRUCTED-reason-to-BedEnterResult.patch delete mode 100644 patches/api/0227-Expose-LivingEntity-hurt-direction.patch delete mode 100644 patches/api/0228-Add-OBSTRUCTED-reason-to-BedEnterResult.patch create mode 100644 patches/api/0228-Added-PlayerTradeEvent.patch create mode 100644 patches/api/0229-Add-TargetHitEvent-API.patch delete mode 100644 patches/api/0229-Added-PlayerTradeEvent.patch delete mode 100644 patches/api/0230-Add-TargetHitEvent-API.patch create mode 100644 patches/api/0230-Additional-Block-Material-API-s.patch create mode 100644 patches/api/0231-Add-API-to-get-Material-from-Boats-and-Minecarts.patch delete mode 100644 patches/api/0231-Additional-Block-Material-API-s.patch delete mode 100644 patches/api/0232-Add-API-to-get-Material-from-Boats-and-Minecarts.patch create mode 100644 patches/api/0232-Add-PlayerFlowerPotManipulateEvent.patch delete mode 100644 patches/api/0233-Add-PlayerFlowerPotManipulateEvent.patch create mode 100644 patches/api/0233-Zombie-API-breaking-doors.patch create mode 100644 patches/api/0234-Add-EntityLoadCrossbowEvent.patch delete mode 100644 patches/api/0234-Zombie-API-breaking-doors.patch delete mode 100644 patches/api/0235-Add-EntityLoadCrossbowEvent.patch create mode 100644 patches/api/0235-Added-WorldGameRuleChangeEvent.patch create mode 100644 patches/api/0236-Added-ServerResourcesReloadedEvent.patch delete mode 100644 patches/api/0236-Added-WorldGameRuleChangeEvent.patch create mode 100644 patches/api/0237-Add-BlockFailedDispenseEvent.patch delete mode 100644 patches/api/0237-Added-ServerResourcesReloadedEvent.patch delete mode 100644 patches/api/0238-Add-BlockFailedDispenseEvent.patch create mode 100644 patches/api/0238-Added-PlayerLecternPageChangeEvent.patch delete mode 100644 patches/api/0239-Added-PlayerLecternPageChangeEvent.patch create mode 100644 patches/api/0239-Added-PlayerLoomPatternSelectEvent.patch create mode 100644 patches/api/0240-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch delete mode 100644 patches/api/0240-Added-PlayerLoomPatternSelectEvent.patch delete mode 100644 patches/api/0241-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch create mode 100644 patches/api/0241-Add-sendOpLevel-API.patch create mode 100644 patches/api/0242-Add-RegistryAccess-for-managing-registries.patch delete mode 100644 patches/api/0242-Add-sendOpLevel-API.patch delete mode 100644 patches/api/0243-Add-RegistryAccess-for-managing-registries.patch create mode 100644 patches/api/0243-Add-StructuresLocateEvent.patch create mode 100644 patches/api/0244-Add-BlockPreDispenseEvent.patch delete mode 100644 patches/api/0244-Add-StructuresLocateEvent.patch delete mode 100644 patches/api/0245-Add-BlockPreDispenseEvent.patch create mode 100644 patches/api/0245-Added-PlayerChangeBeaconEffectEvent.patch delete mode 100644 patches/api/0246-Added-PlayerChangeBeaconEffectEvent.patch create mode 100644 patches/api/0246-Added-PlayerStonecutterRecipeSelectEvent.patch create mode 100644 patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch delete mode 100644 patches/api/0247-Added-PlayerStonecutterRecipeSelectEvent.patch delete mode 100644 patches/api/0248-Add-dropLeash-variable-to-EntityUnleashEvent.patch create mode 100644 patches/api/0248-add-DragonEggFormEvent.patch create mode 100644 patches/api/0249-EntityMoveEvent.patch delete mode 100644 patches/api/0249-add-DragonEggFormEvent.patch create mode 100644 patches/api/0250-Allow-adding-items-to-BlockDropItemEvent.patch delete mode 100644 patches/api/0250-EntityMoveEvent.patch create mode 100644 patches/api/0251-Add-getMainThreadExecutor-to-BukkitScheduler.patch delete mode 100644 patches/api/0251-Allow-adding-items-to-BlockDropItemEvent.patch delete mode 100644 patches/api/0252-Add-getMainThreadExecutor-to-BukkitScheduler.patch create mode 100644 patches/api/0252-living-entity-allow-attribute-registration.patch create mode 100644 patches/api/0253-Add-missing-effects.patch delete mode 100644 patches/api/0253-living-entity-allow-attribute-registration.patch delete mode 100644 patches/api/0254-Add-missing-effects.patch create mode 100644 patches/api/0254-Expose-Tracked-Players.patch create mode 100644 patches/api/0255-Cache-the-result-of-Material-isBlock.patch delete mode 100644 patches/api/0255-Expose-Tracked-Players.patch create mode 100644 patches/api/0256-Add-worldborder-events.patch delete mode 100644 patches/api/0256-Cache-the-result-of-Material-isBlock.patch delete mode 100644 patches/api/0257-Add-worldborder-events.patch create mode 100644 patches/api/0257-added-PlayerNameEntityEvent.patch create mode 100644 patches/api/0258-Add-recipe-to-cook-events.patch delete mode 100644 patches/api/0258-added-PlayerNameEntityEvent.patch create mode 100644 patches/api/0259-Add-Block-isValidTool.patch delete mode 100644 patches/api/0259-Add-recipe-to-cook-events.patch delete mode 100644 patches/api/0260-Add-Block-isValidTool.patch create mode 100644 patches/api/0260-Expand-world-key-API.patch delete mode 100644 patches/api/0261-Expand-world-key-API.patch create mode 100644 patches/api/0261-Improve-Item-Rarity-API.patch create mode 100644 patches/api/0262-Expose-protocol-version.patch delete mode 100644 patches/api/0262-Improve-Item-Rarity-API.patch delete mode 100644 patches/api/0263-Expose-protocol-version.patch create mode 100644 patches/api/0263-add-isDeeplySleeping-to-HumanEntity.patch create mode 100644 patches/api/0264-add-consumeFuel-to-FurnaceBurnEvent.patch delete mode 100644 patches/api/0264-add-isDeeplySleeping-to-HumanEntity.patch delete mode 100644 patches/api/0265-add-consumeFuel-to-FurnaceBurnEvent.patch create mode 100644 patches/api/0265-add-get-set-drop-chance-to-EntityEquipment.patch create mode 100644 patches/api/0266-Added-PlayerDeepSleepEvent.patch delete mode 100644 patches/api/0266-add-get-set-drop-chance-to-EntityEquipment.patch delete mode 100644 patches/api/0267-Added-PlayerDeepSleepEvent.patch create mode 100644 patches/api/0267-More-World-API.patch create mode 100644 patches/api/0268-Added-PlayerBedFailEnterEvent.patch delete mode 100644 patches/api/0268-More-World-API.patch delete mode 100644 patches/api/0269-Added-PlayerBedFailEnterEvent.patch create mode 100644 patches/api/0269-Introduce-beacon-activation-deactivation-events.patch delete mode 100644 patches/api/0270-Introduce-beacon-activation-deactivation-events.patch create mode 100644 patches/api/0270-PlayerMoveEvent-Improvements.patch delete mode 100644 patches/api/0271-PlayerMoveEvent-Improvements.patch create mode 100644 patches/api/0271-add-RespawnFlags-to-PlayerRespawnEvent.patch create mode 100644 patches/api/0272-Add-more-WanderingTrader-API.patch delete mode 100644 patches/api/0272-add-RespawnFlags-to-PlayerRespawnEvent.patch create mode 100644 patches/api/0273-Add-EntityBlockStorage-clearEntities.patch delete mode 100644 patches/api/0273-Add-more-WanderingTrader-API.patch create mode 100644 patches/api/0274-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch delete mode 100644 patches/api/0274-Add-EntityBlockStorage-clearEntities.patch delete mode 100644 patches/api/0275-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch create mode 100644 patches/api/0275-Inventory-close.patch create mode 100644 patches/api/0276-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch delete mode 100644 patches/api/0276-Inventory-close.patch delete mode 100644 patches/api/0277-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch create mode 100644 patches/api/0277-Add-basic-Datapack-API.patch delete mode 100644 patches/api/0278-Add-basic-Datapack-API.patch create mode 100644 patches/api/0278-additions-to-PlayerGameModeChangeEvent.patch create mode 100644 patches/api/0279-ItemStack-repair-check-API.patch delete mode 100644 patches/api/0279-additions-to-PlayerGameModeChangeEvent.patch delete mode 100644 patches/api/0280-ItemStack-repair-check-API.patch create mode 100644 patches/api/0280-More-Enchantment-API.patch create mode 100644 patches/api/0281-Add-Mob-lookAt-API.patch delete mode 100644 patches/api/0281-More-Enchantment-API.patch delete mode 100644 patches/api/0282-Add-Mob-lookAt-API.patch create mode 100644 patches/api/0282-ItemStack-editMeta.patch create mode 100644 patches/api/0283-Add-EntityInsideBlockEvent.patch delete mode 100644 patches/api/0283-ItemStack-editMeta.patch delete mode 100644 patches/api/0284-Add-EntityInsideBlockEvent.patch create mode 100644 patches/api/0284-Attributes-API-for-item-defaults.patch create mode 100644 patches/api/0285-Add-cause-to-Weather-ThunderChangeEvents.patch delete mode 100644 patches/api/0285-Attributes-API-for-item-defaults.patch delete mode 100644 patches/api/0286-Add-cause-to-Weather-ThunderChangeEvents.patch create mode 100644 patches/api/0286-More-Lidded-Block-API.patch create mode 100644 patches/api/0287-Add-PlayerKickEvent-causes.patch delete mode 100644 patches/api/0287-More-Lidded-Block-API.patch delete mode 100644 patches/api/0288-Add-PlayerKickEvent-causes.patch create mode 100644 patches/api/0288-Add-PufferFishStateChangeEvent.patch create mode 100644 patches/api/0289-Add-BellRevealRaiderEvent.patch delete mode 100644 patches/api/0289-Add-PufferFishStateChangeEvent.patch delete mode 100644 patches/api/0290-Add-BellRevealRaiderEvent.patch create mode 100644 patches/api/0290-Add-ElderGuardianAppearanceEvent.patch delete mode 100644 patches/api/0291-Add-ElderGuardianAppearanceEvent.patch create mode 100644 patches/api/0291-Add-more-line-of-sight-methods.patch create mode 100644 patches/api/0292-Add-WaterBottleSplashEvent.patch delete mode 100644 patches/api/0292-Add-more-line-of-sight-methods.patch delete mode 100644 patches/api/0293-Add-WaterBottleSplashEvent.patch create mode 100644 patches/api/0293-Add-more-LimitedRegion-API.patch delete mode 100644 patches/api/0294-Add-more-LimitedRegion-API.patch create mode 100644 patches/api/0294-Missing-Entity-API.patch create mode 100644 patches/api/0295-Adds-PlayerArmSwingEvent.patch delete mode 100644 patches/api/0295-Missing-Entity-API.patch create mode 100644 patches/api/0296-Add-PlayerSignCommandPreprocessEvent.patch delete mode 100644 patches/api/0296-Adds-PlayerArmSwingEvent.patch delete mode 100644 patches/api/0297-Add-PlayerSignCommandPreprocessEvent.patch create mode 100644 patches/api/0297-fix-empty-array-elements-in-command-arguments.patch create mode 100644 patches/api/0298-Stinger-API.patch delete mode 100644 patches/api/0298-fix-empty-array-elements-in-command-arguments.patch create mode 100644 patches/api/0299-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch delete mode 100644 patches/api/0299-Stinger-API.patch create mode 100644 patches/api/0300-Add-PlayerSetSpawnEvent.patch delete mode 100644 patches/api/0300-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch delete mode 100644 patches/api/0301-Add-PlayerSetSpawnEvent.patch create mode 100644 patches/api/0301-Added-EntityDamageItemEvent.patch delete mode 100644 patches/api/0302-Added-EntityDamageItemEvent.patch create mode 100644 patches/api/0302-Make-EntityUnleashEvent-cancellable.patch create mode 100644 patches/api/0303-Change-EnderEye-target-without-changing-other-things.patch delete mode 100644 patches/api/0303-Make-EntityUnleashEvent-cancellable.patch create mode 100644 patches/api/0304-Add-BlockBreakBlockEvent.patch delete mode 100644 patches/api/0304-Change-EnderEye-target-without-changing-other-things.patch delete mode 100644 patches/api/0305-Add-BlockBreakBlockEvent.patch create mode 100644 patches/api/0305-Add-helpers-for-left-right-click-to-Action.patch delete mode 100644 patches/api/0306-Add-helpers-for-left-right-click-to-Action.patch create mode 100644 patches/api/0306-Option-to-prevent-data-components-copy-in-smithing-r.patch create mode 100644 patches/api/0307-More-CommandBlock-API.patch delete mode 100644 patches/api/0307-Option-to-prevent-data-components-copy-in-smithing-r.patch create mode 100644 patches/api/0308-Add-missing-team-sidebar-display-slots.patch delete mode 100644 patches/api/0308-More-CommandBlock-API.patch delete mode 100644 patches/api/0309-Add-missing-team-sidebar-display-slots.patch create mode 100644 patches/api/0309-add-back-EntityPortalExitEvent.patch create mode 100644 patches/api/0310-Add-methods-to-find-targets-for-lightning-strikes.patch delete mode 100644 patches/api/0310-add-back-EntityPortalExitEvent.patch delete mode 100644 patches/api/0311-Add-methods-to-find-targets-for-lightning-strikes.patch create mode 100644 patches/api/0311-Get-entity-default-attributes.patch delete mode 100644 patches/api/0312-Get-entity-default-attributes.patch create mode 100644 patches/api/0312-Left-handed-API.patch create mode 100644 patches/api/0313-Add-critical-damage-API.patch delete mode 100644 patches/api/0313-Left-handed-API.patch delete mode 100644 patches/api/0314-Add-critical-damage-API.patch create mode 100644 patches/api/0314-Add-more-advancement-API.patch delete mode 100644 patches/api/0315-Add-more-advancement-API.patch create mode 100644 patches/api/0315-Fix-issues-with-mob-conversion.patch create mode 100644 patches/api/0316-Add-isCollidable-methods-to-various-places.patch delete mode 100644 patches/api/0316-Fix-issues-with-mob-conversion.patch delete mode 100644 patches/api/0317-Add-isCollidable-methods-to-various-places.patch create mode 100644 patches/api/0317-Goat-ram-API.patch create mode 100644 patches/api/0318-Add-API-for-resetting-a-single-score.patch delete mode 100644 patches/api/0318-Goat-ram-API.patch delete mode 100644 patches/api/0319-Add-API-for-resetting-a-single-score.patch create mode 100644 patches/api/0319-Add-Raw-Byte-Entity-Serialization.patch create mode 100644 patches/api/0320-Add-PlayerItemFrameChangeEvent.patch delete mode 100644 patches/api/0320-Add-Raw-Byte-Entity-Serialization.patch delete mode 100644 patches/api/0321-Add-PlayerItemFrameChangeEvent.patch create mode 100644 patches/api/0321-Allow-delegation-to-vanilla-chunk-gen.patch create mode 100644 patches/api/0322-Add-more-Campfire-API.patch delete mode 100644 patches/api/0322-Allow-delegation-to-vanilla-chunk-gen.patch delete mode 100644 patches/api/0323-Add-more-Campfire-API.patch create mode 100644 patches/api/0323-Extend-VehicleCollisionEvent-move-HandlerList-up.patch delete mode 100644 patches/api/0324-Extend-VehicleCollisionEvent-move-HandlerList-up.patch create mode 100644 patches/api/0324-Improve-scoreboard-entries.patch create mode 100644 patches/api/0325-Entity-powdered-snow-API.patch delete mode 100644 patches/api/0325-Improve-scoreboard-entries.patch create mode 100644 patches/api/0326-Add-API-for-item-entity-health.patch delete mode 100644 patches/api/0326-Entity-powdered-snow-API.patch delete mode 100644 patches/api/0327-Add-API-for-item-entity-health.patch create mode 100644 patches/api/0327-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch create mode 100644 patches/api/0328-Bucketable-API.patch delete mode 100644 patches/api/0328-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch delete mode 100644 patches/api/0329-Bucketable-API.patch create mode 100644 patches/api/0329-System-prop-for-default-config-comment-parsing.patch create mode 100644 patches/api/0330-Expose-vanilla-BiomeProvider-from-WorldInfo.patch delete mode 100644 patches/api/0330-System-prop-for-default-config-comment-parsing.patch delete mode 100644 patches/api/0331-Expose-vanilla-BiomeProvider-from-WorldInfo.patch create mode 100644 patches/api/0331-Multiple-Entries-with-Scoreboards.patch delete mode 100644 patches/api/0332-Multiple-Entries-with-Scoreboards.patch create mode 100644 patches/api/0332-Warn-on-strange-EventHandler-return-types.patch create mode 100644 patches/api/0333-Multi-Block-Change-API.patch delete mode 100644 patches/api/0333-Warn-on-strange-EventHandler-return-types.patch create mode 100644 patches/api/0334-Fix-NotePlayEvent.patch delete mode 100644 patches/api/0334-Multi-Block-Change-API.patch delete mode 100644 patches/api/0335-Fix-NotePlayEvent.patch create mode 100644 patches/api/0335-Freeze-Tick-Lock-API.patch create mode 100644 patches/api/0336-Dolphin-API.patch delete mode 100644 patches/api/0336-Freeze-Tick-Lock-API.patch delete mode 100644 patches/api/0337-Dolphin-API.patch create mode 100644 patches/api/0337-More-PotionEffectType-API.patch create mode 100644 patches/api/0338-API-for-creating-command-sender-which-forwards-feedb.patch delete mode 100644 patches/api/0338-More-PotionEffectType-API.patch delete mode 100644 patches/api/0339-API-for-creating-command-sender-which-forwards-feedb.patch create mode 100644 patches/api/0339-Implement-regenerateChunk.patch create mode 100644 patches/api/0340-Add-GameEvent-tags.patch delete mode 100644 patches/api/0340-Implement-regenerateChunk.patch delete mode 100644 patches/api/0341-Add-GameEvent-tags.patch create mode 100644 patches/api/0341-Furnace-RecipesUsed-API.patch create mode 100644 patches/api/0342-Configurable-sculk-sensor-listener-range.patch delete mode 100644 patches/api/0342-Furnace-RecipesUsed-API.patch create mode 100644 patches/api/0343-Add-missing-block-data-mins-and-maxes.patch delete mode 100644 patches/api/0343-Configurable-sculk-sensor-listener-range.patch delete mode 100644 patches/api/0344-Add-missing-block-data-mins-and-maxes.patch create mode 100644 patches/api/0344-Custom-Potion-Mixes.patch delete mode 100644 patches/api/0345-Custom-Potion-Mixes.patch create mode 100644 patches/api/0345-Expose-furnace-minecart-push-values.patch delete mode 100644 patches/api/0346-Expose-furnace-minecart-push-values.patch create mode 100644 patches/api/0346-More-Projectile-API.patch create mode 100644 patches/api/0347-Add-getComputedBiome-API.patch delete mode 100644 patches/api/0347-More-Projectile-API.patch create mode 100644 patches/api/0348-Add-enchantWithLevels-API.patch delete mode 100644 patches/api/0348-Add-getComputedBiome-API.patch create mode 100644 patches/api/0349-Add-TameableDeathMessageEvent.patch delete mode 100644 patches/api/0349-Add-enchantWithLevels-API.patch delete mode 100644 patches/api/0350-Add-TameableDeathMessageEvent.patch create mode 100644 patches/api/0350-Allow-to-change-the-podium-of-the-EnderDragon.patch delete mode 100644 patches/api/0351-Allow-to-change-the-podium-of-the-EnderDragon.patch create mode 100644 patches/api/0351-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch create mode 100644 patches/api/0352-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch delete mode 100644 patches/api/0352-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch delete mode 100644 patches/api/0353-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch create mode 100644 patches/api/0353-WorldCreator-keepSpawnLoaded.patch create mode 100644 patches/api/0354-Add-EntityDyeEvent-and-CollarColorable-interface.patch delete mode 100644 patches/api/0354-WorldCreator-keepSpawnLoaded.patch delete mode 100644 patches/api/0355-Add-EntityDyeEvent-and-CollarColorable-interface.patch create mode 100644 patches/api/0355-Add-PlayerStopUsingItemEvent.patch delete mode 100644 patches/api/0356-Add-PlayerStopUsingItemEvent.patch create mode 100644 patches/api/0356-Expand-FallingBlock-API.patch create mode 100644 patches/api/0357-Add-method-isTickingWorlds-to-Bukkit.patch delete mode 100644 patches/api/0357-Expand-FallingBlock-API.patch create mode 100644 patches/api/0358-Add-WardenAngerChangeEvent.patch delete mode 100644 patches/api/0358-Add-method-isTickingWorlds-to-Bukkit.patch delete mode 100644 patches/api/0359-Add-WardenAngerChangeEvent.patch create mode 100644 patches/api/0359-Nameable-Banner-API.patch create mode 100644 patches/api/0360-Add-Player-getFishHook.patch delete mode 100644 patches/api/0360-Nameable-Banner-API.patch delete mode 100644 patches/api/0361-Add-Player-getFishHook.patch create mode 100644 patches/api/0361-More-Teleport-API.patch create mode 100644 patches/api/0362-Add-EntityPortalReadyEvent.patch delete mode 100644 patches/api/0362-More-Teleport-API.patch delete mode 100644 patches/api/0363-Add-EntityPortalReadyEvent.patch create mode 100644 patches/api/0363-Custom-Chat-Completion-Suggestions-API.patch create mode 100644 patches/api/0364-Collision-API.patch delete mode 100644 patches/api/0364-Custom-Chat-Completion-Suggestions-API.patch create mode 100644 patches/api/0365-Block-Ticking-API.patch delete mode 100644 patches/api/0365-Collision-API.patch create mode 100644 patches/api/0366-Add-NamespacedKey-biome-methods.patch delete mode 100644 patches/api/0366-Block-Ticking-API.patch delete mode 100644 patches/api/0367-Add-NamespacedKey-biome-methods.patch create mode 100644 patches/api/0367-Also-load-resources-from-LibraryLoader.patch create mode 100644 patches/api/0368-Added-byte-array-serialization-deserialization-for-P.patch delete mode 100644 patches/api/0368-Also-load-resources-from-LibraryLoader.patch create mode 100644 patches/api/0369-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch delete mode 100644 patches/api/0369-Added-byte-array-serialization-deserialization-for-P.patch delete mode 100644 patches/api/0370-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch create mode 100644 patches/api/0370-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch create mode 100644 patches/api/0371-Add-getDrops-to-BlockState.patch delete mode 100644 patches/api/0371-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch create mode 100644 patches/api/0372-Add-PlayerInventorySlotChangeEvent.patch delete mode 100644 patches/api/0372-Add-getDrops-to-BlockState.patch delete mode 100644 patches/api/0373-Add-PlayerInventorySlotChangeEvent.patch create mode 100644 patches/api/0373-Elder-Guardian-appearance-API.patch create mode 100644 patches/api/0374-Allow-changing-bed-s-occupied-property.patch delete mode 100644 patches/api/0374-Elder-Guardian-appearance-API.patch create mode 100644 patches/api/0375-Add-EquipmentSlot-convenience-methods.patch delete mode 100644 patches/api/0375-Allow-changing-bed-s-occupied-property.patch delete mode 100644 patches/api/0376-Add-EquipmentSlot-convenience-methods.patch create mode 100644 patches/api/0376-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch delete mode 100644 patches/api/0377-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch create mode 100644 patches/api/0377-Add-entity-knockback-API.patch delete mode 100644 patches/api/0378-Add-entity-knockback-API.patch create mode 100644 patches/api/0378-Added-EntityToggleSitEvent.patch create mode 100644 patches/api/0379-Add-Moving-Piston-API.patch delete mode 100644 patches/api/0379-Added-EntityToggleSitEvent.patch delete mode 100644 patches/api/0380-Add-Moving-Piston-API.patch create mode 100644 patches/api/0380-Add-PrePlayerAttackEntityEvent.patch create mode 100644 patches/api/0381-Add-Player-Warden-Warning-API.patch delete mode 100644 patches/api/0381-Add-PrePlayerAttackEntityEvent.patch delete mode 100644 patches/api/0382-Add-Player-Warden-Warning-API.patch create mode 100644 patches/api/0382-More-vanilla-friendly-methods-to-update-trades.patch create mode 100644 patches/api/0383-Add-paper-dumplisteners-command.patch delete mode 100644 patches/api/0383-More-vanilla-friendly-methods-to-update-trades.patch delete mode 100644 patches/api/0384-Add-paper-dumplisteners-command.patch create mode 100644 patches/api/0384-ItemStack-damage-API.patch create mode 100644 patches/api/0385-Add-Tick-TemporalUnit.patch delete mode 100644 patches/api/0385-ItemStack-damage-API.patch delete mode 100644 patches/api/0386-Add-Tick-TemporalUnit.patch create mode 100644 patches/api/0386-Friction-API.patch delete mode 100644 patches/api/0387-Friction-API.patch create mode 100644 patches/api/0387-Player-Entity-Tracking-Events.patch create mode 100644 patches/api/0388-Add-missing-Fluid-type.patch delete mode 100644 patches/api/0388-Player-Entity-Tracking-Events.patch delete mode 100644 patches/api/0389-Add-missing-Fluid-type.patch create mode 100644 patches/api/0389-fix-Instruments.patch create mode 100644 patches/api/0390-Add-BlockLockCheckEvent.patch delete mode 100644 patches/api/0390-fix-Instruments.patch delete mode 100644 patches/api/0391-Add-BlockLockCheckEvent.patch create mode 100644 patches/api/0391-Add-Sneaking-API-for-Entities.patch delete mode 100644 patches/api/0392-Add-Sneaking-API-for-Entities.patch create mode 100644 patches/api/0392-Improve-PortalEvents.patch create mode 100644 patches/api/0393-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch delete mode 100644 patches/api/0393-Improve-PortalEvents.patch delete mode 100644 patches/api/0394-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch create mode 100644 patches/api/0394-Flying-Fall-Damage-API.patch delete mode 100644 patches/api/0395-Flying-Fall-Damage-API.patch create mode 100644 patches/api/0395-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch delete mode 100644 patches/api/0396-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch create mode 100644 patches/api/0396-Win-Screen-API.patch create mode 100644 patches/api/0397-Add-Entity-Body-Yaw-API.patch delete mode 100644 patches/api/0397-Win-Screen-API.patch delete mode 100644 patches/api/0398-Add-Entity-Body-Yaw-API.patch create mode 100644 patches/api/0398-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch create mode 100644 patches/api/0399-Add-EntityFertilizeEggEvent.patch delete mode 100644 patches/api/0399-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch create mode 100644 patches/api/0400-Add-CompostItemEvent-and-EntityCompostItemEvent.patch delete mode 100644 patches/api/0400-Add-EntityFertilizeEggEvent.patch delete mode 100644 patches/api/0401-Add-CompostItemEvent-and-EntityCompostItemEvent.patch create mode 100644 patches/api/0401-Add-Shearable-API.patch delete mode 100644 patches/api/0402-Add-Shearable-API.patch create mode 100644 patches/api/0402-Fix-SpawnEggMeta-get-setSpawnedType.patch create mode 100644 patches/api/0403-Add-Mob-Experience-reward-API.patch delete mode 100644 patches/api/0403-Fix-SpawnEggMeta-get-setSpawnedType.patch delete mode 100644 patches/api/0404-Add-Mob-Experience-reward-API.patch create mode 100644 patches/api/0404-Expand-PlayerItemMendEvent.patch create mode 100644 patches/api/0405-Add-transient-modifier-API.patch delete mode 100644 patches/api/0405-Expand-PlayerItemMendEvent.patch delete mode 100644 patches/api/0406-Add-transient-modifier-API.patch create mode 100644 patches/api/0406-Properly-remove-the-experimental-smithing-inventory-.patch create mode 100644 patches/api/0407-Add-method-to-remove-all-active-potion-effects.patch delete mode 100644 patches/api/0407-Properly-remove-the-experimental-smithing-inventory-.patch delete mode 100644 patches/api/0408-Add-method-to-remove-all-active-potion-effects.patch create mode 100644 patches/api/0408-Folia-scheduler-and-owned-region-API.patch create mode 100644 patches/api/0409-Add-event-for-player-editing-sign.patch delete mode 100644 patches/api/0409-Folia-scheduler-and-owned-region-API.patch create mode 100644 patches/api/0410-Add-Sign-getInteractableSideFor.patch delete mode 100644 patches/api/0410-Add-event-for-player-editing-sign.patch delete mode 100644 patches/api/0411-Add-Sign-getInteractableSideFor.patch create mode 100644 patches/api/0411-Fix-BanList-API.patch create mode 100644 patches/api/0412-Add-whitelist-events.patch delete mode 100644 patches/api/0412-Fix-BanList-API.patch create mode 100644 patches/api/0413-API-for-updating-recipes-on-clients.patch delete mode 100644 patches/api/0413-Add-whitelist-events.patch delete mode 100644 patches/api/0414-API-for-updating-recipes-on-clients.patch create mode 100644 patches/api/0414-Add-PlayerFailMoveEvent.patch delete mode 100644 patches/api/0415-Add-PlayerFailMoveEvent.patch create mode 100644 patches/api/0415-Fix-custom-statistic-criteria-creation.patch delete mode 100644 patches/api/0416-Fix-custom-statistic-criteria-creation.patch create mode 100644 patches/api/0416-SculkCatalyst-bloom-API.patch create mode 100644 patches/api/0417-API-for-an-entity-s-scoreboard-name.patch delete mode 100644 patches/api/0417-SculkCatalyst-bloom-API.patch delete mode 100644 patches/api/0418-API-for-an-entity-s-scoreboard-name.patch create mode 100644 patches/api/0418-Deprecate-and-replace-methods-with-old-StructureType.patch create mode 100644 patches/api/0419-Add-Listing-API-for-Player.patch delete mode 100644 patches/api/0419-Deprecate-and-replace-methods-with-old-StructureType.patch delete mode 100644 patches/api/0420-Add-Listing-API-for-Player.patch create mode 100644 patches/api/0420-Expose-clicked-BlockFace-during-BlockDamageEvent.patch delete mode 100644 patches/api/0421-Expose-clicked-BlockFace-during-BlockDamageEvent.patch create mode 100644 patches/api/0421-Fix-NPE-on-Boat-getStatus.patch create mode 100644 patches/api/0422-Expand-Pose-API.patch delete mode 100644 patches/api/0422-Fix-NPE-on-Boat-getStatus.patch delete mode 100644 patches/api/0423-Expand-Pose-API.patch create mode 100644 patches/api/0423-MerchantRecipe-add-copy-constructor.patch delete mode 100644 patches/api/0424-MerchantRecipe-add-copy-constructor.patch create mode 100644 patches/api/0424-More-DragonBattle-API.patch create mode 100644 patches/api/0425-Add-PlayerPickItemEvent.patch delete mode 100644 patches/api/0425-More-DragonBattle-API.patch delete mode 100644 patches/api/0426-Add-PlayerPickItemEvent.patch create mode 100644 patches/api/0426-Allow-trident-custom-damage.patch delete mode 100644 patches/api/0427-Allow-trident-custom-damage.patch create mode 100644 patches/api/0427-Expose-hand-during-BlockCanBuildEvent.patch delete mode 100644 patches/api/0428-Expose-hand-during-BlockCanBuildEvent.patch create mode 100644 patches/api/0428-Limit-setBurnTime-to-valid-short-values.patch create mode 100644 patches/api/0429-Add-OfflinePlayer-isConnected.patch delete mode 100644 patches/api/0429-Limit-setBurnTime-to-valid-short-values.patch delete mode 100644 patches/api/0430-Add-OfflinePlayer-isConnected.patch create mode 100644 patches/api/0430-Add-titleOverride-to-InventoryOpenEvent.patch delete mode 100644 patches/api/0431-Add-titleOverride-to-InventoryOpenEvent.patch create mode 100644 patches/api/0431-Allow-proper-checking-of-empty-item-stacks.patch delete mode 100644 patches/api/0432-Allow-proper-checking-of-empty-item-stacks.patch create mode 100644 patches/api/0432-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch create mode 100644 patches/api/0433-Add-player-idle-duration-API.patch delete mode 100644 patches/api/0433-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch create mode 100644 patches/api/0434-Add-API-to-get-the-collision-shape-of-a-block-before.patch delete mode 100644 patches/api/0434-Add-player-idle-duration-API.patch delete mode 100644 patches/api/0435-Add-API-to-get-the-collision-shape-of-a-block-before.patch create mode 100644 patches/api/0435-Add-predicate-for-blocks-when-raytracing.patch create mode 100644 patches/api/0436-Add-hand-to-fish-event-for-all-player-interactions.patch delete mode 100644 patches/api/0436-Add-predicate-for-blocks-when-raytracing.patch create mode 100644 patches/api/0437-Add-UUID-attribute-modifier-API.patch delete mode 100644 patches/api/0437-Add-hand-to-fish-event-for-all-player-interactions.patch delete mode 100644 patches/api/0438-Add-UUID-attribute-modifier-API.patch create mode 100644 patches/api/0438-Expand-LingeringPotion-API.patch delete mode 100644 patches/api/0439-Expand-LingeringPotion-API.patch create mode 100644 patches/api/0439-Remove-unnecessary-durability-check-in-ItemStack-isS.patch create mode 100644 patches/api/0440-Add-Structure-check-API.patch delete mode 100644 patches/api/0440-Remove-unnecessary-durability-check-in-ItemStack-isS.patch delete mode 100644 patches/api/0441-Add-Structure-check-API.patch create mode 100644 patches/api/0441-add-missing-Experimental-annotations.patch create mode 100644 patches/api/0442-Add-more-scoreboard-API.patch delete mode 100644 patches/api/0442-add-missing-Experimental-annotations.patch delete mode 100644 patches/api/0443-Add-more-scoreboard-API.patch create mode 100644 patches/api/0443-Improve-Registry.patch create mode 100644 patches/api/0444-Add-experience-points-API.patch delete mode 100644 patches/api/0444-Improve-Registry.patch delete mode 100644 patches/api/0445-Add-experience-points-API.patch create mode 100644 patches/api/0445-Add-missing-InventoryType.patch create mode 100644 patches/api/0446-Add-drops-to-shear-events.patch delete mode 100644 patches/api/0446-Add-missing-InventoryType.patch create mode 100644 patches/api/0447-Add-HiddenPotionEffect-API.patch delete mode 100644 patches/api/0447-Add-drops-to-shear-events.patch delete mode 100644 patches/api/0448-Add-HiddenPotionEffect-API.patch create mode 100644 patches/api/0448-Add-PlayerShieldDisableEvent.patch delete mode 100644 patches/api/0449-Add-PlayerShieldDisableEvent.patch create mode 100644 patches/api/0449-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch create mode 100644 patches/api/0450-Add-BlockStateMeta-clearBlockState.patch delete mode 100644 patches/api/0450-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch delete mode 100644 patches/api/0451-Add-BlockStateMeta-clearBlockState.patch create mode 100644 patches/api/0451-Expose-LootTable-of-DecoratedPot.patch create mode 100644 patches/api/0452-Add-ShulkerDuplicateEvent.patch delete mode 100644 patches/api/0452-Expose-LootTable-of-DecoratedPot.patch delete mode 100644 patches/api/0453-Add-ShulkerDuplicateEvent.patch create mode 100644 patches/api/0453-Add-api-for-spawn-egg-texture-colors.patch create mode 100644 patches/api/0454-Add-Lifecycle-Event-system.patch delete mode 100644 patches/api/0454-Add-api-for-spawn-egg-texture-colors.patch delete mode 100644 patches/api/0455-Add-Lifecycle-Event-system.patch create mode 100644 patches/api/0455-ItemStack-Tooltip-API.patch create mode 100644 patches/api/0456-Add-getChunkSnapshot-includeLightData-parameter.patch delete mode 100644 patches/api/0456-ItemStack-Tooltip-API.patch create mode 100644 patches/api/0457-Add-FluidState-API.patch delete mode 100644 patches/api/0457-Add-getChunkSnapshot-includeLightData-parameter.patch delete mode 100644 patches/api/0458-Add-FluidState-API.patch create mode 100644 patches/api/0458-add-number-format-api.patch delete mode 100644 patches/api/0459-add-number-format-api.patch create mode 100644 patches/api/0459-improve-BanList-types.patch create mode 100644 patches/api/0460-Suspicious-Effect-Entry-API.patch delete mode 100644 patches/api/0460-improve-BanList-types.patch create mode 100644 patches/api/0461-Fix-DamageSource-API.patch delete mode 100644 patches/api/0461-Suspicious-Effect-Entry-API.patch create mode 100644 patches/api/0462-Expanded-Hopper-API.patch delete mode 100644 patches/api/0462-Fix-DamageSource-API.patch create mode 100644 patches/api/0463-Clone-mutables-to-prevent-unexpected-issues.patch delete mode 100644 patches/api/0463-Expanded-Hopper-API.patch create mode 100644 patches/api/0464-Add-BlockBreakProgressUpdateEvent.patch delete mode 100644 patches/api/0464-Clone-mutables-to-prevent-unexpected-issues.patch delete mode 100644 patches/api/0465-Add-BlockBreakProgressUpdateEvent.patch create mode 100644 patches/api/0465-Deprecate-ItemStack-setType.patch delete mode 100644 patches/api/0466-Deprecate-ItemStack-setType.patch create mode 100644 patches/api/0466-Item-Mutation-Fixes.patch create mode 100644 patches/api/0467-API-for-checking-sent-chunks.patch delete mode 100644 patches/api/0467-Item-Mutation-Fixes.patch delete mode 100644 patches/api/0468-API-for-checking-sent-chunks.patch create mode 100644 patches/api/0468-Add-CartographyItemEvent.patch delete mode 100644 patches/api/0469-Add-CartographyItemEvent.patch create mode 100644 patches/api/0469-More-Raid-API.patch create mode 100644 patches/api/0470-Fix-SpawnerEntry-Equipment-API.patch delete mode 100644 patches/api/0470-More-Raid-API.patch create mode 100644 patches/api/0471-Fix-ItemFlags.patch delete mode 100644 patches/api/0471-Fix-SpawnerEntry-Equipment-API.patch create mode 100644 patches/api/0472-Allow-modifying-library-loader-jars-bytecode.patch delete mode 100644 patches/api/0472-Fix-ItemFlags.patch create mode 100644 patches/api/0473-Add-hook-to-remap-library-jars.patch delete mode 100644 patches/api/0473-Allow-modifying-library-loader-jars-bytecode.patch create mode 100644 patches/api/0474-Add-GameMode-isInvulnerable.patch delete mode 100644 patches/api/0474-Add-hook-to-remap-library-jars.patch delete mode 100644 patches/api/0475-Add-GameMode-isInvulnerable.patch create mode 100644 patches/api/0475-Expose-hasColor-to-leather-armor.patch create mode 100644 patches/api/0476-Add-missing-wind-charge-damage-type.patch delete mode 100644 patches/api/0476-Expose-hasColor-to-leather-armor.patch delete mode 100644 patches/api/0477-Add-missing-wind-charge-damage-type.patch create mode 100644 patches/api/0477-Added-API-to-get-player-ha-proxy-address.patch delete mode 100644 patches/api/0478-Added-API-to-get-player-ha-proxy-address.patch create mode 100644 patches/api/0478-More-Chest-Block-API.patch delete mode 100644 patches/api/0479-More-Chest-Block-API.patch diff --git a/patches/api/0011-Timings-v2.patch b/patches/api/0011-Timings-v2.patch index 5b729d09d2..f5da4a8880 100644 --- a/patches/api/0011-Timings-v2.patch +++ b/patches/api/0011-Timings-v2.patch @@ -717,10 +717,10 @@ index 0000000000000000000000000000000000000000..199789d56d22fcb1b77ebd56805cc28a +} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java new file mode 100644 -index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf542989301d21b1c +index 0000000000000000000000000000000000000000..7df5ca61fee4e19b08fceafdc44226328789e898 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -0,0 +1,355 @@ +@@ -0,0 +1,284 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -746,15 +746,10 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893 + */ +package co.aikar.timings; + -+import co.aikar.timings.TimingHistory.RegionData.RegionId; +import com.google.common.base.Function; +import com.google.common.collect.Sets; +import org.bukkit.Bukkit; -+import org.bukkit.Chunk; +import org.bukkit.Material; -+import org.bukkit.World; -+import org.bukkit.block.BlockState; -+import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import co.aikar.util.LoadingMap; @@ -825,74 +820,8 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893 + + // Information about all loaded chunks/entities + //noinspection unchecked -+ this.worlds = toObjectMapper(Bukkit.getWorlds(), new Function() { -+ @NotNull -+ @Override -+ public JSONPair apply(World world) { -+ Map regions = LoadingMap.newHashMap(RegionData.LOADER); -+ -+ for (Chunk chunk : world.getLoadedChunks()) { -+ RegionData data = regions.get(new RegionId(chunk.getX(), chunk.getZ())); -+ -+ for (Entity entity : chunk.getEntities()) { -+ if (entity == null) { -+ Bukkit.getLogger().warning("Null entity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ()); -+ continue; -+ } -+ -+ data.entityCounts.get(entity.getType()).increment(); -+ } -+ -+ for (BlockState tileEntity : chunk.getTileEntities()) { -+ if (tileEntity == null) { -+ Bukkit.getLogger().warning("Null tileentity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ()); -+ continue; -+ } + -+ data.tileEntityCounts.get(tileEntity.getBlock().getType()).increment(); -+ } -+ } -+ return pair( -+ worldMap.get(world.getName()), -+ toArrayMapper(regions.values(),new Function() { -+ @NotNull -+ @Override -+ public Object apply(RegionData input) { -+ return toArray( -+ input.regionId.x, -+ input.regionId.z, -+ toObjectMapper(input.entityCounts.entrySet(), -+ new Function, JSONPair>() { -+ @NotNull -+ @Override -+ public JSONPair apply(Map.Entry entry) { -+ entityTypeSet.add(entry.getKey()); -+ return pair( -+ String.valueOf(entry.getKey().ordinal()), -+ entry.getValue().count() -+ ); -+ } -+ } -+ ), -+ toObjectMapper(input.tileEntityCounts.entrySet(), -+ new Function, JSONPair>() { -+ @NotNull -+ @Override -+ public JSONPair apply(Map.Entry entry) { -+ tileEntityTypeSet.add(entry.getKey()); -+ return pair( -+ String.valueOf(entry.getKey().ordinal()), -+ entry.getValue().count() -+ ); -+ } -+ } -+ ) -+ ); -+ } -+ }) -+ ); -+ } -+ }); ++ this.worlds = toObjectMapper(Bukkit.getWorlds(), Bukkit.getUnsafe().getWorldTimingExtractor(this) ); + } + static class RegionData { + final RegionId regionId; @@ -1066,7 +995,7 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893 + } + + -+ private static class Counter { ++ static class Counter { + private int count = 0; + public int increment() { + return ++count; @@ -2897,7 +2826,7 @@ index 3bf7db7eac81e3cc6f5c6700637d10d1b4b7a47b..77f8b0889cd7039bf041fc052fba33b6 * Sends the component to the player * diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 6e46302c272b468375f2de3f7f992f55f13805b8..01e796e487cc16710f51b457466a37ba70e1e665 100644 +index 6e46302c272b468375f2de3f7f992f55f13805b8..b116bc3f7abd3f093145071407c45e43b1748bf3 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -40,6 +40,7 @@ public interface UnsafeValues { @@ -2908,7 +2837,7 @@ index 6e46302c272b468375f2de3f7f992f55f13805b8..01e796e487cc16710f51b457466a37ba Material toLegacy(Material material); Material fromLegacy(Material material); -@@ -138,4 +139,12 @@ public interface UnsafeValues { +@@ -138,4 +139,13 @@ public interface UnsafeValues { return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion()); } // Paper end @@ -2919,6 +2848,7 @@ index 6e46302c272b468375f2de3f7f992f55f13805b8..01e796e487cc16710f51b457466a37ba + * @return name + */ + String getTimingsServerName(); ++ com.google.common.base.Function getWorldTimingExtractor(final co.aikar.timings.TimingHistory timingHistory); // Paper - Timings hack + // Paper end } diff --git a/src/main/java/org/bukkit/command/BufferedCommandSender.java b/src/main/java/org/bukkit/command/BufferedCommandSender.java diff --git a/patches/api/0015-Version-Command-2.0.patch b/patches/api/0015-Version-Command-2.0.patch index 32edafcf60..8e7ae211d1 100644 --- a/patches/api/0015-Version-Command-2.0.patch +++ b/patches/api/0015-Version-Command-2.0.patch @@ -56,13 +56,13 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7 + } +} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 01e796e487cc16710f51b457466a37ba70e1e665..d69e5fa40702c283c370a2f712b51dc2ea3a1fa0 100644 +index b116bc3f7abd3f093145071407c45e43b1748bf3..4ac6f5488eb988486ee40473b9b0db84b5fe35c4 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -146,5 +146,12 @@ public interface UnsafeValues { - * @return name +@@ -147,5 +147,12 @@ public interface UnsafeValues { */ String getTimingsServerName(); + com.google.common.base.Function getWorldTimingExtractor(final co.aikar.timings.TimingHistory timingHistory); // Paper - Timings hack + + /** + * Called once by the version command on first use, then cached. diff --git a/patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch new file mode 100644 index 0000000000..c2205057df --- /dev/null +++ b/patches/api/0135-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -0,0 +1,184 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Tue, 14 Aug 2018 21:42:10 -0700 +Subject: [PATCH] Allow Blocks to be accessed via a long key + +The key can be retrieved via methods Location#toBlockKey() and +Block#getBlockKey() + +World provides lookup for blocks by long key via method World#getBlockAtKey(long) + +The formatting for the key is as follows: + +10 bit y|27 bit z|27 bit x + +The y value is considered unsigned while z and x are considered two's complement + +Y range: [0, 1023] +X, Z range: [-67 108 864, 67 108 863] + +diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java +index 41125de49db8eafce4be59cc110ce5be06836a47..042d69e6d4584eb6d678b8ea13a3e4bea78703b8 100644 +--- a/src/main/java/org/bukkit/Location.java ++++ b/src/main/java/org/bukkit/Location.java +@@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable; + + // Paper start + import java.util.Collection; +-import java.util.Collections; + import java.util.function.Predicate; + import org.bukkit.entity.Entity; + import org.bukkit.entity.LivingEntity; +@@ -610,6 +609,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm + blockLoc.setZ(getBlockZ()); + return blockLoc; + } ++ ++ // Paper start ++ /** ++ * @return The block key for this location's block location. ++ * @see Block#getBlockKey(int, int, int) ++ * @deprecated only encodes y block ranges from -512 to 511 and represents an already changed implementation detail ++ */ ++ @Deprecated ++ public long toBlockKey() { ++ return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ()); ++ } ++ // Paper end ++ + /** + * @return A new location where X/Y/Z are the center of the block + */ +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 273c50b6e4f26457415779000cf09aeaffd21733..575fd50b8456beed7c5049a392fca011271a8fe4 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -99,6 +99,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @NotNull + public Block getBlockAt(@NotNull Location location); + ++ // Paper start ++ /** ++ * Gets the {@link Block} at the given block key ++ * ++ * @param key The block key. See {@link Block#getBlockKey()} ++ * @return Block at the key ++ * @see Block#getBlockKey(int, int, int) ++ * @deprecated only encodes y block ranges from -512 to 511 and represents an already changed implementation detail ++ */ ++ @NotNull ++ @Deprecated ++ public default Block getBlockAtKey(long key) { ++ int x = Block.getBlockKeyX(key); ++ int y = Block.getBlockKeyY(key); ++ int z = Block.getBlockKeyZ(key); ++ return getBlockAt(x, y, z); ++ } ++ ++ /** ++ * Gets the {@link Location} at the given block key ++ * ++ * @param key The block key. See {@link Location#toBlockKey()} ++ * @return Location at the key ++ * @see Block#getBlockKey(int, int, int) ++ */ ++ @NotNull ++ @Deprecated ++ public default Location getLocationAtKey(long key) { ++ int x = Block.getBlockKeyX(key); ++ int y = Block.getBlockKeyY(key); ++ int z = Block.getBlockKeyZ(key); ++ return new Location(this, x, y, z); ++ } ++ // Paper end ++ + /** + * Gets the highest non-empty (impassable) block at the given coordinates. + * +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index f3b3606dc5881e931853fc2631aad9ca9083474d..a71001677e2b1b0b6225a7be63b8ea5ce4456862 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -156,6 +156,82 @@ public interface Block extends Metadatable, Translatable { + */ + int getZ(); + ++ // Paper start ++ /** ++ * Returns this block's coordinates packed into a long value. ++ * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())} ++ * @see Block#getBlockKey(int, int, int) ++ * @return This block's x, y, and z coordinates packed into a long value ++ * @deprecated see {@link #getBlockKey(int, int, int)} ++ */ ++ @Deprecated ++ public default long getBlockKey() { ++ return Block.getBlockKey(this.getX(), this.getY(), this.getZ()); ++ } ++ ++ /** ++ * Returns the specified block coordinates packed into a long value ++ *

++ * The return value can be computed as follows: ++ *
++ * {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);} ++ *

++ * ++ *

++ * And may be unpacked as follows: ++ *
++ * {@code int x = (int) ((packed << 37) >> 37);} ++ *
++ * {@code int y = (int) (packed >> 54);} ++ *
++ * {@code int z = (int) ((packed << 10) >> 37);} ++ *

++ * ++ * @return This block's x, y, and z coordinates packed into a long value ++ * @deprecated only encodes y block ranges from -512 to 511 and represents an already changed implementation detail ++ */ ++ @Deprecated ++ public static long getBlockKey(int x, int y, int z) { ++ return ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54); ++ } ++ ++ /** ++ * Returns the x component from the packed value. ++ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)} ++ * @see Block#getBlockKey(int, int, int) ++ * @return The x component from the packed value. ++ * @deprecated see {@link #getBlockKey(int, int, int)} ++ */ ++ @Deprecated ++ public static int getBlockKeyX(long packed) { ++ return (int) ((packed << 37) >> 37); ++ } ++ ++ /** ++ * Returns the y component from the packed value. ++ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)} ++ * @see Block#getBlockKey(int, int, int) ++ * @return The y component from the packed value. ++ * @deprecated see {@link #getBlockKey(int, int, int)} ++ */ ++ @Deprecated ++ public static int getBlockKeyY(long packed) { ++ return (int) (packed >> 54); ++ } ++ ++ /** ++ * Returns the z component from the packed value. ++ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)} ++ * @see Block#getBlockKey(int, int, int) ++ * @return The z component from the packed value. ++ * @deprecated see {@link #getBlockKey(int, int, int)} ++ */ ++ @Deprecated ++ public static int getBlockKeyZ(long packed) { ++ return (int) ((packed << 10) >> 37); ++ } ++ // Paper end ++ + /** + * Gets the Location of the block + * diff --git a/patches/api/0135-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch b/patches/api/0135-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch deleted file mode 100644 index 83897ac115..0000000000 --- a/patches/api/0135-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 15 Aug 2018 01:19:37 -0400 -Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports - - -diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java -index eb9d58f8852e732a1284beeaf542989301d21b1c..02e88db63be2d5e31da6b65157ba7b971b1f10f3 100644 ---- a/src/main/java/co/aikar/timings/TimingHistory.java -+++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -120,7 +120,7 @@ public class TimingHistory { - data.entityCounts.get(entity.getType()).increment(); - } - -- for (BlockState tileEntity : chunk.getTileEntities()) { -+ for (BlockState tileEntity : chunk.getTileEntities(false)) { - if (tileEntity == null) { - Bukkit.getLogger().warning("Null tileentity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ()); - continue; diff --git a/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch deleted file mode 100644 index c2205057df..0000000000 --- a/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Tue, 14 Aug 2018 21:42:10 -0700 -Subject: [PATCH] Allow Blocks to be accessed via a long key - -The key can be retrieved via methods Location#toBlockKey() and -Block#getBlockKey() - -World provides lookup for blocks by long key via method World#getBlockAtKey(long) - -The formatting for the key is as follows: - -10 bit y|27 bit z|27 bit x - -The y value is considered unsigned while z and x are considered two's complement - -Y range: [0, 1023] -X, Z range: [-67 108 864, 67 108 863] - -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 41125de49db8eafce4be59cc110ce5be06836a47..042d69e6d4584eb6d678b8ea13a3e4bea78703b8 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable; - - // Paper start - import java.util.Collection; --import java.util.Collections; - import java.util.function.Predicate; - import org.bukkit.entity.Entity; - import org.bukkit.entity.LivingEntity; -@@ -610,6 +609,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - blockLoc.setZ(getBlockZ()); - return blockLoc; - } -+ -+ // Paper start -+ /** -+ * @return The block key for this location's block location. -+ * @see Block#getBlockKey(int, int, int) -+ * @deprecated only encodes y block ranges from -512 to 511 and represents an already changed implementation detail -+ */ -+ @Deprecated -+ public long toBlockKey() { -+ return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ()); -+ } -+ // Paper end -+ - /** - * @return A new location where X/Y/Z are the center of the block - */ -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 273c50b6e4f26457415779000cf09aeaffd21733..575fd50b8456beed7c5049a392fca011271a8fe4 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -99,6 +99,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public Block getBlockAt(@NotNull Location location); - -+ // Paper start -+ /** -+ * Gets the {@link Block} at the given block key -+ * -+ * @param key The block key. See {@link Block#getBlockKey()} -+ * @return Block at the key -+ * @see Block#getBlockKey(int, int, int) -+ * @deprecated only encodes y block ranges from -512 to 511 and represents an already changed implementation detail -+ */ -+ @NotNull -+ @Deprecated -+ public default Block getBlockAtKey(long key) { -+ int x = Block.getBlockKeyX(key); -+ int y = Block.getBlockKeyY(key); -+ int z = Block.getBlockKeyZ(key); -+ return getBlockAt(x, y, z); -+ } -+ -+ /** -+ * Gets the {@link Location} at the given block key -+ * -+ * @param key The block key. See {@link Location#toBlockKey()} -+ * @return Location at the key -+ * @see Block#getBlockKey(int, int, int) -+ */ -+ @NotNull -+ @Deprecated -+ public default Location getLocationAtKey(long key) { -+ int x = Block.getBlockKeyX(key); -+ int y = Block.getBlockKeyY(key); -+ int z = Block.getBlockKeyZ(key); -+ return new Location(this, x, y, z); -+ } -+ // Paper end -+ - /** - * Gets the highest non-empty (impassable) block at the given coordinates. - * -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index f3b3606dc5881e931853fc2631aad9ca9083474d..a71001677e2b1b0b6225a7be63b8ea5ce4456862 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -156,6 +156,82 @@ public interface Block extends Metadatable, Translatable { - */ - int getZ(); - -+ // Paper start -+ /** -+ * Returns this block's coordinates packed into a long value. -+ * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())} -+ * @see Block#getBlockKey(int, int, int) -+ * @return This block's x, y, and z coordinates packed into a long value -+ * @deprecated see {@link #getBlockKey(int, int, int)} -+ */ -+ @Deprecated -+ public default long getBlockKey() { -+ return Block.getBlockKey(this.getX(), this.getY(), this.getZ()); -+ } -+ -+ /** -+ * Returns the specified block coordinates packed into a long value -+ *

-+ * The return value can be computed as follows: -+ *
-+ * {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);} -+ *

-+ * -+ *

-+ * And may be unpacked as follows: -+ *
-+ * {@code int x = (int) ((packed << 37) >> 37);} -+ *
-+ * {@code int y = (int) (packed >> 54);} -+ *
-+ * {@code int z = (int) ((packed << 10) >> 37);} -+ *

-+ * -+ * @return This block's x, y, and z coordinates packed into a long value -+ * @deprecated only encodes y block ranges from -512 to 511 and represents an already changed implementation detail -+ */ -+ @Deprecated -+ public static long getBlockKey(int x, int y, int z) { -+ return ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54); -+ } -+ -+ /** -+ * Returns the x component from the packed value. -+ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)} -+ * @see Block#getBlockKey(int, int, int) -+ * @return The x component from the packed value. -+ * @deprecated see {@link #getBlockKey(int, int, int)} -+ */ -+ @Deprecated -+ public static int getBlockKeyX(long packed) { -+ return (int) ((packed << 37) >> 37); -+ } -+ -+ /** -+ * Returns the y component from the packed value. -+ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)} -+ * @see Block#getBlockKey(int, int, int) -+ * @return The y component from the packed value. -+ * @deprecated see {@link #getBlockKey(int, int, int)} -+ */ -+ @Deprecated -+ public static int getBlockKeyY(long packed) { -+ return (int) (packed >> 54); -+ } -+ -+ /** -+ * Returns the z component from the packed value. -+ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)} -+ * @see Block#getBlockKey(int, int, int) -+ * @return The z component from the packed value. -+ * @deprecated see {@link #getBlockKey(int, int, int)} -+ */ -+ @Deprecated -+ public static int getBlockKeyZ(long packed) { -+ return (int) ((packed << 10) >> 37); -+ } -+ // Paper end -+ - /** - * Gets the Location of the block - * diff --git a/patches/api/0136-Slime-Pathfinder-Events.patch b/patches/api/0136-Slime-Pathfinder-Events.patch new file mode 100644 index 0000000000..a569c5bdda --- /dev/null +++ b/patches/api/0136-Slime-Pathfinder-Events.patch @@ -0,0 +1,228 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 24 Aug 2018 08:18:27 -0500 +Subject: [PATCH] Slime Pathfinder Events + + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..30864539574e23bbe9e4c5dc73ad6614de782ac2 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java +@@ -0,0 +1,40 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.Slime; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Slime decides to change its facing direction. ++ *

++ * This event does not fire for the entity's actual movement. Only when it ++ * is choosing to change direction. ++ */ ++public class SlimeChangeDirectionEvent extends SlimePathfindEvent { ++ ++ private float yaw; ++ ++ @ApiStatus.Internal ++ public SlimeChangeDirectionEvent(@NotNull Slime slime, float yaw) { ++ super(slime); ++ this.yaw = yaw; ++ } ++ ++ /** ++ * Get the new chosen yaw ++ * ++ * @return Chosen yaw ++ */ ++ public float getNewYaw() { ++ return this.yaw; ++ } ++ ++ /** ++ * Set the new chosen yaw ++ * ++ * @param yaw Chosen yaw ++ */ ++ public void setNewYaw(float yaw) { ++ this.yaw = yaw; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..706ed85a5415d688aaa5f138cbf583b9e2bab27d +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java +@@ -0,0 +1,56 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.Slime; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Slime decides to start pathfinding. ++ *

++ * This event does not fire for the entity's actual movement. Only when it ++ * is choosing to start moving. ++ */ ++public class SlimePathfindEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public SlimePathfindEvent(@NotNull Slime slime) { ++ super(slime); ++ } ++ ++ /** ++ * The Slime that is pathfinding. ++ * ++ * @return The Slime that is pathfinding. ++ */ ++ @NotNull ++ public Slime getEntity() { ++ return (Slime) super.getEntity(); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..65e8a29751e338b0f0acda7bef9e014852a73e6e +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java +@@ -0,0 +1,19 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.Slime; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Slime decides to start jumping while swimming in water/lava. ++ *

++ * This event does not fire for the entity's actual movement. Only when it ++ * is choosing to start jumping. ++ */ ++public class SlimeSwimEvent extends SlimeWanderEvent { ++ ++ @ApiStatus.Internal ++ public SlimeSwimEvent(@NotNull Slime slime) { ++ super(slime); ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..87c64b04dfec232e98361c3ec29da7664498c65b +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java +@@ -0,0 +1,33 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.entity.Slime; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Slime decides to change direction to target a LivingEntity. ++ *

++ * This event does not fire for the entity's actual movement. Only when it ++ * is choosing to start moving. ++ */ ++public class SlimeTargetLivingEntityEvent extends SlimePathfindEvent { ++ ++ @NotNull private final LivingEntity target; ++ ++ @ApiStatus.Internal ++ public SlimeTargetLivingEntityEvent(@NotNull Slime slime, @NotNull LivingEntity target) { ++ super(slime); ++ this.target = target; ++ } ++ ++ /** ++ * Get the targeted entity ++ * ++ * @return Targeted entity ++ */ ++ @NotNull ++ public LivingEntity getTarget() { ++ return this.target; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2ad9cc1673ffbb8b48349e461d1154d1d4ec2874 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java +@@ -0,0 +1,19 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.Slime; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Slime decides to start wandering. ++ *

++ * This event does not fire for the entity's actual movement. Only when it ++ * is choosing to start moving. ++ */ ++public class SlimeWanderEvent extends SlimePathfindEvent { ++ ++ @ApiStatus.Internal ++ public SlimeWanderEvent(@NotNull Slime slime) { ++ super(slime); ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Slime.java b/src/main/java/org/bukkit/entity/Slime.java +index bfac874840cf1f36afba16ae4d176c5821a68cfb..335b92e7be49ae13b2a1140183650642063a4219 100644 +--- a/src/main/java/org/bukkit/entity/Slime.java ++++ b/src/main/java/org/bukkit/entity/Slime.java +@@ -24,4 +24,20 @@ public interface Slime extends Mob, Enemy { + * @param sz The new size of the slime. + */ + public void setSize(int sz); ++ ++ // Paper start ++ /** ++ * Get whether this slime can randomly wander/jump around on its own ++ * ++ * @return true if can wander ++ */ ++ public boolean canWander(); ++ ++ /** ++ * Set whether this slime can randomly wander/jump around on its own ++ * ++ * @param canWander true if can wander ++ */ ++ public void setWander(boolean canWander); ++ // Paper end + } diff --git a/patches/api/0137-Add-PhantomPreSpawnEvent.patch b/patches/api/0137-Add-PhantomPreSpawnEvent.patch new file mode 100644 index 0000000000..943f1561db --- /dev/null +++ b/patches/api/0137-Add-PhantomPreSpawnEvent.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 25 Aug 2018 19:56:42 -0500 +Subject: [PATCH] Add PhantomPreSpawnEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ff7d9ff618ab821eeece6923a694a9a4eea8585d +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java +@@ -0,0 +1,32 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.EntityType; ++import org.bukkit.event.entity.CreatureSpawnEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a phantom is spawned for an exhausted player ++ */ ++public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent { ++ ++ @NotNull private final Entity entity; ++ ++ @ApiStatus.Internal ++ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) { ++ super(location, EntityType.PHANTOM, reason); ++ this.entity = entity; ++ } ++ ++ /** ++ * Get the entity this phantom is spawning for ++ * ++ * @return the Entity ++ */ ++ @NotNull ++ public Entity getSpawningEntity() { ++ return this.entity; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java +index 86cfdcf3060876c87066483d122e12f5feb55e02..082601f349ae2cebbffd1012c19c521241696a09 100644 +--- a/src/main/java/org/bukkit/entity/Phantom.java ++++ b/src/main/java/org/bukkit/entity/Phantom.java +@@ -1,5 +1,8 @@ + package org.bukkit.entity; + ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ + /** + * Represents a phantom. + */ +@@ -14,4 +17,14 @@ public interface Phantom extends Flying, Enemy { + * @param sz The new size of the phantom. + */ + public void setSize(int sz); ++ ++ // Paper start ++ /** ++ * Get the UUID of the entity that caused this phantom to spawn ++ * ++ * @return UUID ++ */ ++ @Nullable ++ public java.util.UUID getSpawningEntity(); ++ // Paper end + } diff --git a/patches/api/0137-Slime-Pathfinder-Events.patch b/patches/api/0137-Slime-Pathfinder-Events.patch deleted file mode 100644 index a569c5bdda..0000000000 --- a/patches/api/0137-Slime-Pathfinder-Events.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 24 Aug 2018 08:18:27 -0500 -Subject: [PATCH] Slime Pathfinder Events - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..30864539574e23bbe9e4c5dc73ad6614de782ac2 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java -@@ -0,0 +1,40 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Slime; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Slime decides to change its facing direction. -+ *

-+ * This event does not fire for the entity's actual movement. Only when it -+ * is choosing to change direction. -+ */ -+public class SlimeChangeDirectionEvent extends SlimePathfindEvent { -+ -+ private float yaw; -+ -+ @ApiStatus.Internal -+ public SlimeChangeDirectionEvent(@NotNull Slime slime, float yaw) { -+ super(slime); -+ this.yaw = yaw; -+ } -+ -+ /** -+ * Get the new chosen yaw -+ * -+ * @return Chosen yaw -+ */ -+ public float getNewYaw() { -+ return this.yaw; -+ } -+ -+ /** -+ * Set the new chosen yaw -+ * -+ * @param yaw Chosen yaw -+ */ -+ public void setNewYaw(float yaw) { -+ this.yaw = yaw; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..706ed85a5415d688aaa5f138cbf583b9e2bab27d ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java -@@ -0,0 +1,56 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Slime; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Slime decides to start pathfinding. -+ *

-+ * This event does not fire for the entity's actual movement. Only when it -+ * is choosing to start moving. -+ */ -+public class SlimePathfindEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public SlimePathfindEvent(@NotNull Slime slime) { -+ super(slime); -+ } -+ -+ /** -+ * The Slime that is pathfinding. -+ * -+ * @return The Slime that is pathfinding. -+ */ -+ @NotNull -+ public Slime getEntity() { -+ return (Slime) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..65e8a29751e338b0f0acda7bef9e014852a73e6e ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java -@@ -0,0 +1,19 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Slime; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Slime decides to start jumping while swimming in water/lava. -+ *

-+ * This event does not fire for the entity's actual movement. Only when it -+ * is choosing to start jumping. -+ */ -+public class SlimeSwimEvent extends SlimeWanderEvent { -+ -+ @ApiStatus.Internal -+ public SlimeSwimEvent(@NotNull Slime slime) { -+ super(slime); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..87c64b04dfec232e98361c3ec29da7664498c65b ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java -@@ -0,0 +1,33 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Slime; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Slime decides to change direction to target a LivingEntity. -+ *

-+ * This event does not fire for the entity's actual movement. Only when it -+ * is choosing to start moving. -+ */ -+public class SlimeTargetLivingEntityEvent extends SlimePathfindEvent { -+ -+ @NotNull private final LivingEntity target; -+ -+ @ApiStatus.Internal -+ public SlimeTargetLivingEntityEvent(@NotNull Slime slime, @NotNull LivingEntity target) { -+ super(slime); -+ this.target = target; -+ } -+ -+ /** -+ * Get the targeted entity -+ * -+ * @return Targeted entity -+ */ -+ @NotNull -+ public LivingEntity getTarget() { -+ return this.target; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2ad9cc1673ffbb8b48349e461d1154d1d4ec2874 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java -@@ -0,0 +1,19 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Slime; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Slime decides to start wandering. -+ *

-+ * This event does not fire for the entity's actual movement. Only when it -+ * is choosing to start moving. -+ */ -+public class SlimeWanderEvent extends SlimePathfindEvent { -+ -+ @ApiStatus.Internal -+ public SlimeWanderEvent(@NotNull Slime slime) { -+ super(slime); -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Slime.java b/src/main/java/org/bukkit/entity/Slime.java -index bfac874840cf1f36afba16ae4d176c5821a68cfb..335b92e7be49ae13b2a1140183650642063a4219 100644 ---- a/src/main/java/org/bukkit/entity/Slime.java -+++ b/src/main/java/org/bukkit/entity/Slime.java -@@ -24,4 +24,20 @@ public interface Slime extends Mob, Enemy { - * @param sz The new size of the slime. - */ - public void setSize(int sz); -+ -+ // Paper start -+ /** -+ * Get whether this slime can randomly wander/jump around on its own -+ * -+ * @return true if can wander -+ */ -+ public boolean canWander(); -+ -+ /** -+ * Set whether this slime can randomly wander/jump around on its own -+ * -+ * @param canWander true if can wander -+ */ -+ public void setWander(boolean canWander); -+ // Paper end - } diff --git a/patches/api/0138-Add-More-Creeper-API.patch b/patches/api/0138-Add-More-Creeper-API.patch new file mode 100644 index 0000000000..2ea104b552 --- /dev/null +++ b/patches/api/0138-Add-More-Creeper-API.patch @@ -0,0 +1,97 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 24 Aug 2018 11:50:16 -0500 +Subject: [PATCH] Add More Creeper API + + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e86500337f26fcb6bb04545c68c67df32021ce25 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java +@@ -0,0 +1,60 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.Creeper; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a Creeper is ignited either by a ++ * flint and steel, {@link Creeper#ignite()} or ++ * {@link Creeper#setIgnited(boolean)}. ++ */ ++public class CreeperIgniteEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean ignited; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) { ++ super(creeper); ++ this.ignited = ignited; ++ } ++ ++ @NotNull ++ @Override ++ public Creeper getEntity() { ++ return (Creeper) super.getEntity(); ++ } ++ ++ public boolean isIgnited() { ++ return this.ignited; ++ } ++ ++ public void setIgnited(boolean ignited) { ++ this.ignited = ignited; ++ } ++ ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java +index 5793193d93d76a062fd0431475c269c4978ec993..e144f618702122bf28ebedc5cb8ce0f6ef27c107 100644 +--- a/src/main/java/org/bukkit/entity/Creeper.java ++++ b/src/main/java/org/bukkit/entity/Creeper.java +@@ -87,4 +87,20 @@ public interface Creeper extends Monster { + * griefing gamerule. + */ + public void ignite(); ++ // Paper start ++ ++ /** ++ * Set whether creeper is ignited or not (armed to explode) ++ * ++ * @param ignited New ignited state ++ */ ++ public void setIgnited(boolean ignited); ++ ++ /** ++ * Check if creeper is ignited or not (armed to explode) ++ * ++ * @return Ignited state ++ */ ++ public boolean isIgnited(); ++ // Paper end + } diff --git a/patches/api/0138-Add-PhantomPreSpawnEvent.patch b/patches/api/0138-Add-PhantomPreSpawnEvent.patch deleted file mode 100644 index 943f1561db..0000000000 --- a/patches/api/0138-Add-PhantomPreSpawnEvent.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sat, 25 Aug 2018 19:56:42 -0500 -Subject: [PATCH] Add PhantomPreSpawnEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ff7d9ff618ab821eeece6923a694a9a4eea8585d ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java -@@ -0,0 +1,32 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.EntityType; -+import org.bukkit.event.entity.CreatureSpawnEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a phantom is spawned for an exhausted player -+ */ -+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent { -+ -+ @NotNull private final Entity entity; -+ -+ @ApiStatus.Internal -+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) { -+ super(location, EntityType.PHANTOM, reason); -+ this.entity = entity; -+ } -+ -+ /** -+ * Get the entity this phantom is spawning for -+ * -+ * @return the Entity -+ */ -+ @NotNull -+ public Entity getSpawningEntity() { -+ return this.entity; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java -index 86cfdcf3060876c87066483d122e12f5feb55e02..082601f349ae2cebbffd1012c19c521241696a09 100644 ---- a/src/main/java/org/bukkit/entity/Phantom.java -+++ b/src/main/java/org/bukkit/entity/Phantom.java -@@ -1,5 +1,8 @@ - package org.bukkit.entity; - -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ - /** - * Represents a phantom. - */ -@@ -14,4 +17,14 @@ public interface Phantom extends Flying, Enemy { - * @param sz The new size of the phantom. - */ - public void setSize(int sz); -+ -+ // Paper start -+ /** -+ * Get the UUID of the entity that caused this phantom to spawn -+ * -+ * @return UUID -+ */ -+ @Nullable -+ public java.util.UUID getSpawningEntity(); -+ // Paper end - } diff --git a/patches/api/0139-Add-More-Creeper-API.patch b/patches/api/0139-Add-More-Creeper-API.patch deleted file mode 100644 index 2ea104b552..0000000000 --- a/patches/api/0139-Add-More-Creeper-API.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 24 Aug 2018 11:50:16 -0500 -Subject: [PATCH] Add More Creeper API - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e86500337f26fcb6bb04545c68c67df32021ce25 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java -@@ -0,0 +1,60 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Creeper; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a Creeper is ignited either by a -+ * flint and steel, {@link Creeper#ignite()} or -+ * {@link Creeper#setIgnited(boolean)}. -+ */ -+public class CreeperIgniteEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean ignited; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) { -+ super(creeper); -+ this.ignited = ignited; -+ } -+ -+ @NotNull -+ @Override -+ public Creeper getEntity() { -+ return (Creeper) super.getEntity(); -+ } -+ -+ public boolean isIgnited() { -+ return this.ignited; -+ } -+ -+ public void setIgnited(boolean ignited) { -+ this.ignited = ignited; -+ } -+ -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java -index 5793193d93d76a062fd0431475c269c4978ec993..e144f618702122bf28ebedc5cb8ce0f6ef27c107 100644 ---- a/src/main/java/org/bukkit/entity/Creeper.java -+++ b/src/main/java/org/bukkit/entity/Creeper.java -@@ -87,4 +87,20 @@ public interface Creeper extends Monster { - * griefing gamerule. - */ - public void ignite(); -+ // Paper start -+ -+ /** -+ * Set whether creeper is ignited or not (armed to explode) -+ * -+ * @param ignited New ignited state -+ */ -+ public void setIgnited(boolean ignited); -+ -+ /** -+ * Check if creeper is ignited or not (armed to explode) -+ * -+ * @return Ignited state -+ */ -+ public boolean isIgnited(); -+ // Paper end - } diff --git a/patches/api/0139-Inventory-removeItemAnySlot.patch b/patches/api/0139-Inventory-removeItemAnySlot.patch new file mode 100644 index 0000000000..25b79cf6bd --- /dev/null +++ b/patches/api/0139-Inventory-removeItemAnySlot.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 28 Aug 2018 23:04:06 -0400 +Subject: [PATCH] Inventory#removeItemAnySlot + + +diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java +index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c383cff8707 100644 +--- a/src/main/java/org/bukkit/inventory/Inventory.java ++++ b/src/main/java/org/bukkit/inventory/Inventory.java +@@ -104,7 +104,9 @@ public interface Inventory extends Iterable { + public HashMap addItem(@NotNull ItemStack... items) throws IllegalArgumentException; + + /** +- * Removes the given ItemStacks from the inventory. ++ * Removes the given ItemStacks from the storage contents of the inventory. ++ * For removing ItemStacks from the inventories that have other content groups, ++ * like Player inventories, see {@link #removeItemAnySlot(ItemStack...)}. + *

+ * It will try to remove 'as much as possible' from the types and amounts + * you give as arguments. +@@ -121,10 +123,39 @@ public interface Inventory extends Iterable { + * @param items The ItemStacks to remove + * @return A HashMap containing items that couldn't be removed. + * @throws IllegalArgumentException if items is null ++ * @see #removeItemAnySlot(ItemStack...) + */ + @NotNull + public HashMap removeItem(@NotNull ItemStack... items) throws IllegalArgumentException; + ++ // Paper start ++ /** ++ * Searches all possible inventory slots in order to remove the given ItemStacks. ++ *

++ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this ++ * method will check all possible slots in the inventory, rather than just the main ++ * storage contents. ++ *

++ * It will try to remove 'as much as possible' from the types and amounts ++ * you give as arguments. ++ *

++ * The returned HashMap contains what it couldn't remove, where the key is ++ * the index of the parameter, and the value is the ItemStack at that ++ * index of the varargs parameter. If all the given ItemStacks are ++ * removed, it will return an empty HashMap. ++ *

++ * It is known that in some implementations this method will also set the ++ * inputted argument amount to the number of that item not removed from ++ * slots. ++ * ++ * @param items The ItemStacks to remove ++ * @return A HashMap containing items that couldn't be removed. ++ * @throws IllegalArgumentException if items is null ++ */ ++ @NotNull ++ public HashMap removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException; ++ // Paper end ++ + /** + * Returns all ItemStacks from the inventory + * diff --git a/patches/api/0140-Inventory-removeItemAnySlot.patch b/patches/api/0140-Inventory-removeItemAnySlot.patch deleted file mode 100644 index 25b79cf6bd..0000000000 --- a/patches/api/0140-Inventory-removeItemAnySlot.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 28 Aug 2018 23:04:06 -0400 -Subject: [PATCH] Inventory#removeItemAnySlot - - -diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java -index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c383cff8707 100644 ---- a/src/main/java/org/bukkit/inventory/Inventory.java -+++ b/src/main/java/org/bukkit/inventory/Inventory.java -@@ -104,7 +104,9 @@ public interface Inventory extends Iterable { - public HashMap addItem(@NotNull ItemStack... items) throws IllegalArgumentException; - - /** -- * Removes the given ItemStacks from the inventory. -+ * Removes the given ItemStacks from the storage contents of the inventory. -+ * For removing ItemStacks from the inventories that have other content groups, -+ * like Player inventories, see {@link #removeItemAnySlot(ItemStack...)}. - *

- * It will try to remove 'as much as possible' from the types and amounts - * you give as arguments. -@@ -121,10 +123,39 @@ public interface Inventory extends Iterable { - * @param items The ItemStacks to remove - * @return A HashMap containing items that couldn't be removed. - * @throws IllegalArgumentException if items is null -+ * @see #removeItemAnySlot(ItemStack...) - */ - @NotNull - public HashMap removeItem(@NotNull ItemStack... items) throws IllegalArgumentException; - -+ // Paper start -+ /** -+ * Searches all possible inventory slots in order to remove the given ItemStacks. -+ *

-+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this -+ * method will check all possible slots in the inventory, rather than just the main -+ * storage contents. -+ *

-+ * It will try to remove 'as much as possible' from the types and amounts -+ * you give as arguments. -+ *

-+ * The returned HashMap contains what it couldn't remove, where the key is -+ * the index of the parameter, and the value is the ItemStack at that -+ * index of the varargs parameter. If all the given ItemStacks are -+ * removed, it will return an empty HashMap. -+ *

-+ * It is known that in some implementations this method will also set the -+ * inputted argument amount to the number of that item not removed from -+ * slots. -+ * -+ * @param items The ItemStacks to remove -+ * @return A HashMap containing items that couldn't be removed. -+ * @throws IllegalArgumentException if items is null -+ */ -+ @NotNull -+ public HashMap removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException; -+ // Paper end -+ - /** - * Returns all ItemStacks from the inventory - * diff --git a/patches/api/0140-isChunkGenerated-API.patch b/patches/api/0140-isChunkGenerated-API.patch new file mode 100644 index 0000000000..aba6214696 --- /dev/null +++ b/patches/api/0140-isChunkGenerated-API.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: cswhite2000 <18whitechristop@gmail.com> +Date: Tue, 21 Aug 2018 19:39:46 -0700 +Subject: [PATCH] isChunkGenerated API + + +diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java +index 042d69e6d4584eb6d678b8ea13a3e4bea78703b8..02b4ffa6b918269bd64f7c518fcceef1f6990737 100644 +--- a/src/main/java/org/bukkit/Location.java ++++ b/src/main/java/org/bukkit/Location.java +@@ -3,6 +3,7 @@ package org.bukkit; + import com.google.common.base.Preconditions; + import java.lang.ref.Reference; + import java.lang.ref.WeakReference; ++import com.google.common.base.Preconditions; // Paper + import java.util.HashMap; + import java.util.Map; + import org.bukkit.block.Block; +@@ -544,6 +545,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm + + public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper + ++ // Paper start - isGenerated API ++ /** ++ * Checks if a {@link Chunk} has been generated at this location. ++ * ++ * @return true if a chunk has been generated at this location ++ */ ++ public boolean isGenerated() { ++ World world = this.getWorld(); ++ Preconditions.checkNotNull(world, "Location has no world!"); ++ return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4); ++ } ++ // Paper end - isGenerated API ++ + // Paper start - expand location manipulation API + + /** +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 575fd50b8456beed7c5049a392fca011271a8fe4..b3098ce9134acf24f49d23fc1babe79c6bf502f1 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -248,6 +248,19 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + } + // Paper end - chunk long key API + ++ // Paper start - isChunkGenerated API ++ /** ++ * Checks if a {@link Chunk} has been generated at the specified chunk key, ++ * which is the X and Z packed into a long. ++ * ++ * @param chunkKey The Chunk Key to look up the chunk by ++ * @return true if the chunk has been generated, otherwise false ++ */ ++ default boolean isChunkGenerated(long chunkKey) { ++ return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32)); ++ } ++ // Paper end - isChunkGenerated API ++ + /** + * Checks if the specified {@link Chunk} is loaded + * diff --git a/patches/api/0141-Add-source-block-constructor-and-getChangedBlockData.patch b/patches/api/0141-Add-source-block-constructor-and-getChangedBlockData.patch new file mode 100644 index 0000000000..f12e6ac1f5 --- /dev/null +++ b/patches/api/0141-Add-source-block-constructor-and-getChangedBlockData.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sotr +Date: Thu, 23 Aug 2018 16:14:25 +0800 +Subject: [PATCH] Add source block constructor and getChangedBlockData() to + BlockPhysicsEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java +index e3a5f5824ed882058f5bac5003f66ce79733a868..b23686d2e452dc0b8bde453b4a375f424cb7504a 100644 +--- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java +@@ -32,6 +32,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { + private final Block sourceBlock; + private boolean cancel = false; + ++ // Paper start - Legacy constructor, use #BlockPhysicsEvent(Block, BlockData, Block) ++ @Deprecated ++ public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) { ++ this(block, changed, block.getWorld().getBlockAt(sourceX, sourceY, sourceZ)); ++ } ++ // Paper end ++ + public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) { + this(block, changed, block); + } +@@ -55,7 +62,8 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { + } + + /** +- * Gets the type of block that changed, causing this event ++ * Gets the type of block that changed, causing this event. ++ * This is the type of {@link #getBlock()} at the time of the event. + * + * @return Changed block's type + */ +@@ -64,6 +72,19 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { + return changed.getMaterial(); + } + ++ // Paper start - Getter for the BlockData ++ /** ++ * Gets the BlockData of the block that changed, causing this event. ++ * This is the BlockData of {@link #getBlock()} at the time of the event. ++ * ++ * @return Changed block's BlockData ++ */ ++ @NotNull ++ public BlockData getChangedBlockData() { ++ return changed.clone(); ++ } ++ // Paper end ++ + @Override + public boolean isCancelled() { + return cancel; diff --git a/patches/api/0141-isChunkGenerated-API.patch b/patches/api/0141-isChunkGenerated-API.patch deleted file mode 100644 index aba6214696..0000000000 --- a/patches/api/0141-isChunkGenerated-API.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: cswhite2000 <18whitechristop@gmail.com> -Date: Tue, 21 Aug 2018 19:39:46 -0700 -Subject: [PATCH] isChunkGenerated API - - -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 042d69e6d4584eb6d678b8ea13a3e4bea78703b8..02b4ffa6b918269bd64f7c518fcceef1f6990737 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -3,6 +3,7 @@ package org.bukkit; - import com.google.common.base.Preconditions; - import java.lang.ref.Reference; - import java.lang.ref.WeakReference; -+import com.google.common.base.Preconditions; // Paper - import java.util.HashMap; - import java.util.Map; - import org.bukkit.block.Block; -@@ -544,6 +545,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - - public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper - -+ // Paper start - isGenerated API -+ /** -+ * Checks if a {@link Chunk} has been generated at this location. -+ * -+ * @return true if a chunk has been generated at this location -+ */ -+ public boolean isGenerated() { -+ World world = this.getWorld(); -+ Preconditions.checkNotNull(world, "Location has no world!"); -+ return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4); -+ } -+ // Paper end - isGenerated API -+ - // Paper start - expand location manipulation API - - /** -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 575fd50b8456beed7c5049a392fca011271a8fe4..b3098ce9134acf24f49d23fc1babe79c6bf502f1 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -248,6 +248,19 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - } - // Paper end - chunk long key API - -+ // Paper start - isChunkGenerated API -+ /** -+ * Checks if a {@link Chunk} has been generated at the specified chunk key, -+ * which is the X and Z packed into a long. -+ * -+ * @param chunkKey The Chunk Key to look up the chunk by -+ * @return true if the chunk has been generated, otherwise false -+ */ -+ default boolean isChunkGenerated(long chunkKey) { -+ return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32)); -+ } -+ // Paper end - isChunkGenerated API -+ - /** - * Checks if the specified {@link Chunk} is loaded - * diff --git a/patches/api/0142-Add-source-block-constructor-and-getChangedBlockData.patch b/patches/api/0142-Add-source-block-constructor-and-getChangedBlockData.patch deleted file mode 100644 index f12e6ac1f5..0000000000 --- a/patches/api/0142-Add-source-block-constructor-and-getChangedBlockData.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Sotr -Date: Thu, 23 Aug 2018 16:14:25 +0800 -Subject: [PATCH] Add source block constructor and getChangedBlockData() to - BlockPhysicsEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java -index e3a5f5824ed882058f5bac5003f66ce79733a868..b23686d2e452dc0b8bde453b4a375f424cb7504a 100644 ---- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java -@@ -32,6 +32,13 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { - private final Block sourceBlock; - private boolean cancel = false; - -+ // Paper start - Legacy constructor, use #BlockPhysicsEvent(Block, BlockData, Block) -+ @Deprecated -+ public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) { -+ this(block, changed, block.getWorld().getBlockAt(sourceX, sourceY, sourceZ)); -+ } -+ // Paper end -+ - public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) { - this(block, changed, block); - } -@@ -55,7 +62,8 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { - } - - /** -- * Gets the type of block that changed, causing this event -+ * Gets the type of block that changed, causing this event. -+ * This is the type of {@link #getBlock()} at the time of the event. - * - * @return Changed block's type - */ -@@ -64,6 +72,19 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable { - return changed.getMaterial(); - } - -+ // Paper start - Getter for the BlockData -+ /** -+ * Gets the BlockData of the block that changed, causing this event. -+ * This is the BlockData of {@link #getBlock()} at the time of the event. -+ * -+ * @return Changed block's BlockData -+ */ -+ @NotNull -+ public BlockData getChangedBlockData() { -+ return changed.clone(); -+ } -+ // Paper end -+ - @Override - public boolean isCancelled() { - return cancel; diff --git a/patches/api/0142-Async-Chunks-API.patch b/patches/api/0142-Async-Chunks-API.patch new file mode 100644 index 0000000000..68867e8a37 --- /dev/null +++ b/patches/api/0142-Async-Chunks-API.patch @@ -0,0 +1,530 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 29 Feb 2016 17:43:33 -0600 +Subject: [PATCH] Async Chunks API + +Adds API's to load or generate chunks asynchronously. + +Also adds utility methods to Entity to teleport asynchronously. + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index b3098ce9134acf24f49d23fc1babe79c6bf502f1..5efe33cef4d9c153d760fc71606721ff8abafbfc 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -950,6 +950,472 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + } + // Paper end - additional getNearbyEntities API + ++ // Paper start - async chunks API ++ /** ++ * This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided, ++ * as well as future support ++ * ++ * Used by {@link World#getChunkAtAsync(Location,ChunkLoadCallback)} methods ++ * to request a {@link Chunk} to be loaded, with this callback receiving ++ * the chunk when it is finished. ++ * ++ * This callback will be executed on synchronously on the main thread. ++ * ++ * Timing and order this callback is fired is intentionally not defined and ++ * and subject to change. ++ * ++ * @deprecated Use either the Future or the Consumer based methods ++ */ ++ @Deprecated ++ public static interface ChunkLoadCallback extends java.util.function.Consumer { ++ public void onLoad(@NotNull Chunk chunk); ++ ++ // backwards compat to old api ++ @Override ++ default void accept(@NotNull Chunk chunk) { ++ onLoad(chunk); ++ } ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link ChunkLoadCallback} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @deprecated Use either the Future or the Consumer based methods ++ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) ++ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ @Deprecated ++ public default void getChunkAtAsync(int x, int z, @NotNull ChunkLoadCallback cb) { ++ getChunkAtAsync(x, z, true).thenAccept(cb::onLoad).exceptionally((ex) -> { ++ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); ++ return null; ++ }); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given {@link Location} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link ChunkLoadCallback} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @deprecated Use either the Future or the Consumer based methods ++ * @param loc Location of the chunk ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ @Deprecated ++ public default void getChunkAtAsync(@NotNull Location loc, @NotNull ChunkLoadCallback cb) { ++ getChunkAtAsync(loc, true).thenAccept(cb::onLoad).exceptionally((ex) -> { ++ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); ++ return null; ++ }); ++ } ++ ++ /** ++ * Requests {@link Chunk} to be loaded that contains the given {@link Block} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link ChunkLoadCallback} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @deprecated Use either the Future or the Consumer based methods ++ * @param block Block to get the containing chunk from ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ @Deprecated ++ public default void getChunkAtAsync(@NotNull Block block, @NotNull ChunkLoadCallback cb) { ++ getChunkAtAsync(block, true).thenAccept(cb::onLoad).exceptionally((ex) -> { ++ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); ++ return null; ++ }); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link java.util.function.Consumer} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) ++ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ default void getChunkAtAsync(final int x, final int z, final @NotNull Consumer cb) { ++ this.getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> { ++ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); ++ return null; ++ }); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link java.util.function.Consumer} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) ++ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) ++ * @param gen Should we generate a chunk if it doesn't exist or not ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ default void getChunkAtAsync(final int x, final int z, final boolean gen, final @NotNull Consumer cb) { ++ this.getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> { ++ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); ++ return null; ++ }); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given {@link Location} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link java.util.function.Consumer} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param loc Location of the chunk ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ default void getChunkAtAsync(final @NotNull Location loc, final @NotNull Consumer cb) { ++ this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true, cb); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given {@link Location} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link java.util.function.Consumer} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param loc Location of the chunk ++ * @param gen Should the chunk generate if it doesn't exist ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ default void getChunkAtAsync(final @NotNull Location loc, final boolean gen, final @NotNull Consumer cb) { ++ this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen, cb); ++ } ++ ++ /** ++ * Requests {@link Chunk} to be loaded that contains the given {@link Block} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link java.util.function.Consumer} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param block Block to get the containing chunk from ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ default void getChunkAtAsync(final @NotNull Block block, final @NotNull Consumer cb) { ++ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, cb); ++ } ++ ++ /** ++ * Requests {@link Chunk} to be loaded that contains the given {@link Block} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link java.util.function.Consumer} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param block Block to get the containing chunk from ++ * @param gen Should the chunk generate if it doesn't exist ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ default void getChunkAtAsync(final @NotNull Block block, final boolean gen, final @NotNull Consumer cb) { ++ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, cb); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param loc Location to load the corresponding chunk from ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Location loc) { ++ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param loc Location to load the corresponding chunk from ++ * @param gen Should the chunk generate if it doesn't exist ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Location loc, final boolean gen) { ++ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param block Block to load the corresponding chunk from ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Block block) { ++ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param block Block to load the corresponding chunk from ++ * @param gen Should the chunk generate if it doesn't exist ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Block block, final boolean gen) { ++ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) ++ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final int x, final int z) { ++ return this.getChunkAtAsync(x, z, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) ++ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) ++ * @param gen Should we generate a chunk if it doesn't exist or not ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final int x, final int z, final boolean gen) { ++ return this.getChunkAtAsync(x, z, gen, false); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param loc Location to load the corresponding chunk from ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Location loc) { ++ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param loc Location to load the corresponding chunk from ++ * @param gen Should the chunk generate if it doesn't exist ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Location loc, final boolean gen) { ++ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param block Block to load the corresponding chunk from ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Block block) { ++ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * @param block Block to load the corresponding chunk from ++ * @param gen Should the chunk generate if it doesn't exist ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Block block, final boolean gen) { ++ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, true); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The future will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param x X Coord ++ * @param z Z Coord ++ * @return Future that will resolve when the chunk is loaded ++ */ ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final int x, final int z) { ++ return this.getChunkAtAsync(x, z, true, true); ++ } ++ ++ java.util.concurrent.@NotNull CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent); ++ // Paper end - async chunks API ++ + /** + * Get a list of all players in this World + * +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 1e43deadce5a1a0e97521b1f69fee3106f5a0b9e..f1fc42ad24648ee481b9a5d4c4cc58ae8c0a93c1 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -168,6 +168,39 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + public boolean teleport(@NotNull Entity destination, @NotNull TeleportCause cause); + ++ // Paper start ++ /** ++ * Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready. ++ * @param loc Location to teleport to ++ * @return A future that will be completed with the result of the teleport ++ */ ++ default java.util.concurrent.@NotNull CompletableFuture teleportAsync(final @NotNull Location loc) { ++ return this.teleportAsync(loc, TeleportCause.PLUGIN); ++ } ++ ++ /** ++ * Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready. ++ * @param loc Location to teleport to ++ * @param cause Reason for teleport ++ * @return A future that will be completed with the result of the teleport ++ */ ++ default java.util.concurrent.@NotNull CompletableFuture teleportAsync(final @NotNull Location loc, final @NotNull TeleportCause cause) { ++ final class Holder { ++ static final io.papermc.paper.entity.TeleportFlag[] EMPTY_FLAGS = new io.papermc.paper.entity.TeleportFlag[0]; ++ } ++ return this.teleportAsync(loc, cause, Holder.EMPTY_FLAGS); ++ } ++ ++ /** ++ * Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready. ++ * @param loc Location to teleport to ++ * @param cause Reason for teleport ++ * @param teleportFlags Flags to be used in this teleportation ++ * @return A future that will be completed with the result of the teleport ++ */ ++ java.util.concurrent.@NotNull CompletableFuture teleportAsync(@NotNull Location loc, @NotNull TeleportCause cause, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags); ++ // Paper end ++ + /** + * Returns a list of entities within a bounding box centered around this + * entity diff --git a/patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch new file mode 100644 index 0000000000..5a9655eafe --- /dev/null +++ b/patches/api/0143-Add-ray-tracing-methods-to-LivingEntity.patch @@ -0,0 +1,182 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Mon, 3 Sep 2018 18:13:53 -0500 +Subject: [PATCH] Add ray tracing methods to LivingEntity + + +diff --git a/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c896d172519a8552a132031cb956378db272878f +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java +@@ -0,0 +1,67 @@ ++package com.destroystokyo.paper.block; ++ ++import org.bukkit.FluidCollisionMode; ++import org.bukkit.block.Block; ++import org.bukkit.block.BlockFace; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents information about a targeted block ++ * @deprecated use {@link org.bukkit.util.RayTraceResult} ++ */ ++@Deprecated(forRemoval = true) ++public class TargetBlockInfo { ++ private final Block block; ++ private final BlockFace blockFace; ++ ++ public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) { ++ this.block = block; ++ this.blockFace = blockFace; ++ } ++ ++ /** ++ * Get the block that is targeted ++ * ++ * @return Targeted block ++ */ ++ @NotNull ++ public Block getBlock() { ++ return block; ++ } ++ ++ /** ++ * Get the targeted BlockFace ++ * ++ * @return Targeted blockface ++ */ ++ @NotNull ++ public BlockFace getBlockFace() { ++ return blockFace; ++ } ++ ++ /** ++ * Get the relative Block to the targeted block on the side it is targeted at ++ * ++ * @return Block relative to targeted block ++ */ ++ @NotNull ++ public Block getRelativeBlock() { ++ return block.getRelative(blockFace); ++ } ++ ++ /** ++ * @deprecated use {@link org.bukkit.FluidCollisionMode} ++ */ ++ @Deprecated(forRemoval = true) ++ public enum FluidMode { ++ NEVER(FluidCollisionMode.NEVER), ++ SOURCE_ONLY(FluidCollisionMode.SOURCE_ONLY), ++ ALWAYS(FluidCollisionMode.ALWAYS); ++ ++ public final FluidCollisionMode bukkit; ++ ++ FluidMode(FluidCollisionMode bukkit) { ++ this.bukkit = bukkit; ++ } ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 0ed64618b3f62ee984fe4f99dc6a52d5fad7b3cc..b41152d81c1ec89a65eaee2a606f4f1b0d421bc7 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -85,6 +85,98 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + @NotNull + public Block getTargetBlock(@Nullable Set transparent, int maxDistance); + ++ // Paper start ++ /** ++ * Gets the block that the living entity has targeted, ignoring fluids ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @return block that the living entity has targeted, ++ * or null if no block is within maxDistance ++ * @deprecated use {@link #getTargetBlockExact(int)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public default Block getTargetBlock(int maxDistance) { ++ return getTargetBlock(maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode.NEVER); ++ } ++ ++ /** ++ * Gets the block that the living entity has targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param fluidMode whether to check fluids or not ++ * @return block that the living entity has targeted, ++ * or null if no block is within maxDistance ++ * @deprecated use {@link #getTargetBlockExact(int, FluidCollisionMode)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public Block getTargetBlock(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); ++ ++ /** ++ * Gets the blockface of that block that the living entity has targeted, ignoring fluids ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @return blockface of the block that the living entity has targeted, ++ * or null if no block is targeted ++ */ ++ @Nullable ++ public default org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance) { ++ return getTargetBlockFace(maxDistance, org.bukkit.FluidCollisionMode.NEVER); ++ } ++ ++ /** ++ * Gets the blockface of that block that the living entity has targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param fluidMode whether to check fluids or not ++ * @return blockface of the block that the living entity has targeted, ++ * or null if no block is targeted ++ * @deprecated use {@link #getTargetBlockFace(int, FluidCollisionMode)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); ++ ++ /** ++ * Gets the blockface of that block that the living entity has targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param fluidMode whether to check fluids or not ++ * @return blockface of the block that the living entity has targeted, ++ * or null if no block is targeted ++ */ ++ @Nullable ++ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull FluidCollisionMode fluidMode); ++ ++ /** ++ * Gets information about the block the living entity has targeted, ignoring fluids ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @return TargetBlockInfo about the block the living entity has targeted, ++ * or null if no block is targeted ++ * @deprecated use {@link #rayTraceBlocks(double)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public default com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance) { ++ return getTargetBlockInfo(maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode.NEVER); ++ } ++ ++ /** ++ * Gets information about the block the living entity has targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param fluidMode whether to check fluids or not ++ * @return TargetBlockInfo about the block the living entity has targeted, ++ * or null if no block is targeted ++ * @deprecated use {@link #rayTraceBlocks(double, FluidCollisionMode)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); ++ // Paper end ++ + /** + * Gets the last two blocks along the living entity's line of sight. + *

diff --git a/patches/api/0143-Async-Chunks-API.patch b/patches/api/0143-Async-Chunks-API.patch deleted file mode 100644 index 68867e8a37..0000000000 --- a/patches/api/0143-Async-Chunks-API.patch +++ /dev/null @@ -1,530 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 29 Feb 2016 17:43:33 -0600 -Subject: [PATCH] Async Chunks API - -Adds API's to load or generate chunks asynchronously. - -Also adds utility methods to Entity to teleport asynchronously. - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index b3098ce9134acf24f49d23fc1babe79c6bf502f1..5efe33cef4d9c153d760fc71606721ff8abafbfc 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -950,6 +950,472 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - } - // Paper end - additional getNearbyEntities API - -+ // Paper start - async chunks API -+ /** -+ * This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided, -+ * as well as future support -+ * -+ * Used by {@link World#getChunkAtAsync(Location,ChunkLoadCallback)} methods -+ * to request a {@link Chunk} to be loaded, with this callback receiving -+ * the chunk when it is finished. -+ * -+ * This callback will be executed on synchronously on the main thread. -+ * -+ * Timing and order this callback is fired is intentionally not defined and -+ * and subject to change. -+ * -+ * @deprecated Use either the Future or the Consumer based methods -+ */ -+ @Deprecated -+ public static interface ChunkLoadCallback extends java.util.function.Consumer { -+ public void onLoad(@NotNull Chunk chunk); -+ -+ // backwards compat to old api -+ @Override -+ default void accept(@NotNull Chunk chunk) { -+ onLoad(chunk); -+ } -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link ChunkLoadCallback} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @deprecated Use either the Future or the Consumer based methods -+ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) -+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ @Deprecated -+ public default void getChunkAtAsync(int x, int z, @NotNull ChunkLoadCallback cb) { -+ getChunkAtAsync(x, z, true).thenAccept(cb::onLoad).exceptionally((ex) -> { -+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); -+ return null; -+ }); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given {@link Location} -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link ChunkLoadCallback} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @deprecated Use either the Future or the Consumer based methods -+ * @param loc Location of the chunk -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ @Deprecated -+ public default void getChunkAtAsync(@NotNull Location loc, @NotNull ChunkLoadCallback cb) { -+ getChunkAtAsync(loc, true).thenAccept(cb::onLoad).exceptionally((ex) -> { -+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); -+ return null; -+ }); -+ } -+ -+ /** -+ * Requests {@link Chunk} to be loaded that contains the given {@link Block} -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link ChunkLoadCallback} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @deprecated Use either the Future or the Consumer based methods -+ * @param block Block to get the containing chunk from -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ @Deprecated -+ public default void getChunkAtAsync(@NotNull Block block, @NotNull ChunkLoadCallback cb) { -+ getChunkAtAsync(block, true).thenAccept(cb::onLoad).exceptionally((ex) -> { -+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); -+ return null; -+ }); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link java.util.function.Consumer} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) -+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ default void getChunkAtAsync(final int x, final int z, final @NotNull Consumer cb) { -+ this.getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> { -+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); -+ return null; -+ }); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link java.util.function.Consumer} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) -+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) -+ * @param gen Should we generate a chunk if it doesn't exist or not -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ default void getChunkAtAsync(final int x, final int z, final boolean gen, final @NotNull Consumer cb) { -+ this.getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> { -+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); -+ return null; -+ }); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given {@link Location} -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link java.util.function.Consumer} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param loc Location of the chunk -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ default void getChunkAtAsync(final @NotNull Location loc, final @NotNull Consumer cb) { -+ this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true, cb); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given {@link Location} -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link java.util.function.Consumer} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param loc Location of the chunk -+ * @param gen Should the chunk generate if it doesn't exist -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ default void getChunkAtAsync(final @NotNull Location loc, final boolean gen, final @NotNull Consumer cb) { -+ this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen, cb); -+ } -+ -+ /** -+ * Requests {@link Chunk} to be loaded that contains the given {@link Block} -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link java.util.function.Consumer} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param block Block to get the containing chunk from -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ default void getChunkAtAsync(final @NotNull Block block, final @NotNull Consumer cb) { -+ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, cb); -+ } -+ -+ /** -+ * Requests {@link Chunk} to be loaded that contains the given {@link Block} -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The {@link java.util.function.Consumer} will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param block Block to get the containing chunk from -+ * @param gen Should the chunk generate if it doesn't exist -+ * @param cb Callback to receive the chunk when it is loaded. -+ * will be executed synchronously -+ */ -+ default void getChunkAtAsync(final @NotNull Block block, final boolean gen, final @NotNull Consumer cb) { -+ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, cb); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param loc Location to load the corresponding chunk from -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Location loc) { -+ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param loc Location to load the corresponding chunk from -+ * @param gen Should the chunk generate if it doesn't exist -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Location loc, final boolean gen) { -+ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param block Block to load the corresponding chunk from -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Block block) { -+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param block Block to load the corresponding chunk from -+ * @param gen Should the chunk generate if it doesn't exist -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Block block, final boolean gen) { -+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) -+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final int x, final int z) { -+ return this.getChunkAtAsync(x, z, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param x Chunk X-coordinate of the chunk - floor(world coordinate / 16) -+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16) -+ * @param gen Should we generate a chunk if it doesn't exist or not -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final int x, final int z, final boolean gen) { -+ return this.getChunkAtAsync(x, z, gen, false); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param loc Location to load the corresponding chunk from -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Location loc) { -+ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param loc Location to load the corresponding chunk from -+ * @param gen Should the chunk generate if it doesn't exist -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Location loc, final boolean gen) { -+ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param block Block to load the corresponding chunk from -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Block block) { -+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * @param block Block to load the corresponding chunk from -+ * @param gen Should the chunk generate if it doesn't exist -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Block block, final boolean gen) { -+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, true); -+ } -+ -+ /** -+ * Requests a {@link Chunk} to be loaded at the given coordinates -+ * -+ * This method makes no guarantee on how fast the chunk will load, -+ * and will return the chunk to the callback at a later time. -+ * -+ * You should use this method if you need a chunk but do not need it -+ * immediately, and you wish to let the server control the speed -+ * of chunk loads, keeping performance in mind. -+ * -+ * The future will always be executed synchronously -+ * on the main Server Thread. -+ * -+ * @param x X Coord -+ * @param z Z Coord -+ * @return Future that will resolve when the chunk is loaded -+ */ -+ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final int x, final int z) { -+ return this.getChunkAtAsync(x, z, true, true); -+ } -+ -+ java.util.concurrent.@NotNull CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent); -+ // Paper end - async chunks API -+ - /** - * Get a list of all players in this World - * -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 1e43deadce5a1a0e97521b1f69fee3106f5a0b9e..f1fc42ad24648ee481b9a5d4c4cc58ae8c0a93c1 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -168,6 +168,39 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - public boolean teleport(@NotNull Entity destination, @NotNull TeleportCause cause); - -+ // Paper start -+ /** -+ * Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready. -+ * @param loc Location to teleport to -+ * @return A future that will be completed with the result of the teleport -+ */ -+ default java.util.concurrent.@NotNull CompletableFuture teleportAsync(final @NotNull Location loc) { -+ return this.teleportAsync(loc, TeleportCause.PLUGIN); -+ } -+ -+ /** -+ * Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready. -+ * @param loc Location to teleport to -+ * @param cause Reason for teleport -+ * @return A future that will be completed with the result of the teleport -+ */ -+ default java.util.concurrent.@NotNull CompletableFuture teleportAsync(final @NotNull Location loc, final @NotNull TeleportCause cause) { -+ final class Holder { -+ static final io.papermc.paper.entity.TeleportFlag[] EMPTY_FLAGS = new io.papermc.paper.entity.TeleportFlag[0]; -+ } -+ return this.teleportAsync(loc, cause, Holder.EMPTY_FLAGS); -+ } -+ -+ /** -+ * Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready. -+ * @param loc Location to teleport to -+ * @param cause Reason for teleport -+ * @param teleportFlags Flags to be used in this teleportation -+ * @return A future that will be completed with the result of the teleport -+ */ -+ java.util.concurrent.@NotNull CompletableFuture teleportAsync(@NotNull Location loc, @NotNull TeleportCause cause, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags); -+ // Paper end -+ - /** - * Returns a list of entities within a bounding box centered around this - * entity diff --git a/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch deleted file mode 100644 index 5a9655eafe..0000000000 --- a/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Mon, 3 Sep 2018 18:13:53 -0500 -Subject: [PATCH] Add ray tracing methods to LivingEntity - - -diff --git a/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c896d172519a8552a132031cb956378db272878f ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/block/TargetBlockInfo.java -@@ -0,0 +1,67 @@ -+package com.destroystokyo.paper.block; -+ -+import org.bukkit.FluidCollisionMode; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents information about a targeted block -+ * @deprecated use {@link org.bukkit.util.RayTraceResult} -+ */ -+@Deprecated(forRemoval = true) -+public class TargetBlockInfo { -+ private final Block block; -+ private final BlockFace blockFace; -+ -+ public TargetBlockInfo(@NotNull Block block, @NotNull BlockFace blockFace) { -+ this.block = block; -+ this.blockFace = blockFace; -+ } -+ -+ /** -+ * Get the block that is targeted -+ * -+ * @return Targeted block -+ */ -+ @NotNull -+ public Block getBlock() { -+ return block; -+ } -+ -+ /** -+ * Get the targeted BlockFace -+ * -+ * @return Targeted blockface -+ */ -+ @NotNull -+ public BlockFace getBlockFace() { -+ return blockFace; -+ } -+ -+ /** -+ * Get the relative Block to the targeted block on the side it is targeted at -+ * -+ * @return Block relative to targeted block -+ */ -+ @NotNull -+ public Block getRelativeBlock() { -+ return block.getRelative(blockFace); -+ } -+ -+ /** -+ * @deprecated use {@link org.bukkit.FluidCollisionMode} -+ */ -+ @Deprecated(forRemoval = true) -+ public enum FluidMode { -+ NEVER(FluidCollisionMode.NEVER), -+ SOURCE_ONLY(FluidCollisionMode.SOURCE_ONLY), -+ ALWAYS(FluidCollisionMode.ALWAYS); -+ -+ public final FluidCollisionMode bukkit; -+ -+ FluidMode(FluidCollisionMode bukkit) { -+ this.bukkit = bukkit; -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0ed64618b3f62ee984fe4f99dc6a52d5fad7b3cc..b41152d81c1ec89a65eaee2a606f4f1b0d421bc7 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -85,6 +85,98 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @NotNull - public Block getTargetBlock(@Nullable Set transparent, int maxDistance); - -+ // Paper start -+ /** -+ * Gets the block that the living entity has targeted, ignoring fluids -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return block that the living entity has targeted, -+ * or null if no block is within maxDistance -+ * @deprecated use {@link #getTargetBlockExact(int)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public default Block getTargetBlock(int maxDistance) { -+ return getTargetBlock(maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode.NEVER); -+ } -+ -+ /** -+ * Gets the block that the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return block that the living entity has targeted, -+ * or null if no block is within maxDistance -+ * @deprecated use {@link #getTargetBlockExact(int, FluidCollisionMode)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public Block getTargetBlock(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ -+ /** -+ * Gets the blockface of that block that the living entity has targeted, ignoring fluids -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return blockface of the block that the living entity has targeted, -+ * or null if no block is targeted -+ */ -+ @Nullable -+ public default org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance) { -+ return getTargetBlockFace(maxDistance, org.bukkit.FluidCollisionMode.NEVER); -+ } -+ -+ /** -+ * Gets the blockface of that block that the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return blockface of the block that the living entity has targeted, -+ * or null if no block is targeted -+ * @deprecated use {@link #getTargetBlockFace(int, FluidCollisionMode)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ -+ /** -+ * Gets the blockface of that block that the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return blockface of the block that the living entity has targeted, -+ * or null if no block is targeted -+ */ -+ @Nullable -+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, @NotNull FluidCollisionMode fluidMode); -+ -+ /** -+ * Gets information about the block the living entity has targeted, ignoring fluids -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return TargetBlockInfo about the block the living entity has targeted, -+ * or null if no block is targeted -+ * @deprecated use {@link #rayTraceBlocks(double)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public default com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance) { -+ return getTargetBlockInfo(maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode.NEVER); -+ } -+ -+ /** -+ * Gets information about the block the living entity has targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param fluidMode whether to check fluids or not -+ * @return TargetBlockInfo about the block the living entity has targeted, -+ * or null if no block is targeted -+ * @deprecated use {@link #rayTraceBlocks(double, FluidCollisionMode)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ // Paper end -+ - /** - * Gets the last two blocks along the living entity's line of sight. - *

diff --git a/patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch b/patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch new file mode 100644 index 0000000000..0727dbdfbb --- /dev/null +++ b/patches/api/0144-Expose-attack-cooldown-methods-for-Player.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Tue, 4 Sep 2018 15:01:54 -0500 +Subject: [PATCH] Expose attack cooldown methods for Player + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 9dcec906cea7d4eb6da99ef3100a98218a280594..92a83edc03fa8d11f026ac312b989329fa6a7e88 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3263,6 +3263,28 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + void setPlayerProfile(com.destroystokyo.paper.profile.@NotNull PlayerProfile profile); + // Paper end - Player Profile API + ++ // Paper start - attack cooldown API ++ /** ++ * Returns the amount of ticks the current cooldown lasts ++ * ++ * @return Amount of ticks cooldown will last ++ */ ++ float getCooldownPeriod(); ++ ++ /** ++ * Returns the percentage of attack power available based on the cooldown (zero to one). ++ * ++ * @param adjustTicks Amount of ticks to add to cooldown counter for this calculation ++ * @return Percentage of attack power available ++ */ ++ float getCooledAttackStrength(float adjustTicks); ++ ++ /** ++ * Reset the cooldown counter to 0, effectively starting the cooldown period. ++ */ ++ void resetCooldown(); ++ // Paper end - attack cooldown API ++ + // Spigot start + public class Spigot extends Entity.Spigot { + diff --git a/patches/api/0145-Expose-attack-cooldown-methods-for-Player.patch b/patches/api/0145-Expose-attack-cooldown-methods-for-Player.patch deleted file mode 100644 index 0727dbdfbb..0000000000 --- a/patches/api/0145-Expose-attack-cooldown-methods-for-Player.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Tue, 4 Sep 2018 15:01:54 -0500 -Subject: [PATCH] Expose attack cooldown methods for Player - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9dcec906cea7d4eb6da99ef3100a98218a280594..92a83edc03fa8d11f026ac312b989329fa6a7e88 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3263,6 +3263,28 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void setPlayerProfile(com.destroystokyo.paper.profile.@NotNull PlayerProfile profile); - // Paper end - Player Profile API - -+ // Paper start - attack cooldown API -+ /** -+ * Returns the amount of ticks the current cooldown lasts -+ * -+ * @return Amount of ticks cooldown will last -+ */ -+ float getCooldownPeriod(); -+ -+ /** -+ * Returns the percentage of attack power available based on the cooldown (zero to one). -+ * -+ * @param adjustTicks Amount of ticks to add to cooldown counter for this calculation -+ * @return Percentage of attack power available -+ */ -+ float getCooledAttackStrength(float adjustTicks); -+ -+ /** -+ * Reset the cooldown counter to 0, effectively starting the cooldown period. -+ */ -+ void resetCooldown(); -+ // Paper end - attack cooldown API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/0145-Improve-death-events.patch b/patches/api/0145-Improve-death-events.patch new file mode 100644 index 0000000000..90a6bdde24 --- /dev/null +++ b/patches/api/0145-Improve-death-events.patch @@ -0,0 +1,204 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Phoenix616 +Date: Tue, 21 Aug 2018 01:32:28 +0100 +Subject: [PATCH] Improve death events + +This adds the ability to cancel the death events and to modify the sound +an entity makes when dying. (In cases were no sound should it will be +called with shouldPlaySound set to false allowing unsilencing of silent +entities) + +It makes handling of entity deaths a lot nicer as you no longer need +to listen on the damage event and calculate if the entity dies yourself +to cancel the death which has the benefit of also receiving the dropped +items and experience which is otherwise only properly possible by using +internal code. + +diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +index a5984ab06cce95d30e70511e125f69339b574c04..130cf9e5981f701dff4fa72e71e0b5dc8295bfc8 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +@@ -5,14 +5,24 @@ import org.bukkit.entity.LivingEntity; + import org.bukkit.event.HandlerList; + import org.bukkit.inventory.ItemStack; + import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; + + /** + * Thrown whenever a LivingEntity dies + */ +-public class EntityDeathEvent extends EntityEvent { ++public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper - make cancellable + private static final HandlerList handlers = new HandlerList(); + private final List drops; + private int dropExp = 0; ++ // Paper start - make cancellable ++ private boolean cancelled; ++ private double reviveHealth = 0; ++ private boolean shouldPlayDeathSound; ++ @Nullable private org.bukkit.Sound deathSound; ++ @Nullable private org.bukkit.SoundCategory deathSoundCategory; ++ private float deathSoundVolume; ++ private float deathSoundPitch; ++ // Paper end + + public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull final List drops) { + this(entity, drops, 0); +@@ -74,4 +84,133 @@ public class EntityDeathEvent extends EntityEvent { + public static HandlerList getHandlerList() { + return handlers; + } ++ ++ // Paper start - make cancellable ++ @Override ++ public boolean isCancelled() { ++ return cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ cancelled = cancel; ++ } ++ ++ /** ++ * Get the amount of health that the entity should revive with after cancelling the event. ++ * Set to the entity's max health by default. ++ * ++ * @return The amount of health ++ */ ++ public double getReviveHealth() { ++ return reviveHealth; ++ } ++ ++ /** ++ * Set the amount of health that the entity should revive with after cancelling the event. ++ * Revive health value must be between 0 (exclusive) and the entity's max health (inclusive). ++ * ++ * @param reviveHealth The amount of health ++ * @throws IllegalArgumentException Thrown if the health is {@literal <= 0 or >} max health ++ */ ++ public void setReviveHealth(double reviveHealth) throws IllegalArgumentException { ++ double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue(); ++ if ((maxHealth != 0 && reviveHealth <= 0) || (reviveHealth > maxHealth)) { ++ throw new IllegalArgumentException("Health must be between 0 (exclusive) and " + maxHealth + " (inclusive), but was " + reviveHealth); ++ } ++ this.reviveHealth = reviveHealth; ++ } ++ ++ /** ++ * Whether or not the death sound should play when the entity dies. If the event is cancelled it does not play! ++ * ++ * @return Whether or not the death sound should play. Event is called with this set to false if the entity is silent. ++ */ ++ public boolean shouldPlayDeathSound() { ++ return shouldPlayDeathSound; ++ } ++ ++ /** ++ * Set whether or not the death sound should play when the entity dies. If the event is cancelled it does not play! ++ * ++ * @param playDeathSound Enable or disable the death sound ++ */ ++ public void setShouldPlayDeathSound(boolean playDeathSound) { ++ this.shouldPlayDeathSound = playDeathSound; ++ } ++ ++ /** ++ * Get the sound that the entity makes when dying ++ * ++ * @return The sound that the entity makes ++ */ ++ @Nullable ++ public org.bukkit.Sound getDeathSound() { ++ return deathSound; ++ } ++ ++ /** ++ * Set the sound that the entity makes when dying ++ * ++ * @param sound The sound that the entity should make when dying ++ */ ++ public void setDeathSound(@Nullable org.bukkit.Sound sound) { ++ deathSound = sound; ++ } ++ ++ /** ++ * Get the sound category that the death sound should play in ++ * ++ * @return The sound category ++ */ ++ @Nullable ++ public org.bukkit.SoundCategory getDeathSoundCategory() { ++ return deathSoundCategory; ++ } ++ ++ /** ++ * Set the sound category that the death sound should play in. ++ * ++ * @param soundCategory The sound category ++ */ ++ public void setDeathSoundCategory(@Nullable org.bukkit.SoundCategory soundCategory) { ++ this.deathSoundCategory = soundCategory; ++ } ++ ++ /** ++ * Get the volume that the death sound will play at. ++ * ++ * @return The volume the death sound will play at ++ */ ++ public float getDeathSoundVolume() { ++ return deathSoundVolume; ++ } ++ ++ /** ++ * Set the volume the death sound should play at. If the event is cancelled this will not play the sound! ++ * ++ * @param volume The volume the death sound should play at ++ */ ++ public void setDeathSoundVolume(float volume) { ++ this.deathSoundVolume = volume; ++ } ++ ++ /** ++ * Get the pitch that the death sound will play with. ++ * ++ * @return The pitch the death sound will play with ++ */ ++ public float getDeathSoundPitch() { ++ return deathSoundPitch; ++ } ++ ++ /** ++ * Set the pitch that the death sound should play with. ++ * ++ * @param pitch The pitch the death sound should play with ++ */ ++ public void setDeathSoundPitch(float pitch) { ++ this.deathSoundPitch = pitch; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +index 03b4e0300d228e3f3a9f4f75c96e0cf9ed1a7d2d..38f81772edacb178e21c3f273e8c41ed46177d6d 100644 +--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +@@ -62,6 +62,19 @@ public class PlayerDeathEvent extends EntityDeathEvent { + return (Player) entity; + } + ++ // Paper start - improve death events ++ /** ++ * Clarity method for getting the player. Not really needed except ++ * for reasons of clarity. ++ * ++ * @return Player who is involved in this event ++ */ ++ public @NotNull Player getPlayer() { ++ return this.getEntity(); ++ } ++ ++ // Paper end - improve death events ++ + // Paper start - adventure + /** + * Set the death message that will appear to everyone on the server. diff --git a/patches/api/0146-Add-Git-information-to-version-command-on-startup.patch b/patches/api/0146-Add-Git-information-to-version-command-on-startup.patch new file mode 100644 index 0000000000..6c3f8d857b --- /dev/null +++ b/patches/api/0146-Add-Git-information-to-version-command-on-startup.patch @@ -0,0 +1,101 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Professor Bloodstone +Date: Sun, 20 Jun 2021 01:48:31 +0200 +Subject: [PATCH] Add Git information to version command/on startup + + +diff --git a/src/main/java/io/papermc/paper/util/JarManifests.java b/src/main/java/io/papermc/paper/util/JarManifests.java +new file mode 100644 +index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b306076343 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/util/JarManifests.java +@@ -0,0 +1,37 @@ ++package io.papermc.paper.util; ++ ++import java.io.IOException; ++import java.io.InputStream; ++import java.net.URL; ++import java.util.Collections; ++import java.util.Map; ++import java.util.WeakHashMap; ++import java.util.jar.Manifest; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++@ApiStatus.Internal ++public final class JarManifests { ++ private JarManifests() { ++ } ++ ++ private static final Map MANIFESTS = Collections.synchronizedMap(new WeakHashMap<>()); ++ ++ public static @Nullable Manifest manifest(final @NotNull Class clazz) { ++ return MANIFESTS.computeIfAbsent(clazz.getClassLoader(), classLoader -> { ++ final String classLocation = "/" + clazz.getName().replace(".", "/") + ".class"; ++ final URL resource = clazz.getResource(classLocation); ++ if (resource == null) { ++ return null; ++ } ++ final String classFilePath = resource.toString().replace("\\", "/"); ++ final String archivePath = classFilePath.substring(0, classFilePath.length() - classLocation.length()); ++ try (final InputStream stream = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) { ++ return new Manifest(stream); ++ } catch (final IOException ex) { ++ return null; ++ } ++ }); ++ } ++} +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 3e32a6bbf593b269f1af23c7e2fdafaccc0d2110..d60780a26e10f5f9c80446693552384281327b51 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -60,6 +60,7 @@ import org.bukkit.util.CachedServerIcon; + import org.jetbrains.annotations.Contract; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; ++import io.papermc.paper.util.JarManifests; // Paper + + /** + * Represents the Bukkit core, for version and Server singleton handling +@@ -109,7 +110,25 @@ public final class Bukkit { + } + + Bukkit.server = server; +- server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")"); ++ // Paper start - add git information ++ server.getLogger().info(getVersionMessage()); ++ } ++ /** ++ * Gets message describing the version server is running. ++ * ++ * @return message describing the version server is running ++ */ ++ @NotNull ++ public static String getVersionMessage() { ++ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); ++ final String gitBranch = manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch"); ++ final String gitCommit = manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit"); ++ String branchMsg = " on " + gitBranch; ++ if ("master".equals(gitBranch) || "main".equals(gitBranch)) { ++ branchMsg = ""; // Don't show branch on main/master ++ } ++ return "This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ") (Git: " + gitCommit + branchMsg + ")"; ++ // Paper end + } + + /** +diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +index b437cf212a63aa96a9492db8d01d5d37061aee23..fd5d9881abfd930bb883120f018f76dc78b62b14 100644 +--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java ++++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +@@ -256,7 +256,7 @@ public class VersionCommand extends BukkitCommand { + private void setVersionMessage(final @NotNull Component msg) { + lastCheck = System.currentTimeMillis(); + final Component message = Component.textOfChildren( +- Component.text("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")", NamedTextColor.WHITE), ++ Component.text(Bukkit.getVersionMessage(), NamedTextColor.WHITE), + Component.newline(), + msg + ); diff --git a/patches/api/0146-Improve-death-events.patch b/patches/api/0146-Improve-death-events.patch deleted file mode 100644 index 90a6bdde24..0000000000 --- a/patches/api/0146-Improve-death-events.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Phoenix616 -Date: Tue, 21 Aug 2018 01:32:28 +0100 -Subject: [PATCH] Improve death events - -This adds the ability to cancel the death events and to modify the sound -an entity makes when dying. (In cases were no sound should it will be -called with shouldPlaySound set to false allowing unsilencing of silent -entities) - -It makes handling of entity deaths a lot nicer as you no longer need -to listen on the damage event and calculate if the entity dies yourself -to cancel the death which has the benefit of also receiving the dropped -items and experience which is otherwise only properly possible by using -internal code. - -diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -index a5984ab06cce95d30e70511e125f69339b574c04..130cf9e5981f701dff4fa72e71e0b5dc8295bfc8 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -@@ -5,14 +5,24 @@ import org.bukkit.entity.LivingEntity; - import org.bukkit.event.HandlerList; - import org.bukkit.inventory.ItemStack; - import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; - - /** - * Thrown whenever a LivingEntity dies - */ --public class EntityDeathEvent extends EntityEvent { -+public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper - make cancellable - private static final HandlerList handlers = new HandlerList(); - private final List drops; - private int dropExp = 0; -+ // Paper start - make cancellable -+ private boolean cancelled; -+ private double reviveHealth = 0; -+ private boolean shouldPlayDeathSound; -+ @Nullable private org.bukkit.Sound deathSound; -+ @Nullable private org.bukkit.SoundCategory deathSoundCategory; -+ private float deathSoundVolume; -+ private float deathSoundPitch; -+ // Paper end - - public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull final List drops) { - this(entity, drops, 0); -@@ -74,4 +84,133 @@ public class EntityDeathEvent extends EntityEvent { - public static HandlerList getHandlerList() { - return handlers; - } -+ -+ // Paper start - make cancellable -+ @Override -+ public boolean isCancelled() { -+ return cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ cancelled = cancel; -+ } -+ -+ /** -+ * Get the amount of health that the entity should revive with after cancelling the event. -+ * Set to the entity's max health by default. -+ * -+ * @return The amount of health -+ */ -+ public double getReviveHealth() { -+ return reviveHealth; -+ } -+ -+ /** -+ * Set the amount of health that the entity should revive with after cancelling the event. -+ * Revive health value must be between 0 (exclusive) and the entity's max health (inclusive). -+ * -+ * @param reviveHealth The amount of health -+ * @throws IllegalArgumentException Thrown if the health is {@literal <= 0 or >} max health -+ */ -+ public void setReviveHealth(double reviveHealth) throws IllegalArgumentException { -+ double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue(); -+ if ((maxHealth != 0 && reviveHealth <= 0) || (reviveHealth > maxHealth)) { -+ throw new IllegalArgumentException("Health must be between 0 (exclusive) and " + maxHealth + " (inclusive), but was " + reviveHealth); -+ } -+ this.reviveHealth = reviveHealth; -+ } -+ -+ /** -+ * Whether or not the death sound should play when the entity dies. If the event is cancelled it does not play! -+ * -+ * @return Whether or not the death sound should play. Event is called with this set to false if the entity is silent. -+ */ -+ public boolean shouldPlayDeathSound() { -+ return shouldPlayDeathSound; -+ } -+ -+ /** -+ * Set whether or not the death sound should play when the entity dies. If the event is cancelled it does not play! -+ * -+ * @param playDeathSound Enable or disable the death sound -+ */ -+ public void setShouldPlayDeathSound(boolean playDeathSound) { -+ this.shouldPlayDeathSound = playDeathSound; -+ } -+ -+ /** -+ * Get the sound that the entity makes when dying -+ * -+ * @return The sound that the entity makes -+ */ -+ @Nullable -+ public org.bukkit.Sound getDeathSound() { -+ return deathSound; -+ } -+ -+ /** -+ * Set the sound that the entity makes when dying -+ * -+ * @param sound The sound that the entity should make when dying -+ */ -+ public void setDeathSound(@Nullable org.bukkit.Sound sound) { -+ deathSound = sound; -+ } -+ -+ /** -+ * Get the sound category that the death sound should play in -+ * -+ * @return The sound category -+ */ -+ @Nullable -+ public org.bukkit.SoundCategory getDeathSoundCategory() { -+ return deathSoundCategory; -+ } -+ -+ /** -+ * Set the sound category that the death sound should play in. -+ * -+ * @param soundCategory The sound category -+ */ -+ public void setDeathSoundCategory(@Nullable org.bukkit.SoundCategory soundCategory) { -+ this.deathSoundCategory = soundCategory; -+ } -+ -+ /** -+ * Get the volume that the death sound will play at. -+ * -+ * @return The volume the death sound will play at -+ */ -+ public float getDeathSoundVolume() { -+ return deathSoundVolume; -+ } -+ -+ /** -+ * Set the volume the death sound should play at. If the event is cancelled this will not play the sound! -+ * -+ * @param volume The volume the death sound should play at -+ */ -+ public void setDeathSoundVolume(float volume) { -+ this.deathSoundVolume = volume; -+ } -+ -+ /** -+ * Get the pitch that the death sound will play with. -+ * -+ * @return The pitch the death sound will play with -+ */ -+ public float getDeathSoundPitch() { -+ return deathSoundPitch; -+ } -+ -+ /** -+ * Set the pitch that the death sound should play with. -+ * -+ * @param pitch The pitch the death sound should play with -+ */ -+ public void setDeathSoundPitch(float pitch) { -+ this.deathSoundPitch = pitch; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 03b4e0300d228e3f3a9f4f75c96e0cf9ed1a7d2d..38f81772edacb178e21c3f273e8c41ed46177d6d 100644 ---- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -@@ -62,6 +62,19 @@ public class PlayerDeathEvent extends EntityDeathEvent { - return (Player) entity; - } - -+ // Paper start - improve death events -+ /** -+ * Clarity method for getting the player. Not really needed except -+ * for reasons of clarity. -+ * -+ * @return Player who is involved in this event -+ */ -+ public @NotNull Player getPlayer() { -+ return this.getEntity(); -+ } -+ -+ // Paper end - improve death events -+ - // Paper start - adventure - /** - * Set the death message that will appear to everyone on the server. diff --git a/patches/api/0147-Add-Git-information-to-version-command-on-startup.patch b/patches/api/0147-Add-Git-information-to-version-command-on-startup.patch deleted file mode 100644 index 6c3f8d857b..0000000000 --- a/patches/api/0147-Add-Git-information-to-version-command-on-startup.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Professor Bloodstone -Date: Sun, 20 Jun 2021 01:48:31 +0200 -Subject: [PATCH] Add Git information to version command/on startup - - -diff --git a/src/main/java/io/papermc/paper/util/JarManifests.java b/src/main/java/io/papermc/paper/util/JarManifests.java -new file mode 100644 -index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b306076343 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/util/JarManifests.java -@@ -0,0 +1,37 @@ -+package io.papermc.paper.util; -+ -+import java.io.IOException; -+import java.io.InputStream; -+import java.net.URL; -+import java.util.Collections; -+import java.util.Map; -+import java.util.WeakHashMap; -+import java.util.jar.Manifest; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+@ApiStatus.Internal -+public final class JarManifests { -+ private JarManifests() { -+ } -+ -+ private static final Map MANIFESTS = Collections.synchronizedMap(new WeakHashMap<>()); -+ -+ public static @Nullable Manifest manifest(final @NotNull Class clazz) { -+ return MANIFESTS.computeIfAbsent(clazz.getClassLoader(), classLoader -> { -+ final String classLocation = "/" + clazz.getName().replace(".", "/") + ".class"; -+ final URL resource = clazz.getResource(classLocation); -+ if (resource == null) { -+ return null; -+ } -+ final String classFilePath = resource.toString().replace("\\", "/"); -+ final String archivePath = classFilePath.substring(0, classFilePath.length() - classLocation.length()); -+ try (final InputStream stream = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) { -+ return new Manifest(stream); -+ } catch (final IOException ex) { -+ return null; -+ } -+ }); -+ } -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 3e32a6bbf593b269f1af23c7e2fdafaccc0d2110..d60780a26e10f5f9c80446693552384281327b51 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -60,6 +60,7 @@ import org.bukkit.util.CachedServerIcon; - import org.jetbrains.annotations.Contract; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; -+import io.papermc.paper.util.JarManifests; // Paper - - /** - * Represents the Bukkit core, for version and Server singleton handling -@@ -109,7 +110,25 @@ public final class Bukkit { - } - - Bukkit.server = server; -- server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")"); -+ // Paper start - add git information -+ server.getLogger().info(getVersionMessage()); -+ } -+ /** -+ * Gets message describing the version server is running. -+ * -+ * @return message describing the version server is running -+ */ -+ @NotNull -+ public static String getVersionMessage() { -+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass()); -+ final String gitBranch = manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch"); -+ final String gitCommit = manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit"); -+ String branchMsg = " on " + gitBranch; -+ if ("master".equals(gitBranch) || "main".equals(gitBranch)) { -+ branchMsg = ""; // Don't show branch on main/master -+ } -+ return "This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ") (Git: " + gitCommit + branchMsg + ")"; -+ // Paper end - } - - /** -diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -index b437cf212a63aa96a9492db8d01d5d37061aee23..fd5d9881abfd930bb883120f018f76dc78b62b14 100644 ---- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -@@ -256,7 +256,7 @@ public class VersionCommand extends BukkitCommand { - private void setVersionMessage(final @NotNull Component msg) { - lastCheck = System.currentTimeMillis(); - final Component message = Component.textOfChildren( -- Component.text("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")", NamedTextColor.WHITE), -+ Component.text(Bukkit.getVersionMessage(), NamedTextColor.WHITE), - Component.newline(), - msg - ); diff --git a/patches/api/0147-Mob-Pathfinding-API.patch b/patches/api/0147-Mob-Pathfinding-API.patch new file mode 100644 index 0000000000..83fb575817 --- /dev/null +++ b/patches/api/0147-Mob-Pathfinding-API.patch @@ -0,0 +1,265 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 9 Sep 2018 12:39:06 -0400 +Subject: [PATCH] Mob Pathfinding API + +Adds an API to allow plugins to instruct a Mob to Pathfind to a Location or Entity + +This does not do anything to stop other AI rules from changing the location, so +it is still up to the plugin to control that or override after another goal changed +the location. + +You can use EntityPathfindEvent to cancel new pathfinds from overriding your current. + +diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3c1e2c93d923a683cc0455af77c43784ef12270e +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java +@@ -0,0 +1,220 @@ ++package com.destroystokyo.paper.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.entity.Mob; ++ ++import java.util.List; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Handles pathfinding operations for an Entity ++ */ ++public interface Pathfinder { ++ ++ /** ++ * ++ * @return The entity that is controlled by this pathfinder ++ */ ++ @NotNull ++ Mob getEntity(); ++ ++ /** ++ * Instructs the Entity to stop trying to navigate to its current desired location ++ */ ++ void stopPathfinding(); ++ ++ /** ++ * If the entity is currently trying to navigate to a destination, this will return true ++ * @return true if the entity is navigating to a destination ++ */ ++ boolean hasPath(); ++ ++ /** ++ * @return The location the entity is trying to navigate to, or null if there is no destination ++ */ ++ @Nullable ++ PathResult getCurrentPath(); ++ ++ /** ++ * Calculates a destination for the Entity to navigate to, but does not set it ++ * as the current target. Useful for calculating what would happen before setting it. ++ * @param loc Location to navigate to ++ * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated ++ */ ++ @Nullable PathResult findPath(@NotNull Location loc); ++ ++ /** ++ * Calculates a destination for the Entity to navigate to to reach the target entity, ++ * but does not set it as the current target. ++ * Useful for calculating what would happen before setting it. ++ * ++ * The behavior of this PathResult is subject to the games pathfinding rules, and may ++ * result in the pathfinding automatically updating to follow the target Entity. ++ * ++ * However, this behavior is not guaranteed, and is subject to the games behavior. ++ * ++ * @param target the Entity to navigate to ++ * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated ++ */ ++ @Nullable PathResult findPath(@NotNull LivingEntity target); ++ ++ /** ++ * Calculates a destination for the Entity to navigate to, and sets it with default speed ++ * as the current target. ++ * @param loc Location to navigate to ++ * @return If the pathfinding was successfully started ++ */ ++ default boolean moveTo(@NotNull Location loc) { ++ return moveTo(loc, 1); ++ } ++ ++ /** ++ * Calculates a destination for the Entity to navigate to, with desired speed ++ * as the current target. ++ * @param loc Location to navigate to ++ * @param speed Speed multiplier to navigate at, where 1 is 'normal' ++ * @return If the pathfinding was successfully started ++ */ ++ default boolean moveTo(@NotNull Location loc, double speed) { ++ PathResult path = findPath(loc); ++ return path != null && moveTo(path, speed); ++ } ++ ++ /** ++ * Calculates a destination for the Entity to navigate to to reach the target entity, ++ * and sets it with default speed. ++ * ++ * The behavior of this PathResult is subject to the games pathfinding rules, and may ++ * result in the pathfinding automatically updating to follow the target Entity. ++ * ++ * However, this behavior is not guaranteed, and is subject to the games behavior. ++ * ++ * @param target the Entity to navigate to ++ * @return If the pathfinding was successfully started ++ */ ++ default boolean moveTo(@NotNull LivingEntity target) { ++ return moveTo(target, 1); ++ } ++ ++ /** ++ * Calculates a destination for the Entity to navigate to to reach the target entity, ++ * and sets it with specified speed. ++ * ++ * The behavior of this PathResult is subject to the games pathfinding rules, and may ++ * result in the pathfinding automatically updating to follow the target Entity. ++ * ++ * However, this behavior is not guaranteed, and is subject to the games behavior. ++ * ++ * @param target the Entity to navigate to ++ * @param speed Speed multiplier to navigate at, where 1 is 'normal' ++ * @return If the pathfinding was successfully started ++ */ ++ default boolean moveTo(@NotNull LivingEntity target, double speed) { ++ PathResult path = findPath(target); ++ return path != null && moveTo(path, speed); ++ } ++ ++ /** ++ * Takes the result of a previous pathfinding calculation and sets it ++ * as the active pathfinding with default speed. ++ * ++ * @param path The Path to start following ++ * @return If the pathfinding was successfully started ++ */ ++ default boolean moveTo(@NotNull PathResult path) { ++ return moveTo(path, 1); ++ } ++ ++ /** ++ * Takes the result of a previous pathfinding calculation and sets it ++ * as the active pathfinding, ++ * ++ * @param path The Path to start following ++ * @param speed Speed multiplier to navigate at, where 1 is 'normal' ++ * @return If the pathfinding was successfully started ++ */ ++ boolean moveTo(@NotNull PathResult path, double speed); ++ ++ /** ++ * Checks if this pathfinder allows passing through closed doors. ++ * ++ * @return if this pathfinder allows passing through closed doors ++ */ ++ boolean canOpenDoors(); ++ ++ /** ++ * Allows this pathfinder to pass through closed doors, or not ++ * ++ * @param canOpenDoors if the mob can pass through closed doors, or not ++ */ ++ void setCanOpenDoors(boolean canOpenDoors); ++ ++ /** ++ * Checks if this pathfinder allows passing through open doors. ++ * ++ * @return if this pathfinder allows passing through open doors ++ */ ++ boolean canPassDoors(); ++ ++ /** ++ * Allows this pathfinder to pass through open doors, or not ++ * ++ * @param canPassDoors if the mob can pass through open doors, or not ++ */ ++ void setCanPassDoors(boolean canPassDoors); ++ ++ /** ++ * Checks if this pathfinder assumes that the mob can float ++ * ++ * @return if this pathfinder assumes that the mob can float ++ */ ++ boolean canFloat(); ++ ++ /** ++ * Makes this pathfinder assume that the mob can float, or not ++ * ++ * @param canFloat if the mob can float, or not ++ */ ++ void setCanFloat(boolean canFloat); ++ ++ /** ++ * Represents the result of a pathfinding calculation ++ */ ++ interface PathResult { ++ ++ /** ++ * All currently calculated points to follow along the path to reach the destination location ++ * ++ * Will return points the entity has already moved past, see {@link #getNextPointIndex()} ++ * @return List of points ++ */ ++ @NotNull ++ List getPoints(); ++ ++ /** ++ * @return Returns the index of the current point along the points returned in {@link #getPoints()} the entity ++ * is trying to reach. This value will be higher than the maximum index of {@link #getPoints()} if this path finding is done. ++ */ ++ int getNextPointIndex(); ++ ++ /** ++ * @return The next location in the path points the entity is trying to reach, or null if there is no next point ++ */ ++ @Nullable Location getNextPoint(); ++ ++ /** ++ * @return The closest point the path can get to the target location ++ */ ++ @Nullable Location getFinalPoint(); ++ ++ /** ++ * Checks whether the final point can be reached ++ * ++ * @return whether the final point can be reached ++ * @see #getFinalPoint() ++ */ ++ boolean canReachFinalPoint(); ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 4f63988848443aff55619bc12ef12c925642a3f9..6de4344931b2e3d570346b800186c44a0d5782cc 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -2,6 +2,7 @@ package org.bukkit.entity; + + import org.bukkit.Sound; + import org.bukkit.loot.Lootable; ++import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + + /** +@@ -12,6 +13,13 @@ public interface Mob extends LivingEntity, Lootable { + // Paper start + @Override + org.bukkit.inventory.@org.jetbrains.annotations.NotNull EntityEquipment getEquipment(); ++ ++ /** ++ * Enables access to control the pathing of an Entity ++ * @return Pathfinding Manager for this entity ++ */ ++ @NotNull ++ com.destroystokyo.paper.entity.Pathfinder getPathfinder(); + // Paper end + /** + * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/0148-Mob-Pathfinding-API.patch b/patches/api/0148-Mob-Pathfinding-API.patch deleted file mode 100644 index 83fb575817..0000000000 --- a/patches/api/0148-Mob-Pathfinding-API.patch +++ /dev/null @@ -1,265 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 9 Sep 2018 12:39:06 -0400 -Subject: [PATCH] Mob Pathfinding API - -Adds an API to allow plugins to instruct a Mob to Pathfind to a Location or Entity - -This does not do anything to stop other AI rules from changing the location, so -it is still up to the plugin to control that or override after another goal changed -the location. - -You can use EntityPathfindEvent to cancel new pathfinds from overriding your current. - -diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3c1e2c93d923a683cc0455af77c43784ef12270e ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java -@@ -0,0 +1,220 @@ -+package com.destroystokyo.paper.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Mob; -+ -+import java.util.List; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Handles pathfinding operations for an Entity -+ */ -+public interface Pathfinder { -+ -+ /** -+ * -+ * @return The entity that is controlled by this pathfinder -+ */ -+ @NotNull -+ Mob getEntity(); -+ -+ /** -+ * Instructs the Entity to stop trying to navigate to its current desired location -+ */ -+ void stopPathfinding(); -+ -+ /** -+ * If the entity is currently trying to navigate to a destination, this will return true -+ * @return true if the entity is navigating to a destination -+ */ -+ boolean hasPath(); -+ -+ /** -+ * @return The location the entity is trying to navigate to, or null if there is no destination -+ */ -+ @Nullable -+ PathResult getCurrentPath(); -+ -+ /** -+ * Calculates a destination for the Entity to navigate to, but does not set it -+ * as the current target. Useful for calculating what would happen before setting it. -+ * @param loc Location to navigate to -+ * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated -+ */ -+ @Nullable PathResult findPath(@NotNull Location loc); -+ -+ /** -+ * Calculates a destination for the Entity to navigate to to reach the target entity, -+ * but does not set it as the current target. -+ * Useful for calculating what would happen before setting it. -+ * -+ * The behavior of this PathResult is subject to the games pathfinding rules, and may -+ * result in the pathfinding automatically updating to follow the target Entity. -+ * -+ * However, this behavior is not guaranteed, and is subject to the games behavior. -+ * -+ * @param target the Entity to navigate to -+ * @return The closest Location the Entity can get to for this navigation, or null if no path could be calculated -+ */ -+ @Nullable PathResult findPath(@NotNull LivingEntity target); -+ -+ /** -+ * Calculates a destination for the Entity to navigate to, and sets it with default speed -+ * as the current target. -+ * @param loc Location to navigate to -+ * @return If the pathfinding was successfully started -+ */ -+ default boolean moveTo(@NotNull Location loc) { -+ return moveTo(loc, 1); -+ } -+ -+ /** -+ * Calculates a destination for the Entity to navigate to, with desired speed -+ * as the current target. -+ * @param loc Location to navigate to -+ * @param speed Speed multiplier to navigate at, where 1 is 'normal' -+ * @return If the pathfinding was successfully started -+ */ -+ default boolean moveTo(@NotNull Location loc, double speed) { -+ PathResult path = findPath(loc); -+ return path != null && moveTo(path, speed); -+ } -+ -+ /** -+ * Calculates a destination for the Entity to navigate to to reach the target entity, -+ * and sets it with default speed. -+ * -+ * The behavior of this PathResult is subject to the games pathfinding rules, and may -+ * result in the pathfinding automatically updating to follow the target Entity. -+ * -+ * However, this behavior is not guaranteed, and is subject to the games behavior. -+ * -+ * @param target the Entity to navigate to -+ * @return If the pathfinding was successfully started -+ */ -+ default boolean moveTo(@NotNull LivingEntity target) { -+ return moveTo(target, 1); -+ } -+ -+ /** -+ * Calculates a destination for the Entity to navigate to to reach the target entity, -+ * and sets it with specified speed. -+ * -+ * The behavior of this PathResult is subject to the games pathfinding rules, and may -+ * result in the pathfinding automatically updating to follow the target Entity. -+ * -+ * However, this behavior is not guaranteed, and is subject to the games behavior. -+ * -+ * @param target the Entity to navigate to -+ * @param speed Speed multiplier to navigate at, where 1 is 'normal' -+ * @return If the pathfinding was successfully started -+ */ -+ default boolean moveTo(@NotNull LivingEntity target, double speed) { -+ PathResult path = findPath(target); -+ return path != null && moveTo(path, speed); -+ } -+ -+ /** -+ * Takes the result of a previous pathfinding calculation and sets it -+ * as the active pathfinding with default speed. -+ * -+ * @param path The Path to start following -+ * @return If the pathfinding was successfully started -+ */ -+ default boolean moveTo(@NotNull PathResult path) { -+ return moveTo(path, 1); -+ } -+ -+ /** -+ * Takes the result of a previous pathfinding calculation and sets it -+ * as the active pathfinding, -+ * -+ * @param path The Path to start following -+ * @param speed Speed multiplier to navigate at, where 1 is 'normal' -+ * @return If the pathfinding was successfully started -+ */ -+ boolean moveTo(@NotNull PathResult path, double speed); -+ -+ /** -+ * Checks if this pathfinder allows passing through closed doors. -+ * -+ * @return if this pathfinder allows passing through closed doors -+ */ -+ boolean canOpenDoors(); -+ -+ /** -+ * Allows this pathfinder to pass through closed doors, or not -+ * -+ * @param canOpenDoors if the mob can pass through closed doors, or not -+ */ -+ void setCanOpenDoors(boolean canOpenDoors); -+ -+ /** -+ * Checks if this pathfinder allows passing through open doors. -+ * -+ * @return if this pathfinder allows passing through open doors -+ */ -+ boolean canPassDoors(); -+ -+ /** -+ * Allows this pathfinder to pass through open doors, or not -+ * -+ * @param canPassDoors if the mob can pass through open doors, or not -+ */ -+ void setCanPassDoors(boolean canPassDoors); -+ -+ /** -+ * Checks if this pathfinder assumes that the mob can float -+ * -+ * @return if this pathfinder assumes that the mob can float -+ */ -+ boolean canFloat(); -+ -+ /** -+ * Makes this pathfinder assume that the mob can float, or not -+ * -+ * @param canFloat if the mob can float, or not -+ */ -+ void setCanFloat(boolean canFloat); -+ -+ /** -+ * Represents the result of a pathfinding calculation -+ */ -+ interface PathResult { -+ -+ /** -+ * All currently calculated points to follow along the path to reach the destination location -+ * -+ * Will return points the entity has already moved past, see {@link #getNextPointIndex()} -+ * @return List of points -+ */ -+ @NotNull -+ List getPoints(); -+ -+ /** -+ * @return Returns the index of the current point along the points returned in {@link #getPoints()} the entity -+ * is trying to reach. This value will be higher than the maximum index of {@link #getPoints()} if this path finding is done. -+ */ -+ int getNextPointIndex(); -+ -+ /** -+ * @return The next location in the path points the entity is trying to reach, or null if there is no next point -+ */ -+ @Nullable Location getNextPoint(); -+ -+ /** -+ * @return The closest point the path can get to the target location -+ */ -+ @Nullable Location getFinalPoint(); -+ -+ /** -+ * Checks whether the final point can be reached -+ * -+ * @return whether the final point can be reached -+ * @see #getFinalPoint() -+ */ -+ boolean canReachFinalPoint(); -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 4f63988848443aff55619bc12ef12c925642a3f9..6de4344931b2e3d570346b800186c44a0d5782cc 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -2,6 +2,7 @@ package org.bukkit.entity; - - import org.bukkit.Sound; - import org.bukkit.loot.Lootable; -+import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - - /** -@@ -12,6 +13,13 @@ public interface Mob extends LivingEntity, Lootable { - // Paper start - @Override - org.bukkit.inventory.@org.jetbrains.annotations.NotNull EntityEquipment getEquipment(); -+ -+ /** -+ * Enables access to control the pathing of an Entity -+ * @return Pathfinding Manager for this entity -+ */ -+ @NotNull -+ com.destroystokyo.paper.entity.Pathfinder getPathfinder(); - // Paper end - /** - * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/0148-Performance-Concurrency-Improvements-to-Permissions.patch b/patches/api/0148-Performance-Concurrency-Improvements-to-Permissions.patch new file mode 100644 index 0000000000..6befcec378 --- /dev/null +++ b/patches/api/0148-Performance-Concurrency-Improvements-to-Permissions.patch @@ -0,0 +1,113 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 13 Sep 2018 20:51:50 -0400 +Subject: [PATCH] Performance & Concurrency Improvements to Permissions + +Modifying of permissions was only half protected, enabling concurrency +issues to occur if permissions were modified async. + +While no plugin really should be doing that, modifying operations +are not heavily called, so they are safe to add synchronization to. + +Now, all modification API's will be synchronized ensuring safety. + +Additionally, hasPermission was victim to a common java newbie mistake +of calling if (containsKey(k)) return get(k), resulting in 2 map lookups. + +Optimized it to simply be a single get call cutting permission map +lookups in half. + +diff --git a/src/main/java/org/bukkit/permissions/PermissibleBase.java b/src/main/java/org/bukkit/permissions/PermissibleBase.java +index 728fc46daf7a38f13906353bdd7362133853af92..cd3296fea01648592d2af89b3d80135acb6d0958 100644 +--- a/src/main/java/org/bukkit/permissions/PermissibleBase.java ++++ b/src/main/java/org/bukkit/permissions/PermissibleBase.java +@@ -72,8 +72,11 @@ public class PermissibleBase implements Permissible { + + String name = inName.toLowerCase(java.util.Locale.ENGLISH); + +- if (isPermissionSet(name)) { +- return permissions.get(name).getValue(); ++ // Paper start ++ PermissionAttachmentInfo info = permissions.get(name); ++ if (info != null) { ++ return info.getValue(); ++ // Paper end + } else { + Permission perm = Bukkit.getServer().getPluginManager().getPermission(name); + +@@ -93,15 +96,18 @@ public class PermissibleBase implements Permissible { + + String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH); + +- if (isPermissionSet(name)) { +- return permissions.get(name).getValue(); ++ // Paper start ++ PermissionAttachmentInfo info = permissions.get(name); ++ if (info != null) { ++ return info.getValue(); + } ++ // Paper end + return perm.getDefault().getValue(isOp()); + } + + @Override + @NotNull +- public PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) { ++ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) { // Paper - synchronized + if (name == null) { + throw new IllegalArgumentException("Permission name cannot be null"); + } else if (plugin == null) { +@@ -120,7 +126,7 @@ public class PermissibleBase implements Permissible { + + @Override + @NotNull +- public PermissionAttachment addAttachment(@NotNull Plugin plugin) { ++ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin) { // Paper - synchronized + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } else if (!plugin.isEnabled()) { +@@ -136,7 +142,7 @@ public class PermissibleBase implements Permissible { + } + + @Override +- public void removeAttachment(@NotNull PermissionAttachment attachment) { ++ public synchronized void removeAttachment(@NotNull PermissionAttachment attachment) { // Paper - synchronized + if (attachment == null) { + throw new IllegalArgumentException("Attachment cannot be null"); + } +@@ -155,7 +161,7 @@ public class PermissibleBase implements Permissible { + } + + @Override +- public void recalculatePermissions() { ++ public synchronized void recalculatePermissions() { // Paper - synchronized + clearPermissions(); + Set defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(isOp()); + Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(isOp(), parent); +@@ -204,7 +210,7 @@ public class PermissibleBase implements Permissible { + + @Override + @Nullable +- public PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) { ++ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) { // Paper + if (name == null) { + throw new IllegalArgumentException("Permission name cannot be null"); + } else if (plugin == null) { +@@ -224,7 +230,7 @@ public class PermissibleBase implements Permissible { + + @Override + @Nullable +- public PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) { ++ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) { // Paper - synchronized + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } else if (!plugin.isEnabled()) { +@@ -244,7 +250,7 @@ public class PermissibleBase implements Permissible { + + @Override + @NotNull +- public Set getEffectivePermissions() { ++ public synchronized Set getEffectivePermissions() { // Paper - synchronized + return new HashSet(permissions.values()); + } + diff --git a/patches/api/0149-Add-ItemStackRecipeChoice-Draft-API.patch b/patches/api/0149-Add-ItemStackRecipeChoice-Draft-API.patch new file mode 100644 index 0000000000..4cfddc6f59 --- /dev/null +++ b/patches/api/0149-Add-ItemStackRecipeChoice-Draft-API.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 13 Sep 2018 21:39:26 -0400 +Subject: [PATCH] Add ItemStackRecipeChoice Draft API + +This is based on Spigots Draft API. This is subject to change + +Allows creating recipes that must match isSimilar to full item stack. + +diff --git a/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java +new file mode 100644 +index 0000000000000000000000000000000000000000..18c96aeef00dc11e5083001adfba4204f0de4e2b +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java +@@ -0,0 +1,52 @@ ++package com.destroystokyo.paper.inventory; ++ ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.RecipeChoice; ++ ++import java.util.ArrayList; ++import java.util.List; ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * Allows crafting Items that require full matching itemstacks to complete the recipe for custom items ++ * @deprecated Draft API ++ */ ++@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++public class ItemStackRecipeChoice implements RecipeChoice { ++ ++ protected final List choices = new ArrayList<>(); ++ ++ public ItemStackRecipeChoice(ItemStack choices) { ++ this.choices.add(choices); ++ } ++ ++ public ItemStackRecipeChoice(List choices) { ++ this.choices.addAll(choices); ++ } ++ ++ @Override ++ public ItemStack getItemStack() { ++ return choices.isEmpty() ? null : choices.get(0); ++ } ++ ++ @Override ++ public RecipeChoice clone() { ++ try { ++ ItemStackRecipeChoice clone = (ItemStackRecipeChoice) super.clone(); ++ clone.choices.addAll(this.choices); ++ return clone; ++ } catch (CloneNotSupportedException ex) { ++ throw new AssertionError(ex); ++ } ++ } ++ ++ @Override ++ public boolean test(ItemStack itemStack) { ++ for (ItemStack stack : choices) { ++ if (stack.isSimilar(itemStack)) { ++ return true; ++ } ++ } ++ return false; ++ } ++} diff --git a/patches/api/0149-Performance-Concurrency-Improvements-to-Permissions.patch b/patches/api/0149-Performance-Concurrency-Improvements-to-Permissions.patch deleted file mode 100644 index 6befcec378..0000000000 --- a/patches/api/0149-Performance-Concurrency-Improvements-to-Permissions.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 13 Sep 2018 20:51:50 -0400 -Subject: [PATCH] Performance & Concurrency Improvements to Permissions - -Modifying of permissions was only half protected, enabling concurrency -issues to occur if permissions were modified async. - -While no plugin really should be doing that, modifying operations -are not heavily called, so they are safe to add synchronization to. - -Now, all modification API's will be synchronized ensuring safety. - -Additionally, hasPermission was victim to a common java newbie mistake -of calling if (containsKey(k)) return get(k), resulting in 2 map lookups. - -Optimized it to simply be a single get call cutting permission map -lookups in half. - -diff --git a/src/main/java/org/bukkit/permissions/PermissibleBase.java b/src/main/java/org/bukkit/permissions/PermissibleBase.java -index 728fc46daf7a38f13906353bdd7362133853af92..cd3296fea01648592d2af89b3d80135acb6d0958 100644 ---- a/src/main/java/org/bukkit/permissions/PermissibleBase.java -+++ b/src/main/java/org/bukkit/permissions/PermissibleBase.java -@@ -72,8 +72,11 @@ public class PermissibleBase implements Permissible { - - String name = inName.toLowerCase(java.util.Locale.ENGLISH); - -- if (isPermissionSet(name)) { -- return permissions.get(name).getValue(); -+ // Paper start -+ PermissionAttachmentInfo info = permissions.get(name); -+ if (info != null) { -+ return info.getValue(); -+ // Paper end - } else { - Permission perm = Bukkit.getServer().getPluginManager().getPermission(name); - -@@ -93,15 +96,18 @@ public class PermissibleBase implements Permissible { - - String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH); - -- if (isPermissionSet(name)) { -- return permissions.get(name).getValue(); -+ // Paper start -+ PermissionAttachmentInfo info = permissions.get(name); -+ if (info != null) { -+ return info.getValue(); - } -+ // Paper end - return perm.getDefault().getValue(isOp()); - } - - @Override - @NotNull -- public PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) { -+ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value) { // Paper - synchronized - if (name == null) { - throw new IllegalArgumentException("Permission name cannot be null"); - } else if (plugin == null) { -@@ -120,7 +126,7 @@ public class PermissibleBase implements Permissible { - - @Override - @NotNull -- public PermissionAttachment addAttachment(@NotNull Plugin plugin) { -+ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin) { // Paper - synchronized - if (plugin == null) { - throw new IllegalArgumentException("Plugin cannot be null"); - } else if (!plugin.isEnabled()) { -@@ -136,7 +142,7 @@ public class PermissibleBase implements Permissible { - } - - @Override -- public void removeAttachment(@NotNull PermissionAttachment attachment) { -+ public synchronized void removeAttachment(@NotNull PermissionAttachment attachment) { // Paper - synchronized - if (attachment == null) { - throw new IllegalArgumentException("Attachment cannot be null"); - } -@@ -155,7 +161,7 @@ public class PermissibleBase implements Permissible { - } - - @Override -- public void recalculatePermissions() { -+ public synchronized void recalculatePermissions() { // Paper - synchronized - clearPermissions(); - Set defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(isOp()); - Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(isOp(), parent); -@@ -204,7 +210,7 @@ public class PermissibleBase implements Permissible { - - @Override - @Nullable -- public PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) { -+ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin, @NotNull String name, boolean value, int ticks) { // Paper - if (name == null) { - throw new IllegalArgumentException("Permission name cannot be null"); - } else if (plugin == null) { -@@ -224,7 +230,7 @@ public class PermissibleBase implements Permissible { - - @Override - @Nullable -- public PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) { -+ public synchronized PermissionAttachment addAttachment(@NotNull Plugin plugin, int ticks) { // Paper - synchronized - if (plugin == null) { - throw new IllegalArgumentException("Plugin cannot be null"); - } else if (!plugin.isEnabled()) { -@@ -244,7 +250,7 @@ public class PermissibleBase implements Permissible { - - @Override - @NotNull -- public Set getEffectivePermissions() { -+ public synchronized Set getEffectivePermissions() { // Paper - synchronized - return new HashSet(permissions.values()); - } - diff --git a/patches/api/0150-Add-ItemStackRecipeChoice-Draft-API.patch b/patches/api/0150-Add-ItemStackRecipeChoice-Draft-API.patch deleted file mode 100644 index 4cfddc6f59..0000000000 --- a/patches/api/0150-Add-ItemStackRecipeChoice-Draft-API.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 13 Sep 2018 21:39:26 -0400 -Subject: [PATCH] Add ItemStackRecipeChoice Draft API - -This is based on Spigots Draft API. This is subject to change - -Allows creating recipes that must match isSimilar to full item stack. - -diff --git a/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java -new file mode 100644 -index 0000000000000000000000000000000000000000..18c96aeef00dc11e5083001adfba4204f0de4e2b ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java -@@ -0,0 +1,52 @@ -+package com.destroystokyo.paper.inventory; -+ -+import org.bukkit.inventory.ItemStack; -+import org.bukkit.inventory.RecipeChoice; -+ -+import java.util.ArrayList; -+import java.util.List; -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * Allows crafting Items that require full matching itemstacks to complete the recipe for custom items -+ * @deprecated Draft API -+ */ -+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+public class ItemStackRecipeChoice implements RecipeChoice { -+ -+ protected final List choices = new ArrayList<>(); -+ -+ public ItemStackRecipeChoice(ItemStack choices) { -+ this.choices.add(choices); -+ } -+ -+ public ItemStackRecipeChoice(List choices) { -+ this.choices.addAll(choices); -+ } -+ -+ @Override -+ public ItemStack getItemStack() { -+ return choices.isEmpty() ? null : choices.get(0); -+ } -+ -+ @Override -+ public RecipeChoice clone() { -+ try { -+ ItemStackRecipeChoice clone = (ItemStackRecipeChoice) super.clone(); -+ clone.choices.addAll(this.choices); -+ return clone; -+ } catch (CloneNotSupportedException ex) { -+ throw new AssertionError(ex); -+ } -+ } -+ -+ @Override -+ public boolean test(ItemStack itemStack) { -+ for (ItemStack stack : choices) { -+ if (stack.isSimilar(itemStack)) { -+ return true; -+ } -+ } -+ return false; -+ } -+} diff --git a/patches/api/0150-Implement-furnace-cook-speed-multiplier-API.patch b/patches/api/0150-Implement-furnace-cook-speed-multiplier-API.patch new file mode 100644 index 0000000000..6e836a844d --- /dev/null +++ b/patches/api/0150-Implement-furnace-cook-speed-multiplier-API.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tassu +Date: Thu, 13 Sep 2018 08:45:01 +0300 +Subject: [PATCH] Implement furnace cook speed multiplier API + +Signed-off-by: Tassu + +diff --git a/src/main/java/org/bukkit/block/Furnace.java b/src/main/java/org/bukkit/block/Furnace.java +index ac3b24c5c99eeb1435d785efade728dd40947da5..dbdf3dbe9517b09a7965cf9d65cae1edd87af67d 100644 +--- a/src/main/java/org/bukkit/block/Furnace.java ++++ b/src/main/java/org/bukkit/block/Furnace.java +@@ -74,6 +74,26 @@ public interface Furnace extends Container { + @NotNull + public Map, Integer> getRecipesUsed(); + ++ // Paper start ++ /** ++ * Gets the cook speed multiplier that this {@link Furnace} will cook ++ * compared to vanilla. ++ * ++ * @return the multiplier, a value between 0 and 200 ++ */ ++ public double getCookSpeedMultiplier(); ++ ++ /** ++ * Sets the speed multiplier that this {@link Furnace} will cook ++ * compared to vanilla. ++ * ++ * @param multiplier the multiplier to set, a value between 0 and 200 ++ * @throws IllegalArgumentException if value is less than 0 ++ * @throws IllegalArgumentException if value is more than 200 ++ */ ++ public void setCookSpeedMultiplier(double multiplier); ++ // Paper end ++ + @NotNull + @Override + public FurnaceInventory getInventory(); +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +index 0808e7aeffb69160913344de5b5e21d5e857f1d6..d386ab5dd46cc6706ace61fe6b646713ffd50cb7 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +@@ -18,10 +18,17 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { + private final CookingRecipe recipe; + private int totalCookTime; + ++ @Deprecated // Paper - furnace cook speed multiplier + public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull final CookingRecipe recipe) { ++ // Paper start ++ this(furnace, source, recipe, recipe.getCookingTime()); ++ } ++ ++ public FurnaceStartSmeltEvent(final @NotNull Block furnace, final @NotNull ItemStack source, final @NotNull CookingRecipe recipe, final int cookingTime) { ++ // Paper end + super(furnace, source); + this.recipe = recipe; +- this.totalCookTime = recipe.getCookingTime(); ++ this.totalCookTime = cookingTime; // Paper - furnace cook speed multiplier + } + + /** diff --git a/patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch b/patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch deleted file mode 100644 index 6e836a844d..0000000000 --- a/patches/api/0151-Implement-furnace-cook-speed-multiplier-API.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tassu -Date: Thu, 13 Sep 2018 08:45:01 +0300 -Subject: [PATCH] Implement furnace cook speed multiplier API - -Signed-off-by: Tassu - -diff --git a/src/main/java/org/bukkit/block/Furnace.java b/src/main/java/org/bukkit/block/Furnace.java -index ac3b24c5c99eeb1435d785efade728dd40947da5..dbdf3dbe9517b09a7965cf9d65cae1edd87af67d 100644 ---- a/src/main/java/org/bukkit/block/Furnace.java -+++ b/src/main/java/org/bukkit/block/Furnace.java -@@ -74,6 +74,26 @@ public interface Furnace extends Container { - @NotNull - public Map, Integer> getRecipesUsed(); - -+ // Paper start -+ /** -+ * Gets the cook speed multiplier that this {@link Furnace} will cook -+ * compared to vanilla. -+ * -+ * @return the multiplier, a value between 0 and 200 -+ */ -+ public double getCookSpeedMultiplier(); -+ -+ /** -+ * Sets the speed multiplier that this {@link Furnace} will cook -+ * compared to vanilla. -+ * -+ * @param multiplier the multiplier to set, a value between 0 and 200 -+ * @throws IllegalArgumentException if value is less than 0 -+ * @throws IllegalArgumentException if value is more than 200 -+ */ -+ public void setCookSpeedMultiplier(double multiplier); -+ // Paper end -+ - @NotNull - @Override - public FurnaceInventory getInventory(); -diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -index 0808e7aeffb69160913344de5b5e21d5e857f1d6..d386ab5dd46cc6706ace61fe6b646713ffd50cb7 100644 ---- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -@@ -18,10 +18,17 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { - private final CookingRecipe recipe; - private int totalCookTime; - -+ @Deprecated // Paper - furnace cook speed multiplier - public FurnaceStartSmeltEvent(@NotNull final Block furnace, @NotNull ItemStack source, @NotNull final CookingRecipe recipe) { -+ // Paper start -+ this(furnace, source, recipe, recipe.getCookingTime()); -+ } -+ -+ public FurnaceStartSmeltEvent(final @NotNull Block furnace, final @NotNull ItemStack source, final @NotNull CookingRecipe recipe, final int cookingTime) { -+ // Paper end - super(furnace, source); - this.recipe = recipe; -- this.totalCookTime = recipe.getCookingTime(); -+ this.totalCookTime = cookingTime; // Paper - furnace cook speed multiplier - } - - /** diff --git a/patches/api/0151-Material-API-additions.patch b/patches/api/0151-Material-API-additions.patch new file mode 100644 index 0000000000..9405b650d1 --- /dev/null +++ b/patches/api/0151-Material-API-additions.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 6 Oct 2018 21:14:29 -0400 +Subject: [PATCH] Material API additions + + +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 2750e143a3ac20797e16a15b687952157197d562..c2808db693647bdf3b9617cb6c665e8499874485 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -125,6 +125,7 @@ import org.jetbrains.annotations.Nullable; + /** + * An enum of all material IDs accepted by the official server and client + */ ++@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper + public enum Material implements Keyed, Translatable { + // + AIR(9648, 0), +@@ -4725,6 +4726,22 @@ public enum Material implements Keyed, Translatable { + } + } + ++ // Paper start ++ ++ /** ++ * @return If the type is either AIR, CAVE_AIR or VOID_AIR ++ */ ++ public boolean isEmpty() { ++ switch (this) { ++ case AIR: ++ case CAVE_AIR: ++ case VOID_AIR: ++ return true; ++ } ++ return false; ++ } ++ // Paper end ++ + /** + * Do not use for any reason. + * diff --git a/patches/api/0152-Add-Material-Tags.patch b/patches/api/0152-Add-Material-Tags.patch new file mode 100644 index 0000000000..9c8781e5b6 --- /dev/null +++ b/patches/api/0152-Add-Material-Tags.patch @@ -0,0 +1,1239 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 17 Jul 2018 01:27:15 -0400 +Subject: [PATCH] Add Material Tags + +This adds a bunch of useful and missing Tags to be able to identify items that +are related to each other by a trait. + +Co-authored-by: Jake Potrebic +Co-authored-by: Lena Kolb +Co-authored-by: Layla Silbernberg + +diff --git a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab01565b3d92a +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java +@@ -0,0 +1,97 @@ ++/* ++ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License ++ */ ++ ++package com.destroystokyo.paper; ++ ++import com.google.common.collect.Lists; ++import io.papermc.paper.tag.BaseTag; ++import org.bukkit.Material; ++import org.bukkit.NamespacedKey; ++import org.bukkit.block.Block; ++import org.bukkit.block.BlockState; ++import org.bukkit.block.data.BlockData; ++import org.bukkit.inventory.ItemStack; ++ ++import java.util.Collection; ++import java.util.Set; ++import java.util.function.Predicate; ++import java.util.stream.Collectors; ++import java.util.stream.Stream; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public class MaterialSetTag extends BaseTag { ++ ++ /** ++ * @deprecated Use NamespacedKey version of constructor ++ */ ++ @Deprecated ++ public MaterialSetTag(@NotNull Predicate filter) { ++ this(null, Stream.of(Material.values()).filter(filter).collect(Collectors.toList())); ++ } ++ ++ /** ++ * @deprecated Use NamespacedKey version of constructor ++ */ ++ @Deprecated ++ public MaterialSetTag(@NotNull Collection materials) { ++ this(null, materials); ++ } ++ ++ /** ++ * @deprecated Use NamespacedKey version of constructor ++ */ ++ @Deprecated ++ public MaterialSetTag(@NotNull Material... materials) { ++ this(null, materials); ++ } ++ ++ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Predicate filter) { ++ this(key, Stream.of(Material.values()).filter(filter).collect(Collectors.toList())); ++ } ++ ++ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Material... materials) { ++ this(key, Lists.newArrayList(materials)); ++ } ++ ++ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection materials) { ++ this(key != null ? key : NamespacedKey.randomKey(), materials, ((Predicate) Material::isLegacy).negate()); ++ } ++ ++ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection materials, @NotNull Predicate...globalPredicates) { ++ super(Material.class, key != null ? key : NamespacedKey.randomKey(), materials, globalPredicates); ++ } ++ ++ @NotNull ++ @Override ++ protected Set getAllPossibleValues() { ++ return Stream.of(Material.values()).collect(Collectors.toSet()); ++ } ++ ++ @Override ++ @NotNull ++ protected String getName(@NotNull Material value) { ++ return value.name(); ++ } ++ ++ public boolean isTagged(@NotNull BlockData block) { ++ return isTagged(block.getMaterial()); ++ } ++ ++ public boolean isTagged(@NotNull BlockState block) { ++ return isTagged(block.getType()); ++ } ++ ++ public boolean isTagged(@NotNull Block block) { ++ return isTagged(block.getType()); ++ } ++ ++ public boolean isTagged(@NotNull ItemStack item) { ++ return isTagged(item.getType()); ++ } ++ ++ public boolean isTagged(@NotNull Material material) { ++ return this.tagged.contains(material); ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java +new file mode 100644 +index 0000000000000000000000000000000000000000..be212b4fbeabab32a4dab6ae554768c368efaa88 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java +@@ -0,0 +1,717 @@ ++/* ++ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be ++ * included in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ++ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION ++ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++package com.destroystokyo.paper; ++ ++import org.bukkit.Material; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Tag; ++ ++/** ++ * Represents a collection tags to identify materials that share common properties. ++ * Will map to minecraft for missing tags, as well as custom ones that may be useful. ++ *

++ * All tags in this class are unmodifiable, attempting to modify them will throw an ++ * {@link UnsupportedOperationException}. ++ */ ++@SuppressWarnings({"NonFinalUtilityClass", "unused", "WeakerAccess"}) ++public class MaterialTags { ++ ++ private static NamespacedKey keyFor(String key) { ++ //noinspection deprecation ++ return new NamespacedKey("paper", key + "_settag"); ++ } ++ public static final MaterialSetTag ARROWS = new MaterialSetTag(keyFor("arrows")) ++ .endsWith("ARROW") ++ .ensureSize("ARROWS", 3).lock(); ++ ++ /** ++ * Covers all colors of beds. ++ */ ++ public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds")) ++ .endsWith("_BED") ++ .ensureSize("BEDS", 16).lock(); ++ ++ /** ++ * Covers all bucket items. ++ */ ++ public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets")) ++ .endsWith("BUCKET") ++ .ensureSize("BUCKETS", 11).lock(); ++ ++ /** ++ * Covers coal and charcoal. ++ */ ++ public static final MaterialSetTag COALS = new MaterialSetTag(keyFor("coals")) ++ .add(Material.COAL, Material.CHARCOAL).lock(); ++ ++ /** ++ * Covers both cobblestone wall variants. ++ */ ++ public static final MaterialSetTag COBBLESTONE_WALLS = new MaterialSetTag(keyFor("cobblestone_walls")) ++ .endsWith("COBBLESTONE_WALL") ++ .ensureSize("COBBLESTONE_WALLS", 2).lock(); ++ ++ /** ++ * Covers both cobblestone and mossy Cobblestone. ++ */ ++ public static final MaterialSetTag COBBLESTONES = new MaterialSetTag(keyFor("cobblestones")) ++ .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE).lock(); ++ ++ /** ++ * Covers all colors of concrete. ++ */ ++ public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes")) ++ .endsWith("_CONCRETE") ++ .ensureSize("CONCRETES", 16).lock(); ++ ++ /** ++ * Covers all colors of concrete powder. ++ */ ++ public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder")) ++ .endsWith("_CONCRETE_POWDER") ++ .ensureSize("CONCRETE_POWDER", 16).lock(); ++ ++ /** ++ * Covers the two types of cooked fish. ++ */ ++ public static final MaterialSetTag COOKED_FISH = new MaterialSetTag(keyFor("cooked_fish")) ++ .add(Material.COOKED_COD, Material.COOKED_SALMON).lock(); ++ ++ /** ++ * Covers all variants of doors. ++ */ ++ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors")) ++ .endsWith("_DOOR") ++ .ensureSize("DOORS", 20).lock(); ++ ++ /** ++ * Covers all dyes. ++ */ ++ public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes")) ++ .endsWith("_DYE") ++ .ensureSize("DYES", 16).lock(); ++ ++ /** ++ * Covers all variants of gates. ++ */ ++ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) ++ .endsWith("_GATE") ++ .ensureSize("FENCE_GATES", 11).lock(); ++ ++ /** ++ * Covers all variants of fences. ++ */ ++ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) ++ .endsWith("_FENCE") ++ .ensureSize("FENCES", 12).lock(); ++ ++ /** ++ * Covers all variants of fish buckets. ++ */ ++ public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets")) ++ .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET).lock(); ++ ++ /** ++ * Covers the non-colored glass and 16 stained glass (not panes). ++ */ ++ public static final MaterialSetTag GLASS = new MaterialSetTag(keyFor("glass")) ++ .endsWith("_GLASS") ++ .add(Material.GLASS) ++ .ensureSize("GLASS", 18).lock(); ++ ++ /** ++ * Covers the non-colored glass panes and stained glass panes (panes only). ++ */ ++ public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes")) ++ .endsWith("GLASS_PANE") ++ .ensureSize("GLASS_PANES", 17).lock(); ++ ++ /** ++ * Covers all glazed terracotta blocks. ++ */ ++ public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta")) ++ .endsWith("GLAZED_TERRACOTTA") ++ .ensureSize("GLAZED_TERRACOTTA", 16).lock(); ++ ++ /** ++ * Covers the colors of stained terracotta. ++ */ ++ public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta")) ++ .endsWith("TERRACOTTA") ++ .not(Material.TERRACOTTA) ++ .notEndsWith("GLAZED_TERRACOTTA") ++ .ensureSize("STAINED_TERRACOTTA", 16).lock(); ++ ++ /** ++ * Covers terracotta along with the stained variants. ++ */ ++ public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta")) ++ .endsWith("TERRACOTTA") ++ .ensureSize("TERRACOTTA", 33).lock(); ++ ++ /** ++ * Covers both golden apples. ++ */ ++ public static final MaterialSetTag GOLDEN_APPLES = new MaterialSetTag(keyFor("golden_apples")) ++ .endsWith("GOLDEN_APPLE") ++ .ensureSize("GOLDEN_APPLES", 2).lock(); ++ ++ /** ++ * Covers the variants of horse armor. ++ */ ++ public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors")) ++ .endsWith("_HORSE_ARMOR") ++ .ensureSize("HORSE_ARMORS", 4).lock(); ++ ++ /** ++ * Covers the variants of infested blocks. ++ */ ++ public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks")) ++ .startsWith("INFESTED_") ++ .ensureSize("INFESTED_BLOCKS", 7).lock(); ++ ++ /** ++ * Covers the variants of mushroom blocks. ++ */ ++ public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks")) ++ .endsWith("MUSHROOM_BLOCK") ++ .add(Material.MUSHROOM_STEM) ++ .ensureSize("MUSHROOM_BLOCKS", 3).lock(); ++ ++ /** ++ * Covers all mushrooms. ++ */ ++ public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms")) ++ .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM).lock(); ++ ++ /** ++ * Covers all music disc items. ++ */ ++ public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs")) ++ .startsWith("MUSIC_DISC_").lock(); ++ ++ /** ++ * Covers all ores. ++ */ ++ public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores")) ++ .add(Material.ANCIENT_DEBRIS) ++ .endsWith("_ORE") ++ .ensureSize("ORES", 19).lock(); ++ ++ /** ++ * Covers all piston typed items and blocks including the piston head and moving piston. ++ */ ++ public static final MaterialSetTag PISTONS = new MaterialSetTag(keyFor("pistons")) ++ .contains("PISTON") ++ .ensureSize("PISTONS", 4).lock(); ++ ++ /** ++ * Covers all potato items. ++ */ ++ public static final MaterialSetTag POTATOES = new MaterialSetTag(keyFor("potatoes")) ++ .endsWith("POTATO") ++ .ensureSize("POTATOES", 3).lock(); ++ ++ /** ++ * Covers all wooden pressure plates and the weighted pressure plates and the stone pressure plate. ++ */ ++ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) ++ .endsWith("_PRESSURE_PLATE") ++ .ensureSize("PRESSURE_PLATES", 15).lock(); ++ ++ /** ++ * Covers the variants of prismarine blocks. ++ */ ++ public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine")) ++ .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE).lock(); ++ ++ /** ++ * Covers the variants of prismarine slabs. ++ */ ++ public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs")) ++ .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB).lock(); ++ ++ /** ++ * Covers the variants of prismarine stairs. ++ */ ++ public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs")) ++ .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS).lock(); ++ ++ /** ++ * Covers the variants of pumpkins. ++ */ ++ public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins")) ++ .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN).lock(); ++ ++ /** ++ * Covers the variants of quartz blocks. ++ */ ++ public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks")) ++ .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ).lock(); ++ ++ /** ++ * Covers all uncooked fish items. ++ */ ++ public static final MaterialSetTag RAW_FISH = new MaterialSetTag(keyFor("raw_fish")) ++ .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH).lock(); ++ ++ /** ++ * Covers the variants of red sandstone blocks. ++ */ ++ public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones")) ++ .endsWith("RED_SANDSTONE") ++ .ensureSize("RED_SANDSTONES", 4).lock(); ++ ++ /** ++ * Covers the variants of sandstone blocks. ++ */ ++ public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones")) ++ .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE).lock(); ++ ++ /** ++ * Covers sponge and wet sponge. ++ */ ++ public static final MaterialSetTag SPONGES = new MaterialSetTag(keyFor("sponges")) ++ .endsWith("SPONGE") ++ .ensureSize("SPONGES", 2).lock(); ++ ++ /** ++ * Covers the non-colored and colored shulker boxes. ++ */ ++ public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes")) ++ .endsWith("SHULKER_BOX") ++ .ensureSize("SHULKER_BOXES", 17).lock(); ++ ++ /** ++ * Covers zombie, creeper, skeleton, dragon, and player heads. ++ */ ++ public static final MaterialSetTag SKULLS = new MaterialSetTag(keyFor("skulls")) ++ .endsWith("_HEAD") ++ .endsWith("_SKULL") ++ .not(Material.PISTON_HEAD) ++ .ensureSize("SKULLS", 14).lock(); ++ ++ /** ++ * Covers all spawn egg items. ++ */ ++ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) ++ .endsWith("_SPAWN_EGG") ++ .ensureSize("SPAWN_EGGS", 80).lock(); ++ ++ /** ++ * Covers all colors of stained glass. ++ */ ++ public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass")) ++ .endsWith("_STAINED_GLASS") ++ .ensureSize("STAINED_GLASS", 16).lock(); ++ ++ /** ++ * Covers all colors of stained glass panes. ++ */ ++ public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes")) ++ .endsWith("STAINED_GLASS_PANE") ++ .ensureSize("STAINED_GLASS_PANES", 16).lock(); ++ ++ /** ++ * Covers all variants of trapdoors. ++ */ ++ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) ++ .endsWith("_TRAPDOOR") ++ .ensureSize("TRAPDOORS", 20).lock(); ++ ++ /** ++ * Covers all wood variants of doors. ++ */ ++ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors")) ++ .endsWith("_DOOR") ++ .not(Material.IRON_DOOR) ++ .notContains("COPPER") ++ .ensureSize("WOODEN_DOORS", 11).lock(); ++ ++ /** ++ * Covers all wood variants of fences. ++ */ ++ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) ++ .endsWith("_FENCE") ++ .not(Material.NETHER_BRICK_FENCE) ++ .ensureSize("WOODEN_FENCES", 11).lock(); ++ ++ /** ++ * Covers all wood variants of trapdoors. ++ */ ++ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) ++ .endsWith("_TRAPDOOR") ++ .not(Material.IRON_TRAPDOOR) ++ .notContains("COPPER") ++ .ensureSize("WOODEN_TRAPDOORS", 11).lock(); ++ ++ /** ++ * Covers the wood variants of gates. ++ */ ++ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) ++ .endsWith("_GATE") ++ .ensureSize("WOODEN_GATES", 11).lock(); ++ ++ /** ++ * Covers the variants of purpur. ++ */ ++ public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur")) ++ .startsWith("PURPUR_") ++ .ensureSize("PURPUR", 4).lock(); ++ ++ /** ++ * Covers the variants of signs. ++ */ ++ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) ++ .endsWith("_SIGN") ++ .ensureSize("SIGNS", 44).lock(); ++ ++ /** ++ * Covers the variants of a regular torch. ++ */ ++ public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch")) ++ .add(Material.TORCH, Material.WALL_TORCH) ++ .ensureSize("TORCH", 2).lock(); ++ ++ /** ++ * Covers the variants of a redstone torch. ++ */ ++ public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("redstone_torch")) ++ .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH) ++ .ensureSize("REDSTONE_TORCH", 2).lock(); ++ ++ /** ++ * Covers the variants of a soul torch. ++ */ ++ public static final MaterialSetTag SOUL_TORCH = new MaterialSetTag(keyFor("soul_torch")) ++ .add(Material.SOUL_TORCH, Material.SOUL_WALL_TORCH) ++ .ensureSize("SOUL_TORCH", 2).lock(); ++ ++ /** ++ * Covers the variants of torches. ++ */ ++ public static final MaterialSetTag TORCHES = new MaterialSetTag(keyFor("torches")) ++ .add(TORCH, REDSTONE_TORCH, SOUL_TORCH) ++ .ensureSize("TORCHES", 6).lock(); ++ ++ /** ++ * Covers the variants of lanterns. ++ */ ++ public static final MaterialSetTag LANTERNS = new MaterialSetTag(keyFor("lanterns")) ++ .add(Material.LANTERN, Material.SOUL_LANTERN) ++ .ensureSize("LANTERNS", 2).lock(); ++ ++ /** ++ * Covers the variants of rails. ++ */ ++ public static final MaterialSetTag RAILS = new MaterialSetTag(keyFor("rails")) ++ .endsWith("RAIL") ++ .ensureSize("RAILS", 4).lock(); ++ ++ /** ++ * Covers the variants of swords. ++ */ ++ public static final MaterialSetTag SWORDS = new MaterialSetTag(keyFor("swords")) ++ .endsWith("_SWORD") ++ .ensureSize("SWORDS", 6).lock(); ++ ++ /** ++ * Covers the variants of shovels. ++ */ ++ public static final MaterialSetTag SHOVELS = new MaterialSetTag(keyFor("shovels")) ++ .endsWith("_SHOVEL") ++ .ensureSize("SHOVELS", 6).lock(); ++ ++ /** ++ * Covers the variants of pickaxes. ++ */ ++ public static final MaterialSetTag PICKAXES = new MaterialSetTag(keyFor("pickaxes")) ++ .endsWith("_PICKAXE") ++ .ensureSize("PICKAXES", 6).lock(); ++ ++ /** ++ * Covers the variants of axes. ++ */ ++ public static final MaterialSetTag AXES = new MaterialSetTag(keyFor("axes")) ++ .endsWith("_AXE") ++ .ensureSize("AXES", 6).lock(); ++ ++ /** ++ * Covers the variants of hoes. ++ */ ++ public static final MaterialSetTag HOES = new MaterialSetTag(keyFor("hoes")) ++ .endsWith("_HOE") ++ .ensureSize("HOES", 6).lock(); ++ ++ /** ++ * Covers the variants of helmets. ++ */ ++ public static final MaterialSetTag HELMETS = new MaterialSetTag(keyFor("helmets")) ++ .endsWith("_HELMET") ++ .ensureSize("HELMETS", 7).lock(); ++ ++ /** ++ * Covers the variants of items that can be equipped in the helmet slot. ++ */ ++ public static final MaterialSetTag HEAD_EQUIPPABLE = new MaterialSetTag(keyFor("head_equippable")) ++ .endsWith("_HELMET") ++ .add(SKULLS) ++ .add(Material.CARVED_PUMPKIN) ++ .ensureSize("HEAD_EQUIPPABLE", 22).lock(); ++ ++ /** ++ * Covers the variants of chestplate. ++ */ ++ public static final MaterialSetTag CHESTPLATES = new MaterialSetTag(keyFor("chestplates")) ++ .endsWith("_CHESTPLATE") ++ .ensureSize("CHESTPLATES", 6).lock(); ++ ++ /** ++ * Covers the variants of items that can be equipped in the chest slot. ++ */ ++ public static final MaterialSetTag CHEST_EQUIPPABLE = new MaterialSetTag(keyFor("chest_equippable")) ++ .endsWith("_CHESTPLATE") ++ .add(Material.ELYTRA) ++ .ensureSize("CHEST_EQUIPPABLE", 7).lock(); ++ ++ /** ++ * Covers the variants of leggings. ++ */ ++ public static final MaterialSetTag LEGGINGS = new MaterialSetTag(keyFor("leggings")) ++ .endsWith("_LEGGINGS") ++ .ensureSize("LEGGINGS", 6).lock(); ++ ++ /** ++ * Covers the variants of boots. ++ */ ++ public static final MaterialSetTag BOOTS = new MaterialSetTag(keyFor("boots")) ++ .endsWith("_BOOTS") ++ .ensureSize("BOOTS", 6).lock(); ++ ++ /** ++ * Covers all variants of armor. ++ */ ++ public static final MaterialSetTag ARMOR = new MaterialSetTag(keyFor("armor")).add(HELMETS, CHESTPLATES, LEGGINGS, BOOTS) ++ .ensureSize("ARMOR", 25).lock(); ++ ++ /** ++ * Covers the variants of bows. ++ */ ++ public static final MaterialSetTag BOWS = new MaterialSetTag(keyFor("bows")) ++ .add(Material.BOW) ++ .add(Material.CROSSBOW) ++ .ensureSize("BOWS", 2).lock(); ++ ++ /** ++ * Covers the variants of player-throwable projectiles (not requiring a bow or any other "assistance"). ++ */ ++ public static final MaterialSetTag THROWABLE_PROJECTILES = new MaterialSetTag(keyFor("throwable_projectiles")) ++ .add(Material.EGG, Material.SNOWBALL, Material.SPLASH_POTION, Material.TRIDENT, Material.ENDER_PEARL, Material.EXPERIENCE_BOTTLE, Material.FIREWORK_ROCKET).lock(); ++ ++ /** ++ * Covers materials that can be colored, such as wool, shulker boxes, stained glass etc. ++ */ ++ @SuppressWarnings("unchecked") ++ public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable")) ++ .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock(); ++ //.ensureSize("COLORABLE", 81).lock(); unit test don't have the vanilla item tags, so counts don't line up for real ++ ++ /** ++ * Covers the variants of coral. ++ */ ++ public static final MaterialSetTag CORAL = new MaterialSetTag(keyFor("coral")) ++ .endsWith("_CORAL") ++ .ensureSize("CORAL", 10).lock(); ++ ++ /** ++ * Covers the variants of coral fans. ++ */ ++ public static final MaterialSetTag CORAL_FANS = new MaterialSetTag(keyFor("coral_fans")) ++ .endsWith("_CORAL_FAN") ++ .endsWith("_CORAL_WALL_FAN") ++ .ensureSize("CORAL_FANS", 20).lock(); ++ ++ /** ++ * Covers the variants of coral blocks. ++ */ ++ public static final MaterialSetTag CORAL_BLOCKS = new MaterialSetTag(keyFor("coral_blocks")) ++ .endsWith("_CORAL_BLOCK") ++ .ensureSize("CORAL_BLOCKS", 10).lock(); ++ ++ /** ++ * Covers all items that can be enchanted from the enchantment table or anvil. ++ */ ++ public static final MaterialSetTag ENCHANTABLE = new MaterialSetTag(keyFor("enchantable")) ++ .add(PICKAXES, SWORDS, SHOVELS, AXES, HOES, HELMETS, CHEST_EQUIPPABLE, LEGGINGS, BOOTS, BOWS) ++ .add(Material.TRIDENT, Material.SHIELD, Material.FISHING_ROD, Material.SHEARS, ++ Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK, ++ Material.BRUSH, Material.CARVED_PUMPKIN, Material.COMPASS, Material.SKELETON_SKULL, ++ Material.WITHER_SKELETON_SKULL, Material.PLAYER_HEAD, Material.ZOMBIE_HEAD, ++ Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD) ++ .ensureSize("ENCHANTABLE", 75).lock(); ++ ++ /** ++ * Covers the variants of raw ores. ++ */ ++ public static final MaterialSetTag RAW_ORES = new MaterialSetTag(keyFor("raw_ores")) ++ .add(Material.RAW_COPPER, Material.RAW_GOLD, Material.RAW_IRON).lock(); ++ ++ /** ++ * Covers the variants of deepslate ores. ++ */ ++ public static final MaterialSetTag DEEPSLATE_ORES = new MaterialSetTag(keyFor("deepslate_ores")) ++ .add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE")) ++ .ensureSize("DEEPSLATE_ORES", 8).lock(); ++ ++ /** ++ * Covers the variants of raw ore blocks. ++ */ ++ public static final MaterialSetTag RAW_ORE_BLOCKS = new MaterialSetTag(keyFor("raw_ore_blocks")) ++ .add(Material.RAW_COPPER_BLOCK, Material.RAW_GOLD_BLOCK, Material.RAW_IRON_BLOCK).lock(); ++ ++ /** ++ * Covers all oxidized copper blocks. ++ */ ++ public static final MaterialSetTag OXIDIZED_COPPER_BLOCKS = new MaterialSetTag(keyFor("oxidized_copper_blocks")) ++ .startsWith("OXIDIZED_").startsWith("WAXED_OXIDIZED_").ensureSize("OXIDIZED_COPPER_BLOCKS", 18).lock(); ++ ++ /** ++ * Covers all weathered copper blocks. ++ */ ++ public static final MaterialSetTag WEATHERED_COPPER_BLOCKS = new MaterialSetTag(keyFor("weathered_copper_blocks")) ++ .startsWith("WEATHERED_").startsWith("WAXED_WEATHERED_").ensureSize("WEATHERED_COPPER_BLOCKS", 18).lock(); ++ ++ /** ++ * Covers all exposed copper blocks. ++ */ ++ public static final MaterialSetTag EXPOSED_COPPER_BLOCKS = new MaterialSetTag(keyFor("exposed_copper_blocks")) ++ .startsWith("EXPOSED_").startsWith("WAXED_EXPOSED_").ensureSize("EXPOSED_COPPER_BLOCKS", 18).lock(); ++ ++ /** ++ * Covers all un-weathered copper blocks. ++ */ ++ public static final MaterialSetTag UNAFFECTED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unaffected_copper_blocks")) ++ .startsWith("CUT_COPPER").startsWith("WAXED_CUT_COPPER") ++ .startsWith("WAXED_COPPER_").startsWith("COPPER_") ++ .add(Material.CHISELED_COPPER, Material.WAXED_CHISELED_COPPER) ++ .not(Material.COPPER_INGOT, Material.COPPER_ORE) ++ .ensureSize("UNAFFECTED_COPPER_BLOCKS", 18).lock(); ++ ++ /** ++ * Covers all waxed copper blocks. ++ *

++ * Combine with other copper-related tags to filter is-waxed or not. ++ */ ++ public static final MaterialSetTag WAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("waxed_copper_blocks")) ++ .add(m -> m.name().startsWith("WAXED_") && m.name().contains("COPPER")).ensureSize("WAXED_COPPER_BLOCKS", 36).lock(); ++ ++ /** ++ * Covers all un-waxed copper blocks. ++ *

++ * Combine with other copper-related tags to filter is-un-waxed or not. ++ */ ++ public static final MaterialSetTag UNWAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unwaxed_copper_blocks")) ++ .startsWith("EXPOSED_").startsWith("WEATHERED_").startsWith("OXIDIZED_") ++ .startsWith("CUT_COPPER") ++ .add(Material.COPPER_BLOCK, Material.CHISELED_COPPER, Material.COPPER_DOOR, Material.COPPER_TRAPDOOR, Material.COPPER_GRATE, Material.COPPER_BULB) ++ .ensureSize("UNWAXED_COPPER_BLOCKS", 36).lock(); ++ ++ /** ++ * Covers all copper block variants. ++ */ ++ public static final MaterialSetTag COPPER_BLOCKS = new MaterialSetTag(keyFor("copper_blocks")) ++ .add(WAXED_COPPER_BLOCKS).add(UNWAXED_COPPER_BLOCKS).ensureSize("COPPER_BLOCKS", 72).lock(); ++ ++ /** ++ * Covers all weathering/waxed states of the plain copper block. ++ */ ++ public static final MaterialSetTag FULL_COPPER_BLOCKS = new MaterialSetTag(keyFor("full_copper_blocks")) ++ .endsWith("OXIDIZED_COPPER") ++ .endsWith("WEATHERED_COPPER") ++ .endsWith("EXPOSED_COPPER") ++ .endsWith("COPPER_BLOCK") ++ .not(Material.RAW_COPPER_BLOCK) ++ .ensureSize("FULL_COPPER_BLOCKS", 8).lock(); ++ ++ /** ++ * Covers all weathering/waxed states of the cut copper block. ++ */ ++ public static final MaterialSetTag CUT_COPPER_BLOCKS = new MaterialSetTag(keyFor("cut_copper_blocks")) ++ .endsWith("CUT_COPPER").ensureSize("CUT_COPPER_BLOCKS", 8).lock(); ++ ++ /** ++ * Covers all weathering/waxed states of the cut copper stairs. ++ */ ++ public static final MaterialSetTag CUT_COPPER_STAIRS = new MaterialSetTag(keyFor("cut_copper_stairs")) ++ .endsWith("CUT_COPPER_STAIRS").ensureSize("CUT_COPPER_STAIRS", 8).lock(); ++ ++ /** ++ * Covers all weathering/waxed states of the cut copper slab. ++ */ ++ public static final MaterialSetTag CUT_COPPER_SLABS = new MaterialSetTag(keyFor("cut_copper_slabs")) ++ .endsWith("CUT_COPPER_SLAB").ensureSize("CUT_COPPER_SLABS", 8).lock(); ++ ++ /** ++ * Covers all Wooden Tools. ++ */ ++ public static final MaterialSetTag WOODEN_TOOLS = new MaterialSetTag(keyFor("wooden_tools")) ++ .add(Material.WOODEN_AXE, Material.WOODEN_HOE, Material.WOODEN_PICKAXE, Material.WOODEN_SHOVEL, Material.WOODEN_SWORD) ++ .ensureSize("WOODEN_TOOLS", 5).lock(); ++ ++ /** ++ * Covers all Stone Tools. ++ */ ++ public static final MaterialSetTag STONE_TOOLS = new MaterialSetTag(keyFor("stone_tools")) ++ .add(Material.STONE_AXE, Material.STONE_HOE, Material.STONE_PICKAXE, Material.STONE_SHOVEL, Material.STONE_SWORD) ++ .ensureSize("STONE_TOOLS", 5).lock(); ++ ++ /** ++ * Covers all Iron Tools. ++ */ ++ public static final MaterialSetTag IRON_TOOLS = new MaterialSetTag(keyFor("iron_tools")) ++ .add(Material.IRON_AXE, Material.IRON_HOE, Material.IRON_PICKAXE, Material.IRON_SHOVEL, Material.IRON_SWORD) ++ .ensureSize("IRON_TOOLS", 5).lock(); ++ ++ /** ++ * Covers all Gold Tools. ++ */ ++ public static final MaterialSetTag GOLDEN_TOOLS = new MaterialSetTag(keyFor("golden_tools")) ++ .add(Material.GOLDEN_AXE, Material.GOLDEN_HOE, Material.GOLDEN_PICKAXE, Material.GOLDEN_SHOVEL, Material.GOLDEN_SWORD) ++ .ensureSize("GOLDEN_TOOLS", 5).lock(); ++ ++ /** ++ * Covers all Diamond Tools. ++ */ ++ public static final MaterialSetTag DIAMOND_TOOLS = new MaterialSetTag(keyFor("diamond_tools")) ++ .add(Material.DIAMOND_AXE, Material.DIAMOND_HOE, Material.DIAMOND_PICKAXE, Material.DIAMOND_SHOVEL, Material.DIAMOND_SWORD) ++ .ensureSize("DIAMOND_TOOLS", 5).lock(); ++ ++ /** ++ * Covers all Netherite Tools. ++ */ ++ public static final MaterialSetTag NETHERITE_TOOLS = new MaterialSetTag(keyFor("netherite_tools")) ++ .add(Material.NETHERITE_AXE, Material.NETHERITE_HOE, Material.NETHERITE_PICKAXE, Material.NETHERITE_SHOVEL, Material.NETHERITE_SWORD) ++ .ensureSize("NETHERITE_TOOLS", 5).lock(); ++ ++} +diff --git a/src/main/java/io/papermc/paper/tag/BaseTag.java b/src/main/java/io/papermc/paper/tag/BaseTag.java +new file mode 100644 +index 0000000000000000000000000000000000000000..794787912325ae32b3cfc8217bc3fc2159ceabd5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/tag/BaseTag.java +@@ -0,0 +1,181 @@ ++package io.papermc.paper.tag; ++ ++import com.google.common.collect.Lists; ++import java.util.Collections; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Tag; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Collection; ++import java.util.EnumSet; ++import java.util.HashSet; ++import java.util.List; ++import java.util.Set; ++import java.util.function.Predicate; ++import java.util.stream.Collectors; ++ ++public abstract class BaseTag> implements Tag { ++ ++ protected final NamespacedKey key; ++ protected final Set tagged; ++ private final List> globalPredicates; ++ private boolean locked = false; ++ ++ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Predicate filter) { ++ this(clazz, key); ++ add(filter); ++ } ++ ++ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull T...values) { ++ this(clazz, key, Lists.newArrayList(values)); ++ } ++ ++ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Collection values) { ++ this(clazz, key, values, o -> true); ++ } ++ ++ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Collection values, @NotNull Predicate... globalPredicates) { ++ this.key = key != null ? key : NamespacedKey.randomKey(); ++ this.tagged = clazz.isEnum() ? createEnumSet(clazz) : new HashSet<>(); ++ this.tagged.addAll(values); ++ this.globalPredicates = Lists.newArrayList(globalPredicates); ++ } ++ ++ private Set createEnumSet(Class enumClass) { ++ assert enumClass.isEnum(); ++ return (Set) EnumSet.noneOf((Class) enumClass); ++ } ++ ++ public @NotNull C lock() { ++ this.locked = true; ++ return (C) this; ++ } ++ ++ public boolean isLocked() { ++ return this.locked; ++ } ++ ++ private void checkLock() { ++ if (this.locked) { ++ throw new UnsupportedOperationException("Tag (" + this.key + ") is locked"); ++ } ++ } ++ ++ @NotNull ++ @Override ++ public NamespacedKey getKey() { ++ return key; ++ } ++ ++ @NotNull ++ @Override ++ public Set getValues() { ++ return Collections.unmodifiableSet(tagged); ++ } ++ ++ @Override ++ public boolean isTagged(@NotNull T item) { ++ return tagged.contains(item); ++ } ++ ++ @NotNull ++ public C add(@NotNull Tag...tags) { ++ for (Tag tag : tags) { ++ add(tag.getValues()); ++ } ++ return (C) this; ++ } ++ ++ @NotNull ++ public C add(@NotNull T...values) { ++ this.checkLock(); ++ this.tagged.addAll(Lists.newArrayList(values)); ++ return (C) this; ++ } ++ ++ @NotNull ++ public C add(@NotNull Collection collection) { ++ this.checkLock(); ++ this.tagged.addAll(collection); ++ return (C) this; ++ } ++ ++ @NotNull ++ public C add(@NotNull Predicate filter) { ++ return add(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet())); ++ } ++ ++ @NotNull ++ public C contains(@NotNull String with) { ++ return add(value -> getName(value).contains(with)); ++ } ++ ++ @NotNull ++ public C endsWith(@NotNull String with) { ++ return add(value -> getName(value).endsWith(with)); ++ } ++ ++ @NotNull ++ public C startsWith(@NotNull String with) { ++ return add(value -> getName(value).startsWith(with)); ++ } ++ ++ @NotNull ++ public C not(@NotNull Tag...tags) { ++ for (Tag tag : tags) { ++ not(tag.getValues()); ++ } ++ return (C) this; ++ } ++ ++ @NotNull ++ public C not(@NotNull T...values) { ++ this.checkLock(); ++ this.tagged.removeAll(Lists.newArrayList(values)); ++ return (C) this; ++ } ++ ++ @NotNull ++ public C not(@NotNull Collection values) { ++ this.checkLock(); ++ this.tagged.removeAll(values); ++ return (C) this; ++ } ++ ++ @NotNull ++ public C not(@NotNull Predicate filter) { ++ not(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet())); ++ return (C) this; ++ } ++ ++ @NotNull ++ public C notContains(@NotNull String with) { ++ return not(value -> getName(value).contains(with)); ++ } ++ ++ @NotNull ++ public C notEndsWith(@NotNull String with) { ++ return not(value -> getName(value).endsWith(with)); ++ } ++ ++ @NotNull ++ public C notStartsWith(@NotNull String with) { ++ return not(value -> getName(value).startsWith(with)); ++ } ++ ++ @NotNull ++ public C ensureSize(@NotNull String label, int size) { ++ long actual = this.tagged.stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).count(); ++ if (size != actual) { ++ throw new IllegalStateException(key.toString() + ": " + label + " - Expected " + size + " values, got " + actual); ++ } ++ return (C) this; ++ } ++ ++ @NotNull ++ protected abstract Set getAllPossibleValues(); ++ ++ @NotNull ++ protected abstract String getName(@NotNull T value); ++} +diff --git a/src/main/java/io/papermc/paper/tag/EntitySetTag.java b/src/main/java/io/papermc/paper/tag/EntitySetTag.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c89c4619aaf388197834d98eb95af2f1e93db871 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/tag/EntitySetTag.java +@@ -0,0 +1,42 @@ ++package io.papermc.paper.tag; ++ ++import org.bukkit.NamespacedKey; ++import org.bukkit.entity.EntityType; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Collection; ++import java.util.Set; ++import java.util.function.Predicate; ++import java.util.stream.Collectors; ++import java.util.stream.Stream; ++ ++public class EntitySetTag extends BaseTag { ++ ++ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Predicate filter) { ++ super(EntityType.class, key, filter); ++ } ++ ++ public EntitySetTag(@NotNull NamespacedKey key, @NotNull EntityType... values) { ++ super(EntityType.class, key, values); ++ } ++ ++ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Collection values) { ++ super(EntityType.class, key, values); ++ } ++ ++ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Collection values, @NotNull Predicate... globalPredicates) { ++ super(EntityType.class, key, values, globalPredicates); ++ } ++ ++ @NotNull ++ @Override ++ protected Set getAllPossibleValues() { ++ return Stream.of(EntityType.values()).collect(Collectors.toSet()); ++ } ++ ++ @NotNull ++ @Override ++ protected String getName(@NotNull EntityType value) { ++ return value.name(); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/tag/EntityTags.java b/src/main/java/io/papermc/paper/tag/EntityTags.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5376e51adf5af15572b0d760b17f2de6d3f24a9b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/tag/EntityTags.java +@@ -0,0 +1,54 @@ ++package io.papermc.paper.tag; ++ ++import org.bukkit.NamespacedKey; ++ ++import static org.bukkit.entity.EntityType.*; ++ ++/** ++ * All tags in this class are unmodifiable, attempting to modify them will throw an ++ * {@link UnsupportedOperationException}. ++ */ ++public class EntityTags { ++ ++ private static NamespacedKey keyFor(String key) { ++ //noinspection deprecation ++ return new NamespacedKey("paper", key + "_settag"); ++ } ++ ++ /** ++ * Covers undead mobs ++ * @see https://minecraft.wiki/wiki/Mob#Undead_mobs ++ */ ++ public static final EntitySetTag UNDEADS = new EntitySetTag(keyFor("undeads")) ++ .add(DROWNED, HUSK, PHANTOM, SKELETON, SKELETON_HORSE, STRAY, WITHER, WITHER_SKELETON, ZOGLIN, ZOMBIE, ZOMBIE_HORSE, ZOMBIE_VILLAGER, ZOMBIFIED_PIGLIN) ++ .ensureSize("UNDEADS", 13).lock(); ++ ++ /** ++ * Covers all horses ++ */ ++ public static final EntitySetTag HORSES = new EntitySetTag(keyFor("horses")) ++ .contains("HORSE") ++ .ensureSize("HORSES", 3).lock(); ++ ++ /** ++ * Covers all minecarts ++ */ ++ public static final EntitySetTag MINECARTS = new EntitySetTag(keyFor("minecarts")) ++ .contains("MINECART") ++ .ensureSize("MINECARTS", 7).lock(); ++ ++ /** ++ * Covers mobs that split into smaller mobs ++ */ ++ public static final EntitySetTag SPLITTING_MOBS = new EntitySetTag(keyFor("splitting_mobs")) ++ .add(SLIME, MAGMA_CUBE) ++ .ensureSize("SLIMES", 2).lock(); ++ ++ /** ++ * Covers all water based mobs ++ * @see https://minecraft.wiki/wiki/Mob#Aquatic_mobs ++ */ ++ public static final EntitySetTag WATER_BASED = new EntitySetTag(keyFor("water_based")) ++ .add(AXOLOTL, DOLPHIN, SQUID, GLOW_SQUID, GUARDIAN, ELDER_GUARDIAN, TURTLE, COD, SALMON, PUFFERFISH, TROPICAL_FISH) ++ .ensureSize("WATER_BASED", 11).lock(); ++} +diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java +index 1be862110e94654be12fcef5980388abf242ac7f..298ae1294a122705bca6bd74ea540185839d1ed5 100644 +--- a/src/main/java/org/bukkit/Tag.java ++++ b/src/main/java/org/bukkit/Tag.java +@@ -11,6 +11,10 @@ import org.jetbrains.annotations.NotNull; + * Note that whilst all tags defined within this interface must be present in + * implementations, their existence is not guaranteed across future versions. + * ++ *

Custom tags defined by Paper are not present (as constants) in this class. ++ * To access them please refer to {@link com.destroystokyo.paper.MaterialTags} ++ * and {@link io.papermc.paper.tag.EntityTags}.

++ * + * @param the type of things grouped by this tag + */ + public interface Tag extends Keyed { +diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..82ee9a486d1c3deec6e529b1cb12ecc2c6a5862e +--- /dev/null ++++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java +@@ -0,0 +1,58 @@ ++/* ++ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License ++ */ ++ ++package com.destroystokyo.paper; ++ ++import io.papermc.paper.tag.BaseTag; ++import io.papermc.paper.tag.EntityTags; ++import java.lang.reflect.Field; ++import java.lang.reflect.Modifier; ++import java.util.HashSet; ++import java.util.Set; ++import java.util.logging.Level; ++import org.bukkit.Bukkit; ++import org.bukkit.support.AbstractTestingBase; ++import org.junit.jupiter.api.Test; ++ ++import static org.junit.jupiter.api.Assertions.assertTrue; ++ ++public class MaterialTagsTest extends AbstractTestingBase { ++ ++ @Test ++ public void testInitialize() { ++ try { ++ MaterialTags.SHULKER_BOXES.getValues(); ++ assert true; ++ } catch (Throwable e) { ++ Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); ++ assert false; ++ } ++ } ++ ++ @Test ++ public void testLocked() { ++ testLocked(MaterialTags.class); ++ testLocked(EntityTags.class); ++ } ++ ++ private static void testLocked(Class clazz) { ++ for (BaseTag tag : collectTags(clazz)) { ++ assertTrue(tag.isLocked(), "Tag " + tag.key() + " is not locked"); ++ } ++ } ++ ++ private static Set> collectTags(Class clazz) { ++ Set> tags = new HashSet<>(); ++ try { ++ for (Field field : clazz.getDeclaredFields()) { ++ if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && BaseTag.class.isAssignableFrom(field.getType())) { ++ tags.add((BaseTag) field.get(null)); ++ } ++ } ++ } catch (IllegalAccessException e) { ++ e.printStackTrace(); ++ } ++ return tags; ++ } ++} +diff --git a/src/test/java/io/papermc/paper/EntityTagsTest.java b/src/test/java/io/papermc/paper/EntityTagsTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..91d70cc703192b5a3a48211ee0dadd2e4260ec00 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/EntityTagsTest.java +@@ -0,0 +1,21 @@ ++package io.papermc.paper; ++ ++import io.papermc.paper.tag.EntityTags; ++import java.util.logging.Level; ++import org.bukkit.Bukkit; ++import org.bukkit.support.AbstractTestingBase; ++import org.junit.jupiter.api.Test; ++ ++public class EntityTagsTest extends AbstractTestingBase { ++ ++ @Test ++ public void testInitialize() { ++ try { ++ EntityTags.HORSES.getValues(); ++ assert true; ++ } catch (Throwable e) { ++ Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); ++ assert false; ++ } ++ } ++} diff --git a/patches/api/0152-Material-API-additions.patch b/patches/api/0152-Material-API-additions.patch deleted file mode 100644 index 9405b650d1..0000000000 --- a/patches/api/0152-Material-API-additions.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 6 Oct 2018 21:14:29 -0400 -Subject: [PATCH] Material API additions - - -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 2750e143a3ac20797e16a15b687952157197d562..c2808db693647bdf3b9617cb6c665e8499874485 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -125,6 +125,7 @@ import org.jetbrains.annotations.Nullable; - /** - * An enum of all material IDs accepted by the official server and client - */ -+@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper - public enum Material implements Keyed, Translatable { - // - AIR(9648, 0), -@@ -4725,6 +4726,22 @@ public enum Material implements Keyed, Translatable { - } - } - -+ // Paper start -+ -+ /** -+ * @return If the type is either AIR, CAVE_AIR or VOID_AIR -+ */ -+ public boolean isEmpty() { -+ switch (this) { -+ case AIR: -+ case CAVE_AIR: -+ case VOID_AIR: -+ return true; -+ } -+ return false; -+ } -+ // Paper end -+ - /** - * Do not use for any reason. - * diff --git a/patches/api/0153-Add-Material-Tags.patch b/patches/api/0153-Add-Material-Tags.patch deleted file mode 100644 index 9c8781e5b6..0000000000 --- a/patches/api/0153-Add-Material-Tags.patch +++ /dev/null @@ -1,1239 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 17 Jul 2018 01:27:15 -0400 -Subject: [PATCH] Add Material Tags - -This adds a bunch of useful and missing Tags to be able to identify items that -are related to each other by a trait. - -Co-authored-by: Jake Potrebic -Co-authored-by: Lena Kolb -Co-authored-by: Layla Silbernberg - -diff --git a/src/main/java/com/destroystokyo/paper/MaterialSetTag.java b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab01565b3d92a ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/MaterialSetTag.java -@@ -0,0 +1,97 @@ -+/* -+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License -+ */ -+ -+package com.destroystokyo.paper; -+ -+import com.google.common.collect.Lists; -+import io.papermc.paper.tag.BaseTag; -+import org.bukkit.Material; -+import org.bukkit.NamespacedKey; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockState; -+import org.bukkit.block.data.BlockData; -+import org.bukkit.inventory.ItemStack; -+ -+import java.util.Collection; -+import java.util.Set; -+import java.util.function.Predicate; -+import java.util.stream.Collectors; -+import java.util.stream.Stream; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+public class MaterialSetTag extends BaseTag { -+ -+ /** -+ * @deprecated Use NamespacedKey version of constructor -+ */ -+ @Deprecated -+ public MaterialSetTag(@NotNull Predicate filter) { -+ this(null, Stream.of(Material.values()).filter(filter).collect(Collectors.toList())); -+ } -+ -+ /** -+ * @deprecated Use NamespacedKey version of constructor -+ */ -+ @Deprecated -+ public MaterialSetTag(@NotNull Collection materials) { -+ this(null, materials); -+ } -+ -+ /** -+ * @deprecated Use NamespacedKey version of constructor -+ */ -+ @Deprecated -+ public MaterialSetTag(@NotNull Material... materials) { -+ this(null, materials); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Predicate filter) { -+ this(key, Stream.of(Material.values()).filter(filter).collect(Collectors.toList())); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Material... materials) { -+ this(key, Lists.newArrayList(materials)); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection materials) { -+ this(key != null ? key : NamespacedKey.randomKey(), materials, ((Predicate) Material::isLegacy).negate()); -+ } -+ -+ public MaterialSetTag(@Nullable NamespacedKey key, @NotNull Collection materials, @NotNull Predicate...globalPredicates) { -+ super(Material.class, key != null ? key : NamespacedKey.randomKey(), materials, globalPredicates); -+ } -+ -+ @NotNull -+ @Override -+ protected Set getAllPossibleValues() { -+ return Stream.of(Material.values()).collect(Collectors.toSet()); -+ } -+ -+ @Override -+ @NotNull -+ protected String getName(@NotNull Material value) { -+ return value.name(); -+ } -+ -+ public boolean isTagged(@NotNull BlockData block) { -+ return isTagged(block.getMaterial()); -+ } -+ -+ public boolean isTagged(@NotNull BlockState block) { -+ return isTagged(block.getType()); -+ } -+ -+ public boolean isTagged(@NotNull Block block) { -+ return isTagged(block.getType()); -+ } -+ -+ public boolean isTagged(@NotNull ItemStack item) { -+ return isTagged(item.getType()); -+ } -+ -+ public boolean isTagged(@NotNull Material material) { -+ return this.tagged.contains(material); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java -new file mode 100644 -index 0000000000000000000000000000000000000000..be212b4fbeabab32a4dab6ae554768c368efaa88 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java -@@ -0,0 +1,717 @@ -+/* -+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -+ */ -+ -+package com.destroystokyo.paper; -+ -+import org.bukkit.Material; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Tag; -+ -+/** -+ * Represents a collection tags to identify materials that share common properties. -+ * Will map to minecraft for missing tags, as well as custom ones that may be useful. -+ *

-+ * All tags in this class are unmodifiable, attempting to modify them will throw an -+ * {@link UnsupportedOperationException}. -+ */ -+@SuppressWarnings({"NonFinalUtilityClass", "unused", "WeakerAccess"}) -+public class MaterialTags { -+ -+ private static NamespacedKey keyFor(String key) { -+ //noinspection deprecation -+ return new NamespacedKey("paper", key + "_settag"); -+ } -+ public static final MaterialSetTag ARROWS = new MaterialSetTag(keyFor("arrows")) -+ .endsWith("ARROW") -+ .ensureSize("ARROWS", 3).lock(); -+ -+ /** -+ * Covers all colors of beds. -+ */ -+ public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds")) -+ .endsWith("_BED") -+ .ensureSize("BEDS", 16).lock(); -+ -+ /** -+ * Covers all bucket items. -+ */ -+ public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets")) -+ .endsWith("BUCKET") -+ .ensureSize("BUCKETS", 11).lock(); -+ -+ /** -+ * Covers coal and charcoal. -+ */ -+ public static final MaterialSetTag COALS = new MaterialSetTag(keyFor("coals")) -+ .add(Material.COAL, Material.CHARCOAL).lock(); -+ -+ /** -+ * Covers both cobblestone wall variants. -+ */ -+ public static final MaterialSetTag COBBLESTONE_WALLS = new MaterialSetTag(keyFor("cobblestone_walls")) -+ .endsWith("COBBLESTONE_WALL") -+ .ensureSize("COBBLESTONE_WALLS", 2).lock(); -+ -+ /** -+ * Covers both cobblestone and mossy Cobblestone. -+ */ -+ public static final MaterialSetTag COBBLESTONES = new MaterialSetTag(keyFor("cobblestones")) -+ .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE).lock(); -+ -+ /** -+ * Covers all colors of concrete. -+ */ -+ public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes")) -+ .endsWith("_CONCRETE") -+ .ensureSize("CONCRETES", 16).lock(); -+ -+ /** -+ * Covers all colors of concrete powder. -+ */ -+ public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder")) -+ .endsWith("_CONCRETE_POWDER") -+ .ensureSize("CONCRETE_POWDER", 16).lock(); -+ -+ /** -+ * Covers the two types of cooked fish. -+ */ -+ public static final MaterialSetTag COOKED_FISH = new MaterialSetTag(keyFor("cooked_fish")) -+ .add(Material.COOKED_COD, Material.COOKED_SALMON).lock(); -+ -+ /** -+ * Covers all variants of doors. -+ */ -+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors")) -+ .endsWith("_DOOR") -+ .ensureSize("DOORS", 20).lock(); -+ -+ /** -+ * Covers all dyes. -+ */ -+ public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes")) -+ .endsWith("_DYE") -+ .ensureSize("DYES", 16).lock(); -+ -+ /** -+ * Covers all variants of gates. -+ */ -+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) -+ .endsWith("_GATE") -+ .ensureSize("FENCE_GATES", 11).lock(); -+ -+ /** -+ * Covers all variants of fences. -+ */ -+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) -+ .endsWith("_FENCE") -+ .ensureSize("FENCES", 12).lock(); -+ -+ /** -+ * Covers all variants of fish buckets. -+ */ -+ public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets")) -+ .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET).lock(); -+ -+ /** -+ * Covers the non-colored glass and 16 stained glass (not panes). -+ */ -+ public static final MaterialSetTag GLASS = new MaterialSetTag(keyFor("glass")) -+ .endsWith("_GLASS") -+ .add(Material.GLASS) -+ .ensureSize("GLASS", 18).lock(); -+ -+ /** -+ * Covers the non-colored glass panes and stained glass panes (panes only). -+ */ -+ public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes")) -+ .endsWith("GLASS_PANE") -+ .ensureSize("GLASS_PANES", 17).lock(); -+ -+ /** -+ * Covers all glazed terracotta blocks. -+ */ -+ public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta")) -+ .endsWith("GLAZED_TERRACOTTA") -+ .ensureSize("GLAZED_TERRACOTTA", 16).lock(); -+ -+ /** -+ * Covers the colors of stained terracotta. -+ */ -+ public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta")) -+ .endsWith("TERRACOTTA") -+ .not(Material.TERRACOTTA) -+ .notEndsWith("GLAZED_TERRACOTTA") -+ .ensureSize("STAINED_TERRACOTTA", 16).lock(); -+ -+ /** -+ * Covers terracotta along with the stained variants. -+ */ -+ public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta")) -+ .endsWith("TERRACOTTA") -+ .ensureSize("TERRACOTTA", 33).lock(); -+ -+ /** -+ * Covers both golden apples. -+ */ -+ public static final MaterialSetTag GOLDEN_APPLES = new MaterialSetTag(keyFor("golden_apples")) -+ .endsWith("GOLDEN_APPLE") -+ .ensureSize("GOLDEN_APPLES", 2).lock(); -+ -+ /** -+ * Covers the variants of horse armor. -+ */ -+ public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors")) -+ .endsWith("_HORSE_ARMOR") -+ .ensureSize("HORSE_ARMORS", 4).lock(); -+ -+ /** -+ * Covers the variants of infested blocks. -+ */ -+ public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks")) -+ .startsWith("INFESTED_") -+ .ensureSize("INFESTED_BLOCKS", 7).lock(); -+ -+ /** -+ * Covers the variants of mushroom blocks. -+ */ -+ public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks")) -+ .endsWith("MUSHROOM_BLOCK") -+ .add(Material.MUSHROOM_STEM) -+ .ensureSize("MUSHROOM_BLOCKS", 3).lock(); -+ -+ /** -+ * Covers all mushrooms. -+ */ -+ public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms")) -+ .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM).lock(); -+ -+ /** -+ * Covers all music disc items. -+ */ -+ public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs")) -+ .startsWith("MUSIC_DISC_").lock(); -+ -+ /** -+ * Covers all ores. -+ */ -+ public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores")) -+ .add(Material.ANCIENT_DEBRIS) -+ .endsWith("_ORE") -+ .ensureSize("ORES", 19).lock(); -+ -+ /** -+ * Covers all piston typed items and blocks including the piston head and moving piston. -+ */ -+ public static final MaterialSetTag PISTONS = new MaterialSetTag(keyFor("pistons")) -+ .contains("PISTON") -+ .ensureSize("PISTONS", 4).lock(); -+ -+ /** -+ * Covers all potato items. -+ */ -+ public static final MaterialSetTag POTATOES = new MaterialSetTag(keyFor("potatoes")) -+ .endsWith("POTATO") -+ .ensureSize("POTATOES", 3).lock(); -+ -+ /** -+ * Covers all wooden pressure plates and the weighted pressure plates and the stone pressure plate. -+ */ -+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) -+ .endsWith("_PRESSURE_PLATE") -+ .ensureSize("PRESSURE_PLATES", 15).lock(); -+ -+ /** -+ * Covers the variants of prismarine blocks. -+ */ -+ public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine")) -+ .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE).lock(); -+ -+ /** -+ * Covers the variants of prismarine slabs. -+ */ -+ public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs")) -+ .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB).lock(); -+ -+ /** -+ * Covers the variants of prismarine stairs. -+ */ -+ public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs")) -+ .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS).lock(); -+ -+ /** -+ * Covers the variants of pumpkins. -+ */ -+ public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins")) -+ .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN).lock(); -+ -+ /** -+ * Covers the variants of quartz blocks. -+ */ -+ public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks")) -+ .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ).lock(); -+ -+ /** -+ * Covers all uncooked fish items. -+ */ -+ public static final MaterialSetTag RAW_FISH = new MaterialSetTag(keyFor("raw_fish")) -+ .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH).lock(); -+ -+ /** -+ * Covers the variants of red sandstone blocks. -+ */ -+ public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones")) -+ .endsWith("RED_SANDSTONE") -+ .ensureSize("RED_SANDSTONES", 4).lock(); -+ -+ /** -+ * Covers the variants of sandstone blocks. -+ */ -+ public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones")) -+ .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE).lock(); -+ -+ /** -+ * Covers sponge and wet sponge. -+ */ -+ public static final MaterialSetTag SPONGES = new MaterialSetTag(keyFor("sponges")) -+ .endsWith("SPONGE") -+ .ensureSize("SPONGES", 2).lock(); -+ -+ /** -+ * Covers the non-colored and colored shulker boxes. -+ */ -+ public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes")) -+ .endsWith("SHULKER_BOX") -+ .ensureSize("SHULKER_BOXES", 17).lock(); -+ -+ /** -+ * Covers zombie, creeper, skeleton, dragon, and player heads. -+ */ -+ public static final MaterialSetTag SKULLS = new MaterialSetTag(keyFor("skulls")) -+ .endsWith("_HEAD") -+ .endsWith("_SKULL") -+ .not(Material.PISTON_HEAD) -+ .ensureSize("SKULLS", 14).lock(); -+ -+ /** -+ * Covers all spawn egg items. -+ */ -+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) -+ .endsWith("_SPAWN_EGG") -+ .ensureSize("SPAWN_EGGS", 80).lock(); -+ -+ /** -+ * Covers all colors of stained glass. -+ */ -+ public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass")) -+ .endsWith("_STAINED_GLASS") -+ .ensureSize("STAINED_GLASS", 16).lock(); -+ -+ /** -+ * Covers all colors of stained glass panes. -+ */ -+ public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes")) -+ .endsWith("STAINED_GLASS_PANE") -+ .ensureSize("STAINED_GLASS_PANES", 16).lock(); -+ -+ /** -+ * Covers all variants of trapdoors. -+ */ -+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) -+ .endsWith("_TRAPDOOR") -+ .ensureSize("TRAPDOORS", 20).lock(); -+ -+ /** -+ * Covers all wood variants of doors. -+ */ -+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors")) -+ .endsWith("_DOOR") -+ .not(Material.IRON_DOOR) -+ .notContains("COPPER") -+ .ensureSize("WOODEN_DOORS", 11).lock(); -+ -+ /** -+ * Covers all wood variants of fences. -+ */ -+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) -+ .endsWith("_FENCE") -+ .not(Material.NETHER_BRICK_FENCE) -+ .ensureSize("WOODEN_FENCES", 11).lock(); -+ -+ /** -+ * Covers all wood variants of trapdoors. -+ */ -+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) -+ .endsWith("_TRAPDOOR") -+ .not(Material.IRON_TRAPDOOR) -+ .notContains("COPPER") -+ .ensureSize("WOODEN_TRAPDOORS", 11).lock(); -+ -+ /** -+ * Covers the wood variants of gates. -+ */ -+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) -+ .endsWith("_GATE") -+ .ensureSize("WOODEN_GATES", 11).lock(); -+ -+ /** -+ * Covers the variants of purpur. -+ */ -+ public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur")) -+ .startsWith("PURPUR_") -+ .ensureSize("PURPUR", 4).lock(); -+ -+ /** -+ * Covers the variants of signs. -+ */ -+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) -+ .endsWith("_SIGN") -+ .ensureSize("SIGNS", 44).lock(); -+ -+ /** -+ * Covers the variants of a regular torch. -+ */ -+ public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch")) -+ .add(Material.TORCH, Material.WALL_TORCH) -+ .ensureSize("TORCH", 2).lock(); -+ -+ /** -+ * Covers the variants of a redstone torch. -+ */ -+ public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("redstone_torch")) -+ .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH) -+ .ensureSize("REDSTONE_TORCH", 2).lock(); -+ -+ /** -+ * Covers the variants of a soul torch. -+ */ -+ public static final MaterialSetTag SOUL_TORCH = new MaterialSetTag(keyFor("soul_torch")) -+ .add(Material.SOUL_TORCH, Material.SOUL_WALL_TORCH) -+ .ensureSize("SOUL_TORCH", 2).lock(); -+ -+ /** -+ * Covers the variants of torches. -+ */ -+ public static final MaterialSetTag TORCHES = new MaterialSetTag(keyFor("torches")) -+ .add(TORCH, REDSTONE_TORCH, SOUL_TORCH) -+ .ensureSize("TORCHES", 6).lock(); -+ -+ /** -+ * Covers the variants of lanterns. -+ */ -+ public static final MaterialSetTag LANTERNS = new MaterialSetTag(keyFor("lanterns")) -+ .add(Material.LANTERN, Material.SOUL_LANTERN) -+ .ensureSize("LANTERNS", 2).lock(); -+ -+ /** -+ * Covers the variants of rails. -+ */ -+ public static final MaterialSetTag RAILS = new MaterialSetTag(keyFor("rails")) -+ .endsWith("RAIL") -+ .ensureSize("RAILS", 4).lock(); -+ -+ /** -+ * Covers the variants of swords. -+ */ -+ public static final MaterialSetTag SWORDS = new MaterialSetTag(keyFor("swords")) -+ .endsWith("_SWORD") -+ .ensureSize("SWORDS", 6).lock(); -+ -+ /** -+ * Covers the variants of shovels. -+ */ -+ public static final MaterialSetTag SHOVELS = new MaterialSetTag(keyFor("shovels")) -+ .endsWith("_SHOVEL") -+ .ensureSize("SHOVELS", 6).lock(); -+ -+ /** -+ * Covers the variants of pickaxes. -+ */ -+ public static final MaterialSetTag PICKAXES = new MaterialSetTag(keyFor("pickaxes")) -+ .endsWith("_PICKAXE") -+ .ensureSize("PICKAXES", 6).lock(); -+ -+ /** -+ * Covers the variants of axes. -+ */ -+ public static final MaterialSetTag AXES = new MaterialSetTag(keyFor("axes")) -+ .endsWith("_AXE") -+ .ensureSize("AXES", 6).lock(); -+ -+ /** -+ * Covers the variants of hoes. -+ */ -+ public static final MaterialSetTag HOES = new MaterialSetTag(keyFor("hoes")) -+ .endsWith("_HOE") -+ .ensureSize("HOES", 6).lock(); -+ -+ /** -+ * Covers the variants of helmets. -+ */ -+ public static final MaterialSetTag HELMETS = new MaterialSetTag(keyFor("helmets")) -+ .endsWith("_HELMET") -+ .ensureSize("HELMETS", 7).lock(); -+ -+ /** -+ * Covers the variants of items that can be equipped in the helmet slot. -+ */ -+ public static final MaterialSetTag HEAD_EQUIPPABLE = new MaterialSetTag(keyFor("head_equippable")) -+ .endsWith("_HELMET") -+ .add(SKULLS) -+ .add(Material.CARVED_PUMPKIN) -+ .ensureSize("HEAD_EQUIPPABLE", 22).lock(); -+ -+ /** -+ * Covers the variants of chestplate. -+ */ -+ public static final MaterialSetTag CHESTPLATES = new MaterialSetTag(keyFor("chestplates")) -+ .endsWith("_CHESTPLATE") -+ .ensureSize("CHESTPLATES", 6).lock(); -+ -+ /** -+ * Covers the variants of items that can be equipped in the chest slot. -+ */ -+ public static final MaterialSetTag CHEST_EQUIPPABLE = new MaterialSetTag(keyFor("chest_equippable")) -+ .endsWith("_CHESTPLATE") -+ .add(Material.ELYTRA) -+ .ensureSize("CHEST_EQUIPPABLE", 7).lock(); -+ -+ /** -+ * Covers the variants of leggings. -+ */ -+ public static final MaterialSetTag LEGGINGS = new MaterialSetTag(keyFor("leggings")) -+ .endsWith("_LEGGINGS") -+ .ensureSize("LEGGINGS", 6).lock(); -+ -+ /** -+ * Covers the variants of boots. -+ */ -+ public static final MaterialSetTag BOOTS = new MaterialSetTag(keyFor("boots")) -+ .endsWith("_BOOTS") -+ .ensureSize("BOOTS", 6).lock(); -+ -+ /** -+ * Covers all variants of armor. -+ */ -+ public static final MaterialSetTag ARMOR = new MaterialSetTag(keyFor("armor")).add(HELMETS, CHESTPLATES, LEGGINGS, BOOTS) -+ .ensureSize("ARMOR", 25).lock(); -+ -+ /** -+ * Covers the variants of bows. -+ */ -+ public static final MaterialSetTag BOWS = new MaterialSetTag(keyFor("bows")) -+ .add(Material.BOW) -+ .add(Material.CROSSBOW) -+ .ensureSize("BOWS", 2).lock(); -+ -+ /** -+ * Covers the variants of player-throwable projectiles (not requiring a bow or any other "assistance"). -+ */ -+ public static final MaterialSetTag THROWABLE_PROJECTILES = new MaterialSetTag(keyFor("throwable_projectiles")) -+ .add(Material.EGG, Material.SNOWBALL, Material.SPLASH_POTION, Material.TRIDENT, Material.ENDER_PEARL, Material.EXPERIENCE_BOTTLE, Material.FIREWORK_ROCKET).lock(); -+ -+ /** -+ * Covers materials that can be colored, such as wool, shulker boxes, stained glass etc. -+ */ -+ @SuppressWarnings("unchecked") -+ public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable")) -+ .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS).lock(); -+ //.ensureSize("COLORABLE", 81).lock(); unit test don't have the vanilla item tags, so counts don't line up for real -+ -+ /** -+ * Covers the variants of coral. -+ */ -+ public static final MaterialSetTag CORAL = new MaterialSetTag(keyFor("coral")) -+ .endsWith("_CORAL") -+ .ensureSize("CORAL", 10).lock(); -+ -+ /** -+ * Covers the variants of coral fans. -+ */ -+ public static final MaterialSetTag CORAL_FANS = new MaterialSetTag(keyFor("coral_fans")) -+ .endsWith("_CORAL_FAN") -+ .endsWith("_CORAL_WALL_FAN") -+ .ensureSize("CORAL_FANS", 20).lock(); -+ -+ /** -+ * Covers the variants of coral blocks. -+ */ -+ public static final MaterialSetTag CORAL_BLOCKS = new MaterialSetTag(keyFor("coral_blocks")) -+ .endsWith("_CORAL_BLOCK") -+ .ensureSize("CORAL_BLOCKS", 10).lock(); -+ -+ /** -+ * Covers all items that can be enchanted from the enchantment table or anvil. -+ */ -+ public static final MaterialSetTag ENCHANTABLE = new MaterialSetTag(keyFor("enchantable")) -+ .add(PICKAXES, SWORDS, SHOVELS, AXES, HOES, HELMETS, CHEST_EQUIPPABLE, LEGGINGS, BOOTS, BOWS) -+ .add(Material.TRIDENT, Material.SHIELD, Material.FISHING_ROD, Material.SHEARS, -+ Material.FLINT_AND_STEEL, Material.CARROT_ON_A_STICK, Material.WARPED_FUNGUS_ON_A_STICK, -+ Material.BRUSH, Material.CARVED_PUMPKIN, Material.COMPASS, Material.SKELETON_SKULL, -+ Material.WITHER_SKELETON_SKULL, Material.PLAYER_HEAD, Material.ZOMBIE_HEAD, -+ Material.CREEPER_HEAD, Material.DRAGON_HEAD, Material.PIGLIN_HEAD) -+ .ensureSize("ENCHANTABLE", 75).lock(); -+ -+ /** -+ * Covers the variants of raw ores. -+ */ -+ public static final MaterialSetTag RAW_ORES = new MaterialSetTag(keyFor("raw_ores")) -+ .add(Material.RAW_COPPER, Material.RAW_GOLD, Material.RAW_IRON).lock(); -+ -+ /** -+ * Covers the variants of deepslate ores. -+ */ -+ public static final MaterialSetTag DEEPSLATE_ORES = new MaterialSetTag(keyFor("deepslate_ores")) -+ .add(material -> material.name().startsWith("DEEPSLATE_") && material.name().endsWith("_ORE")) -+ .ensureSize("DEEPSLATE_ORES", 8).lock(); -+ -+ /** -+ * Covers the variants of raw ore blocks. -+ */ -+ public static final MaterialSetTag RAW_ORE_BLOCKS = new MaterialSetTag(keyFor("raw_ore_blocks")) -+ .add(Material.RAW_COPPER_BLOCK, Material.RAW_GOLD_BLOCK, Material.RAW_IRON_BLOCK).lock(); -+ -+ /** -+ * Covers all oxidized copper blocks. -+ */ -+ public static final MaterialSetTag OXIDIZED_COPPER_BLOCKS = new MaterialSetTag(keyFor("oxidized_copper_blocks")) -+ .startsWith("OXIDIZED_").startsWith("WAXED_OXIDIZED_").ensureSize("OXIDIZED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all weathered copper blocks. -+ */ -+ public static final MaterialSetTag WEATHERED_COPPER_BLOCKS = new MaterialSetTag(keyFor("weathered_copper_blocks")) -+ .startsWith("WEATHERED_").startsWith("WAXED_WEATHERED_").ensureSize("WEATHERED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all exposed copper blocks. -+ */ -+ public static final MaterialSetTag EXPOSED_COPPER_BLOCKS = new MaterialSetTag(keyFor("exposed_copper_blocks")) -+ .startsWith("EXPOSED_").startsWith("WAXED_EXPOSED_").ensureSize("EXPOSED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all un-weathered copper blocks. -+ */ -+ public static final MaterialSetTag UNAFFECTED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unaffected_copper_blocks")) -+ .startsWith("CUT_COPPER").startsWith("WAXED_CUT_COPPER") -+ .startsWith("WAXED_COPPER_").startsWith("COPPER_") -+ .add(Material.CHISELED_COPPER, Material.WAXED_CHISELED_COPPER) -+ .not(Material.COPPER_INGOT, Material.COPPER_ORE) -+ .ensureSize("UNAFFECTED_COPPER_BLOCKS", 18).lock(); -+ -+ /** -+ * Covers all waxed copper blocks. -+ *

-+ * Combine with other copper-related tags to filter is-waxed or not. -+ */ -+ public static final MaterialSetTag WAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("waxed_copper_blocks")) -+ .add(m -> m.name().startsWith("WAXED_") && m.name().contains("COPPER")).ensureSize("WAXED_COPPER_BLOCKS", 36).lock(); -+ -+ /** -+ * Covers all un-waxed copper blocks. -+ *

-+ * Combine with other copper-related tags to filter is-un-waxed or not. -+ */ -+ public static final MaterialSetTag UNWAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unwaxed_copper_blocks")) -+ .startsWith("EXPOSED_").startsWith("WEATHERED_").startsWith("OXIDIZED_") -+ .startsWith("CUT_COPPER") -+ .add(Material.COPPER_BLOCK, Material.CHISELED_COPPER, Material.COPPER_DOOR, Material.COPPER_TRAPDOOR, Material.COPPER_GRATE, Material.COPPER_BULB) -+ .ensureSize("UNWAXED_COPPER_BLOCKS", 36).lock(); -+ -+ /** -+ * Covers all copper block variants. -+ */ -+ public static final MaterialSetTag COPPER_BLOCKS = new MaterialSetTag(keyFor("copper_blocks")) -+ .add(WAXED_COPPER_BLOCKS).add(UNWAXED_COPPER_BLOCKS).ensureSize("COPPER_BLOCKS", 72).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the plain copper block. -+ */ -+ public static final MaterialSetTag FULL_COPPER_BLOCKS = new MaterialSetTag(keyFor("full_copper_blocks")) -+ .endsWith("OXIDIZED_COPPER") -+ .endsWith("WEATHERED_COPPER") -+ .endsWith("EXPOSED_COPPER") -+ .endsWith("COPPER_BLOCK") -+ .not(Material.RAW_COPPER_BLOCK) -+ .ensureSize("FULL_COPPER_BLOCKS", 8).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the cut copper block. -+ */ -+ public static final MaterialSetTag CUT_COPPER_BLOCKS = new MaterialSetTag(keyFor("cut_copper_blocks")) -+ .endsWith("CUT_COPPER").ensureSize("CUT_COPPER_BLOCKS", 8).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the cut copper stairs. -+ */ -+ public static final MaterialSetTag CUT_COPPER_STAIRS = new MaterialSetTag(keyFor("cut_copper_stairs")) -+ .endsWith("CUT_COPPER_STAIRS").ensureSize("CUT_COPPER_STAIRS", 8).lock(); -+ -+ /** -+ * Covers all weathering/waxed states of the cut copper slab. -+ */ -+ public static final MaterialSetTag CUT_COPPER_SLABS = new MaterialSetTag(keyFor("cut_copper_slabs")) -+ .endsWith("CUT_COPPER_SLAB").ensureSize("CUT_COPPER_SLABS", 8).lock(); -+ -+ /** -+ * Covers all Wooden Tools. -+ */ -+ public static final MaterialSetTag WOODEN_TOOLS = new MaterialSetTag(keyFor("wooden_tools")) -+ .add(Material.WOODEN_AXE, Material.WOODEN_HOE, Material.WOODEN_PICKAXE, Material.WOODEN_SHOVEL, Material.WOODEN_SWORD) -+ .ensureSize("WOODEN_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Stone Tools. -+ */ -+ public static final MaterialSetTag STONE_TOOLS = new MaterialSetTag(keyFor("stone_tools")) -+ .add(Material.STONE_AXE, Material.STONE_HOE, Material.STONE_PICKAXE, Material.STONE_SHOVEL, Material.STONE_SWORD) -+ .ensureSize("STONE_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Iron Tools. -+ */ -+ public static final MaterialSetTag IRON_TOOLS = new MaterialSetTag(keyFor("iron_tools")) -+ .add(Material.IRON_AXE, Material.IRON_HOE, Material.IRON_PICKAXE, Material.IRON_SHOVEL, Material.IRON_SWORD) -+ .ensureSize("IRON_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Gold Tools. -+ */ -+ public static final MaterialSetTag GOLDEN_TOOLS = new MaterialSetTag(keyFor("golden_tools")) -+ .add(Material.GOLDEN_AXE, Material.GOLDEN_HOE, Material.GOLDEN_PICKAXE, Material.GOLDEN_SHOVEL, Material.GOLDEN_SWORD) -+ .ensureSize("GOLDEN_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Diamond Tools. -+ */ -+ public static final MaterialSetTag DIAMOND_TOOLS = new MaterialSetTag(keyFor("diamond_tools")) -+ .add(Material.DIAMOND_AXE, Material.DIAMOND_HOE, Material.DIAMOND_PICKAXE, Material.DIAMOND_SHOVEL, Material.DIAMOND_SWORD) -+ .ensureSize("DIAMOND_TOOLS", 5).lock(); -+ -+ /** -+ * Covers all Netherite Tools. -+ */ -+ public static final MaterialSetTag NETHERITE_TOOLS = new MaterialSetTag(keyFor("netherite_tools")) -+ .add(Material.NETHERITE_AXE, Material.NETHERITE_HOE, Material.NETHERITE_PICKAXE, Material.NETHERITE_SHOVEL, Material.NETHERITE_SWORD) -+ .ensureSize("NETHERITE_TOOLS", 5).lock(); -+ -+} -diff --git a/src/main/java/io/papermc/paper/tag/BaseTag.java b/src/main/java/io/papermc/paper/tag/BaseTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..794787912325ae32b3cfc8217bc3fc2159ceabd5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/tag/BaseTag.java -@@ -0,0 +1,181 @@ -+package io.papermc.paper.tag; -+ -+import com.google.common.collect.Lists; -+import java.util.Collections; -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Tag; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Collection; -+import java.util.EnumSet; -+import java.util.HashSet; -+import java.util.List; -+import java.util.Set; -+import java.util.function.Predicate; -+import java.util.stream.Collectors; -+ -+public abstract class BaseTag> implements Tag { -+ -+ protected final NamespacedKey key; -+ protected final Set tagged; -+ private final List> globalPredicates; -+ private boolean locked = false; -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Predicate filter) { -+ this(clazz, key); -+ add(filter); -+ } -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull T...values) { -+ this(clazz, key, Lists.newArrayList(values)); -+ } -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Collection values) { -+ this(clazz, key, values, o -> true); -+ } -+ -+ public BaseTag(@NotNull Class clazz, @NotNull NamespacedKey key, @NotNull Collection values, @NotNull Predicate... globalPredicates) { -+ this.key = key != null ? key : NamespacedKey.randomKey(); -+ this.tagged = clazz.isEnum() ? createEnumSet(clazz) : new HashSet<>(); -+ this.tagged.addAll(values); -+ this.globalPredicates = Lists.newArrayList(globalPredicates); -+ } -+ -+ private Set createEnumSet(Class enumClass) { -+ assert enumClass.isEnum(); -+ return (Set) EnumSet.noneOf((Class) enumClass); -+ } -+ -+ public @NotNull C lock() { -+ this.locked = true; -+ return (C) this; -+ } -+ -+ public boolean isLocked() { -+ return this.locked; -+ } -+ -+ private void checkLock() { -+ if (this.locked) { -+ throw new UnsupportedOperationException("Tag (" + this.key + ") is locked"); -+ } -+ } -+ -+ @NotNull -+ @Override -+ public NamespacedKey getKey() { -+ return key; -+ } -+ -+ @NotNull -+ @Override -+ public Set getValues() { -+ return Collections.unmodifiableSet(tagged); -+ } -+ -+ @Override -+ public boolean isTagged(@NotNull T item) { -+ return tagged.contains(item); -+ } -+ -+ @NotNull -+ public C add(@NotNull Tag...tags) { -+ for (Tag tag : tags) { -+ add(tag.getValues()); -+ } -+ return (C) this; -+ } -+ -+ @NotNull -+ public C add(@NotNull T...values) { -+ this.checkLock(); -+ this.tagged.addAll(Lists.newArrayList(values)); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C add(@NotNull Collection collection) { -+ this.checkLock(); -+ this.tagged.addAll(collection); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C add(@NotNull Predicate filter) { -+ return add(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet())); -+ } -+ -+ @NotNull -+ public C contains(@NotNull String with) { -+ return add(value -> getName(value).contains(with)); -+ } -+ -+ @NotNull -+ public C endsWith(@NotNull String with) { -+ return add(value -> getName(value).endsWith(with)); -+ } -+ -+ @NotNull -+ public C startsWith(@NotNull String with) { -+ return add(value -> getName(value).startsWith(with)); -+ } -+ -+ @NotNull -+ public C not(@NotNull Tag...tags) { -+ for (Tag tag : tags) { -+ not(tag.getValues()); -+ } -+ return (C) this; -+ } -+ -+ @NotNull -+ public C not(@NotNull T...values) { -+ this.checkLock(); -+ this.tagged.removeAll(Lists.newArrayList(values)); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C not(@NotNull Collection values) { -+ this.checkLock(); -+ this.tagged.removeAll(values); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C not(@NotNull Predicate filter) { -+ not(getAllPossibleValues().stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).filter(filter).collect(Collectors.toSet())); -+ return (C) this; -+ } -+ -+ @NotNull -+ public C notContains(@NotNull String with) { -+ return not(value -> getName(value).contains(with)); -+ } -+ -+ @NotNull -+ public C notEndsWith(@NotNull String with) { -+ return not(value -> getName(value).endsWith(with)); -+ } -+ -+ @NotNull -+ public C notStartsWith(@NotNull String with) { -+ return not(value -> getName(value).startsWith(with)); -+ } -+ -+ @NotNull -+ public C ensureSize(@NotNull String label, int size) { -+ long actual = this.tagged.stream().filter(globalPredicates.stream().reduce(Predicate::or).orElse(t -> true)).count(); -+ if (size != actual) { -+ throw new IllegalStateException(key.toString() + ": " + label + " - Expected " + size + " values, got " + actual); -+ } -+ return (C) this; -+ } -+ -+ @NotNull -+ protected abstract Set getAllPossibleValues(); -+ -+ @NotNull -+ protected abstract String getName(@NotNull T value); -+} -diff --git a/src/main/java/io/papermc/paper/tag/EntitySetTag.java b/src/main/java/io/papermc/paper/tag/EntitySetTag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c89c4619aaf388197834d98eb95af2f1e93db871 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/tag/EntitySetTag.java -@@ -0,0 +1,42 @@ -+package io.papermc.paper.tag; -+ -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.EntityType; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Collection; -+import java.util.Set; -+import java.util.function.Predicate; -+import java.util.stream.Collectors; -+import java.util.stream.Stream; -+ -+public class EntitySetTag extends BaseTag { -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Predicate filter) { -+ super(EntityType.class, key, filter); -+ } -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull EntityType... values) { -+ super(EntityType.class, key, values); -+ } -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Collection values) { -+ super(EntityType.class, key, values); -+ } -+ -+ public EntitySetTag(@NotNull NamespacedKey key, @NotNull Collection values, @NotNull Predicate... globalPredicates) { -+ super(EntityType.class, key, values, globalPredicates); -+ } -+ -+ @NotNull -+ @Override -+ protected Set getAllPossibleValues() { -+ return Stream.of(EntityType.values()).collect(Collectors.toSet()); -+ } -+ -+ @NotNull -+ @Override -+ protected String getName(@NotNull EntityType value) { -+ return value.name(); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/tag/EntityTags.java b/src/main/java/io/papermc/paper/tag/EntityTags.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5376e51adf5af15572b0d760b17f2de6d3f24a9b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/tag/EntityTags.java -@@ -0,0 +1,54 @@ -+package io.papermc.paper.tag; -+ -+import org.bukkit.NamespacedKey; -+ -+import static org.bukkit.entity.EntityType.*; -+ -+/** -+ * All tags in this class are unmodifiable, attempting to modify them will throw an -+ * {@link UnsupportedOperationException}. -+ */ -+public class EntityTags { -+ -+ private static NamespacedKey keyFor(String key) { -+ //noinspection deprecation -+ return new NamespacedKey("paper", key + "_settag"); -+ } -+ -+ /** -+ * Covers undead mobs -+ * @see https://minecraft.wiki/wiki/Mob#Undead_mobs -+ */ -+ public static final EntitySetTag UNDEADS = new EntitySetTag(keyFor("undeads")) -+ .add(DROWNED, HUSK, PHANTOM, SKELETON, SKELETON_HORSE, STRAY, WITHER, WITHER_SKELETON, ZOGLIN, ZOMBIE, ZOMBIE_HORSE, ZOMBIE_VILLAGER, ZOMBIFIED_PIGLIN) -+ .ensureSize("UNDEADS", 13).lock(); -+ -+ /** -+ * Covers all horses -+ */ -+ public static final EntitySetTag HORSES = new EntitySetTag(keyFor("horses")) -+ .contains("HORSE") -+ .ensureSize("HORSES", 3).lock(); -+ -+ /** -+ * Covers all minecarts -+ */ -+ public static final EntitySetTag MINECARTS = new EntitySetTag(keyFor("minecarts")) -+ .contains("MINECART") -+ .ensureSize("MINECARTS", 7).lock(); -+ -+ /** -+ * Covers mobs that split into smaller mobs -+ */ -+ public static final EntitySetTag SPLITTING_MOBS = new EntitySetTag(keyFor("splitting_mobs")) -+ .add(SLIME, MAGMA_CUBE) -+ .ensureSize("SLIMES", 2).lock(); -+ -+ /** -+ * Covers all water based mobs -+ * @see https://minecraft.wiki/wiki/Mob#Aquatic_mobs -+ */ -+ public static final EntitySetTag WATER_BASED = new EntitySetTag(keyFor("water_based")) -+ .add(AXOLOTL, DOLPHIN, SQUID, GLOW_SQUID, GUARDIAN, ELDER_GUARDIAN, TURTLE, COD, SALMON, PUFFERFISH, TROPICAL_FISH) -+ .ensureSize("WATER_BASED", 11).lock(); -+} -diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index 1be862110e94654be12fcef5980388abf242ac7f..298ae1294a122705bca6bd74ea540185839d1ed5 100644 ---- a/src/main/java/org/bukkit/Tag.java -+++ b/src/main/java/org/bukkit/Tag.java -@@ -11,6 +11,10 @@ import org.jetbrains.annotations.NotNull; - * Note that whilst all tags defined within this interface must be present in - * implementations, their existence is not guaranteed across future versions. - * -+ *

Custom tags defined by Paper are not present (as constants) in this class. -+ * To access them please refer to {@link com.destroystokyo.paper.MaterialTags} -+ * and {@link io.papermc.paper.tag.EntityTags}.

-+ * - * @param the type of things grouped by this tag - */ - public interface Tag extends Keyed { -diff --git a/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..82ee9a486d1c3deec6e529b1cb12ecc2c6a5862e ---- /dev/null -+++ b/src/test/java/com/destroystokyo/paper/MaterialTagsTest.java -@@ -0,0 +1,58 @@ -+/* -+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License -+ */ -+ -+package com.destroystokyo.paper; -+ -+import io.papermc.paper.tag.BaseTag; -+import io.papermc.paper.tag.EntityTags; -+import java.lang.reflect.Field; -+import java.lang.reflect.Modifier; -+import java.util.HashSet; -+import java.util.Set; -+import java.util.logging.Level; -+import org.bukkit.Bukkit; -+import org.bukkit.support.AbstractTestingBase; -+import org.junit.jupiter.api.Test; -+ -+import static org.junit.jupiter.api.Assertions.assertTrue; -+ -+public class MaterialTagsTest extends AbstractTestingBase { -+ -+ @Test -+ public void testInitialize() { -+ try { -+ MaterialTags.SHULKER_BOXES.getValues(); -+ assert true; -+ } catch (Throwable e) { -+ Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); -+ assert false; -+ } -+ } -+ -+ @Test -+ public void testLocked() { -+ testLocked(MaterialTags.class); -+ testLocked(EntityTags.class); -+ } -+ -+ private static void testLocked(Class clazz) { -+ for (BaseTag tag : collectTags(clazz)) { -+ assertTrue(tag.isLocked(), "Tag " + tag.key() + " is not locked"); -+ } -+ } -+ -+ private static Set> collectTags(Class clazz) { -+ Set> tags = new HashSet<>(); -+ try { -+ for (Field field : clazz.getDeclaredFields()) { -+ if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && BaseTag.class.isAssignableFrom(field.getType())) { -+ tags.add((BaseTag) field.get(null)); -+ } -+ } -+ } catch (IllegalAccessException e) { -+ e.printStackTrace(); -+ } -+ return tags; -+ } -+} -diff --git a/src/test/java/io/papermc/paper/EntityTagsTest.java b/src/test/java/io/papermc/paper/EntityTagsTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..91d70cc703192b5a3a48211ee0dadd2e4260ec00 ---- /dev/null -+++ b/src/test/java/io/papermc/paper/EntityTagsTest.java -@@ -0,0 +1,21 @@ -+package io.papermc.paper; -+ -+import io.papermc.paper.tag.EntityTags; -+import java.util.logging.Level; -+import org.bukkit.Bukkit; -+import org.bukkit.support.AbstractTestingBase; -+import org.junit.jupiter.api.Test; -+ -+public class EntityTagsTest extends AbstractTestingBase { -+ -+ @Test -+ public void testInitialize() { -+ try { -+ EntityTags.HORSES.getValues(); -+ assert true; -+ } catch (Throwable e) { -+ Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); -+ assert false; -+ } -+ } -+} diff --git a/patches/api/0153-PreSpawnerSpawnEvent.patch b/patches/api/0153-PreSpawnerSpawnEvent.patch new file mode 100644 index 0000000000..4b6bbe6f7a --- /dev/null +++ b/patches/api/0153-PreSpawnerSpawnEvent.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Phoenix616 +Date: Tue, 18 Sep 2018 23:50:10 +0100 +Subject: [PATCH] PreSpawnerSpawnEvent + +This adds a separate event before an entity is spawned by a spawner +which contains the location of the spawner too similarly to how the +SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for +spawners. + +Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not being applied + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2910f0bf929d918c86510f29d9361bbc19411256 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java +@@ -0,0 +1,29 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.entity.EntityType; ++import org.bukkit.event.entity.CreatureSpawnEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called before an entity is spawned into a world by a spawner. ++ *

++ * This only includes the spawner's location and not the full BlockState snapshot for performance reasons. ++ * If you really need it you have to get the spawner yourself. ++ */ ++public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent { ++ ++ @NotNull private final Location spawnerLocation; ++ ++ @ApiStatus.Internal ++ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) { ++ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER); ++ this.spawnerLocation = spawnerLocation; ++ } ++ ++ @NotNull ++ public Location getSpawnerLocation() { ++ return this.spawnerLocation.clone(); ++ } ++} diff --git a/patches/api/0154-Add-LivingEntity-getTargetEntity.patch b/patches/api/0154-Add-LivingEntity-getTargetEntity.patch new file mode 100644 index 0000000000..171a95979a --- /dev/null +++ b/patches/api/0154-Add-LivingEntity-getTargetEntity.patch @@ -0,0 +1,134 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 22 Sep 2018 00:32:53 -0500 +Subject: [PATCH] Add LivingEntity#getTargetEntity + + +diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java +new file mode 100644 +index 0000000000000000000000000000000000000000..af8765b213390cf75fe02a6eb68aecf7a06d5acf +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java +@@ -0,0 +1,40 @@ ++package com.destroystokyo.paper.entity; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.util.Vector; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents information about a targeted entity ++ * @deprecated use {@link org.bukkit.util.RayTraceResult} ++ */ ++@Deprecated(forRemoval = true) ++public class TargetEntityInfo { ++ private final Entity entity; ++ private final Vector hitVec; ++ ++ public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) { ++ this.entity = entity; ++ this.hitVec = hitVec; ++ } ++ ++ /** ++ * Get the entity that is targeted ++ * ++ * @return Targeted entity ++ */ ++ @NotNull ++ public Entity getEntity() { ++ return entity; ++ } ++ ++ /** ++ * Get the position the entity is targeted at ++ * ++ * @return Targeted position ++ */ ++ @NotNull ++ public Vector getHitVector() { ++ return hitVec; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index b41152d81c1ec89a65eaee2a606f4f1b0d421bc7..8cd525dd8ded0ddbd405c66e9c0fbeb40f788521 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -175,6 +175,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + @Deprecated(forRemoval = true) + @Nullable + public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); ++ ++ /** ++ * Gets information about the entity being targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @return entity being targeted, or null if no entity is targeted ++ */ ++ @Nullable ++ public default Entity getTargetEntity(int maxDistance) { ++ return getTargetEntity(maxDistance, false); ++ } ++ ++ /** ++ * Gets information about the entity being targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param ignoreBlocks true to scan through blocks ++ * @return entity being targeted, or null if no entity is targeted ++ */ ++ @Nullable ++ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks); ++ ++ /** ++ * Gets information about the entity being targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @return TargetEntityInfo about the entity being targeted, ++ * or null if no entity is targeted ++ * @deprecated use {@link #rayTraceEntities(int)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public default com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance) { ++ return getTargetEntityInfo(maxDistance, false); ++ } ++ ++ /** ++ * Gets information about the entity being targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @return RayTraceResult about the entity being targeted, ++ * or null if no entity is targeted ++ */ ++ @Nullable ++ default RayTraceResult rayTraceEntities(int maxDistance) { ++ return this.rayTraceEntities(maxDistance, false); ++ } ++ ++ /** ++ * Gets information about the entity being targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param ignoreBlocks true to scan through blocks ++ * @return TargetEntityInfo about the entity being targeted, ++ * or null if no entity is targeted ++ * @deprecated use {@link #rayTraceEntities(int, boolean)} ++ */ ++ @Deprecated(forRemoval = true) ++ @Nullable ++ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks); ++ ++ /** ++ * Gets information about the entity being targeted ++ * ++ * @param maxDistance this is the maximum distance to scan ++ * @param ignoreBlocks true to scan through blocks ++ * @return RayTraceResult about the entity being targeted, ++ * or null if no entity is targeted ++ */ ++ @Nullable ++ RayTraceResult rayTraceEntities(int maxDistance, boolean ignoreBlocks); + // Paper end + + /** diff --git a/patches/api/0154-PreSpawnerSpawnEvent.patch b/patches/api/0154-PreSpawnerSpawnEvent.patch deleted file mode 100644 index 4b6bbe6f7a..0000000000 --- a/patches/api/0154-PreSpawnerSpawnEvent.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Phoenix616 -Date: Tue, 18 Sep 2018 23:50:10 +0100 -Subject: [PATCH] PreSpawnerSpawnEvent - -This adds a separate event before an entity is spawned by a spawner -which contains the location of the spawner too similarly to how the -SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for -spawners. - -Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not being applied - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2910f0bf929d918c86510f29d9361bbc19411256 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java -@@ -0,0 +1,29 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.EntityType; -+import org.bukkit.event.entity.CreatureSpawnEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called before an entity is spawned into a world by a spawner. -+ *

-+ * This only includes the spawner's location and not the full BlockState snapshot for performance reasons. -+ * If you really need it you have to get the spawner yourself. -+ */ -+public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent { -+ -+ @NotNull private final Location spawnerLocation; -+ -+ @ApiStatus.Internal -+ public PreSpawnerSpawnEvent(@NotNull Location location, @NotNull EntityType type, @NotNull Location spawnerLocation) { -+ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER); -+ this.spawnerLocation = spawnerLocation; -+ } -+ -+ @NotNull -+ public Location getSpawnerLocation() { -+ return this.spawnerLocation.clone(); -+ } -+} diff --git a/patches/api/0155-Add-LivingEntity-getTargetEntity.patch b/patches/api/0155-Add-LivingEntity-getTargetEntity.patch deleted file mode 100644 index 171a95979a..0000000000 --- a/patches/api/0155-Add-LivingEntity-getTargetEntity.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sat, 22 Sep 2018 00:32:53 -0500 -Subject: [PATCH] Add LivingEntity#getTargetEntity - - -diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java -new file mode 100644 -index 0000000000000000000000000000000000000000..af8765b213390cf75fe02a6eb68aecf7a06d5acf ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java -@@ -0,0 +1,40 @@ -+package com.destroystokyo.paper.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents information about a targeted entity -+ * @deprecated use {@link org.bukkit.util.RayTraceResult} -+ */ -+@Deprecated(forRemoval = true) -+public class TargetEntityInfo { -+ private final Entity entity; -+ private final Vector hitVec; -+ -+ public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) { -+ this.entity = entity; -+ this.hitVec = hitVec; -+ } -+ -+ /** -+ * Get the entity that is targeted -+ * -+ * @return Targeted entity -+ */ -+ @NotNull -+ public Entity getEntity() { -+ return entity; -+ } -+ -+ /** -+ * Get the position the entity is targeted at -+ * -+ * @return Targeted position -+ */ -+ @NotNull -+ public Vector getHitVector() { -+ return hitVec; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index b41152d81c1ec89a65eaee2a606f4f1b0d421bc7..8cd525dd8ded0ddbd405c66e9c0fbeb40f788521 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -175,6 +175,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @Deprecated(forRemoval = true) - @Nullable - public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return entity being targeted, or null if no entity is targeted -+ */ -+ @Nullable -+ public default Entity getTargetEntity(int maxDistance) { -+ return getTargetEntity(maxDistance, false); -+ } -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param ignoreBlocks true to scan through blocks -+ * @return entity being targeted, or null if no entity is targeted -+ */ -+ @Nullable -+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks); -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return TargetEntityInfo about the entity being targeted, -+ * or null if no entity is targeted -+ * @deprecated use {@link #rayTraceEntities(int)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public default com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance) { -+ return getTargetEntityInfo(maxDistance, false); -+ } -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @return RayTraceResult about the entity being targeted, -+ * or null if no entity is targeted -+ */ -+ @Nullable -+ default RayTraceResult rayTraceEntities(int maxDistance) { -+ return this.rayTraceEntities(maxDistance, false); -+ } -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param ignoreBlocks true to scan through blocks -+ * @return TargetEntityInfo about the entity being targeted, -+ * or null if no entity is targeted -+ * @deprecated use {@link #rayTraceEntities(int, boolean)} -+ */ -+ @Deprecated(forRemoval = true) -+ @Nullable -+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks); -+ -+ /** -+ * Gets information about the entity being targeted -+ * -+ * @param maxDistance this is the maximum distance to scan -+ * @param ignoreBlocks true to scan through blocks -+ * @return RayTraceResult about the entity being targeted, -+ * or null if no entity is targeted -+ */ -+ @Nullable -+ RayTraceResult rayTraceEntities(int maxDistance, boolean ignoreBlocks); - // Paper end - - /** diff --git a/patches/api/0155-Add-sun-related-API.patch b/patches/api/0155-Add-sun-related-API.patch new file mode 100644 index 0000000000..7132b29be0 --- /dev/null +++ b/patches/api/0155-Add-sun-related-API.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 7 Oct 2018 00:54:15 -0500 +Subject: [PATCH] Add sun related API + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 5efe33cef4d9c153d760fc71606721ff8abafbfc..b6ca63afb74b345e381d35646cc8faf52a2c7cbc 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -1771,6 +1771,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + */ + public void setFullTime(long time); + ++ // Paper start ++ ++ /** ++ * Check if it is currently daytime in this world ++ * ++ * @return True if it is daytime ++ */ ++ public boolean isDayTime(); ++ // Paper end ++ + /** + * Gets the full in-game time on this world since the world generation + * +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 6de4344931b2e3d570346b800186c44a0d5782cc..7eee2e561346ac1d672f9652edb78e76c910fc9d 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -20,6 +20,13 @@ public interface Mob extends LivingEntity, Lootable { + */ + @NotNull + com.destroystokyo.paper.entity.Pathfinder getPathfinder(); ++ ++ /** ++ * Check if this mob is exposed to daylight ++ * ++ * @return True if mob is exposed to daylight ++ */ ++ boolean isInDaylight(); + // Paper end + /** + * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/0156-Add-sun-related-API.patch b/patches/api/0156-Add-sun-related-API.patch deleted file mode 100644 index 7132b29be0..0000000000 --- a/patches/api/0156-Add-sun-related-API.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 7 Oct 2018 00:54:15 -0500 -Subject: [PATCH] Add sun related API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 5efe33cef4d9c153d760fc71606721ff8abafbfc..b6ca63afb74b345e381d35646cc8faf52a2c7cbc 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -1771,6 +1771,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - */ - public void setFullTime(long time); - -+ // Paper start -+ -+ /** -+ * Check if it is currently daytime in this world -+ * -+ * @return True if it is daytime -+ */ -+ public boolean isDayTime(); -+ // Paper end -+ - /** - * Gets the full in-game time on this world since the world generation - * -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 6de4344931b2e3d570346b800186c44a0d5782cc..7eee2e561346ac1d672f9652edb78e76c910fc9d 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -20,6 +20,13 @@ public interface Mob extends LivingEntity, Lootable { - */ - @NotNull - com.destroystokyo.paper.entity.Pathfinder getPathfinder(); -+ -+ /** -+ * Check if this mob is exposed to daylight -+ * -+ * @return True if mob is exposed to daylight -+ */ -+ boolean isInDaylight(); - // Paper end - /** - * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/0156-Turtle-API.patch b/patches/api/0156-Turtle-API.patch new file mode 100644 index 0000000000..3ec867d360 --- /dev/null +++ b/patches/api/0156-Turtle-API.patch @@ -0,0 +1,291 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 28 Sep 2018 17:08:09 -0500 +Subject: [PATCH] Turtle API + + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cfbc8aaf862ac90e794ee38bf8a6cb9ea414b13e +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java +@@ -0,0 +1,53 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.Turtle; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Turtle decides to go home ++ */ ++public class TurtleGoHomeEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public TurtleGoHomeEvent(@NotNull Turtle turtle) { ++ super(turtle); ++ } ++ ++ /** ++ * The turtle going home ++ * ++ * @return The turtle ++ */ ++ @NotNull ++ public Turtle getEntity() { ++ return (Turtle) super.getEntity(); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3029e406cd684efb5645e38711dff9c0bb7b01e4 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java +@@ -0,0 +1,92 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.entity.Turtle; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Turtle lays eggs ++ */ ++public class TurtleLayEggEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull ++ private final Location location; ++ private int eggCount; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) { ++ super(turtle); ++ this.location = location; ++ this.eggCount = eggCount; ++ } ++ ++ /** ++ * The turtle laying the eggs ++ * ++ * @return The turtle ++ */ ++ @NotNull ++ public Turtle getEntity() { ++ return (Turtle) super.getEntity(); ++ } ++ ++ /** ++ * Get the location where the eggs are being laid ++ * ++ * @return Location of eggs ++ */ ++ @NotNull ++ public Location getLocation() { ++ return this.location.clone(); ++ } ++ ++ /** ++ * Get the number of eggs being laid ++ * ++ * @return Number of eggs ++ */ ++ public int getEggCount() { ++ return this.eggCount; ++ } ++ ++ /** ++ * Set the number of eggs being laid ++ * ++ * @param eggCount Number of eggs ++ */ ++ public void setEggCount(int eggCount) { ++ if (eggCount < 1) { ++ this.cancelled = true; ++ return; ++ } ++ this.eggCount = Math.min(eggCount, 4); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7a2fa4a11b47e4982d1644830d7e28f12b4378ec +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java +@@ -0,0 +1,66 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.entity.Turtle; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired when a Turtle starts digging to lay eggs ++ */ ++public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final Location location; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) { ++ super(turtle); ++ this.location = location; ++ } ++ ++ /** ++ * The turtle digging ++ * ++ * @return The turtle ++ */ ++ @NotNull ++ public Turtle getEntity() { ++ return (Turtle) super.getEntity(); ++ } ++ ++ /** ++ * Get the location where the turtle is digging ++ * ++ * @return Location where digging ++ */ ++ @NotNull ++ public Location getLocation() { ++ return this.location.clone(); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java +index 5584936158e3762d348cb2eaee2082da24ede367..aa83615a0c6565c9874c906a83cfe20c2a964b22 100644 +--- a/src/main/java/org/bukkit/entity/Turtle.java ++++ b/src/main/java/org/bukkit/entity/Turtle.java +@@ -1,5 +1,8 @@ + package org.bukkit.entity; + ++import org.bukkit.Location; ++import org.jetbrains.annotations.NotNull; ++ + /** + * Represents a turtle. + */ +@@ -18,4 +21,42 @@ public interface Turtle extends Animals { + * @return Whether the turtle is laying an egg + */ + boolean isLayingEgg(); ++ ++ // Paper start ++ /** ++ * Get the turtle's home location ++ * ++ * @return Home location ++ */ ++ @NotNull ++ Location getHome(); ++ ++ /** ++ * Set the turtle's home location ++ * ++ * @param location Home location ++ */ ++ void setHome(@NotNull Location location); ++ ++ /** ++ * Check if turtle is currently pathfinding to it's home ++ * ++ * @return True if going home ++ */ ++ boolean isGoingHome(); ++ ++ /** ++ * Get if turtle is digging to lay eggs ++ * ++ * @return True if digging ++ */ ++ boolean isDigging(); ++ ++ /** ++ * Set if turtle is carrying egg ++ * ++ * @param hasEgg True if carrying egg ++ */ ++ void setHasEgg(boolean hasEgg); ++ // Paper end + } diff --git a/patches/api/0157-Add-spectator-target-events.patch b/patches/api/0157-Add-spectator-target-events.patch new file mode 100644 index 0000000000..90f65b5fc8 --- /dev/null +++ b/patches/api/0157-Add-spectator-target-events.patch @@ -0,0 +1,148 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Caleb Bassham +Date: Fri, 28 Sep 2018 02:30:56 -0500 +Subject: [PATCH] Add spectator target events + +- PlayerStartSpectatingEntityEvent +- PlayerStopSpectatingEntityEvent + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a70a64d2273414d95d77e601a41a208cce78e345 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java +@@ -0,0 +1,71 @@ ++package com.destroystokyo.paper.event.player; ++ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Triggered when a player starts spectating an entity in spectator mode. ++ */ ++public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final Entity currentSpectatorTarget; ++ @NotNull private final Entity newSpectatorTarget; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) { ++ super(player); ++ this.currentSpectatorTarget = currentSpectatorTarget; ++ this.newSpectatorTarget = newSpectatorTarget; ++ } ++ ++ /** ++ * Gets the entity that the player is currently spectating or themselves if they weren't spectating anything ++ * ++ * @return The entity the player is currently spectating (before they start spectating the new target). ++ */ ++ @NotNull ++ public Entity getCurrentSpectatorTarget() { ++ return this.currentSpectatorTarget; ++ } ++ ++ /** ++ * Gets the new entity that the player will now be spectating ++ * ++ * @return The entity the player is now going to be spectating. ++ */ ++ @NotNull ++ public Entity getNewSpectatorTarget() { ++ return this.newSpectatorTarget; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} ++ +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a6a5ebc534cc380740ba42790149c8b85f52aabb +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java +@@ -0,0 +1,57 @@ ++package com.destroystokyo.paper.event.player; ++ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Triggered when a player stops spectating an entity in spectator mode. ++ */ ++public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final Entity spectatorTarget; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) { ++ super(player); ++ this.spectatorTarget = spectatorTarget; ++ } ++ ++ /** ++ * Gets the entity that the player is spectating ++ * ++ * @return The entity the player is currently spectating (before they will stop). ++ */ ++ @NotNull ++ public Entity getSpectatorTarget() { ++ return this.spectatorTarget; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0157-Turtle-API.patch b/patches/api/0157-Turtle-API.patch deleted file mode 100644 index 3ec867d360..0000000000 --- a/patches/api/0157-Turtle-API.patch +++ /dev/null @@ -1,291 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 28 Sep 2018 17:08:09 -0500 -Subject: [PATCH] Turtle API - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..cfbc8aaf862ac90e794ee38bf8a6cb9ea414b13e ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java -@@ -0,0 +1,53 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.Turtle; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Turtle decides to go home -+ */ -+public class TurtleGoHomeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public TurtleGoHomeEvent(@NotNull Turtle turtle) { -+ super(turtle); -+ } -+ -+ /** -+ * The turtle going home -+ * -+ * @return The turtle -+ */ -+ @NotNull -+ public Turtle getEntity() { -+ return (Turtle) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3029e406cd684efb5645e38711dff9c0bb7b01e4 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java -@@ -0,0 +1,92 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Turtle; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Turtle lays eggs -+ */ -+public class TurtleLayEggEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull -+ private final Location location; -+ private int eggCount; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) { -+ super(turtle); -+ this.location = location; -+ this.eggCount = eggCount; -+ } -+ -+ /** -+ * The turtle laying the eggs -+ * -+ * @return The turtle -+ */ -+ @NotNull -+ public Turtle getEntity() { -+ return (Turtle) super.getEntity(); -+ } -+ -+ /** -+ * Get the location where the eggs are being laid -+ * -+ * @return Location of eggs -+ */ -+ @NotNull -+ public Location getLocation() { -+ return this.location.clone(); -+ } -+ -+ /** -+ * Get the number of eggs being laid -+ * -+ * @return Number of eggs -+ */ -+ public int getEggCount() { -+ return this.eggCount; -+ } -+ -+ /** -+ * Set the number of eggs being laid -+ * -+ * @param eggCount Number of eggs -+ */ -+ public void setEggCount(int eggCount) { -+ if (eggCount < 1) { -+ this.cancelled = true; -+ return; -+ } -+ this.eggCount = Math.min(eggCount, 4); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7a2fa4a11b47e4982d1644830d7e28f12b4378ec ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java -@@ -0,0 +1,66 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.entity.Turtle; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired when a Turtle starts digging to lay eggs -+ */ -+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final Location location; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) { -+ super(turtle); -+ this.location = location; -+ } -+ -+ /** -+ * The turtle digging -+ * -+ * @return The turtle -+ */ -+ @NotNull -+ public Turtle getEntity() { -+ return (Turtle) super.getEntity(); -+ } -+ -+ /** -+ * Get the location where the turtle is digging -+ * -+ * @return Location where digging -+ */ -+ @NotNull -+ public Location getLocation() { -+ return this.location.clone(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java -index 5584936158e3762d348cb2eaee2082da24ede367..aa83615a0c6565c9874c906a83cfe20c2a964b22 100644 ---- a/src/main/java/org/bukkit/entity/Turtle.java -+++ b/src/main/java/org/bukkit/entity/Turtle.java -@@ -1,5 +1,8 @@ - package org.bukkit.entity; - -+import org.bukkit.Location; -+import org.jetbrains.annotations.NotNull; -+ - /** - * Represents a turtle. - */ -@@ -18,4 +21,42 @@ public interface Turtle extends Animals { - * @return Whether the turtle is laying an egg - */ - boolean isLayingEgg(); -+ -+ // Paper start -+ /** -+ * Get the turtle's home location -+ * -+ * @return Home location -+ */ -+ @NotNull -+ Location getHome(); -+ -+ /** -+ * Set the turtle's home location -+ * -+ * @param location Home location -+ */ -+ void setHome(@NotNull Location location); -+ -+ /** -+ * Check if turtle is currently pathfinding to it's home -+ * -+ * @return True if going home -+ */ -+ boolean isGoingHome(); -+ -+ /** -+ * Get if turtle is digging to lay eggs -+ * -+ * @return True if digging -+ */ -+ boolean isDigging(); -+ -+ /** -+ * Set if turtle is carrying egg -+ * -+ * @param hasEgg True if carrying egg -+ */ -+ void setHasEgg(boolean hasEgg); -+ // Paper end - } diff --git a/patches/api/0158-Add-more-Witch-API.patch b/patches/api/0158-Add-more-Witch-API.patch new file mode 100644 index 0000000000..0da75bb9b7 --- /dev/null +++ b/patches/api/0158-Add-more-Witch-API.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 12 Oct 2018 03:47:26 -0500 +Subject: [PATCH] Add more Witch API + + +diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java +index 6618f2129e108c0a6cd15f6d0e86426021b6ff0d..4badeafe2f20cb123ef95897c90d5e61251cc40f 100644 +--- a/src/main/java/org/bukkit/entity/Witch.java ++++ b/src/main/java/org/bukkit/entity/Witch.java +@@ -2,6 +2,11 @@ package org.bukkit.entity; + + import com.destroystokyo.paper.entity.RangedEntity; + ++// Paper start ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.Nullable; ++// Paper end ++ + /** + * Represents a Witch + */ +@@ -13,4 +18,37 @@ public interface Witch extends Raider, RangedEntity { // Paper + * @return whether the witch is drinking a potion + */ + boolean isDrinkingPotion(); ++ ++ // Paper start ++ /** ++ * Get time remaining (in ticks) the Witch is drinking a potion ++ * ++ * @return Time remaining (in ticks) ++ */ ++ int getPotionUseTimeLeft(); ++ ++ /** ++ * Set time remaining (in ticks) that the Witch is drinking a potion. ++ *

++ * This only has an effect while the Witch is drinking a potion. ++ * ++ * @param ticks Time in ticks remaining ++ * @see #isDrinkingPotion ++ */ ++ void setPotionUseTimeLeft(int ticks); ++ ++ /** ++ * Get the potion the Witch is drinking ++ * ++ * @return The potion the witch is drinking ++ */ ++ @Nullable ItemStack getDrinkingPotion(); ++ ++ /** ++ * Set the potion the Witch should drink ++ * ++ * @param potion Potion to drink ++ */ ++ void setDrinkingPotion(@Nullable ItemStack potion); ++ // Paper end + } diff --git a/patches/api/0158-Add-spectator-target-events.patch b/patches/api/0158-Add-spectator-target-events.patch deleted file mode 100644 index 90f65b5fc8..0000000000 --- a/patches/api/0158-Add-spectator-target-events.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Caleb Bassham -Date: Fri, 28 Sep 2018 02:30:56 -0500 -Subject: [PATCH] Add spectator target events - -- PlayerStartSpectatingEntityEvent -- PlayerStopSpectatingEntityEvent - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a70a64d2273414d95d77e601a41a208cce78e345 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java -@@ -0,0 +1,71 @@ -+package com.destroystokyo.paper.event.player; -+ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Triggered when a player starts spectating an entity in spectator mode. -+ */ -+public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final Entity currentSpectatorTarget; -+ @NotNull private final Entity newSpectatorTarget; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) { -+ super(player); -+ this.currentSpectatorTarget = currentSpectatorTarget; -+ this.newSpectatorTarget = newSpectatorTarget; -+ } -+ -+ /** -+ * Gets the entity that the player is currently spectating or themselves if they weren't spectating anything -+ * -+ * @return The entity the player is currently spectating (before they start spectating the new target). -+ */ -+ @NotNull -+ public Entity getCurrentSpectatorTarget() { -+ return this.currentSpectatorTarget; -+ } -+ -+ /** -+ * Gets the new entity that the player will now be spectating -+ * -+ * @return The entity the player is now going to be spectating. -+ */ -+ @NotNull -+ public Entity getNewSpectatorTarget() { -+ return this.newSpectatorTarget; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -+ -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a6a5ebc534cc380740ba42790149c8b85f52aabb ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java -@@ -0,0 +1,57 @@ -+package com.destroystokyo.paper.event.player; -+ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Triggered when a player stops spectating an entity in spectator mode. -+ */ -+public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final Entity spectatorTarget; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) { -+ super(player); -+ this.spectatorTarget = spectatorTarget; -+ } -+ -+ /** -+ * Gets the entity that the player is spectating -+ * -+ * @return The entity the player is currently spectating (before they will stop). -+ */ -+ @NotNull -+ public Entity getSpectatorTarget() { -+ return this.spectatorTarget; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0159-Add-more-Witch-API.patch b/patches/api/0159-Add-more-Witch-API.patch deleted file mode 100644 index 0da75bb9b7..0000000000 --- a/patches/api/0159-Add-more-Witch-API.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 12 Oct 2018 03:47:26 -0500 -Subject: [PATCH] Add more Witch API - - -diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java -index 6618f2129e108c0a6cd15f6d0e86426021b6ff0d..4badeafe2f20cb123ef95897c90d5e61251cc40f 100644 ---- a/src/main/java/org/bukkit/entity/Witch.java -+++ b/src/main/java/org/bukkit/entity/Witch.java -@@ -2,6 +2,11 @@ package org.bukkit.entity; - - import com.destroystokyo.paper.entity.RangedEntity; - -+// Paper start -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.Nullable; -+// Paper end -+ - /** - * Represents a Witch - */ -@@ -13,4 +18,37 @@ public interface Witch extends Raider, RangedEntity { // Paper - * @return whether the witch is drinking a potion - */ - boolean isDrinkingPotion(); -+ -+ // Paper start -+ /** -+ * Get time remaining (in ticks) the Witch is drinking a potion -+ * -+ * @return Time remaining (in ticks) -+ */ -+ int getPotionUseTimeLeft(); -+ -+ /** -+ * Set time remaining (in ticks) that the Witch is drinking a potion. -+ *

-+ * This only has an effect while the Witch is drinking a potion. -+ * -+ * @param ticks Time in ticks remaining -+ * @see #isDrinkingPotion -+ */ -+ void setPotionUseTimeLeft(int ticks); -+ -+ /** -+ * Get the potion the Witch is drinking -+ * -+ * @return The potion the witch is drinking -+ */ -+ @Nullable ItemStack getDrinkingPotion(); -+ -+ /** -+ * Set the potion the Witch should drink -+ * -+ * @param potion Potion to drink -+ */ -+ void setDrinkingPotion(@Nullable ItemStack potion); -+ // Paper end - } diff --git a/patches/api/0159-Make-the-default-permission-message-configurable.patch b/patches/api/0159-Make-the-default-permission-message-configurable.patch new file mode 100644 index 0000000000..8dac5d0ae4 --- /dev/null +++ b/patches/api/0159-Make-the-default-permission-message-configurable.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 18 Nov 2018 19:44:54 +0000 +Subject: [PATCH] Make the default permission message configurable + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index d60780a26e10f5f9c80446693552384281327b51..f248515862c3bc418b42b8e197feb43addfd122d 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2397,6 +2397,28 @@ public final class Bukkit { + return server.suggestPlayerNamesWhenNullTabCompletions(); + } + ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ * @deprecated use {@link #permissionMessage()} ++ */ ++ @NotNull ++ @Deprecated ++ public static String getPermissionMessage() { ++ return server.getPermissionMessage(); ++ } ++ ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ */ ++ @NotNull ++ public static net.kyori.adventure.text.Component permissionMessage() { ++ return server.permissionMessage(); ++ } ++ + /** + * Creates a PlayerProfile for the specified uuid, with name as null. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 19e6cee94caabfe93c841da783c86a3c283ebcb9..69f236d965c631510b008a7eb38aa1b62a4e196a 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2086,6 +2086,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + boolean suggestPlayerNamesWhenNullTabCompletions(); + ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ * @deprecated use {@link #permissionMessage()} ++ */ ++ @NotNull ++ @Deprecated ++ String getPermissionMessage(); ++ ++ /** ++ * Gets the default no permission message used on the server ++ * ++ * @return the default message ++ */ ++ @NotNull net.kyori.adventure.text.Component permissionMessage(); ++ + /** + * Creates a PlayerProfile for the specified uuid, with name as null. + * +diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java +index f7b78198d9983610fc2185124c3080e6b1c0fa35..b3a2c274f05156fd603bcc7a68ab41265f2eaf44 100644 +--- a/src/main/java/org/bukkit/command/Command.java ++++ b/src/main/java/org/bukkit/command/Command.java +@@ -184,10 +184,9 @@ public abstract class Command { + return true; + } + +- if (permissionMessage == null) { +- target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake."); + // Paper start - use components for permissionMessage +- } else if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { ++ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.permissionMessage(); ++ if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { + target.sendMessage(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("").replacement(permission).build())); + // Paper end + } diff --git a/patches/api/0160-Make-the-default-permission-message-configurable.patch b/patches/api/0160-Make-the-default-permission-message-configurable.patch deleted file mode 100644 index 8dac5d0ae4..0000000000 --- a/patches/api/0160-Make-the-default-permission-message-configurable.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sun, 18 Nov 2018 19:44:54 +0000 -Subject: [PATCH] Make the default permission message configurable - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index d60780a26e10f5f9c80446693552384281327b51..f248515862c3bc418b42b8e197feb43addfd122d 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2397,6 +2397,28 @@ public final class Bukkit { - return server.suggestPlayerNamesWhenNullTabCompletions(); - } - -+ /** -+ * Gets the default no permission message used on the server -+ * -+ * @return the default message -+ * @deprecated use {@link #permissionMessage()} -+ */ -+ @NotNull -+ @Deprecated -+ public static String getPermissionMessage() { -+ return server.getPermissionMessage(); -+ } -+ -+ /** -+ * Gets the default no permission message used on the server -+ * -+ * @return the default message -+ */ -+ @NotNull -+ public static net.kyori.adventure.text.Component permissionMessage() { -+ return server.permissionMessage(); -+ } -+ - /** - * Creates a PlayerProfile for the specified uuid, with name as null. - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 19e6cee94caabfe93c841da783c86a3c283ebcb9..69f236d965c631510b008a7eb38aa1b62a4e196a 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2086,6 +2086,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - boolean suggestPlayerNamesWhenNullTabCompletions(); - -+ /** -+ * Gets the default no permission message used on the server -+ * -+ * @return the default message -+ * @deprecated use {@link #permissionMessage()} -+ */ -+ @NotNull -+ @Deprecated -+ String getPermissionMessage(); -+ -+ /** -+ * Gets the default no permission message used on the server -+ * -+ * @return the default message -+ */ -+ @NotNull net.kyori.adventure.text.Component permissionMessage(); -+ - /** - * Creates a PlayerProfile for the specified uuid, with name as null. - * -diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index f7b78198d9983610fc2185124c3080e6b1c0fa35..b3a2c274f05156fd603bcc7a68ab41265f2eaf44 100644 ---- a/src/main/java/org/bukkit/command/Command.java -+++ b/src/main/java/org/bukkit/command/Command.java -@@ -184,10 +184,9 @@ public abstract class Command { - return true; - } - -- if (permissionMessage == null) { -- target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake."); - // Paper start - use components for permissionMessage -- } else if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { -+ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : Bukkit.permissionMessage(); -+ if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { - target.sendMessage(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("").replacement(permission).build())); - // Paper end - } diff --git a/patches/api/0160-Support-cancellation-supression-of-EntityDismount-Ve.patch b/patches/api/0160-Support-cancellation-supression-of-EntityDismount-Ve.patch new file mode 100644 index 0000000000..420a97487d --- /dev/null +++ b/patches/api/0160-Support-cancellation-supression-of-EntityDismount-Ve.patch @@ -0,0 +1,107 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sun, 18 Nov 2018 15:53:43 +0000 +Subject: [PATCH] Support cancellation supression of EntityDismount/VehicleExit + events" + +Entities must be dismounted before teleportation in order to avoid +multiple issues in the server with regards to teleportation, shamefully, +too many plugins rely on the events firing, which means that not firing +these events caues more issues than it solves; + +In order to counteract this, Entity dismount/exit vehicle events have +been modified to supress cancellation (and has a method to allow plugins +to check if this has been set), noting that cancellation will be silently +surpressed given that plugins are not expecting this event to not be cancellable. + +This is a far from ideal scenario, however: given the current state of this +event and other alternatives causing issues elsewhere, I believe that +this is going to be the best soultion all around. + +Improvements/suggestions welcome! + +diff --git a/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java b/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java +index 00c3f50532392455070ae77ee4ad77cbf8d8827c..91188d77ff350aef20c3bde2bd27a8096825f337 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java +@@ -13,10 +13,18 @@ public class EntityDismountEvent extends EntityEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; + private final Entity dismounted; ++ private final boolean isCancellable; // Paper + + public EntityDismountEvent(@NotNull Entity what, @NotNull Entity dismounted) { ++ // Paper start ++ this(what, dismounted, true); ++ } ++ ++ public EntityDismountEvent(@NotNull Entity what, @NotNull Entity dismounted, boolean isCancellable) { ++ // Paper end + super(what); + this.dismounted = dismounted; ++ this.isCancellable = isCancellable; // Paper + } + + /** +@@ -36,9 +44,18 @@ public class EntityDismountEvent extends EntityEvent implements Cancellable { + + @Override + public void setCancelled(boolean cancel) { ++ // Paper start ++ if (cancel && !this.isCancellable) { ++ return; ++ } + this.cancelled = cancel; + } + ++ public boolean isCancellable() { ++ return this.isCancellable; ++ // Paper end ++ } ++ + @NotNull + @Override + public HandlerList getHandlers() { +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java +index 963b9ead4ca0426b2e95c5641b0e89317c48853d..39f6afd2f9cbcff6a74a91a21dcc3e29d2497dd8 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java +@@ -13,10 +13,18 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; + private final LivingEntity exited; ++ private final boolean isCancellable; // Paper + +- public VehicleExitEvent(@NotNull final Vehicle vehicle, @NotNull final LivingEntity exited) { ++ public VehicleExitEvent(@NotNull final Vehicle vehicle, @NotNull final LivingEntity exited, boolean isCancellable) { // Paper + super(vehicle); + this.exited = exited; ++ // Paper start ++ this.isCancellable = isCancellable; ++ } ++ ++ public VehicleExitEvent(@NotNull final Vehicle vehicle, @NotNull final LivingEntity exited) { ++ this(vehicle, exited, true); ++ // Paper end + } + + /** +@@ -36,9 +44,18 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable { + + @Override + public void setCancelled(boolean cancel) { ++ // Paper start ++ if (cancel && !isCancellable) { ++ return; ++ } + this.cancelled = cancel; + } + ++ public boolean isCancellable() { ++ return isCancellable; ++ // Paper end ++ } ++ + @NotNull + @Override + public HandlerList getHandlers() { diff --git a/patches/api/0161-Add-more-Zombie-API.patch b/patches/api/0161-Add-more-Zombie-API.patch new file mode 100644 index 0000000000..38efc859d8 --- /dev/null +++ b/patches/api/0161-Add-more-Zombie-API.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 7 Oct 2018 04:29:51 -0500 +Subject: [PATCH] Add more Zombie API + + +diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java +index 336b3efaf0a8ed5a238e8b941193d690e8b72d71..c1a5b625ea602d751a8026d989882c60e80756c9 100644 +--- a/src/main/java/org/bukkit/entity/Zombie.java ++++ b/src/main/java/org/bukkit/entity/Zombie.java +@@ -107,4 +107,60 @@ public interface Zombie extends Monster, Ageable { + * @param flag Whether this zombie can break doors + */ + void setCanBreakDoors(boolean flag); ++ ++ // Paper start ++ /** ++ * Check if zombie is drowning ++ * ++ * @return True if zombie conversion process has begun ++ */ ++ boolean isDrowning(); ++ ++ /** ++ * Make zombie start drowning ++ * ++ * @param drownedConversionTime Amount of time until zombie converts from drowning ++ * ++ * @deprecated See {@link #setConversionTime(int)} ++ */ ++ @Deprecated ++ void startDrowning(int drownedConversionTime); ++ ++ /** ++ * Stop a zombie from starting the drowning conversion process ++ */ ++ void stopDrowning(); ++ ++ /** ++ * Set if zombie has its arms raised ++ * ++ * @param raised True to raise arms ++ * @deprecated use {{@link #setAggressive(boolean)}} ++ */ ++ @Deprecated ++ void setArmsRaised(boolean raised); ++ ++ /** ++ * Check if zombie has arms raised ++ * ++ * @return True if arms are raised ++ * @deprecated use {@link #isAggressive()} ++ */ ++ @Deprecated ++ boolean isArmsRaised(); ++ ++ /** ++ * Check if this zombie will burn in the sunlight ++ * ++ * @return True if zombie will burn in sunlight ++ */ ++ boolean shouldBurnInDay(); ++ ++ /** ++ * Set if this zombie should burn in the sunlight ++ * ++ * @param shouldBurnInDay True to burn in sunlight ++ */ ++ void setShouldBurnInDay(boolean shouldBurnInDay); ++ // Paper end + } diff --git a/patches/api/0161-Support-cancellation-supression-of-EntityDismount-Ve.patch b/patches/api/0161-Support-cancellation-supression-of-EntityDismount-Ve.patch deleted file mode 100644 index 420a97487d..0000000000 --- a/patches/api/0161-Support-cancellation-supression-of-EntityDismount-Ve.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sun, 18 Nov 2018 15:53:43 +0000 -Subject: [PATCH] Support cancellation supression of EntityDismount/VehicleExit - events" - -Entities must be dismounted before teleportation in order to avoid -multiple issues in the server with regards to teleportation, shamefully, -too many plugins rely on the events firing, which means that not firing -these events caues more issues than it solves; - -In order to counteract this, Entity dismount/exit vehicle events have -been modified to supress cancellation (and has a method to allow plugins -to check if this has been set), noting that cancellation will be silently -surpressed given that plugins are not expecting this event to not be cancellable. - -This is a far from ideal scenario, however: given the current state of this -event and other alternatives causing issues elsewhere, I believe that -this is going to be the best soultion all around. - -Improvements/suggestions welcome! - -diff --git a/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java b/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java -index 00c3f50532392455070ae77ee4ad77cbf8d8827c..91188d77ff350aef20c3bde2bd27a8096825f337 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityDismountEvent.java -@@ -13,10 +13,18 @@ public class EntityDismountEvent extends EntityEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - private final Entity dismounted; -+ private final boolean isCancellable; // Paper - - public EntityDismountEvent(@NotNull Entity what, @NotNull Entity dismounted) { -+ // Paper start -+ this(what, dismounted, true); -+ } -+ -+ public EntityDismountEvent(@NotNull Entity what, @NotNull Entity dismounted, boolean isCancellable) { -+ // Paper end - super(what); - this.dismounted = dismounted; -+ this.isCancellable = isCancellable; // Paper - } - - /** -@@ -36,9 +44,18 @@ public class EntityDismountEvent extends EntityEvent implements Cancellable { - - @Override - public void setCancelled(boolean cancel) { -+ // Paper start -+ if (cancel && !this.isCancellable) { -+ return; -+ } - this.cancelled = cancel; - } - -+ public boolean isCancellable() { -+ return this.isCancellable; -+ // Paper end -+ } -+ - @NotNull - @Override - public HandlerList getHandlers() { -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -index 963b9ead4ca0426b2e95c5641b0e89317c48853d..39f6afd2f9cbcff6a74a91a21dcc3e29d2497dd8 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java -@@ -13,10 +13,18 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - private final LivingEntity exited; -+ private final boolean isCancellable; // Paper - -- public VehicleExitEvent(@NotNull final Vehicle vehicle, @NotNull final LivingEntity exited) { -+ public VehicleExitEvent(@NotNull final Vehicle vehicle, @NotNull final LivingEntity exited, boolean isCancellable) { // Paper - super(vehicle); - this.exited = exited; -+ // Paper start -+ this.isCancellable = isCancellable; -+ } -+ -+ public VehicleExitEvent(@NotNull final Vehicle vehicle, @NotNull final LivingEntity exited) { -+ this(vehicle, exited, true); -+ // Paper end - } - - /** -@@ -36,9 +44,18 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable { - - @Override - public void setCancelled(boolean cancel) { -+ // Paper start -+ if (cancel && !isCancellable) { -+ return; -+ } - this.cancelled = cancel; - } - -+ public boolean isCancellable() { -+ return isCancellable; -+ // Paper end -+ } -+ - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/0162-Add-more-Zombie-API.patch b/patches/api/0162-Add-more-Zombie-API.patch deleted file mode 100644 index 38efc859d8..0000000000 --- a/patches/api/0162-Add-more-Zombie-API.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 7 Oct 2018 04:29:51 -0500 -Subject: [PATCH] Add more Zombie API - - -diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java -index 336b3efaf0a8ed5a238e8b941193d690e8b72d71..c1a5b625ea602d751a8026d989882c60e80756c9 100644 ---- a/src/main/java/org/bukkit/entity/Zombie.java -+++ b/src/main/java/org/bukkit/entity/Zombie.java -@@ -107,4 +107,60 @@ public interface Zombie extends Monster, Ageable { - * @param flag Whether this zombie can break doors - */ - void setCanBreakDoors(boolean flag); -+ -+ // Paper start -+ /** -+ * Check if zombie is drowning -+ * -+ * @return True if zombie conversion process has begun -+ */ -+ boolean isDrowning(); -+ -+ /** -+ * Make zombie start drowning -+ * -+ * @param drownedConversionTime Amount of time until zombie converts from drowning -+ * -+ * @deprecated See {@link #setConversionTime(int)} -+ */ -+ @Deprecated -+ void startDrowning(int drownedConversionTime); -+ -+ /** -+ * Stop a zombie from starting the drowning conversion process -+ */ -+ void stopDrowning(); -+ -+ /** -+ * Set if zombie has its arms raised -+ * -+ * @param raised True to raise arms -+ * @deprecated use {{@link #setAggressive(boolean)}} -+ */ -+ @Deprecated -+ void setArmsRaised(boolean raised); -+ -+ /** -+ * Check if zombie has arms raised -+ * -+ * @return True if arms are raised -+ * @deprecated use {@link #isAggressive()} -+ */ -+ @Deprecated -+ boolean isArmsRaised(); -+ -+ /** -+ * Check if this zombie will burn in the sunlight -+ * -+ * @return True if zombie will burn in sunlight -+ */ -+ boolean shouldBurnInDay(); -+ -+ /** -+ * Set if this zombie should burn in the sunlight -+ * -+ * @param shouldBurnInDay True to burn in sunlight -+ */ -+ void setShouldBurnInDay(boolean shouldBurnInDay); -+ // Paper end - } diff --git a/patches/api/0162-Change-the-reserved-channel-check-to-be-sensible.patch b/patches/api/0162-Change-the-reserved-channel-check-to-be-sensible.patch new file mode 100644 index 0000000000..8975ff3c43 --- /dev/null +++ b/patches/api/0162-Change-the-reserved-channel-check-to-be-sensible.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com> +Date: Tue, 23 Oct 2018 19:32:55 +0300 +Subject: [PATCH] Change the reserved channel check to be sensible + + +diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java +index 1d061412cdafa28c6940c7433747ab1dabe23de1..6fda7f3aa68e76af64362e9afed70fc6a5e92986 100644 +--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java ++++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java +@@ -172,7 +172,7 @@ public class StandardMessenger implements Messenger { + public boolean isReservedChannel(@NotNull String channel) { + channel = validateAndCorrectChannel(channel); + +- return channel.contains("minecraft") && !channel.equals("minecraft:brand"); ++ return channel.equals("minecraft:register") || channel.equals("minecraft:unregister"); // Paper + } + + @Override +diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java +index 144ae2f31badb8142bc4a76a7abab37a57118191..8ffaa33d97c045c0fd6851ec2f189344b4a070d2 100644 +--- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java ++++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java +@@ -26,8 +26,8 @@ public class StandardMessengerTest { + assertTrue(messenger.isReservedChannel("minecraft:register")); + assertFalse(messenger.isReservedChannel("test:register")); + assertTrue(messenger.isReservedChannel("minecraft:unregister")); +- assertFalse(messenger.isReservedChannel("test:nregister")); +- assertTrue(messenger.isReservedChannel("minecraft:something")); ++ assertFalse(messenger.isReservedChannel("test:unregister")); // Paper - fix typo ++ assertFalse(messenger.isReservedChannel("minecraft:something")); // Paper - now less strict + assertFalse(messenger.isReservedChannel("minecraft:brand")); + } + diff --git a/patches/api/0163-Add-PlayerConnectionCloseEvent.patch b/patches/api/0163-Add-PlayerConnectionCloseEvent.patch new file mode 100644 index 0000000000..6264223dd9 --- /dev/null +++ b/patches/api/0163-Add-PlayerConnectionCloseEvent.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 7 Oct 2018 12:05:06 -0700 +Subject: [PATCH] Add PlayerConnectionCloseEvent + +This event is invoked when a player has disconnected. It is guaranteed that, +if the server is in online-mode, that the provided uuid and username have been +validated. + +The event is invoked for players who have not yet logged into the world, whereas +PlayerQuitEvent is only invoked on players who have logged into the world. + +The event is invoked for players who have already logged into the world, +although whether or not the player exists in the world at the time of +firing is undefined. (That is, whether the plugin can retrieve a Player object +using the event parameters is undefined). However, it is guaranteed that this +event is invoked AFTER PlayerQuitEvent, if the player has already logged into +the world. + +This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has +been called beforehand, and this event may not be called in parallel with +AsyncPlayerPreLoginEvent for the same connection. + +Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding +PlayerConnectionCloseEvent is never called. + +The event may be invoked asynchronously or synchronously. As it stands, +it is never invoked asynchronously. However, plugins should check +Event#isAsynchronous to be future-proof. + +On purpose, the deprecated PlayerPreLoginEvent event is left out of the +API spec for this event. Plugins should not be using that event, and +how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent +is undefined. + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d0fb13adc140f1ca74d0c3448f92baa60684f3e2 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java +@@ -0,0 +1,88 @@ ++package com.destroystokyo.paper.event.player; ++ ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++import java.net.InetAddress; ++import java.util.UUID; ++import org.bukkit.event.player.AsyncPlayerPreLoginEvent; ++import org.bukkit.event.player.PlayerQuitEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ *

++ * This event is invoked when a player has disconnected. It is guaranteed that, ++ * if the server is in online-mode, that the provided uuid and username have been ++ * validated. ++ *

++ * The event is invoked for players who have not yet logged into the world, whereas ++ * {@link PlayerQuitEvent} is only invoked on players who have logged into the world. ++ *

++ * The event is invoked for players who have already logged into the world, ++ * although whether or not the player exists in the world at the time of ++ * firing is undefined. (That is, whether the plugin can retrieve a Player object ++ * using the event parameters is undefined). However, it is guaranteed that this ++ * event is invoked AFTER {@link PlayerQuitEvent}, if the player has already logged into the world. ++ *

++ * This event is guaranteed to never fire unless {@link AsyncPlayerPreLoginEvent} has ++ * been fired beforehand, and this event may not be called in parallel with ++ * {@link AsyncPlayerPreLoginEvent} for the same connection. ++ *

++ * Cancelling the {@link AsyncPlayerPreLoginEvent} guarantees the corresponding ++ * {@code PlayerConnectionCloseEvent} is never called. ++ *

++ * The event may be invoked asynchronously or synchronously. Plugins should check ++ * {@link Event#isAsynchronous()} and handle accordingly. ++ */ ++public class PlayerConnectionCloseEvent extends Event { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final UUID playerUniqueId; ++ @NotNull private final String playerName; ++ @NotNull private final InetAddress ipAddress; ++ ++ @ApiStatus.Internal ++ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) { ++ super(async); ++ this.playerUniqueId = playerUniqueId; ++ this.playerName = playerName; ++ this.ipAddress = ipAddress; ++ } ++ ++ /** ++ * Returns the {@code UUID} of the player disconnecting. ++ */ ++ @NotNull ++ public UUID getPlayerUniqueId() { ++ return this.playerUniqueId; ++ } ++ ++ /** ++ * Returns the name of the player disconnecting. ++ */ ++ @NotNull ++ public String getPlayerName() { ++ return this.playerName; ++ } ++ ++ /** ++ * Returns the player's IP address. ++ */ ++ @NotNull ++ public InetAddress getIpAddress() { ++ return this.ipAddress; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0163-Change-the-reserved-channel-check-to-be-sensible.patch b/patches/api/0163-Change-the-reserved-channel-check-to-be-sensible.patch deleted file mode 100644 index 8975ff3c43..0000000000 --- a/patches/api/0163-Change-the-reserved-channel-check-to-be-sensible.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com> -Date: Tue, 23 Oct 2018 19:32:55 +0300 -Subject: [PATCH] Change the reserved channel check to be sensible - - -diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -index 1d061412cdafa28c6940c7433747ab1dabe23de1..6fda7f3aa68e76af64362e9afed70fc6a5e92986 100644 ---- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -@@ -172,7 +172,7 @@ public class StandardMessenger implements Messenger { - public boolean isReservedChannel(@NotNull String channel) { - channel = validateAndCorrectChannel(channel); - -- return channel.contains("minecraft") && !channel.equals("minecraft:brand"); -+ return channel.equals("minecraft:register") || channel.equals("minecraft:unregister"); // Paper - } - - @Override -diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java -index 144ae2f31badb8142bc4a76a7abab37a57118191..8ffaa33d97c045c0fd6851ec2f189344b4a070d2 100644 ---- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java -+++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java -@@ -26,8 +26,8 @@ public class StandardMessengerTest { - assertTrue(messenger.isReservedChannel("minecraft:register")); - assertFalse(messenger.isReservedChannel("test:register")); - assertTrue(messenger.isReservedChannel("minecraft:unregister")); -- assertFalse(messenger.isReservedChannel("test:nregister")); -- assertTrue(messenger.isReservedChannel("minecraft:something")); -+ assertFalse(messenger.isReservedChannel("test:unregister")); // Paper - fix typo -+ assertFalse(messenger.isReservedChannel("minecraft:something")); // Paper - now less strict - assertFalse(messenger.isReservedChannel("minecraft:brand")); - } - diff --git a/patches/api/0164-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/api/0164-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch new file mode 100644 index 0000000000..dd625f4153 --- /dev/null +++ b/patches/api/0164-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Wed, 2 Jan 2019 00:31:12 -0600 +Subject: [PATCH] Add APIs to replace OfflinePlayer#getLastPlayed + +Currently OfflinePlayer#getLastPlayed could more accurately be described +as "OfflinePlayer#getLastTimeTheirDataWasSaved". + +The API doc says it should return the last time the server "witnessed" +the player, whilst also saying it should return the last time they +logged in. The current implementation does neither. + +Given this interesting contradiction in the API documentation and the +current defacto implementation, I've elected to deprecate (with no +intent to remove) and replace it with two new methods, clearly named and +documented as to their purpose. + +diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java +index ef85e57f812c501fac7abe7dd27c93702f66646f..f5d3e5c5d79910580b6202e7aee01341d09f6225 100644 +--- a/src/main/java/org/bukkit/OfflinePlayer.java ++++ b/src/main/java/org/bukkit/OfflinePlayer.java +@@ -223,7 +223,9 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio + * UTC. + * + * @return Date of last log-in for this player, or 0 ++ * @deprecated The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended use {@link #getLastLogin()} or {@link #getLastSeen()} depending on your needs. + */ ++ @Deprecated + public long getLastPlayed(); + + /** +@@ -246,6 +248,30 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio + @Nullable + @Deprecated + public Location getBedSpawnLocation(); ++ // Paper start ++ /** ++ * Gets the last date and time that this player logged into the server. ++ *

++ * If the player has never played before, this will return 0. Otherwise, ++ * it will be the amount of milliseconds since midnight, January 1, 1970 ++ * UTC. ++ * ++ * @return last login time ++ */ ++ public long getLastLogin(); ++ ++ /** ++ * Gets the last date and time that this player was seen on the server. ++ *

++ * If the player has never played before, this will return 0. If the ++ * player is currently online, this will return the current time. ++ * Otherwise it will be the amount of milliseconds since midnight, ++ * January 1, 1970 UTC. ++ * ++ * @return last seen time ++ */ ++ public long getLastSeen(); ++ // Paper end + + /** + * Gets the Location where the player will spawn at, null if they diff --git a/patches/api/0164-Add-PlayerConnectionCloseEvent.patch b/patches/api/0164-Add-PlayerConnectionCloseEvent.patch deleted file mode 100644 index 6264223dd9..0000000000 --- a/patches/api/0164-Add-PlayerConnectionCloseEvent.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sun, 7 Oct 2018 12:05:06 -0700 -Subject: [PATCH] Add PlayerConnectionCloseEvent - -This event is invoked when a player has disconnected. It is guaranteed that, -if the server is in online-mode, that the provided uuid and username have been -validated. - -The event is invoked for players who have not yet logged into the world, whereas -PlayerQuitEvent is only invoked on players who have logged into the world. - -The event is invoked for players who have already logged into the world, -although whether or not the player exists in the world at the time of -firing is undefined. (That is, whether the plugin can retrieve a Player object -using the event parameters is undefined). However, it is guaranteed that this -event is invoked AFTER PlayerQuitEvent, if the player has already logged into -the world. - -This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has -been called beforehand, and this event may not be called in parallel with -AsyncPlayerPreLoginEvent for the same connection. - -Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding -PlayerConnectionCloseEvent is never called. - -The event may be invoked asynchronously or synchronously. As it stands, -it is never invoked asynchronously. However, plugins should check -Event#isAsynchronous to be future-proof. - -On purpose, the deprecated PlayerPreLoginEvent event is left out of the -API spec for this event. Plugins should not be using that event, and -how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent -is undefined. - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d0fb13adc140f1ca74d0c3448f92baa60684f3e2 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java -@@ -0,0 +1,88 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+ -+import java.net.InetAddress; -+import java.util.UUID; -+import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -+import org.bukkit.event.player.PlayerQuitEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ *

-+ * This event is invoked when a player has disconnected. It is guaranteed that, -+ * if the server is in online-mode, that the provided uuid and username have been -+ * validated. -+ *

-+ * The event is invoked for players who have not yet logged into the world, whereas -+ * {@link PlayerQuitEvent} is only invoked on players who have logged into the world. -+ *

-+ * The event is invoked for players who have already logged into the world, -+ * although whether or not the player exists in the world at the time of -+ * firing is undefined. (That is, whether the plugin can retrieve a Player object -+ * using the event parameters is undefined). However, it is guaranteed that this -+ * event is invoked AFTER {@link PlayerQuitEvent}, if the player has already logged into the world. -+ *

-+ * This event is guaranteed to never fire unless {@link AsyncPlayerPreLoginEvent} has -+ * been fired beforehand, and this event may not be called in parallel with -+ * {@link AsyncPlayerPreLoginEvent} for the same connection. -+ *

-+ * Cancelling the {@link AsyncPlayerPreLoginEvent} guarantees the corresponding -+ * {@code PlayerConnectionCloseEvent} is never called. -+ *

-+ * The event may be invoked asynchronously or synchronously. Plugins should check -+ * {@link Event#isAsynchronous()} and handle accordingly. -+ */ -+public class PlayerConnectionCloseEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final UUID playerUniqueId; -+ @NotNull private final String playerName; -+ @NotNull private final InetAddress ipAddress; -+ -+ @ApiStatus.Internal -+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) { -+ super(async); -+ this.playerUniqueId = playerUniqueId; -+ this.playerName = playerName; -+ this.ipAddress = ipAddress; -+ } -+ -+ /** -+ * Returns the {@code UUID} of the player disconnecting. -+ */ -+ @NotNull -+ public UUID getPlayerUniqueId() { -+ return this.playerUniqueId; -+ } -+ -+ /** -+ * Returns the name of the player disconnecting. -+ */ -+ @NotNull -+ public String getPlayerName() { -+ return this.playerName; -+ } -+ -+ /** -+ * Returns the player's IP address. -+ */ -+ @NotNull -+ public InetAddress getIpAddress() { -+ return this.ipAddress; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch deleted file mode 100644 index dd625f4153..0000000000 --- a/patches/api/0165-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Wed, 2 Jan 2019 00:31:12 -0600 -Subject: [PATCH] Add APIs to replace OfflinePlayer#getLastPlayed - -Currently OfflinePlayer#getLastPlayed could more accurately be described -as "OfflinePlayer#getLastTimeTheirDataWasSaved". - -The API doc says it should return the last time the server "witnessed" -the player, whilst also saying it should return the last time they -logged in. The current implementation does neither. - -Given this interesting contradiction in the API documentation and the -current defacto implementation, I've elected to deprecate (with no -intent to remove) and replace it with two new methods, clearly named and -documented as to their purpose. - -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index ef85e57f812c501fac7abe7dd27c93702f66646f..f5d3e5c5d79910580b6202e7aee01341d09f6225 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -223,7 +223,9 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - * UTC. - * - * @return Date of last log-in for this player, or 0 -+ * @deprecated The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended use {@link #getLastLogin()} or {@link #getLastSeen()} depending on your needs. - */ -+ @Deprecated - public long getLastPlayed(); - - /** -@@ -246,6 +248,30 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - @Nullable - @Deprecated - public Location getBedSpawnLocation(); -+ // Paper start -+ /** -+ * Gets the last date and time that this player logged into the server. -+ *

-+ * If the player has never played before, this will return 0. Otherwise, -+ * it will be the amount of milliseconds since midnight, January 1, 1970 -+ * UTC. -+ * -+ * @return last login time -+ */ -+ public long getLastLogin(); -+ -+ /** -+ * Gets the last date and time that this player was seen on the server. -+ *

-+ * If the player has never played before, this will return 0. If the -+ * player is currently online, this will return the current time. -+ * Otherwise it will be the amount of milliseconds since midnight, -+ * January 1, 1970 UTC. -+ * -+ * @return last seen time -+ */ -+ public long getLastSeen(); -+ // Paper end - - /** - * Gets the Location where the player will spawn at, null if they diff --git a/patches/api/0165-Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/0165-Add-ItemStack-Recipe-API-helper-methods.patch new file mode 100644 index 0000000000..61a45e967f --- /dev/null +++ b/patches/api/0165-Add-ItemStack-Recipe-API-helper-methods.patch @@ -0,0 +1,104 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 28 Jan 2014 19:13:57 -0500 +Subject: [PATCH] Add ItemStack Recipe API helper methods + +Allows using ExactChoice Recipes with easier methods + +Redirects some of upstream's APIs to these new methods to avoid +usage of magic values and the deprecated RecipeChoice#getItemStack + +diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java +index 6734bc9d7a6eee8ee40419ae3fe245b67eabaca6..db8bcc66bdc4bedfffb4705db6338eda4c0ad29a 100644 +--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java ++++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java +@@ -146,8 +146,6 @@ public interface RecipeChoice extends Predicate, Cloneable { + /** + * Represents a choice that will be valid only if one of the stacks is + * exactly matched (aside from stack size). +- *
+- * Only valid for shaped recipes + */ + public static class ExactChoice implements RecipeChoice { + +diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +index 71e494177473c62449aafda1699b26a0c4c81a68..97d5d9c6347bc401e3f4ab7c0ba1391ad5b0449a 100644 +--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java ++++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +@@ -168,6 +168,13 @@ public class ShapedRecipe extends CraftingRecipe { + return this; + } + ++ // Paper start ++ @NotNull ++ public ShapedRecipe setIngredient(char key, @NotNull ItemStack item) { ++ return setIngredient(key, new RecipeChoice.ExactChoice(item)); ++ } ++ // Paper end ++ + /** + * Get a copy of the ingredients map. + * +diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +index d6e38c7ccfe3b6e85eafb611da20b1a29fb74d97..b8ac602cd2718d615ec243ce648951a1a46c26ec 100644 +--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java ++++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +@@ -131,6 +131,40 @@ public class ShapelessRecipe extends CraftingRecipe { + return this; + } + ++ // Paper start ++ @NotNull ++ public ShapelessRecipe addIngredient(@NotNull ItemStack item) { ++ return addIngredient(item.getAmount(), item); ++ } ++ ++ @NotNull ++ public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) { ++ Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); ++ while (count-- > 0) { ++ ingredients.add(new RecipeChoice.ExactChoice(item)); ++ } ++ return this; ++ } ++ ++ @NotNull ++ public ShapelessRecipe removeIngredient(@NotNull ItemStack item) { ++ return removeIngredient(1, item); ++ } ++ ++ @NotNull ++ public ShapelessRecipe removeIngredient(int count, @NotNull ItemStack item) { ++ Iterator iterator = ingredients.iterator(); ++ while (count > 0 && iterator.hasNext()) { ++ RecipeChoice choice = iterator.next(); ++ if (choice.test(item)) { ++ iterator.remove(); ++ count--; ++ } ++ } ++ return this; ++ } ++ // Paper end ++ + /** + * Removes an ingredient from the list. + * +@@ -154,7 +188,7 @@ public class ShapelessRecipe extends CraftingRecipe { + */ + @NotNull + public ShapelessRecipe removeIngredient(@NotNull Material ingredient) { +- return removeIngredient(ingredient, 0); ++ return removeIngredient(new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack) + } + + /** +@@ -181,7 +215,7 @@ public class ShapelessRecipe extends CraftingRecipe { + */ + @NotNull + public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) { +- return removeIngredient(count, ingredient, 0); ++ return removeIngredient(count, new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack) + } + + /** diff --git a/patches/api/0166-Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/0166-Add-ItemStack-Recipe-API-helper-methods.patch deleted file mode 100644 index 61a45e967f..0000000000 --- a/patches/api/0166-Add-ItemStack-Recipe-API-helper-methods.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 28 Jan 2014 19:13:57 -0500 -Subject: [PATCH] Add ItemStack Recipe API helper methods - -Allows using ExactChoice Recipes with easier methods - -Redirects some of upstream's APIs to these new methods to avoid -usage of magic values and the deprecated RecipeChoice#getItemStack - -diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java -index 6734bc9d7a6eee8ee40419ae3fe245b67eabaca6..db8bcc66bdc4bedfffb4705db6338eda4c0ad29a 100644 ---- a/src/main/java/org/bukkit/inventory/RecipeChoice.java -+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java -@@ -146,8 +146,6 @@ public interface RecipeChoice extends Predicate, Cloneable { - /** - * Represents a choice that will be valid only if one of the stacks is - * exactly matched (aside from stack size). -- *
-- * Only valid for shaped recipes - */ - public static class ExactChoice implements RecipeChoice { - -diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java -index 71e494177473c62449aafda1699b26a0c4c81a68..97d5d9c6347bc401e3f4ab7c0ba1391ad5b0449a 100644 ---- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java -+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java -@@ -168,6 +168,13 @@ public class ShapedRecipe extends CraftingRecipe { - return this; - } - -+ // Paper start -+ @NotNull -+ public ShapedRecipe setIngredient(char key, @NotNull ItemStack item) { -+ return setIngredient(key, new RecipeChoice.ExactChoice(item)); -+ } -+ // Paper end -+ - /** - * Get a copy of the ingredients map. - * -diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -index d6e38c7ccfe3b6e85eafb611da20b1a29fb74d97..b8ac602cd2718d615ec243ce648951a1a46c26ec 100644 ---- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -@@ -131,6 +131,40 @@ public class ShapelessRecipe extends CraftingRecipe { - return this; - } - -+ // Paper start -+ @NotNull -+ public ShapelessRecipe addIngredient(@NotNull ItemStack item) { -+ return addIngredient(item.getAmount(), item); -+ } -+ -+ @NotNull -+ public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) { -+ Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients"); -+ while (count-- > 0) { -+ ingredients.add(new RecipeChoice.ExactChoice(item)); -+ } -+ return this; -+ } -+ -+ @NotNull -+ public ShapelessRecipe removeIngredient(@NotNull ItemStack item) { -+ return removeIngredient(1, item); -+ } -+ -+ @NotNull -+ public ShapelessRecipe removeIngredient(int count, @NotNull ItemStack item) { -+ Iterator iterator = ingredients.iterator(); -+ while (count > 0 && iterator.hasNext()) { -+ RecipeChoice choice = iterator.next(); -+ if (choice.test(item)) { -+ iterator.remove(); -+ count--; -+ } -+ } -+ return this; -+ } -+ // Paper end -+ - /** - * Removes an ingredient from the list. - * -@@ -154,7 +188,7 @@ public class ShapelessRecipe extends CraftingRecipe { - */ - @NotNull - public ShapelessRecipe removeIngredient(@NotNull Material ingredient) { -- return removeIngredient(ingredient, 0); -+ return removeIngredient(new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack) - } - - /** -@@ -181,7 +215,7 @@ public class ShapelessRecipe extends CraftingRecipe { - */ - @NotNull - public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) { -- return removeIngredient(count, ingredient, 0); -+ return removeIngredient(count, new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack) - } - - /** diff --git a/patches/api/0166-BlockDestroyEvent.patch b/patches/api/0166-BlockDestroyEvent.patch new file mode 100644 index 0000000000..d6ac7bfb8d --- /dev/null +++ b/patches/api/0166-BlockDestroyEvent.patch @@ -0,0 +1,140 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 6 Feb 2019 00:19:33 -0500 +Subject: [PATCH] BlockDestroyEvent + +Adds an event for when the server is going to destroy a current block, +potentially causing it to drop. This event can be cancelled to avoid +the block destruction, such as preventing signs from popping when +floating in the air. + +This can replace many uses of BlockPhysicsEvent + +diff --git a/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889ece1a9168 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java +@@ -0,0 +1,122 @@ ++package com.destroystokyo.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.block.data.BlockData; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockExpEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired anytime the server intends to 'destroy' a block through some triggering reason. ++ * This does not fire anytime a block is set to air, but only with more direct triggers such ++ * as physics updates, pistons, Entities changing blocks, commands set to "Destroy". ++ *

++ * This event is associated with the game playing a sound effect at the block in question, when ++ * something can be described as "intend to destroy what is there", ++ *

++ * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event. ++ */ ++public class BlockDestroyEvent extends BlockExpEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final BlockData newState; ++ private boolean willDrop; ++ private boolean playEffect = true; ++ private BlockData effectBlock; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, @NotNull BlockData effectBlock, int xp, boolean willDrop) { ++ super(block, xp); ++ this.newState = newState; ++ this.effectBlock = effectBlock; ++ this.willDrop = willDrop; ++ } ++ ++ /** ++ * Get the effect that will be played when the block is broken. ++ * ++ * @return block break effect ++ */ ++ @NotNull ++ public BlockData getEffectBlock() { ++ return this.effectBlock; ++ } ++ ++ /** ++ * Sets the effect that will be played when the block is broken. ++ * Note: {@link BlockDestroyEvent#playEffect()} must be {@code true} in order for this effect to be ++ * played. ++ * ++ * @param effectBlock block effect ++ */ ++ public void setEffectBlock(@NotNull BlockData effectBlock) { ++ this.effectBlock = effectBlock; ++ } ++ ++ /** ++ * @return The new state of this block (Air, or a Fluid type) ++ */ ++ public @NotNull BlockData getNewState() { ++ return this.newState.clone(); ++ } ++ ++ /** ++ * @return If the server is going to drop the block in question with this destroy event ++ */ ++ public boolean willDrop() { ++ return this.willDrop; ++ } ++ ++ /** ++ * @param willDrop If the server is going to drop the block in question with this destroy event ++ */ ++ public void setWillDrop(boolean willDrop) { ++ this.willDrop = willDrop; ++ } ++ ++ /** ++ * @return If the server is going to play the sound effect for this destruction ++ */ ++ public boolean playEffect() { ++ return this.playEffect; ++ } ++ ++ /** ++ * @param playEffect If the server should play the sound effect for this destruction ++ */ ++ public void setPlayEffect(boolean playEffect) { ++ this.playEffect = playEffect; ++ } ++ ++ /** ++ * @return If the event is cancelled, meaning the block will not be destroyed ++ */ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * If the event is cancelled, the block will remain in its previous state. ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0167-Add-WhitelistToggleEvent.patch b/patches/api/0167-Add-WhitelistToggleEvent.patch new file mode 100644 index 0000000000..1e26aba2a3 --- /dev/null +++ b/patches/api/0167-Add-WhitelistToggleEvent.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa +Date: Wed, 13 Mar 2019 20:04:43 +0200 +Subject: [PATCH] Add WhitelistToggleEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..22fa169c278639f31aec2695259963038de0af8a +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java +@@ -0,0 +1,43 @@ ++package com.destroystokyo.paper.event.server; ++ ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * This event is fired when whitelist is toggled ++ * ++ * @author Mark Vainomaa ++ */ ++public class WhitelistToggleEvent extends Event { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final boolean enabled; ++ ++ @ApiStatus.Internal ++ public WhitelistToggleEvent(boolean enabled) { ++ this.enabled = enabled; ++ } ++ ++ /** ++ * Gets whether whitelist is going to be enabled or not ++ * ++ * @return Whether whitelist is going to be enabled or not ++ */ ++ public boolean isEnabled() { ++ return this.enabled; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0167-BlockDestroyEvent.patch b/patches/api/0167-BlockDestroyEvent.patch deleted file mode 100644 index d6ac7bfb8d..0000000000 --- a/patches/api/0167-BlockDestroyEvent.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 6 Feb 2019 00:19:33 -0500 -Subject: [PATCH] BlockDestroyEvent - -Adds an event for when the server is going to destroy a current block, -potentially causing it to drop. This event can be cancelled to avoid -the block destruction, such as preventing signs from popping when -floating in the air. - -This can replace many uses of BlockPhysicsEvent - -diff --git a/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c0742b58ca2c098c27394915b624889ece1a9168 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java -@@ -0,0 +1,122 @@ -+package com.destroystokyo.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.block.data.BlockData; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockExpEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired anytime the server intends to 'destroy' a block through some triggering reason. -+ * This does not fire anytime a block is set to air, but only with more direct triggers such -+ * as physics updates, pistons, Entities changing blocks, commands set to "Destroy". -+ *

-+ * This event is associated with the game playing a sound effect at the block in question, when -+ * something can be described as "intend to destroy what is there", -+ *

-+ * Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event. -+ */ -+public class BlockDestroyEvent extends BlockExpEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final BlockData newState; -+ private boolean willDrop; -+ private boolean playEffect = true; -+ private BlockData effectBlock; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public BlockDestroyEvent(@NotNull Block block, @NotNull BlockData newState, @NotNull BlockData effectBlock, int xp, boolean willDrop) { -+ super(block, xp); -+ this.newState = newState; -+ this.effectBlock = effectBlock; -+ this.willDrop = willDrop; -+ } -+ -+ /** -+ * Get the effect that will be played when the block is broken. -+ * -+ * @return block break effect -+ */ -+ @NotNull -+ public BlockData getEffectBlock() { -+ return this.effectBlock; -+ } -+ -+ /** -+ * Sets the effect that will be played when the block is broken. -+ * Note: {@link BlockDestroyEvent#playEffect()} must be {@code true} in order for this effect to be -+ * played. -+ * -+ * @param effectBlock block effect -+ */ -+ public void setEffectBlock(@NotNull BlockData effectBlock) { -+ this.effectBlock = effectBlock; -+ } -+ -+ /** -+ * @return The new state of this block (Air, or a Fluid type) -+ */ -+ public @NotNull BlockData getNewState() { -+ return this.newState.clone(); -+ } -+ -+ /** -+ * @return If the server is going to drop the block in question with this destroy event -+ */ -+ public boolean willDrop() { -+ return this.willDrop; -+ } -+ -+ /** -+ * @param willDrop If the server is going to drop the block in question with this destroy event -+ */ -+ public void setWillDrop(boolean willDrop) { -+ this.willDrop = willDrop; -+ } -+ -+ /** -+ * @return If the server is going to play the sound effect for this destruction -+ */ -+ public boolean playEffect() { -+ return this.playEffect; -+ } -+ -+ /** -+ * @param playEffect If the server should play the sound effect for this destruction -+ */ -+ public void setPlayEffect(boolean playEffect) { -+ this.playEffect = playEffect; -+ } -+ -+ /** -+ * @return If the event is cancelled, meaning the block will not be destroyed -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * If the event is cancelled, the block will remain in its previous state. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0168-Add-GS4-Query-event.patch b/patches/api/0168-Add-GS4-Query-event.patch new file mode 100644 index 0000000000..a153279317 --- /dev/null +++ b/patches/api/0168-Add-GS4-Query-event.patch @@ -0,0 +1,436 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa +Date: Sun, 17 Mar 2019 21:46:27 +0200 +Subject: [PATCH] Add GS4 Query event + + +diff --git a/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8edc33bde29e967cec488d0f5e2f1097291978a6 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java +@@ -0,0 +1,424 @@ ++package com.destroystokyo.paper.event.server; ++ ++import com.google.common.base.Preconditions; ++import com.google.common.collect.ImmutableList; ++import org.bukkit.Server; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.net.InetAddress; ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.List; ++ ++/** ++ * This event is fired if server is getting queried over GS4 Query protocol. ++ *
++ * Adapted from Velocity's ProxyQueryEvent ++ * ++ * @author Mark Vainomaa ++ */ ++public final class GS4QueryEvent extends Event { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final QueryType queryType; ++ private final InetAddress querierAddress; ++ private QueryResponse response; ++ ++ @ApiStatus.Internal ++ public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) { ++ super(true); // should always be called async ++ this.queryType = queryType; ++ this.querierAddress = querierAddress; ++ this.response = response; ++ } ++ ++ /** ++ * Get query type ++ * ++ * @return query type ++ */ ++ @NotNull ++ public QueryType getQueryType() { ++ return this.queryType; ++ } ++ ++ /** ++ * Get querier address ++ * ++ * @return querier address ++ */ ++ @NotNull ++ public InetAddress getQuerierAddress() { ++ return this.querierAddress; ++ } ++ ++ /** ++ * Get query response ++ * ++ * @return query response ++ */ ++ @NotNull ++ public QueryResponse getResponse() { ++ return this.response; ++ } ++ ++ /** ++ * Set query response ++ * ++ * @param response query response ++ */ ++ public void setResponse(@NotNull QueryResponse response) { ++ this.response = Preconditions.checkNotNull(response, "response"); ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ /** ++ * The type of query ++ */ ++ public enum QueryType { ++ /** ++ * Basic query asks only a subset of information, such as motd, game type (hardcoded to

MINECRAFT
), map, ++ * current players, max players, server port and server motd ++ */ ++ BASIC, ++ ++ /** ++ * Full query asks pretty much everything present on this event (only hardcoded values cannot be modified here). ++ */ ++ FULL ++ } ++ ++ public final static class QueryResponse { ++ ++ private final String motd; ++ private final String gameVersion; ++ private final String map; ++ private final int currentPlayers; ++ private final int maxPlayers; ++ private final String hostname; ++ private final int port; ++ private final Collection players; ++ private final String serverVersion; ++ private final Collection plugins; ++ ++ private QueryResponse(String motd, String gameVersion, String map, int currentPlayers, int maxPlayers, String hostname, int port, Collection players, String serverVersion, Collection plugins) { ++ this.motd = motd; ++ this.gameVersion = gameVersion; ++ this.map = map; ++ this.currentPlayers = currentPlayers; ++ this.maxPlayers = maxPlayers; ++ this.hostname = hostname; ++ this.port = port; ++ this.players = players; ++ this.serverVersion = serverVersion; ++ this.plugins = plugins; ++ } ++ ++ /** ++ * Get motd which will be used to reply to the query. By default it is {@link Server#getMotd()}. ++ * ++ * @return motd ++ */ ++ @NotNull ++ public String getMotd() { ++ return this.motd; ++ } ++ ++ /** ++ * Get game version which will be used to reply to the query. By default supported Minecraft versions range is sent. ++ * ++ * @return game version ++ */ ++ @NotNull ++ public String getGameVersion() { ++ return this.gameVersion; ++ } ++ ++ /** ++ * Get map name which will be used to reply to the query. By default {@code world} is sent. ++ * ++ * @return map name ++ */ ++ @NotNull ++ public String getMap() { ++ return this.map; ++ } ++ ++ /** ++ * Get current online player count which will be used to reply to the query. ++ * ++ * @return online player count ++ */ ++ public int getCurrentPlayers() { ++ return this.currentPlayers; ++ } ++ ++ /** ++ * Get max player count which will be used to reply to the query. ++ * ++ * @return max player count ++ */ ++ public int getMaxPlayers() { ++ return this.maxPlayers; ++ } ++ ++ /** ++ * Get server (public facing) hostname. ++ * ++ * @return server hostname ++ */ ++ @NotNull ++ public String getHostname() { ++ return this.hostname; ++ } ++ ++ /** ++ * Get server (public facing) port. ++ * ++ * @return server port ++ */ ++ public int getPort() { ++ return this.port; ++ } ++ ++ /** ++ * Get collection of players which will be used to reply to the query. ++ * ++ * @return collection of players ++ */ ++ @NotNull ++ public Collection getPlayers() { ++ return this.players; ++ } ++ ++ /** ++ * Get server software (name and version) which will be used to reply to the query. ++ * ++ * @return server software ++ */ ++ @NotNull ++ public String getServerVersion() { ++ return this.serverVersion; ++ } ++ ++ /** ++ * Get list of plugins which will be used to reply to the query. ++ * ++ * @return collection of plugins ++ */ ++ @NotNull ++ public Collection getPlugins() { ++ return this.plugins; ++ } ++ ++ /** ++ * Creates a new {@link Builder} instance from data represented by this response. ++ * ++ * @return {@link QueryResponse} builder ++ */ ++ @NotNull ++ public Builder toBuilder() { ++ return QueryResponse.builder() ++ .motd(getMotd()) ++ .gameVersion(getGameVersion()) ++ .map(getMap()) ++ .currentPlayers(getCurrentPlayers()) ++ .maxPlayers(getMaxPlayers()) ++ .hostname(getHostname()) ++ .port(getPort()) ++ .players(getPlayers()) ++ .serverVersion(getServerVersion()) ++ .plugins(getPlugins()); ++ } ++ ++ /** ++ * Creates a new {@link Builder} instance. ++ * ++ * @return {@link QueryResponse} builder ++ */ ++ @NotNull ++ public static Builder builder() { ++ return new Builder(); ++ } ++ ++ /** ++ * A builder for {@link QueryResponse} objects. ++ */ ++ public static final class Builder { ++ private String motd; ++ private String gameVersion; ++ private String map; ++ private String hostname; ++ private String serverVersion; ++ ++ private int currentPlayers; ++ private int maxPlayers; ++ private int port; ++ ++ private final List players = new ArrayList<>(); ++ private final List plugins = new ArrayList<>(); ++ ++ private Builder() {} ++ ++ @NotNull ++ public Builder motd(@NotNull String motd) { ++ this.motd = Preconditions.checkNotNull(motd, "motd"); ++ return this; ++ } ++ ++ @NotNull ++ public Builder gameVersion(@NotNull String gameVersion) { ++ this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion"); ++ return this; ++ } ++ ++ @NotNull ++ public Builder map(@NotNull String map) { ++ this.map = Preconditions.checkNotNull(map, "map"); ++ return this; ++ } ++ ++ @NotNull ++ public Builder currentPlayers(int currentPlayers) { ++ Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative"); ++ this.currentPlayers = currentPlayers; ++ return this; ++ } ++ ++ @NotNull ++ public Builder maxPlayers(int maxPlayers) { ++ Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative"); ++ this.maxPlayers = maxPlayers; ++ return this; ++ } ++ ++ @NotNull ++ public Builder hostname(@NotNull String hostname) { ++ this.hostname = Preconditions.checkNotNull(hostname, "hostname"); ++ return this; ++ } ++ ++ @NotNull ++ public Builder port(int port) { ++ Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535"); ++ this.port = port; ++ return this; ++ } ++ ++ @NotNull ++ public Builder players(@NotNull Collection players) { ++ this.players.addAll(Preconditions.checkNotNull(players, "players")); ++ return this; ++ } ++ ++ @NotNull ++ public Builder players(@NotNull String... players) { ++ this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players"))); ++ return this; ++ } ++ ++ @NotNull ++ public Builder clearPlayers() { ++ this.players.clear(); ++ return this; ++ } ++ ++ @NotNull ++ public Builder serverVersion(@NotNull String serverVersion) { ++ this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion"); ++ return this; ++ } ++ ++ @NotNull ++ public Builder plugins(@NotNull Collection plugins) { ++ this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins")); ++ return this; ++ } ++ ++ @NotNull ++ public Builder plugins(@NotNull PluginInformation... plugins) { ++ this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins"))); ++ return this; ++ } ++ ++ @NotNull ++ public Builder clearPlugins() { ++ this.plugins.clear(); ++ return this; ++ } ++ ++ /** ++ * Builds new {@link QueryResponse} with supplied data. ++ * ++ * @return response ++ */ ++ @NotNull ++ public QueryResponse build() { ++ return new QueryResponse( ++ Preconditions.checkNotNull(motd, "motd"), ++ Preconditions.checkNotNull(gameVersion, "gameVersion"), ++ Preconditions.checkNotNull(map, "map"), ++ currentPlayers, ++ maxPlayers, ++ Preconditions.checkNotNull(hostname, "hostname"), ++ port, ++ ImmutableList.copyOf(players), ++ Preconditions.checkNotNull(serverVersion, "serverVersion"), ++ ImmutableList.copyOf(plugins) ++ ); ++ } ++ } ++ ++ /** ++ * Plugin information ++ */ ++ public static class PluginInformation { ++ ++ private String name; ++ private String version; ++ ++ public PluginInformation(@NotNull String name, @NotNull String version) { ++ this.name = Preconditions.checkNotNull(name, "name"); ++ this.version = Preconditions.checkNotNull(version, "version"); ++ } ++ ++ @NotNull ++ public String getName() { ++ return this.name; ++ } ++ ++ public void setName(@NotNull String name) { ++ this.name = name; ++ } ++ ++ public void setVersion(@NotNull String version) { ++ this.version = version; ++ } ++ ++ @NotNull ++ public String getVersion() { ++ return this.version; ++ } ++ ++ @NotNull ++ public static PluginInformation of(@NotNull String name, @NotNull String version) { ++ return new PluginInformation(name, version); ++ } ++ } ++ } ++} diff --git a/patches/api/0168-Add-WhitelistToggleEvent.patch b/patches/api/0168-Add-WhitelistToggleEvent.patch deleted file mode 100644 index 1e26aba2a3..0000000000 --- a/patches/api/0168-Add-WhitelistToggleEvent.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Wed, 13 Mar 2019 20:04:43 +0200 -Subject: [PATCH] Add WhitelistToggleEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..22fa169c278639f31aec2695259963038de0af8a ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java -@@ -0,0 +1,43 @@ -+package com.destroystokyo.paper.event.server; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * This event is fired when whitelist is toggled -+ * -+ * @author Mark Vainomaa -+ */ -+public class WhitelistToggleEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final boolean enabled; -+ -+ @ApiStatus.Internal -+ public WhitelistToggleEvent(boolean enabled) { -+ this.enabled = enabled; -+ } -+ -+ /** -+ * Gets whether whitelist is going to be enabled or not -+ * -+ * @return Whether whitelist is going to be enabled or not -+ */ -+ public boolean isEnabled() { -+ return this.enabled; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0169-Add-GS4-Query-event.patch b/patches/api/0169-Add-GS4-Query-event.patch deleted file mode 100644 index a153279317..0000000000 --- a/patches/api/0169-Add-GS4-Query-event.patch +++ /dev/null @@ -1,436 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Sun, 17 Mar 2019 21:46:27 +0200 -Subject: [PATCH] Add GS4 Query event - - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..8edc33bde29e967cec488d0f5e2f1097291978a6 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java -@@ -0,0 +1,424 @@ -+package com.destroystokyo.paper.event.server; -+ -+import com.google.common.base.Preconditions; -+import com.google.common.collect.ImmutableList; -+import org.bukkit.Server; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.net.InetAddress; -+import java.util.ArrayList; -+import java.util.Arrays; -+import java.util.Collection; -+import java.util.List; -+ -+/** -+ * This event is fired if server is getting queried over GS4 Query protocol. -+ *
-+ * Adapted from Velocity's ProxyQueryEvent -+ * -+ * @author Mark Vainomaa -+ */ -+public final class GS4QueryEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final QueryType queryType; -+ private final InetAddress querierAddress; -+ private QueryResponse response; -+ -+ @ApiStatus.Internal -+ public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) { -+ super(true); // should always be called async -+ this.queryType = queryType; -+ this.querierAddress = querierAddress; -+ this.response = response; -+ } -+ -+ /** -+ * Get query type -+ * -+ * @return query type -+ */ -+ @NotNull -+ public QueryType getQueryType() { -+ return this.queryType; -+ } -+ -+ /** -+ * Get querier address -+ * -+ * @return querier address -+ */ -+ @NotNull -+ public InetAddress getQuerierAddress() { -+ return this.querierAddress; -+ } -+ -+ /** -+ * Get query response -+ * -+ * @return query response -+ */ -+ @NotNull -+ public QueryResponse getResponse() { -+ return this.response; -+ } -+ -+ /** -+ * Set query response -+ * -+ * @param response query response -+ */ -+ public void setResponse(@NotNull QueryResponse response) { -+ this.response = Preconditions.checkNotNull(response, "response"); -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * The type of query -+ */ -+ public enum QueryType { -+ /** -+ * Basic query asks only a subset of information, such as motd, game type (hardcoded to
MINECRAFT
), map, -+ * current players, max players, server port and server motd -+ */ -+ BASIC, -+ -+ /** -+ * Full query asks pretty much everything present on this event (only hardcoded values cannot be modified here). -+ */ -+ FULL -+ } -+ -+ public final static class QueryResponse { -+ -+ private final String motd; -+ private final String gameVersion; -+ private final String map; -+ private final int currentPlayers; -+ private final int maxPlayers; -+ private final String hostname; -+ private final int port; -+ private final Collection players; -+ private final String serverVersion; -+ private final Collection plugins; -+ -+ private QueryResponse(String motd, String gameVersion, String map, int currentPlayers, int maxPlayers, String hostname, int port, Collection players, String serverVersion, Collection plugins) { -+ this.motd = motd; -+ this.gameVersion = gameVersion; -+ this.map = map; -+ this.currentPlayers = currentPlayers; -+ this.maxPlayers = maxPlayers; -+ this.hostname = hostname; -+ this.port = port; -+ this.players = players; -+ this.serverVersion = serverVersion; -+ this.plugins = plugins; -+ } -+ -+ /** -+ * Get motd which will be used to reply to the query. By default it is {@link Server#getMotd()}. -+ * -+ * @return motd -+ */ -+ @NotNull -+ public String getMotd() { -+ return this.motd; -+ } -+ -+ /** -+ * Get game version which will be used to reply to the query. By default supported Minecraft versions range is sent. -+ * -+ * @return game version -+ */ -+ @NotNull -+ public String getGameVersion() { -+ return this.gameVersion; -+ } -+ -+ /** -+ * Get map name which will be used to reply to the query. By default {@code world} is sent. -+ * -+ * @return map name -+ */ -+ @NotNull -+ public String getMap() { -+ return this.map; -+ } -+ -+ /** -+ * Get current online player count which will be used to reply to the query. -+ * -+ * @return online player count -+ */ -+ public int getCurrentPlayers() { -+ return this.currentPlayers; -+ } -+ -+ /** -+ * Get max player count which will be used to reply to the query. -+ * -+ * @return max player count -+ */ -+ public int getMaxPlayers() { -+ return this.maxPlayers; -+ } -+ -+ /** -+ * Get server (public facing) hostname. -+ * -+ * @return server hostname -+ */ -+ @NotNull -+ public String getHostname() { -+ return this.hostname; -+ } -+ -+ /** -+ * Get server (public facing) port. -+ * -+ * @return server port -+ */ -+ public int getPort() { -+ return this.port; -+ } -+ -+ /** -+ * Get collection of players which will be used to reply to the query. -+ * -+ * @return collection of players -+ */ -+ @NotNull -+ public Collection getPlayers() { -+ return this.players; -+ } -+ -+ /** -+ * Get server software (name and version) which will be used to reply to the query. -+ * -+ * @return server software -+ */ -+ @NotNull -+ public String getServerVersion() { -+ return this.serverVersion; -+ } -+ -+ /** -+ * Get list of plugins which will be used to reply to the query. -+ * -+ * @return collection of plugins -+ */ -+ @NotNull -+ public Collection getPlugins() { -+ return this.plugins; -+ } -+ -+ /** -+ * Creates a new {@link Builder} instance from data represented by this response. -+ * -+ * @return {@link QueryResponse} builder -+ */ -+ @NotNull -+ public Builder toBuilder() { -+ return QueryResponse.builder() -+ .motd(getMotd()) -+ .gameVersion(getGameVersion()) -+ .map(getMap()) -+ .currentPlayers(getCurrentPlayers()) -+ .maxPlayers(getMaxPlayers()) -+ .hostname(getHostname()) -+ .port(getPort()) -+ .players(getPlayers()) -+ .serverVersion(getServerVersion()) -+ .plugins(getPlugins()); -+ } -+ -+ /** -+ * Creates a new {@link Builder} instance. -+ * -+ * @return {@link QueryResponse} builder -+ */ -+ @NotNull -+ public static Builder builder() { -+ return new Builder(); -+ } -+ -+ /** -+ * A builder for {@link QueryResponse} objects. -+ */ -+ public static final class Builder { -+ private String motd; -+ private String gameVersion; -+ private String map; -+ private String hostname; -+ private String serverVersion; -+ -+ private int currentPlayers; -+ private int maxPlayers; -+ private int port; -+ -+ private final List players = new ArrayList<>(); -+ private final List plugins = new ArrayList<>(); -+ -+ private Builder() {} -+ -+ @NotNull -+ public Builder motd(@NotNull String motd) { -+ this.motd = Preconditions.checkNotNull(motd, "motd"); -+ return this; -+ } -+ -+ @NotNull -+ public Builder gameVersion(@NotNull String gameVersion) { -+ this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion"); -+ return this; -+ } -+ -+ @NotNull -+ public Builder map(@NotNull String map) { -+ this.map = Preconditions.checkNotNull(map, "map"); -+ return this; -+ } -+ -+ @NotNull -+ public Builder currentPlayers(int currentPlayers) { -+ Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative"); -+ this.currentPlayers = currentPlayers; -+ return this; -+ } -+ -+ @NotNull -+ public Builder maxPlayers(int maxPlayers) { -+ Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative"); -+ this.maxPlayers = maxPlayers; -+ return this; -+ } -+ -+ @NotNull -+ public Builder hostname(@NotNull String hostname) { -+ this.hostname = Preconditions.checkNotNull(hostname, "hostname"); -+ return this; -+ } -+ -+ @NotNull -+ public Builder port(int port) { -+ Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535"); -+ this.port = port; -+ return this; -+ } -+ -+ @NotNull -+ public Builder players(@NotNull Collection players) { -+ this.players.addAll(Preconditions.checkNotNull(players, "players")); -+ return this; -+ } -+ -+ @NotNull -+ public Builder players(@NotNull String... players) { -+ this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players"))); -+ return this; -+ } -+ -+ @NotNull -+ public Builder clearPlayers() { -+ this.players.clear(); -+ return this; -+ } -+ -+ @NotNull -+ public Builder serverVersion(@NotNull String serverVersion) { -+ this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion"); -+ return this; -+ } -+ -+ @NotNull -+ public Builder plugins(@NotNull Collection plugins) { -+ this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins")); -+ return this; -+ } -+ -+ @NotNull -+ public Builder plugins(@NotNull PluginInformation... plugins) { -+ this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins"))); -+ return this; -+ } -+ -+ @NotNull -+ public Builder clearPlugins() { -+ this.plugins.clear(); -+ return this; -+ } -+ -+ /** -+ * Builds new {@link QueryResponse} with supplied data. -+ * -+ * @return response -+ */ -+ @NotNull -+ public QueryResponse build() { -+ return new QueryResponse( -+ Preconditions.checkNotNull(motd, "motd"), -+ Preconditions.checkNotNull(gameVersion, "gameVersion"), -+ Preconditions.checkNotNull(map, "map"), -+ currentPlayers, -+ maxPlayers, -+ Preconditions.checkNotNull(hostname, "hostname"), -+ port, -+ ImmutableList.copyOf(players), -+ Preconditions.checkNotNull(serverVersion, "serverVersion"), -+ ImmutableList.copyOf(plugins) -+ ); -+ } -+ } -+ -+ /** -+ * Plugin information -+ */ -+ public static class PluginInformation { -+ -+ private String name; -+ private String version; -+ -+ public PluginInformation(@NotNull String name, @NotNull String version) { -+ this.name = Preconditions.checkNotNull(name, "name"); -+ this.version = Preconditions.checkNotNull(version, "version"); -+ } -+ -+ @NotNull -+ public String getName() { -+ return this.name; -+ } -+ -+ public void setName(@NotNull String name) { -+ this.name = name; -+ } -+ -+ public void setVersion(@NotNull String version) { -+ this.version = version; -+ } -+ -+ @NotNull -+ public String getVersion() { -+ return this.version; -+ } -+ -+ @NotNull -+ public static PluginInformation of(@NotNull String name, @NotNull String version) { -+ return new PluginInformation(name, version); -+ } -+ } -+ } -+} diff --git a/patches/api/0169-Add-PlayerPostRespawnEvent.patch b/patches/api/0169-Add-PlayerPostRespawnEvent.patch new file mode 100644 index 0000000000..c261fc7375 --- /dev/null +++ b/patches/api/0169-Add-PlayerPostRespawnEvent.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MisterVector +Date: Fri, 26 Oct 2018 21:33:13 -0700 +Subject: [PATCH] Add PlayerPostRespawnEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..16961aac061e78fb84029f8435ab5f7c493b1362 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java +@@ -0,0 +1,56 @@ ++package com.destroystokyo.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.jetbrains.annotations.NotNull; ++ ++/** ++ * Fired after a player has respawned ++ */ ++public class PlayerPostRespawnEvent extends PlayerEvent { ++ ++ private final static HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Location respawnedLocation; ++ private final boolean isBedSpawn; ++ ++ @ApiStatus.Internal ++ public PlayerPostRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnedLocation, final boolean isBedSpawn) { ++ super(respawnPlayer); ++ this.respawnedLocation = respawnedLocation; ++ this.isBedSpawn = isBedSpawn; ++ } ++ ++ /** ++ * Returns the location of the respawned player ++ * ++ * @return location of the respawned player ++ */ ++ @NotNull ++ public Location getRespawnedLocation() { ++ return this.respawnedLocation.clone(); ++ } ++ ++ /** ++ * Checks if the player respawned to their bed ++ * ++ * @return whether the player respawned to their bed ++ */ ++ public boolean isBedSpawn() { ++ return this.isBedSpawn; ++ } ++ ++ @Override ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +index c3d9d95be50eacb212108a01b612756f772956aa..03225d2b4c91caa58c2995d9cf0e7fb4663749ab 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +@@ -8,6 +8,9 @@ import org.jetbrains.annotations.NotNull; + + /** + * Called when a player respawns. ++ *

++ * If changing player state, see {@link com.destroystokyo.paper.event.player.PlayerPostRespawnEvent} ++ * because the player is "reset" between this event and that event and some changes won't persist. + */ + public class PlayerRespawnEvent extends PlayerEvent { + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0170-Add-PlayerPostRespawnEvent.patch b/patches/api/0170-Add-PlayerPostRespawnEvent.patch deleted file mode 100644 index c261fc7375..0000000000 --- a/patches/api/0170-Add-PlayerPostRespawnEvent.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MisterVector -Date: Fri, 26 Oct 2018 21:33:13 -0700 -Subject: [PATCH] Add PlayerPostRespawnEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..16961aac061e78fb84029f8435ab5f7c493b1362 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java -@@ -0,0 +1,56 @@ -+package com.destroystokyo.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.jetbrains.annotations.NotNull; -+ -+/** -+ * Fired after a player has respawned -+ */ -+public class PlayerPostRespawnEvent extends PlayerEvent { -+ -+ private final static HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location respawnedLocation; -+ private final boolean isBedSpawn; -+ -+ @ApiStatus.Internal -+ public PlayerPostRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnedLocation, final boolean isBedSpawn) { -+ super(respawnPlayer); -+ this.respawnedLocation = respawnedLocation; -+ this.isBedSpawn = isBedSpawn; -+ } -+ -+ /** -+ * Returns the location of the respawned player -+ * -+ * @return location of the respawned player -+ */ -+ @NotNull -+ public Location getRespawnedLocation() { -+ return this.respawnedLocation.clone(); -+ } -+ -+ /** -+ * Checks if the player respawned to their bed -+ * -+ * @return whether the player respawned to their bed -+ */ -+ public boolean isBedSpawn() { -+ return this.isBedSpawn; -+ } -+ -+ @Override -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -index c3d9d95be50eacb212108a01b612756f772956aa..03225d2b4c91caa58c2995d9cf0e7fb4663749ab 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -@@ -8,6 +8,9 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when a player respawns. -+ *

-+ * If changing player state, see {@link com.destroystokyo.paper.event.player.PlayerPostRespawnEvent} -+ * because the player is "reset" between this event and that event and some changes won't persist. - */ - public class PlayerRespawnEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0170-Entity-getEntitySpawnReason.patch b/patches/api/0170-Entity-getEntitySpawnReason.patch new file mode 100644 index 0000000000..ef25308f6c --- /dev/null +++ b/patches/api/0170-Entity-getEntitySpawnReason.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 24 Mar 2019 00:21:23 -0400 +Subject: [PATCH] Entity#getEntitySpawnReason + +Allows you to return the SpawnReason for why an Entity Spawned + +Pre existing entities will return NATURAL if it was a non +persistenting Living Entity, SPAWNER for spawners, +or DEFAULT since data was not stored. + +Co-authored-by: Aurora + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index f1fc42ad24648ee481b9a5d4c4cc58ae8c0a93c1..66716da0b475524917d4153e481100b795ea11a9 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -853,5 +853,11 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + // TODO remove impl here + return getLocation().getChunk(); + } ++ ++ /** ++ * @return The {@link org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason} that initially spawned this entity. ++ */ ++ @NotNull ++ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason(); + // Paper end + } diff --git a/patches/api/0171-Entity-getEntitySpawnReason.patch b/patches/api/0171-Entity-getEntitySpawnReason.patch deleted file mode 100644 index ef25308f6c..0000000000 --- a/patches/api/0171-Entity-getEntitySpawnReason.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 24 Mar 2019 00:21:23 -0400 -Subject: [PATCH] Entity#getEntitySpawnReason - -Allows you to return the SpawnReason for why an Entity Spawned - -Pre existing entities will return NATURAL if it was a non -persistenting Living Entity, SPAWNER for spawners, -or DEFAULT since data was not stored. - -Co-authored-by: Aurora - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index f1fc42ad24648ee481b9a5d4c4cc58ae8c0a93c1..66716da0b475524917d4153e481100b795ea11a9 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -853,5 +853,11 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - // TODO remove impl here - return getLocation().getChunk(); - } -+ -+ /** -+ * @return The {@link org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason} that initially spawned this entity. -+ */ -+ @NotNull -+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason(); - // Paper end - } diff --git a/patches/api/0171-Fix-Spigot-annotation-mistakes.patch b/patches/api/0171-Fix-Spigot-annotation-mistakes.patch new file mode 100644 index 0000000000..6dc3d96c0b --- /dev/null +++ b/patches/api/0171-Fix-Spigot-annotation-mistakes.patch @@ -0,0 +1,1899 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 24 Mar 2019 18:39:01 -0400 +Subject: [PATCH] Fix Spigot annotation mistakes + +while some of these may of been true, they are extreme cases and cause +a ton of noise to plugin developers. + +Use ApiStatus.Internal instead of Deprecated for actual internal API +that continues to have use (internally). + +These do not help plugin developers if they bring moise noise than value. + +diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java +index ac420f0059fc50d3e1294f85df7515c9e17ff78f..24daba85ce4129fb0babe67570059ca8119360c0 100644 +--- a/src/main/java/org/bukkit/Art.java ++++ b/src/main/java/org/bukkit/Art.java +@@ -75,9 +75,9 @@ public enum Art implements Keyed { + * Get the ID of this painting. + * + * @return The ID of this painting +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getId() { + return id; + } +@@ -93,9 +93,9 @@ public enum Art implements Keyed { + * + * @param id The ID + * @return The painting +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Art getById(int id) { + return BY_ID.get(id); +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index f248515862c3bc418b42b8e197feb43addfd122d..395d7245aac45a1b805e15ee1fdb9949574f3f59 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -870,9 +870,8 @@ public final class Bukkit { + * + * @param id the id of the map to get + * @return a map view if it exists, or null otherwise +- * @deprecated Magic value + */ +- @Deprecated ++ //@Deprecated // Paper - Not a magic value + @Nullable + public static MapView getMap(int id) { + return server.getMap(id); +@@ -951,8 +950,14 @@ public final class Bukkit { + * Returns the primary logger associated with this server instance. + * + * @return Logger associated with this server ++ * @see org.bukkit.plugin.Plugin#getSLF4JLogger() ++ * @apiNote This logger is for the Minecraft server software, not for specific plugins. You should ++ * use a logger for a specific plugin, either via {@link org.bukkit.plugin.Plugin#getSLF4JLogger()} ++ * or {@link org.bukkit.plugin.Plugin#getLogger()} or create a specific logger for a class via slf4j. ++ * That way, log messages contain contextual information about the source of the message. + */ + @NotNull ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper - internalize Bukkit#getLogger + public static Logger getLogger() { + return server.getLogger(); + } +@@ -1349,10 +1354,8 @@ public final class Bukkit { + * @param name the name the player to retrieve + * @return an offline player + * @see #getOfflinePlayer(java.util.UUID) +- * @deprecated Persistent storage of users should be by UUID as names are no longer +- * unique past a single session. + */ +- @Deprecated ++ // @Deprecated // Paper + @NotNull + public static OfflinePlayer getOfflinePlayer(@NotNull String name) { + return server.getOfflinePlayer(name); +@@ -1954,7 +1957,7 @@ public final class Bukkit { + * + * @return the scoreboard manager or null if no worlds are loaded. + */ +- @Nullable ++ @NotNull // Paper + public static ScoreboardManager getScoreboardManager() { + return server.getScoreboardManager(); + } +diff --git a/src/main/java/org/bukkit/CoalType.java b/src/main/java/org/bukkit/CoalType.java +index c07499dbdd49d70717dbd674d97b6dbcfd7e9d5b..75e563d2a6d417b95c7f06a0636811aec8259672 100644 +--- a/src/main/java/org/bukkit/CoalType.java ++++ b/src/main/java/org/bukkit/CoalType.java +@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents the two types of coal + */ ++@Deprecated // Paper + public enum CoalType { + COAL(0x0), + CHARCOAL(0x1); +diff --git a/src/main/java/org/bukkit/CropState.java b/src/main/java/org/bukkit/CropState.java +index fb4832fb796a38c0f5f51cf80a67259924f2c607..519deeeb86672fd75ae62026f956727d01f78fef 100644 +--- a/src/main/java/org/bukkit/CropState.java ++++ b/src/main/java/org/bukkit/CropState.java +@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents the different growth states of crops + */ ++@Deprecated // Paper + public enum CropState { + + /** +diff --git a/src/main/java/org/bukkit/Difficulty.java b/src/main/java/org/bukkit/Difficulty.java +index 3f6cbefc2b1414ba2dad709e79288013b3ef73be..f35801783538d3377b04131b8bf6effd7eb8e1a5 100644 +--- a/src/main/java/org/bukkit/Difficulty.java ++++ b/src/main/java/org/bukkit/Difficulty.java +@@ -44,9 +44,9 @@ public enum Difficulty { + * Gets the difficulty value associated with this Difficulty. + * + * @return An integer value of this difficulty +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getValue() { + return value; + } +@@ -57,9 +57,9 @@ public enum Difficulty { + * @param value Value to check + * @return Associative {@link Difficulty} with the given value, or null if + * it doesn't exist +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Difficulty getByValue(final int value) { + return BY_ID.get(value); +diff --git a/src/main/java/org/bukkit/DyeColor.java b/src/main/java/org/bukkit/DyeColor.java +index bd213cabddd8752e609544f24cfba95405726155..47df858e095c4423c20e49e029d72f0f50d2c924 100644 +--- a/src/main/java/org/bukkit/DyeColor.java ++++ b/src/main/java/org/bukkit/DyeColor.java +@@ -96,9 +96,9 @@ public enum DyeColor { + * + * @return A byte containing the wool data value of this color + * @see #getDyeData() +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getWoolData() { + return woolData; + } +@@ -142,9 +142,9 @@ public enum DyeColor { + * @return The {@link DyeColor} representing the given value, or null if + * it doesn't exist + * @see #getByDyeData(byte) +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static DyeColor getByWoolData(final byte data) { + int i = 0xff & data; +@@ -202,9 +202,9 @@ public enum DyeColor { + * + * @param name dye name + * @return dye color +- * @deprecated legacy use only ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @NotNull + public static DyeColor legacyValueOf(@Nullable String name) { + return "SILVER".equals(name) ? DyeColor.LIGHT_GRAY : DyeColor.valueOf(name); +diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java +index 0d0777771485a76d960da2f16e963b19d2cf6c2d..fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38 100644 +--- a/src/main/java/org/bukkit/Effect.java ++++ b/src/main/java/org/bukkit/Effect.java +@@ -357,9 +357,9 @@ public enum Effect { + * Gets the ID for this effect. + * + * @return ID of this effect +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getId() { + return this.id; + } +@@ -386,9 +386,9 @@ public enum Effect { + * + * @param id ID of the Effect to return + * @return Effect with the given ID +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Effect getById(int id) { + return BY_ID.get(id); +diff --git a/src/main/java/org/bukkit/EntityEffect.java b/src/main/java/org/bukkit/EntityEffect.java +index 9db85b2f6ffd56bbc4db1f75f8769f1c15d5950f..5341957b10cccd7bce5a7595699b1d90412a01d0 100644 +--- a/src/main/java/org/bukkit/EntityEffect.java ++++ b/src/main/java/org/bukkit/EntityEffect.java +@@ -345,9 +345,9 @@ public enum EntityEffect { + * Gets the data value of this EntityEffect, may not be unique. + * + * @return The data value +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getData() { + return data; + } +diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java +index 938c3217f92e6d3ef9a637269c469f8359af6347..81e45984a88fc84acd0f76d825abf4ddaed0ac3b 100644 +--- a/src/main/java/org/bukkit/GameMode.java ++++ b/src/main/java/org/bukkit/GameMode.java +@@ -44,9 +44,9 @@ public enum GameMode { + * Gets the mode value associated with this GameMode + * + * @return An integer value of this gamemode +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getValue() { + return value; + } +@@ -57,9 +57,9 @@ public enum GameMode { + * @param value Value to check + * @return Associative {@link GameMode} with the given value, or null if + * it doesn't exist +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static GameMode getByValue(final int value) { + return BY_ID.get(value); +diff --git a/src/main/java/org/bukkit/GrassSpecies.java b/src/main/java/org/bukkit/GrassSpecies.java +index f9c9ae463aacd593e3aa9caf037ea1e23d56c780..f8ae143acbf586d5279b44f7311ca97f3ae4ead2 100644 +--- a/src/main/java/org/bukkit/GrassSpecies.java ++++ b/src/main/java/org/bukkit/GrassSpecies.java +@@ -6,7 +6,9 @@ import org.jetbrains.annotations.Nullable; + + /** + * Represents the different types of grass. ++ * @deprecated use {@link org.bukkit.block.data.BlockData} + */ ++@Deprecated // Paper + public enum GrassSpecies { + + /** +diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java +index 02b4ffa6b918269bd64f7c518fcceef1f6990737..f0878c7539696cc0676e6010e88914d3850acf20 100644 +--- a/src/main/java/org/bukkit/Location.java ++++ b/src/main/java/org/bukkit/Location.java +@@ -46,7 +46,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm + * @param y The y-coordinate of this new location + * @param z The z-coordinate of this new location + */ +- public Location(@Nullable final World world, final double x, final double y, final double z) { ++ public Location(@UndefinedNullability final World world, final double x, final double y, final double z) { // Paper + this(world, x, y, z, 0, 0); + } + +@@ -60,7 +60,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm + * @param yaw The absolute rotation on the x-plane, in degrees + * @param pitch The absolute rotation on the y-plane, in degrees + */ +- public Location(@Nullable final World world, final double x, final double y, final double z, final float yaw, final float pitch) { ++ public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { // Paper + if (world != null) { + this.world = new WeakReference<>(world); + } +@@ -102,7 +102,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm + * @throws IllegalArgumentException when world is unloaded + * @see #isWorldLoaded() + */ +- @Nullable ++ @UndefinedNullability // Paper + public World getWorld() { + if (this.world == null) { + return null; +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index c2808db693647bdf3b9617cb6c665e8499874485..c605da711c032f7091390e50b4a5d332c992d3d1 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -4746,20 +4746,20 @@ public enum Material implements Keyed, Translatable { + * Do not use for any reason. + * + * @return ID of this material +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getId() { + Preconditions.checkArgument(legacy, "Cannot get ID of Modern Material"); + return id; + } + + /** +- * Do not use for any reason. ++ * Checks if this constant is a legacy material. + * + * @return legacy status + */ +- @Deprecated ++ // @Deprecated // Paper - this is useful, don't deprecate + public boolean isLegacy() { + return legacy; + } +@@ -4835,8 +4835,10 @@ public enum Material implements Keyed, Translatable { + * Gets the MaterialData class associated with this Material + * + * @return MaterialData associated with this Material ++ * @deprecated use {@link #createBlockData()} + */ + @NotNull ++ @Deprecated // Paper + public Class getData() { + Preconditions.checkArgument(legacy, "Cannot get data class of Modern Material"); + return ctor.getDeclaringClass(); +@@ -9103,7 +9105,11 @@ public enum Material implements Keyed, Translatable { + * material. + * + * @return true if this material can be interacted with. ++ * @deprecated This method is not comprehensive and does not accurately reflect what block types are ++ * interactable. Many "interactions" are defined on the item not block, and many are conditional on some other world state ++ * checks being true. + */ ++ @Deprecated // Paper + public boolean isInteractable() { + switch (this) { + // +diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java +index 9b61129c3ef83d0bfceba54aba2effa12bc90678..cbdaa121dbc1876d0cd55f4b7b57f283ecaa8f1a 100644 +--- a/src/main/java/org/bukkit/NamespacedKey.java ++++ b/src/main/java/org/bukkit/NamespacedKey.java +@@ -74,12 +74,14 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap + + /** + * Create a key in a specific namespace. ++ *

++ * For most plugin related code, you should prefer using the ++ * {@link NamespacedKey#NamespacedKey(Plugin, String)} constructor. + * + * @param namespace namespace + * @param key key +- * @apiNote should never be used by plugins, for internal use only!! ++ * @see #NamespacedKey(Plugin, String) + */ +- @ApiStatus.Internal + public NamespacedKey(@NotNull String namespace, @NotNull String key) { + Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace); + Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key); +diff --git a/src/main/java/org/bukkit/NetherWartsState.java b/src/main/java/org/bukkit/NetherWartsState.java +index f43209cf7b752c26718c303ca8c3e1c7d9912ad3..f0094e6fb05e526736629ad3181c8d2c16ba6ca4 100644 +--- a/src/main/java/org/bukkit/NetherWartsState.java ++++ b/src/main/java/org/bukkit/NetherWartsState.java +@@ -1,5 +1,11 @@ + package org.bukkit; + ++// Paper start ++/** ++ * @deprecated use {@link org.bukkit.block.data.BlockData} and {@link org.bukkit.block.data.Ageable} ++ */ ++@Deprecated ++// Paper end + public enum NetherWartsState { + + /** +diff --git a/src/main/java/org/bukkit/Note.java b/src/main/java/org/bukkit/Note.java +index 48aecc9421c500137bbef1dfe3bec8de277c3ff9..aff858346776386f1288b648b221404f7f412399 100644 +--- a/src/main/java/org/bukkit/Note.java ++++ b/src/main/java/org/bukkit/Note.java +@@ -39,9 +39,9 @@ public class Note { + * Returns the not sharped id of this tone. + * + * @return the not sharped id of this tone. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getId() { + return getId(false); + } +@@ -53,9 +53,9 @@ public class Note { + * + * @param sharped Set to true to return the sharped id. + * @return the id of this tone. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getId(boolean sharped) { + byte id = (byte) (sharped && sharpable ? this.id + 1 : this.id); + +@@ -78,9 +78,9 @@ public class Note { + * @return if the tone id is the sharped id of the tone. + * @throws IllegalArgumentException if neither the tone nor the + * semitone have the id. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public boolean isSharped(byte id) { + if (id == getId(false)) { + return false; +@@ -97,9 +97,9 @@ public class Note { + * + * @param id the id of the tone. + * @return the tone to id. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Tone getById(byte id) { + return BY_DATA.get(id); +@@ -222,9 +222,9 @@ public class Note { + * Returns the internal id of this note. + * + * @return the internal id of this note. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getId() { + return note; + } +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index 4f8c54a84c9f737dad3feff9ffd7daf22854e97f..a04d279561676e825905f5512c399d14a3d8f828 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -201,14 +201,12 @@ public interface Registry extends Iterable { + * + * @see TrimMaterial + */ +- @ApiStatus.Experimental + Registry TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class); + /** + * Trim patterns. + * + * @see TrimPattern + */ +- @ApiStatus.Experimental + Registry TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class); + /** + * Damage types. +@@ -310,8 +308,11 @@ public interface Registry extends Iterable { + * + * @param input non-null input + * @return registered object or null if does not exist ++ * @deprecated this method's behavior is broken and not useful. If you want to get an object ++ * based on its vanilla name, or a key, wrap it in a {@link NamespacedKey} object and use {@link #get(NamespacedKey)} + */ + @Nullable ++ @Deprecated(forRemoval = true) // Paper + default T match(@NotNull String input) { + Preconditions.checkArgument(input != null, "input must not be null"); + +diff --git a/src/main/java/org/bukkit/SandstoneType.java b/src/main/java/org/bukkit/SandstoneType.java +index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da45ab28e2f 100644 +--- a/src/main/java/org/bukkit/SandstoneType.java ++++ b/src/main/java/org/bukkit/SandstoneType.java +@@ -6,7 +6,9 @@ import org.jetbrains.annotations.Nullable; + + /** + * Represents the three different types of Sandstone ++ * @deprecated use {@link org.bukkit.block.data.BlockData} + */ ++@Deprecated // Paper + public enum SandstoneType { + CRACKED(0x0), + GLYPHED(0x1), +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 69f236d965c631510b008a7eb38aa1b62a4e196a..2382322bc4f30ff3163b2941650692d9a13328ac 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -730,9 +730,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * + * @param id the id of the map to get + * @return a map view if it exists, or null otherwise +- * @deprecated Magic value + */ +- @Deprecated ++ //@Deprecated // Paper - Not a magic value + @Nullable + public MapView getMap(int id); + +@@ -799,8 +798,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * Returns the primary logger associated with this server instance. + * + * @return Logger associated with this server ++ * @see org.bukkit.plugin.Plugin#getSLF4JLogger() ++ * @apiNote This logger is for the Minecraft server software, not for specific plugins. You should ++ * use a logger for a specific plugin, either via {@link org.bukkit.plugin.Plugin#getSLF4JLogger()} ++ * or {@link org.bukkit.plugin.Plugin#getLogger()} or create a specific logger for a class via slf4j. ++ * That way, log messages contain contextual information about the source of the message. + */ + @NotNull ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper - internalize Bukkit#getLogger + public Logger getLogger(); + + /** +@@ -1137,10 +1142,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * @param name the name the player to retrieve + * @return an offline player + * @see #getOfflinePlayer(java.util.UUID) +- * @deprecated Persistent storage of users should be by UUID as names are no longer +- * unique past a single session. + */ +- @Deprecated ++ // @Deprecated // Paper + @NotNull + public OfflinePlayer getOfflinePlayer(@NotNull String name); + +@@ -1649,7 +1652,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * + * @return the scoreboard manager or null if no worlds are loaded. + */ +- @Nullable ++ @NotNull // Paper + ScoreboardManager getScoreboardManager(); + + /** +diff --git a/src/main/java/org/bukkit/UndefinedNullability.java b/src/main/java/org/bukkit/UndefinedNullability.java +index 4d4265c237179470e1fd017721a8dd595f114013..3babc9df26276300392d3f92ee6e317c33643b0b 100644 +--- a/src/main/java/org/bukkit/UndefinedNullability.java ++++ b/src/main/java/org/bukkit/UndefinedNullability.java +@@ -14,6 +14,7 @@ import org.jetbrains.annotations.ApiStatus; + * suggests a bad API design. + */ + @Retention(RetentionPolicy.CLASS) ++@java.lang.annotation.Documented // Paper + @ApiStatus.Internal + @Deprecated + public @interface UndefinedNullability { +diff --git a/src/main/java/org/bukkit/Vibration.java b/src/main/java/org/bukkit/Vibration.java +index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114306c57cb 100644 +--- a/src/main/java/org/bukkit/Vibration.java ++++ b/src/main/java/org/bukkit/Vibration.java +@@ -13,6 +13,14 @@ public class Vibration { + private final Destination destination; + private final int arrivalTime; + ++ // Paper start ++ public Vibration(@NotNull Destination destination, @NotNull int arrivalTime) { ++ this.destination = destination; ++ this.arrivalTime = arrivalTime; ++ this.origin = new Location(null, 0, 0, 0); // Dummy origin because getter expects null ++ } ++ ++ @Deprecated(forRemoval = true) // Paper end + public Vibration(@NotNull Location origin, @NotNull Destination destination, int arrivalTime) { + this.origin = origin; + this.destination = destination; +@@ -22,9 +30,11 @@ public class Vibration { + /** + * Get the origin of the vibration. + * ++ * @deprecated unused as of 1.19 + * @return origin + */ + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public Location getOrigin() { + return origin; + } +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index b6ca63afb74b345e381d35646cc8faf52a2c7cbc..a523d1725f175c924ab1a7d544d389ec81b68bcf 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -418,9 +418,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * @param z Z-coordinate of the chunk + * @return Whether the chunk was actually refreshed + * +- * @deprecated This method is not guaranteed to work suitably across all client implementations. + */ +- @Deprecated ++ //@Deprecated // Paper + public boolean refreshChunk(int x, int z); + + /** +@@ -3770,6 +3769,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); + + // Spigot start ++ @Deprecated(forRemoval = true) // Paper + public class Spigot { + + /** +@@ -3803,7 +3803,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + } + } + ++ /** ++ * @deprecated Unsupported api ++ */ + @NotNull ++ @Deprecated // Paper + Spigot spigot(); + // Spigot end + +@@ -4021,9 +4025,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * Gets the dimension ID of this environment + * + * @return dimension ID +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getId() { + return id; + } +@@ -4033,9 +4037,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * + * @param id The ID of the environment + * @return The environment +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Environment getEnvironment(int id) { + return lookup.get(id); +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index a71001677e2b1b0b6225a7be63b8ea5ce4456862..c7ef0386a09a07a2317c56274ed41218dfd7153d 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -526,7 +526,7 @@ public interface Block extends Metadatable, Translatable { + * @return a list of dropped items for this type of block + */ + @NotNull +- Collection getDrops(@NotNull ItemStack tool, @Nullable Entity entity); ++ Collection getDrops(@Nullable ItemStack tool, @Nullable Entity entity); // Paper + + /** + * Returns if the given item is a preferred choice to break this Block. +diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java +index 3e07fc1bc0e08d0cfd998711c7fd547b2b7b6b73..fd4a9bdcfb6775dfbdb7492e6c9eb90722d2ecdc 100644 +--- a/src/main/java/org/bukkit/block/BlockState.java ++++ b/src/main/java/org/bukkit/block/BlockState.java +@@ -36,8 +36,10 @@ public interface BlockState extends Metadatable { + * Gets the metadata for this block state. + * + * @return block specific metadata ++ * @deprecated use {@link #getBlockData()} + */ + @NotNull ++ @Deprecated // Paper + MaterialData getData(); + + /** +@@ -151,7 +153,9 @@ public interface BlockState extends Metadatable { + * Sets the metadata for this block state. + * + * @param data New block specific metadata ++ * @deprecated use {@link #setBlockData(BlockData)} + */ ++ @Deprecated // Paper + void setData(@NotNull MaterialData data); + + /** +diff --git a/src/main/java/org/bukkit/block/BrushableBlock.java b/src/main/java/org/bukkit/block/BrushableBlock.java +index 4bd127b3646307398e0c937c3e36ab671235b72b..f2557a87f468ee20c2d276dbfc0e9a976656c75c 100644 +--- a/src/main/java/org/bukkit/block/BrushableBlock.java ++++ b/src/main/java/org/bukkit/block/BrushableBlock.java +@@ -15,7 +15,7 @@ public interface BrushableBlock extends Lootable, TileState { + * + * @return the item + */ +- @Nullable ++ @org.jetbrains.annotations.NotNull // Paper + public ItemStack getItem(); + + /** +diff --git a/src/main/java/org/bukkit/block/PistonMoveReaction.java b/src/main/java/org/bukkit/block/PistonMoveReaction.java +index b90f5dc345ad2cdd3ae353dc57f42a14c231d18a..a7b915ded9154d53ac8ca599119c1699cfca2265 100644 +--- a/src/main/java/org/bukkit/block/PistonMoveReaction.java ++++ b/src/main/java/org/bukkit/block/PistonMoveReaction.java +@@ -48,9 +48,9 @@ public enum PistonMoveReaction { + + /** + * @return The ID of the move reaction +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getId() { + return this.id; + } +@@ -58,9 +58,9 @@ public enum PistonMoveReaction { + /** + * @param id An ID + * @return The move reaction with that ID +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static PistonMoveReaction getById(int id) { + return byId.get(id); +diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java +index a82d6f469aca02fb28b1b3ad84dc40415f1f1ade..f4ec7891bdcedc73bff6938e3eddb7ee43d23ec1 100644 +--- a/src/main/java/org/bukkit/enchantments/Enchantment.java ++++ b/src/main/java/org/bukkit/enchantments/Enchantment.java +@@ -273,7 +273,7 @@ public abstract class Enchantment implements Keyed, Translatable { + * @deprecated enchantment groupings are now managed by tags, not categories + */ + @NotNull +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.5") @org.jetbrains.annotations.Contract("-> fail") // Paper + public abstract EnchantmentTarget getItemTarget(); + + /** +diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java +index 3afe2787de576f7190d87c796bea0ab34dc30248..58191017244f3949f6174fb108e3a245738a53c4 100644 +--- a/src/main/java/org/bukkit/entity/Enderman.java ++++ b/src/main/java/org/bukkit/entity/Enderman.java +@@ -25,15 +25,19 @@ public interface Enderman extends Monster { + * Gets the id and data of the block that the Enderman is carrying. + * + * @return MaterialData containing the id and data of the block ++ * @deprecated use {@link #getCarriedBlock()} + */ + @NotNull ++ @Deprecated // Paper + public MaterialData getCarriedMaterial(); + + /** + * Sets the id and data of the block that the Enderman is carrying. + * + * @param material data to set the carried block to ++ * @deprecated use {@link #setCarriedBlock(BlockData)} + */ ++ @Deprecated // Paper + public void setCarriedMaterial(@NotNull MaterialData material); + + /** +diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java +index c308f6a9f36ae8d108d583179464e078e09bf051..dd410ff2cad3dc34ef9d2a37d72417c7b213de63 100644 +--- a/src/main/java/org/bukkit/entity/EntityType.java ++++ b/src/main/java/org/bukkit/entity/EntityType.java +@@ -393,9 +393,9 @@ public enum EntityType implements Keyed, Translatable { + * + * @param name the entity type's name + * @return the matching entity type or null +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Contract("null -> null") + @Nullable + public static EntityType fromName(@Nullable String name) { +diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java +index b27447d7a2833f84cf05946c851f5b6740a578e3..5afeb2f6c82e8f752229462c2d7846f6ae7a4b44 100644 +--- a/src/main/java/org/bukkit/entity/LightningStrike.java ++++ b/src/main/java/org/bukkit/entity/LightningStrike.java +@@ -84,6 +84,10 @@ public interface LightningStrike extends Entity { + public void setCausingPlayer(@Nullable Player player); + + // Spigot start ++ /** ++ * @deprecated Unsupported api ++ */ ++ @Deprecated // Paper + public class Spigot extends Entity.Spigot { + + /** +@@ -98,8 +102,12 @@ public interface LightningStrike extends Entity { + } + } + ++ /** ++ * @deprecated Unsupported api ++ */ + @NotNull + @Override ++ @Deprecated // Paper + Spigot spigot(); + // Spigot end + } +diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java +index bafef53c1d449135f1300c8c8fbb06f482ba67e1..f50aaddf8582be55fd4860ad374d8f2206991897 100644 +--- a/src/main/java/org/bukkit/entity/LingeringPotion.java ++++ b/src/main/java/org/bukkit/entity/LingeringPotion.java +@@ -3,7 +3,8 @@ package org.bukkit.entity; + /** + * Represents a thrown lingering potion bottle + * +- * @deprecated lingering status depends on only on the potion item. ++ * @deprecated should not be used for anything, use {@link ThrownPotion} and ++ * set the potion via the methods there. + */ +-@Deprecated ++@Deprecated(forRemoval = true) // Paper + public interface LingeringPotion extends ThrownPotion { } +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 8cd525dd8ded0ddbd405c66e9c0fbeb40f788521..2b791a093a1220be80eb6b9d7202f6596fcf2dd6 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -716,7 +716,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * This may have unexpected results if the entity is not in water. + * + * @param swimming True if the entity is swimming. ++ * @deprecated This does nothing and is immediately reverted by the server, in the next tick + */ ++ @Deprecated // Paper + public void setSwimming(boolean swimming); + + /** +@@ -971,7 +973,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * @deprecated entity groupings are now managed by tags, not categories + */ + @NotNull +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.5") @org.jetbrains.annotations.Contract("-> fail") // Paper + public EntityCategory getCategory(); + + /** +diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java +index 95c79c5fa0c4e30201f887da6467ce5f81c8a255..7f9c4d4b430a3f0276461346ff2621bacf864075 100644 +--- a/src/main/java/org/bukkit/entity/Minecart.java ++++ b/src/main/java/org/bukkit/entity/Minecart.java +@@ -101,7 +101,9 @@ public interface Minecart extends Vehicle { + * Passing a null value will set the minecart to have no display block. + * + * @param material the material to set as display block. ++ * @deprecated use {@link #setDisplayBlockData(BlockData)} + */ ++ @Deprecated // Paper + public void setDisplayBlock(@Nullable MaterialData material); + + /** +@@ -109,8 +111,10 @@ public interface Minecart extends Vehicle { + * This function will return the type AIR if none is set. + * + * @return the block displayed by this minecart. ++ * @deprecated use {@link #getDisplayBlockData()} + */ + @NotNull ++ @Deprecated // Paper + public MaterialData getDisplayBlock(); + + /** +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 92a83edc03fa8d11f026ac312b989329fa6a7e88..33547e9e3f8f7c906a5d91b75eb62327cc1f2a3a 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1635,11 +1635,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + + /** + * Forces an update of the player's entire inventory. +- * +- * @apiNote It should not be necessary for plugins to use this method. If it +- * is required for some reason, it is probably a bug. + */ +- @ApiStatus.Internal ++ // @ApiStatus.Internal // Paper - is valid API + public void updateInventory(); + + /** +diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java +index 906b33b7569fff5dd78258f9765e879180a52834..06e3ad9cd8f39de0ef6ead794df1492415bc4302 100644 +--- a/src/main/java/org/bukkit/entity/Projectile.java ++++ b/src/main/java/org/bukkit/entity/Projectile.java +@@ -29,7 +29,7 @@ public interface Projectile extends Entity { + * @return true if it should bounce. + * @deprecated does not do anything + */ +- @Deprecated ++ @Deprecated(forRemoval = true) + public boolean doesBounce(); + + /** +@@ -39,6 +39,6 @@ public interface Projectile extends Entity { + * @param doesBounce whether or not it should bounce. + * @deprecated does not do anything + */ +- @Deprecated ++ @Deprecated(forRemoval = true) + public void setBounce(boolean doesBounce); + } +diff --git a/src/main/java/org/bukkit/entity/SplashPotion.java b/src/main/java/org/bukkit/entity/SplashPotion.java +index 9cb08fe7201a9f91e88c7b1ee22c17889a7bf1c3..c0fcfccdf476106b48e626a099658c04244ebff8 100644 +--- a/src/main/java/org/bukkit/entity/SplashPotion.java ++++ b/src/main/java/org/bukkit/entity/SplashPotion.java +@@ -3,7 +3,8 @@ package org.bukkit.entity; + /** + * Represents a thrown splash potion bottle + * +- * @deprecated splash status depends on only on the potion item. ++ * @deprecated should not be used for anything, use {@link ThrownPotion} and ++ * set the potion via the methods there. + */ +-@Deprecated ++@Deprecated(forRemoval = true) // Paper + public interface SplashPotion extends ThrownPotion { } +diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java +index 8f601e85df580ef8106eaff8b9eafb5691a4874b..d615c006c9153fb65024241604b744fbfc383efc 100644 +--- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java ++++ b/src/main/java/org/bukkit/entity/memory/MemoryKey.java +@@ -69,6 +69,12 @@ public final class MemoryKey implements Keyed { + public static final MemoryKey LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class); + public static final MemoryKey LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class); + public static final MemoryKey ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class); ++ /** ++ * @deprecated this constant uses the wrong generic type, the sniffer now stores different positions ++ * from possibly different worlds. Use the relevant methods in {@link org.bukkit.entity.Sniffer} directly ++ * for now. ++ */ ++ @Deprecated // Paper + public static final MemoryKey SNIFFER_EXPLORED_POSITIONS = new MemoryKey<>(NamespacedKey.minecraft("sniffer_explored_positions"), Location.class); + + /** +diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +index 9e54ef5b60bf5583c12e1edfa76f19013a5b2a65..37be83184cae203d5e99518b0ff5c708fafb0331 100644 +--- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +@@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Called when a brewing stand starts to brew. + */ ++@org.jetbrains.annotations.ApiStatus.Experimental // Paper + public class BrewingStartEvent extends InventoryBlockStartEvent { + + private static final HandlerList handlers = new HandlerList(); +diff --git a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +index 53119742beda00a38111063243665bb995ae2188..2d084214e991fecc51f8e18e3d733e43b1dca248 100644 +--- a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Called when a Campfire starts to cook. + */ ++@org.jetbrains.annotations.ApiStatus.Experimental // Paper + public class CampfireStartEvent extends InventoryBlockStartEvent { + + private static final HandlerList handlers = new HandlerList(); +diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +index f2edd4a9357832e9dec3fb0aafa006335d7b289b..f05ce4fd6c4bbd79edc5f65e7edd1e4a63e93fb8 100644 +--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java ++++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java +@@ -23,7 +23,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab + private boolean cancelled; + private final Player enchanter; + +- public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @NotNull final EnchantmentOffer[] offers, final int bonus) { ++ public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @org.jetbrains.annotations.Nullable final EnchantmentOffer @NotNull [] offers, final int bonus) { // Paper - offers can contain null values + super(view); + this.enchanter = enchanter; + this.table = table; +@@ -86,8 +86,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab + * + * @return list of available enchantment offers + */ +- @NotNull +- public EnchantmentOffer[] getOffers() { ++ public @org.jetbrains.annotations.Nullable EnchantmentOffer @NotNull [] getOffers() { // Paper offers can contain null values + return offers; + } + +diff --git a/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java +index 090ec6f96ca9b7f760389994da988c44c32b9976..e6b4d4c1722bf4a11744a421d09646b22745b138 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java +@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable; + * LivingEntity's. + */ + public class EntityTargetLivingEntityEvent extends EntityTargetEvent { +- public EntityTargetLivingEntityEvent(@NotNull final Entity entity, @Nullable final LivingEntity target, @Nullable final TargetReason reason) { ++ public EntityTargetLivingEntityEvent(@NotNull final Entity entity, @Nullable final LivingEntity target, @NotNull final TargetReason reason) { // Paper + super(entity, target, reason); + } + +diff --git a/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java b/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java +index e1123295b9511a2c610a1baf7195638f7f3e64c4..273ae8e5da0a858d3b82d1b0f5992318ff49f145 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java +@@ -24,6 +24,14 @@ public class EntityToggleSwimEvent extends EntityEvent implements Cancellable { + return cancel; + } + ++ /** ++ * @deprecated This does nothing, the server and the client doesn't work ++ * correctly when the server try to bypass this. A current workaround ++ * exists. If you want to cancel the switch from the ground state to the ++ * swimming state you need to disable the sprinting flag for the player after ++ * the cancel action. ++ */ ++ @Deprecated // Paper + @Override + public void setCancelled(boolean cancel) { + this.cancel = cancel; +diff --git a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java +index 775e3223aa5054f1883403e50c8f2241d97b1285..5d4817d2a3b709f1a1a1162309a1c923bd09cc1d 100644 +--- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java ++++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java +@@ -19,22 +19,27 @@ public class ProjectileHitEvent extends EntityEvent implements Cancellable { + private final BlockFace hitFace; + private boolean cancel = false; + ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + public ProjectileHitEvent(@NotNull final Projectile projectile) { +- this(projectile, null, null); ++ this(projectile, null, null, null); // Paper + } + ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity) { +- this(projectile, hitEntity, null); ++ this(projectile, hitEntity, null, null); // Paper + } + ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Block hitBlock) { +- this(projectile, null, hitBlock); ++ this(projectile, null, hitBlock, null); // Paper + } + ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock) { + this(projectile, hitEntity, hitBlock, null); + } + ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace) { + super(projectile); + this.hitEntity = hitEntity; +diff --git a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java +index 9353f0d09272404f42167ab8b7ad83a03620c436..f3ec8f67328b266defb31a44a36d31401d5e9371 100644 +--- a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java ++++ b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java +@@ -12,12 +12,19 @@ import org.jetbrains.annotations.NotNull; + public class SpawnerSpawnEvent extends EntitySpawnEvent { + private final CreatureSpawner spawner; + +- public SpawnerSpawnEvent(@NotNull final Entity spawnee, @NotNull final CreatureSpawner spawner) { ++ public SpawnerSpawnEvent(@NotNull final Entity spawnee, @org.jetbrains.annotations.Nullable final CreatureSpawner spawner) { // Paper + super(spawnee); + this.spawner = spawner; + } + +- @NotNull ++ /** ++ * Gets the spawner tile state, or null ++ * when the entity is spawned from a minecart ++ * spawner. ++ * ++ * @return the spawner tile state ++ */ ++ @org.jetbrains.annotations.Nullable // Paper + public CreatureSpawner getSpawner() { + return spawner; + } +diff --git a/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java b/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java +index 68517811f63838bdad41073ee26be82f95042a8e..454885e47611edd707358ddfe0a01b7acf9ad5c8 100644 +--- a/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java ++++ b/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java +@@ -11,22 +11,21 @@ import org.jetbrains.annotations.Nullable; + public class HangingBreakByEntityEvent extends HangingBreakEvent { + private final Entity remover; + +- public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @Nullable final Entity remover) { ++ public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @NotNull final Entity remover) { // Paper + this(hanging, remover, HangingBreakEvent.RemoveCause.ENTITY); + } + +- public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @Nullable final Entity remover, @NotNull final HangingBreakEvent.RemoveCause cause) { ++ public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @NotNull final Entity remover, @NotNull final HangingBreakEvent.RemoveCause cause) { // Paper + super(hanging, cause); + this.remover = remover; + } + + /** + * Gets the entity that removed the hanging entity. +- * May be null, for example when broken by an explosion. + * + * @return the entity that removed the hanging entity + */ +- @Nullable ++ @NotNull // Paper + public Entity getRemover() { + return remover; + } +diff --git a/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java b/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java +index 80a0a4ad813d6453b30273d25942e6612bb05c1b..18bb808e73c7a78f367ccdb44d5fe12bc54672cb 100644 +--- a/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java +@@ -34,7 +34,7 @@ public class HopperInventorySearchEvent extends BlockEvent { + DESTINATION; + } + +- public HopperInventorySearchEvent(@NotNull Inventory inventory, @NotNull ContainerType containerType, @NotNull Block hopper, @NotNull Block searchBlock) { ++ public HopperInventorySearchEvent(@Nullable Inventory inventory, @NotNull ContainerType containerType, @NotNull Block hopper, @NotNull Block searchBlock) { // Paper + super(hopper); + this.inventory = inventory; + this.containerType = containerType; +diff --git a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java +index f2a2a2ad9930499c5bf624e73571a3294a90db14..c8540a42ab44647fdd112ce4f731f3dc0df552f4 100644 +--- a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java +@@ -88,7 +88,7 @@ public class InventoryClickEvent extends InventoryInteractEvent { + * + * @return the cursor ItemStack + */ +- @Nullable ++ @NotNull // Paper - fix nullability + public ItemStack getCursor() { + return getView().getCursor(); + } +diff --git a/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java +index 1cb70b5c8776863f44f1c4cdde152c35cb51edb5..f09b378508fcc6299e7cb40f174028f6f88ba067 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java +@@ -43,7 +43,10 @@ public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable { + * {@link Player#setBedSpawnLocation(Location)}. + * + * @return true if the spawn location will be changed ++ * @deprecated the respawn point is now set when the player enter the bed and ++ * this option doesn't work since MC 1.15. + */ ++ @Deprecated(forRemoval = true) // Paper - Unused + public boolean shouldSetSpawnLocation() { + return setBedSpawn; + } +@@ -59,7 +62,10 @@ public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable { + * {@link Player#setBedSpawnLocation(Location)}. + * + * @param setBedSpawn true to change the new spawn location ++ * @deprecated the respawn point is now set when the player enter the bed and ++ * this option doesn't work since MC 1.15. + */ ++ @Deprecated(forRemoval = true) // Paper - Unused + public void setSpawnLocation(boolean setBedSpawn) { + this.setBedSpawn = setBedSpawn; + } +diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java +index 1b2267f4e8ebded198773ec80e2bff2c861c7084..1a58734d919fae247eeb85dd785fd59990856505 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java +@@ -78,7 +78,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable { + * + * @return Location the player moved to + */ +- @Nullable ++ @NotNull // Paper + public Location getTo() { + return to; + } +diff --git a/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java b/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java +index cd58dd7de781823804701fc023706e805c0142a8..1b8bb5241efcf4a90fd098f2000f8394072dca4a 100644 +--- a/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java ++++ b/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java +@@ -19,7 +19,7 @@ public class RaidSpawnWaveEvent extends RaidEvent { + private final List raiders; + private final Raider leader; + +- public RaidSpawnWaveEvent(@NotNull Raid raid, @NotNull World world, @Nullable Raider leader, @NotNull List raiders) { ++ public RaidSpawnWaveEvent(@NotNull Raid raid, @NotNull World world, @NotNull Raider leader, @NotNull List raiders) { // Paper + super(raid, world); + this.raiders = raiders; + this.leader = leader; +@@ -30,7 +30,7 @@ public class RaidSpawnWaveEvent extends RaidEvent { + * + * @return {@link Raider} + */ +- @Nullable ++ @NotNull // Paper + public Raider getPatrolLeader() { + return leader; + } +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java +index 6bafc62e2235a6b783cbf96f4dabeeaf02bd5178..50c762d777ac90a05772501a28cacff8fd3f5126 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java +@@ -36,18 +36,22 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement + this.cancelled = cancel; + } + ++ @Deprecated(forRemoval = true) // Paper - Unused + public boolean isPickupCancelled() { + return cancelledPickup; + } + ++ @Deprecated(forRemoval = true) // Paper - Unused + public void setPickupCancelled(boolean cancel) { + cancelledPickup = cancel; + } + ++ @Deprecated(forRemoval = true) // Paper - Unused + public boolean isCollisionCancelled() { + return cancelledCollision; + } + ++ @Deprecated(forRemoval = true) // Paper - Unused + public void setCollisionCancelled(boolean cancel) { + cancelledCollision = cancel; + } +diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java +index c0b749a5bbf4980d01fed74768bb61909b579cb9..7e7a53b41013f1bf8956c0e278820f18d77b2f0d 100644 +--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java ++++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java +@@ -656,7 +656,9 @@ public abstract class ChunkGenerator { + * @param y the y location in the chunk from minHeight (inclusive) - maxHeight (exclusive) + * @param z the z location in the chunk from 0-15 inclusive + * @param material the type to set the block to ++ * @deprecated use {@link #setBlock(int, int, int, BlockData)} + */ ++ @Deprecated // Paper + public void setBlock(int x, int y, int z, @NotNull MaterialData material); + + /** +@@ -700,7 +702,9 @@ public abstract class ChunkGenerator { + * @param yMax maximum y location (exclusive) in the chunk to set + * @param zMax maximum z location (exclusive) in the chunk to set + * @param material the type to set the blocks to ++ * @deprecated use {@link #setRegion(int, int, int, int, int, int, BlockData)} + */ ++ @Deprecated // Paper + public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull MaterialData material); + + /** +@@ -741,8 +745,10 @@ public abstract class ChunkGenerator { + * @param y the y location in the chunk from minHeight (inclusive) - maxHeight (exclusive) + * @param z the z location in the chunk from 0-15 inclusive + * @return the type and data of the block or the MaterialData for air if x, y or z are outside the chunk's bounds ++ * @deprecated use {@link #getBlockData(int, int, int)} + */ + @NotNull ++ @Deprecated // Paper + public MaterialData getTypeAndData(int x, int y, int z); + + /** +diff --git a/src/main/java/org/bukkit/inventory/CookingRecipe.java b/src/main/java/org/bukkit/inventory/CookingRecipe.java +index 571652ba8843a9493f1843523e24145baa958637..f7fa79393aef40027446b78bac8e9490cfafd8bc 100644 +--- a/src/main/java/org/bukkit/inventory/CookingRecipe.java ++++ b/src/main/java/org/bukkit/inventory/CookingRecipe.java +@@ -68,7 +68,9 @@ public abstract class CookingRecipe implements Recipe, + * Get the input material. + * + * @return The input material. ++ * @deprecated Use {@link #getInputChoice()} instead for more complete data. + */ ++ @Deprecated // Paper + @NotNull + public ItemStack getInput() { + return this.ingredient.getItemStack(); +diff --git a/src/main/java/org/bukkit/inventory/CraftingInventory.java b/src/main/java/org/bukkit/inventory/CraftingInventory.java +index df81bac9ecff697f98941e5c8490e10391e90090..a32977ba3ba60a1c9aee6e469d5d6cd1887c55a2 100644 +--- a/src/main/java/org/bukkit/inventory/CraftingInventory.java ++++ b/src/main/java/org/bukkit/inventory/CraftingInventory.java +@@ -21,8 +21,7 @@ public interface CraftingInventory extends Inventory { + * + * @return The contents. Individual entries may be null. + */ +- @NotNull +- ItemStack[] getMatrix(); ++ @Nullable ItemStack @NotNull [] getMatrix(); // Paper - make array elements nullable instead array + + /** + * Set the item in the result slot of the crafting inventory. +@@ -38,7 +37,7 @@ public interface CraftingInventory extends Inventory { + * @throws IllegalArgumentException if the length of contents is greater + * than the size of the crafting matrix. + */ +- void setMatrix(@NotNull ItemStack[] contents); ++ void setMatrix(@Nullable ItemStack @NotNull [] contents); // Paper - make array elements nullable instead array + + /** + * Get the current recipe formed on the crafting inventory, if any. +diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java +index 2dde946443fee1f6e79b882cbcb448549dc0c99c..127302aa7c22f59438de66fffa0b03ae84a2a8ad 100644 +--- a/src/main/java/org/bukkit/inventory/EntityEquipment.java ++++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java +@@ -525,6 +525,6 @@ public interface EntityEquipment { + * + * @return the entity this EntityEquipment belongs to + */ +- @Nullable ++ @NotNull // Paper + Entity getHolder(); + } +diff --git a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java +index 1d442dc16cbb0fed21714d47007f3f11e30c57d4..af8f7b88edf0fa790edcf16356a030c4834f531e 100644 +--- a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java ++++ b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java +@@ -67,8 +67,10 @@ public class FurnaceRecipe extends CookingRecipe { + * + * @param input The input material. + * @return The changed recipe, so you can chain calls. ++ * @deprecated use {@link #setInputChoice(RecipeChoice)} + */ + @NotNull ++ @Deprecated + public FurnaceRecipe setInput(@NotNull MaterialData input) { + return setInput(input.getItemType(), input.getData()); + } +diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java +index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ecd93dcd54 100644 +--- a/src/main/java/org/bukkit/inventory/Inventory.java ++++ b/src/main/java/org/bukkit/inventory/Inventory.java +@@ -161,8 +161,7 @@ public interface Inventory extends Iterable { + * + * @return An array of ItemStacks from the inventory. Individual items may be null. + */ +- @NotNull +- public ItemStack[] getContents(); ++ public @Nullable ItemStack @NotNull [] getContents(); // Paper - make array elements nullable instead array + + /** + * Completely replaces the inventory's contents. Removes all existing +@@ -173,7 +172,7 @@ public interface Inventory extends Iterable { + * @throws IllegalArgumentException If the array has more items than the + * inventory. + */ +- public void setContents(@NotNull ItemStack[] items) throws IllegalArgumentException; ++ public void setContents(@Nullable ItemStack @NotNull [] items) throws IllegalArgumentException; // Paper - make array elements nullable instead array + + /** + * Return the contents from the section of the inventory where items can +@@ -186,8 +185,7 @@ public interface Inventory extends Iterable { + * + * @return inventory storage contents. Individual items may be null. + */ +- @NotNull +- public ItemStack[] getStorageContents(); ++ public @Nullable ItemStack @NotNull [] getStorageContents(); // Paper - make array elements nullable instead array + + /** + * Put the given ItemStacks into the storage slots +@@ -196,7 +194,7 @@ public interface Inventory extends Iterable { + * @throws IllegalArgumentException If the array has more items than the + * inventory. + */ +- public void setStorageContents(@NotNull ItemStack[] items) throws IllegalArgumentException; ++ public void setStorageContents(@Nullable ItemStack @NotNull [] items) throws IllegalArgumentException; // Paper - make array elements nullable instead array + + /** + * Checks if the inventory contains any ItemStacks with the given +diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java +index 002acfbdce1db10f7ba1b6a013e678f504ac6e69..8d14426eb1ebea27058d5f22ea652f22d00fccb9 100644 +--- a/src/main/java/org/bukkit/inventory/InventoryView.java ++++ b/src/main/java/org/bukkit/inventory/InventoryView.java +@@ -126,9 +126,9 @@ public abstract class InventoryView { + * Gets the id of this view. + * + * @return the id of this view +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public int getId() { + return id; + } +@@ -210,10 +210,10 @@ public abstract class InventoryView { + /** + * Get the item on the cursor of one of the viewing players. + * +- * @return The item on the player's cursor, or null if they aren't holding +- * one. ++ * @return The item on the player's cursor, or an empty stack ++ * if they aren't holding one. + */ +- @Nullable ++ @NotNull // Paper - fix nullability + public final ItemStack getCursor() { + return getPlayer().getItemOnCursor(); + } +diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java +index 898c256140cc7fee2c0cc65cca33a0e86275f115..e34c89a945a0f12cdc4be8cc232c8de986474372 100644 +--- a/src/main/java/org/bukkit/inventory/ItemFactory.java ++++ b/src/main/java/org/bukkit/inventory/ItemFactory.java +@@ -30,7 +30,7 @@ public interface ItemFactory { + * @return a new ItemMeta that could be applied to an item stack of the + * specified material + */ +- @Nullable ++ @org.bukkit.UndefinedNullability // Paper + ItemMeta getItemMeta(@NotNull final Material material); + + /** +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index e388239d6d960af2102111d2ae90b2a655b2a94a..276cfd52817115981fe7dc46363278f8b8c5aee3 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -8,6 +8,7 @@ import java.util.Map; + import org.bukkit.Bukkit; + import org.bukkit.Material; + import org.bukkit.Translatable; ++import org.bukkit.UndefinedNullability; + import org.bukkit.Utility; + import org.bukkit.configuration.serialization.ConfigurationSerializable; + import org.bukkit.enchantments.Enchantment; +@@ -170,8 +171,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + * Gets the MaterialData for this stack of items + * + * @return MaterialData for this item ++ * @deprecated cast to {@link org.bukkit.inventory.meta.BlockDataMeta} and use {@link org.bukkit.inventory.meta.BlockDataMeta#getBlockData(Material)} + */ + @Nullable ++ @Deprecated // Paper + public MaterialData getData() { + Material mat = Bukkit.getUnsafe().toLegacy(getType()); + if (data == null && mat != null && mat.getData() != null) { +@@ -185,7 +188,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + * Sets the MaterialData for this stack of items + * + * @param data New MaterialData for this item ++ * @deprecated cast to {@link org.bukkit.inventory.meta.BlockDataMeta} and use {@link org.bukkit.inventory.meta.BlockDataMeta#setBlockData(org.bukkit.block.data.BlockData)} + */ ++ @Deprecated // Paper + public void setData(@Nullable MaterialData data) { + if (data == null) { + this.data = data; +@@ -561,7 +566,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + * + * @return a copy of the current ItemStack's ItemData + */ +- @Nullable ++ @UndefinedNullability // Paper + public ItemMeta getItemMeta() { + return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone(); + } +diff --git a/src/main/java/org/bukkit/inventory/PlayerInventory.java b/src/main/java/org/bukkit/inventory/PlayerInventory.java +index 476fe14faa39f02444cab8ad95d4401033dc6938..2c54660dc1fbc7c1232096797a23cae1262888e9 100644 +--- a/src/main/java/org/bukkit/inventory/PlayerInventory.java ++++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java +@@ -16,8 +16,7 @@ public interface PlayerInventory extends Inventory { + * null and are returned in a fixed order starting from the boots and going + * up to the helmet + */ +- @NotNull +- public ItemStack[] getArmorContents(); ++ public @Nullable ItemStack @NotNull [] getArmorContents(); // Paper - make array elements nullable instead array + + /** + * Get all additional ItemStacks stored in this inventory. +@@ -28,8 +27,7 @@ public interface PlayerInventory extends Inventory { + * + * @return All additional ItemStacks. Individual items can be null. + */ +- @NotNull +- public ItemStack[] getExtraContents(); ++ public @Nullable ItemStack @NotNull [] getExtraContents(); // Paper - make array elements nullable instead array + + /** + * Return the ItemStack from the helmet slot +@@ -106,9 +104,9 @@ public interface PlayerInventory extends Inventory { + * + * @param slot the slot to get the ItemStack + * +- * @return the ItemStack in the given slot or null if there is not one ++ * @return the ItemStack in the given slot + */ +- @Nullable ++ @NotNull // Paper + public ItemStack getItem(@NotNull EquipmentSlot slot); + + /** +diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +index 97d5d9c6347bc401e3f4ab7c0ba1391ad5b0449a..da878c6d4928ddbc16b50ace86d992685a2b7873 100644 +--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java ++++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java +@@ -100,8 +100,10 @@ public class ShapedRecipe extends CraftingRecipe { + * @param ingredient The ingredient. + * @return The changed recipe, so you can chain calls. + * @throws IllegalArgumentException if the {@code key} does not appear in the shape. ++ * @deprecated use {@link #setIngredient(char, RecipeChoice)} + */ + @NotNull ++ @Deprecated // Paper + public ShapedRecipe setIngredient(char key, @NotNull MaterialData ingredient) { + return setIngredient(key, ingredient.getItemType(), ingredient.getData()); + } +@@ -179,7 +181,9 @@ public class ShapedRecipe extends CraftingRecipe { + * Get a copy of the ingredients map. + * + * @return The mapping of character to ingredients. ++ * @deprecated Use {@link #getChoiceMap()} instead for more complete data. + */ ++ @Deprecated // Paper + @NotNull + public Map getIngredientMap() { + HashMap result = new HashMap(); +diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab6349576ce8 100644 +--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java ++++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +@@ -43,8 +43,10 @@ public class ShapelessRecipe extends CraftingRecipe { + * + * @param ingredient The ingredient to add. + * @return The changed recipe, so you can chain calls. ++ * @deprecated use {@link #addIngredient(RecipeChoice)} + */ + @NotNull ++ @Deprecated + public ShapelessRecipe addIngredient(@NotNull MaterialData ingredient) { + return addIngredient(1, ingredient); + } +@@ -80,8 +82,10 @@ public class ShapelessRecipe extends CraftingRecipe { + * @param count How many to add (can't be more than 9!) + * @param ingredient The ingredient to add. + * @return The changed recipe, so you can chain calls. ++ * @deprecated use {@link #addIngredient(int, Material)} + */ + @NotNull ++ @Deprecated // Paper + public ShapelessRecipe addIngredient(int count, @NotNull MaterialData ingredient) { + return addIngredient(count, ingredient.getItemType(), ingredient.getData()); + } +@@ -198,8 +202,10 @@ public class ShapelessRecipe extends CraftingRecipe { + * + * @param ingredient The ingredient to remove + * @return The changed recipe. ++ * @deprecated use {@link #removeIngredient(Material)} + */ + @NotNull ++ @Deprecated // Paper + public ShapelessRecipe removeIngredient(@NotNull MaterialData ingredient) { + return removeIngredient(ingredient.getItemType(), ingredient.getData()); + } +@@ -226,8 +232,10 @@ public class ShapelessRecipe extends CraftingRecipe { + * @param count The number of copies to remove. + * @param ingredient The ingredient to remove. + * @return The changed recipe. ++ * @deprecated use {@link #removeIngredient(int, Material)} + */ + @NotNull ++ @Deprecated // Paper + public ShapelessRecipe removeIngredient(int count, @NotNull MaterialData ingredient) { + return removeIngredient(count, ingredient.getItemType(), ingredient.getData()); + } +@@ -277,7 +285,9 @@ public class ShapelessRecipe extends CraftingRecipe { + * Get the list of ingredients used for this recipe. + * + * @return The input list ++ * @deprecated Use {@link #getChoiceList()} instead for more complete data. + */ ++ @Deprecated // Paper + @NotNull + public List getIngredientList() { + ArrayList result = new ArrayList(ingredients.size()); +diff --git a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java +index 597a18a767b68b47e81454b7d44613c7178c1366..bc3440eb72127824b3961fbdae583bb61385f65e 100644 +--- a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java ++++ b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java +@@ -57,7 +57,9 @@ public class StonecuttingRecipe implements Recipe, Keyed { + * Get the input material. + * + * @return The input material. ++ * @deprecated Use {@link #getInputChoice()} instead for more complete data. + */ ++ @Deprecated // Paper + @NotNull + public ItemStack getInput() { + return this.ingredient.getItemStack(); +diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bfbe1ff7fd 100644 +--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +@@ -141,6 +141,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + /** + * Checks for existence of a localized name. + * ++ * @deprecated Use {@link ItemMeta#displayName()} and check if it is instanceof a {@link net.kyori.adventure.text.TranslatableComponent}. + * @return true if this has a localized name + * @deprecated meta no longer exists + */ +@@ -153,6 +154,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + * Plugins should check that hasLocalizedName() returns true + * before calling this method. + * ++ * @deprecated Use {@link ItemMeta#displayName()} and cast it to a {@link net.kyori.adventure.text.TranslatableComponent}. No longer used by the client. + * @return the localized name that is set + * @deprecated meta no longer exists + */ +@@ -163,6 +165,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + /** + * Sets the localized name. + * ++ * @deprecated Use {@link ItemMeta#displayName(Component)} with a {@link net.kyori.adventure.text.TranslatableComponent}. No longer used by the client. + * @param name the name to set + * @deprecated meta no longer exists + */ +diff --git a/src/main/java/org/bukkit/inventory/meta/MapMeta.java b/src/main/java/org/bukkit/inventory/meta/MapMeta.java +index 32055a8890425e0b819930f3059da5ea9dfca553..26a336dade83baee97d20eb39a058925659f5777 100644 +--- a/src/main/java/org/bukkit/inventory/meta/MapMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/MapMeta.java +@@ -16,13 +16,8 @@ public interface MapMeta extends ItemMeta { + * + * @return true if this has a map ID number. + * @see #hasMapView() +- * @deprecated These methods are poor API: They rely on the caller to pass +- * in an only an integer property, and have poorly defined implementation +- * behavior if that integer is not a valid map (the current implementation +- * for example will generate a new map with a different ID). The xxxMapView +- * family of methods should be used instead. + */ +- @Deprecated ++ //@Deprecated // Paper + boolean hasMapId(); + + /** +@@ -34,13 +29,8 @@ public interface MapMeta extends ItemMeta { + * + * @return the map ID that is set + * @see #getMapView() +- * @deprecated These methods are poor API: They rely on the caller to pass +- * in an only an integer property, and have poorly defined implementation +- * behavior if that integer is not a valid map (the current implementation +- * for example will generate a new map with a different ID). The xxxMapView +- * family of methods should be used instead. + */ +- @Deprecated ++ //@Deprecated // Paper + int getMapId(); + + /** +diff --git a/src/main/java/org/bukkit/map/MapCanvas.java b/src/main/java/org/bukkit/map/MapCanvas.java +index edef478786bb7456af29ca960009873095830050..e8ac449e6280827beb6d2699df75b1d52a922c9b 100644 +--- a/src/main/java/org/bukkit/map/MapCanvas.java ++++ b/src/main/java/org/bukkit/map/MapCanvas.java +@@ -95,9 +95,9 @@ public interface MapCanvas { + * @param x The x coordinate, from 0 to 127. + * @param y The y coordinate, from 0 to 127. + * @return The color. See {@link MapPalette}. +- * @deprecated Magic value, use {@link #getPixelColor(int, int)} ++ * @deprecated use {@link #getPixelColor(int, int)} + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + public byte getPixel(int x, int y); + + /** +@@ -106,9 +106,9 @@ public interface MapCanvas { + * @param x The x coordinate, from 0 to 127. + * @param y The y coordinate, from 0 to 127. + * @return The color. See {@link MapPalette}. +- * @deprecated Magic value, use {@link #getBasePixelColor(int, int)} ++ * @deprecated use {@link #getBasePixelColor(int, int)} + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + public byte getBasePixel(int x, int y); + + /** +diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java +index f973f0f3925819765412f6f134e553d7d74f1467..1afa33ca0d900d9301d52ace3ddb0bd50b5ce4e8 100644 +--- a/src/main/java/org/bukkit/map/MapCursor.java ++++ b/src/main/java/org/bukkit/map/MapCursor.java +@@ -158,9 +158,9 @@ public final class MapCursor { + * Get the type of this cursor. + * + * @return The type (color/style) of the map cursor. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getRawType() { + return type; + } +@@ -217,9 +217,9 @@ public final class MapCursor { + * Set the type of this cursor. + * + * @param type The type (color/style) of the map cursor. +- * @deprecated Magic value ++ * @deprecated use {@link #setType(Type)} + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + public void setRawType(byte type) { + if (type < 0 || type > 26) { + throw new IllegalArgumentException("Type must be in the range 0-26"); +@@ -339,9 +339,9 @@ public final class MapCursor { + * Gets the internal value of the cursor. + * + * @return the value +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getValue() { + return value; + } +@@ -351,9 +351,9 @@ public final class MapCursor { + * + * @param value the value + * @return the matching type +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Type byValue(byte value) { + for (Type t : values()) { +diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java +index 3a9aaca2e76411a9c27f9f5e0f22d060d5a66d06..c80faa079eca1564847070f0338fc98024639829 100644 +--- a/src/main/java/org/bukkit/map/MapPalette.java ++++ b/src/main/java/org/bukkit/map/MapPalette.java +@@ -197,9 +197,9 @@ public final class MapPalette { + * + * @param image The image to convert. + * @return A byte[] containing the pixels of the image. +- * @deprecated Magic value ++ * @deprecated use color-related methods + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + @NotNull + public static byte[] imageToBytes(@NotNull Image image) { + BufferedImage temp = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); +@@ -225,9 +225,9 @@ public final class MapPalette { + * @param b The blue component of the color. + * @param g The green component of the color. + * @return The index in the palette. +- * @deprecated Magic value ++ * @deprecated use color-related methods + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + public static byte matchColor(int r, int g, int b) { + return matchColor(new Color(r, g, b)); + } +@@ -238,9 +238,9 @@ public final class MapPalette { + * + * @param color The Color to match. + * @return The index in the palette. +- * @deprecated Magic value ++ * @deprecated use color-related methods + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + public static byte matchColor(@NotNull Color color) { + if (color.getAlpha() < 128) return 0; + +@@ -268,9 +268,9 @@ public final class MapPalette { + * + * @param index The index in the palette. + * @return The Color of the palette entry. +- * @deprecated Magic value ++ * @deprecated use color directly + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + @NotNull + public static Color getColor(byte index) { + // Minecraft has 143 colors, some of which have negative byte representations +@@ -311,9 +311,9 @@ public final class MapPalette { + * @param color The Color to match. + * @return The index in the palette. + * @throws IllegalStateException if {@link #isCached()} returns false +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + byte matchColor(@NotNull Color color); + } + } +diff --git a/src/main/java/org/bukkit/map/MapView.java b/src/main/java/org/bukkit/map/MapView.java +index 9b8b68b66dc15b06800251702c2722623c8462a0..e998c5d871e02564c24260a8205dcfafb6e703d9 100644 +--- a/src/main/java/org/bukkit/map/MapView.java ++++ b/src/main/java/org/bukkit/map/MapView.java +@@ -32,9 +32,9 @@ public interface MapView { + * + * @param value The raw scale + * @return The enum scale, or null for an invalid input +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Scale valueOf(byte value) { + switch (value) { +@@ -51,9 +51,9 @@ public interface MapView { + * Get the raw value of this scale level. + * + * @return The scale value +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getValue() { + return value; + } +diff --git a/src/main/java/org/bukkit/material/Openable.java b/src/main/java/org/bukkit/material/Openable.java +index 0ae54f973d11df74abb3105cf9226afb130b4f33..597036bad6bc61b4aa63a61b45e886dd74a0b7f6 100644 +--- a/src/main/java/org/bukkit/material/Openable.java ++++ b/src/main/java/org/bukkit/material/Openable.java +@@ -1,5 +1,6 @@ + package org.bukkit.material; + ++@Deprecated // Paper + public interface Openable { + + /** +diff --git a/src/main/java/org/bukkit/material/Redstone.java b/src/main/java/org/bukkit/material/Redstone.java +index 3e46603f8cd38041394e0e1baf788d9009b3ffc7..b15c141f1db07296bb349f11c6f39b0fbe53e7b1 100644 +--- a/src/main/java/org/bukkit/material/Redstone.java ++++ b/src/main/java/org/bukkit/material/Redstone.java +@@ -3,6 +3,7 @@ package org.bukkit.material; + /** + * Indicated a Material that may carry or create a Redstone current + */ ++@Deprecated // Paper + public interface Redstone { + + /** +diff --git a/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java b/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java +index 0ea9c6b2420a0f990bd1fdf50fc015e37a7060d8..e99644eae1c662b117aa19060d2484aca19fe0a4 100644 +--- a/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java ++++ b/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java +@@ -7,7 +7,9 @@ import org.jetbrains.annotations.Nullable; + + /** + * Represents the different textured blocks of mushroom. ++ * @deprecated use BlockData + */ ++@Deprecated // Paper + public enum MushroomBlockTexture { + + /** +diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java +index 7feeb33f8938be968b20c19437723d8c968690fa..e045e6a74821f291938cc6af86e313c1f1c4626c 100644 +--- a/src/main/java/org/bukkit/potion/PotionEffectType.java ++++ b/src/main/java/org/bukkit/potion/PotionEffectType.java +@@ -270,9 +270,9 @@ public abstract class PotionEffectType implements Keyed, Translatable { + * Returns the unique ID of this type. + * + * @return Unique ID +- * @deprecated Magic value ++ * @deprecated use {@link #key()} + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.2") // Paper + public abstract int getId(); + + /** +@@ -308,9 +308,9 @@ public abstract class PotionEffectType implements Keyed, Translatable { + * + * @param id Unique ID to fetch + * @return Resulting type, or null if not found. +- * @deprecated Magic value ++ * @apiNote Internal Use Only + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static PotionEffectType getById(int id) { + PotionEffectType type = ID_MAP.get(id); +diff --git a/src/test/java/org/bukkit/materials/MaterialDataTest.java b/src/test/java/org/bukkit/materials/MaterialDataTest.java +index 8d78435cc42a9e668b2d4d674b79b4094c3bd1b1..24a8ce4387b897c717b55405f363ffafff45894d 100644 +--- a/src/test/java/org/bukkit/materials/MaterialDataTest.java ++++ b/src/test/java/org/bukkit/materials/MaterialDataTest.java +@@ -22,6 +22,7 @@ import org.bukkit.material.WoodenStep; + import org.bukkit.material.types.MushroomBlockTexture; + import org.junit.jupiter.api.Test; + ++@Deprecated // Paper + public class MaterialDataTest { + + @Test diff --git a/patches/api/0172-Fix-Spigot-annotation-mistakes.patch b/patches/api/0172-Fix-Spigot-annotation-mistakes.patch deleted file mode 100644 index 6dc3d96c0b..0000000000 --- a/patches/api/0172-Fix-Spigot-annotation-mistakes.patch +++ /dev/null @@ -1,1899 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 24 Mar 2019 18:39:01 -0400 -Subject: [PATCH] Fix Spigot annotation mistakes - -while some of these may of been true, they are extreme cases and cause -a ton of noise to plugin developers. - -Use ApiStatus.Internal instead of Deprecated for actual internal API -that continues to have use (internally). - -These do not help plugin developers if they bring moise noise than value. - -diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java -index ac420f0059fc50d3e1294f85df7515c9e17ff78f..24daba85ce4129fb0babe67570059ca8119360c0 100644 ---- a/src/main/java/org/bukkit/Art.java -+++ b/src/main/java/org/bukkit/Art.java -@@ -75,9 +75,9 @@ public enum Art implements Keyed { - * Get the ID of this painting. - * - * @return The ID of this painting -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getId() { - return id; - } -@@ -93,9 +93,9 @@ public enum Art implements Keyed { - * - * @param id The ID - * @return The painting -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Art getById(int id) { - return BY_ID.get(id); -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index f248515862c3bc418b42b8e197feb43addfd122d..395d7245aac45a1b805e15ee1fdb9949574f3f59 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -870,9 +870,8 @@ public final class Bukkit { - * - * @param id the id of the map to get - * @return a map view if it exists, or null otherwise -- * @deprecated Magic value - */ -- @Deprecated -+ //@Deprecated // Paper - Not a magic value - @Nullable - public static MapView getMap(int id) { - return server.getMap(id); -@@ -951,8 +950,14 @@ public final class Bukkit { - * Returns the primary logger associated with this server instance. - * - * @return Logger associated with this server -+ * @see org.bukkit.plugin.Plugin#getSLF4JLogger() -+ * @apiNote This logger is for the Minecraft server software, not for specific plugins. You should -+ * use a logger for a specific plugin, either via {@link org.bukkit.plugin.Plugin#getSLF4JLogger()} -+ * or {@link org.bukkit.plugin.Plugin#getLogger()} or create a specific logger for a class via slf4j. -+ * That way, log messages contain contextual information about the source of the message. - */ - @NotNull -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - internalize Bukkit#getLogger - public static Logger getLogger() { - return server.getLogger(); - } -@@ -1349,10 +1354,8 @@ public final class Bukkit { - * @param name the name the player to retrieve - * @return an offline player - * @see #getOfflinePlayer(java.util.UUID) -- * @deprecated Persistent storage of users should be by UUID as names are no longer -- * unique past a single session. - */ -- @Deprecated -+ // @Deprecated // Paper - @NotNull - public static OfflinePlayer getOfflinePlayer(@NotNull String name) { - return server.getOfflinePlayer(name); -@@ -1954,7 +1957,7 @@ public final class Bukkit { - * - * @return the scoreboard manager or null if no worlds are loaded. - */ -- @Nullable -+ @NotNull // Paper - public static ScoreboardManager getScoreboardManager() { - return server.getScoreboardManager(); - } -diff --git a/src/main/java/org/bukkit/CoalType.java b/src/main/java/org/bukkit/CoalType.java -index c07499dbdd49d70717dbd674d97b6dbcfd7e9d5b..75e563d2a6d417b95c7f06a0636811aec8259672 100644 ---- a/src/main/java/org/bukkit/CoalType.java -+++ b/src/main/java/org/bukkit/CoalType.java -@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents the two types of coal - */ -+@Deprecated // Paper - public enum CoalType { - COAL(0x0), - CHARCOAL(0x1); -diff --git a/src/main/java/org/bukkit/CropState.java b/src/main/java/org/bukkit/CropState.java -index fb4832fb796a38c0f5f51cf80a67259924f2c607..519deeeb86672fd75ae62026f956727d01f78fef 100644 ---- a/src/main/java/org/bukkit/CropState.java -+++ b/src/main/java/org/bukkit/CropState.java -@@ -7,6 +7,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents the different growth states of crops - */ -+@Deprecated // Paper - public enum CropState { - - /** -diff --git a/src/main/java/org/bukkit/Difficulty.java b/src/main/java/org/bukkit/Difficulty.java -index 3f6cbefc2b1414ba2dad709e79288013b3ef73be..f35801783538d3377b04131b8bf6effd7eb8e1a5 100644 ---- a/src/main/java/org/bukkit/Difficulty.java -+++ b/src/main/java/org/bukkit/Difficulty.java -@@ -44,9 +44,9 @@ public enum Difficulty { - * Gets the difficulty value associated with this Difficulty. - * - * @return An integer value of this difficulty -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getValue() { - return value; - } -@@ -57,9 +57,9 @@ public enum Difficulty { - * @param value Value to check - * @return Associative {@link Difficulty} with the given value, or null if - * it doesn't exist -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Difficulty getByValue(final int value) { - return BY_ID.get(value); -diff --git a/src/main/java/org/bukkit/DyeColor.java b/src/main/java/org/bukkit/DyeColor.java -index bd213cabddd8752e609544f24cfba95405726155..47df858e095c4423c20e49e029d72f0f50d2c924 100644 ---- a/src/main/java/org/bukkit/DyeColor.java -+++ b/src/main/java/org/bukkit/DyeColor.java -@@ -96,9 +96,9 @@ public enum DyeColor { - * - * @return A byte containing the wool data value of this color - * @see #getDyeData() -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getWoolData() { - return woolData; - } -@@ -142,9 +142,9 @@ public enum DyeColor { - * @return The {@link DyeColor} representing the given value, or null if - * it doesn't exist - * @see #getByDyeData(byte) -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static DyeColor getByWoolData(final byte data) { - int i = 0xff & data; -@@ -202,9 +202,9 @@ public enum DyeColor { - * - * @param name dye name - * @return dye color -- * @deprecated legacy use only -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @NotNull - public static DyeColor legacyValueOf(@Nullable String name) { - return "SILVER".equals(name) ? DyeColor.LIGHT_GRAY : DyeColor.valueOf(name); -diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java -index 0d0777771485a76d960da2f16e963b19d2cf6c2d..fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38 100644 ---- a/src/main/java/org/bukkit/Effect.java -+++ b/src/main/java/org/bukkit/Effect.java -@@ -357,9 +357,9 @@ public enum Effect { - * Gets the ID for this effect. - * - * @return ID of this effect -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getId() { - return this.id; - } -@@ -386,9 +386,9 @@ public enum Effect { - * - * @param id ID of the Effect to return - * @return Effect with the given ID -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Effect getById(int id) { - return BY_ID.get(id); -diff --git a/src/main/java/org/bukkit/EntityEffect.java b/src/main/java/org/bukkit/EntityEffect.java -index 9db85b2f6ffd56bbc4db1f75f8769f1c15d5950f..5341957b10cccd7bce5a7595699b1d90412a01d0 100644 ---- a/src/main/java/org/bukkit/EntityEffect.java -+++ b/src/main/java/org/bukkit/EntityEffect.java -@@ -345,9 +345,9 @@ public enum EntityEffect { - * Gets the data value of this EntityEffect, may not be unique. - * - * @return The data value -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getData() { - return data; - } -diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java -index 938c3217f92e6d3ef9a637269c469f8359af6347..81e45984a88fc84acd0f76d825abf4ddaed0ac3b 100644 ---- a/src/main/java/org/bukkit/GameMode.java -+++ b/src/main/java/org/bukkit/GameMode.java -@@ -44,9 +44,9 @@ public enum GameMode { - * Gets the mode value associated with this GameMode - * - * @return An integer value of this gamemode -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getValue() { - return value; - } -@@ -57,9 +57,9 @@ public enum GameMode { - * @param value Value to check - * @return Associative {@link GameMode} with the given value, or null if - * it doesn't exist -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static GameMode getByValue(final int value) { - return BY_ID.get(value); -diff --git a/src/main/java/org/bukkit/GrassSpecies.java b/src/main/java/org/bukkit/GrassSpecies.java -index f9c9ae463aacd593e3aa9caf037ea1e23d56c780..f8ae143acbf586d5279b44f7311ca97f3ae4ead2 100644 ---- a/src/main/java/org/bukkit/GrassSpecies.java -+++ b/src/main/java/org/bukkit/GrassSpecies.java -@@ -6,7 +6,9 @@ import org.jetbrains.annotations.Nullable; - - /** - * Represents the different types of grass. -+ * @deprecated use {@link org.bukkit.block.data.BlockData} - */ -+@Deprecated // Paper - public enum GrassSpecies { - - /** -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 02b4ffa6b918269bd64f7c518fcceef1f6990737..f0878c7539696cc0676e6010e88914d3850acf20 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -46,7 +46,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - * @param y The y-coordinate of this new location - * @param z The z-coordinate of this new location - */ -- public Location(@Nullable final World world, final double x, final double y, final double z) { -+ public Location(@UndefinedNullability final World world, final double x, final double y, final double z) { // Paper - this(world, x, y, z, 0, 0); - } - -@@ -60,7 +60,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - * @param yaw The absolute rotation on the x-plane, in degrees - * @param pitch The absolute rotation on the y-plane, in degrees - */ -- public Location(@Nullable final World world, final double x, final double y, final double z, final float yaw, final float pitch) { -+ public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { // Paper - if (world != null) { - this.world = new WeakReference<>(world); - } -@@ -102,7 +102,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - * @throws IllegalArgumentException when world is unloaded - * @see #isWorldLoaded() - */ -- @Nullable -+ @UndefinedNullability // Paper - public World getWorld() { - if (this.world == null) { - return null; -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index c2808db693647bdf3b9617cb6c665e8499874485..c605da711c032f7091390e50b4a5d332c992d3d1 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -4746,20 +4746,20 @@ public enum Material implements Keyed, Translatable { - * Do not use for any reason. - * - * @return ID of this material -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getId() { - Preconditions.checkArgument(legacy, "Cannot get ID of Modern Material"); - return id; - } - - /** -- * Do not use for any reason. -+ * Checks if this constant is a legacy material. - * - * @return legacy status - */ -- @Deprecated -+ // @Deprecated // Paper - this is useful, don't deprecate - public boolean isLegacy() { - return legacy; - } -@@ -4835,8 +4835,10 @@ public enum Material implements Keyed, Translatable { - * Gets the MaterialData class associated with this Material - * - * @return MaterialData associated with this Material -+ * @deprecated use {@link #createBlockData()} - */ - @NotNull -+ @Deprecated // Paper - public Class getData() { - Preconditions.checkArgument(legacy, "Cannot get data class of Modern Material"); - return ctor.getDeclaringClass(); -@@ -9103,7 +9105,11 @@ public enum Material implements Keyed, Translatable { - * material. - * - * @return true if this material can be interacted with. -+ * @deprecated This method is not comprehensive and does not accurately reflect what block types are -+ * interactable. Many "interactions" are defined on the item not block, and many are conditional on some other world state -+ * checks being true. - */ -+ @Deprecated // Paper - public boolean isInteractable() { - switch (this) { - // -diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java -index 9b61129c3ef83d0bfceba54aba2effa12bc90678..cbdaa121dbc1876d0cd55f4b7b57f283ecaa8f1a 100644 ---- a/src/main/java/org/bukkit/NamespacedKey.java -+++ b/src/main/java/org/bukkit/NamespacedKey.java -@@ -74,12 +74,14 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap - - /** - * Create a key in a specific namespace. -+ *

-+ * For most plugin related code, you should prefer using the -+ * {@link NamespacedKey#NamespacedKey(Plugin, String)} constructor. - * - * @param namespace namespace - * @param key key -- * @apiNote should never be used by plugins, for internal use only!! -+ * @see #NamespacedKey(Plugin, String) - */ -- @ApiStatus.Internal - public NamespacedKey(@NotNull String namespace, @NotNull String key) { - Preconditions.checkArgument(namespace != null && isValidNamespace(namespace), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace); - Preconditions.checkArgument(key != null && isValidKey(key), "Invalid key. Must be [a-z0-9/._-]: %s", key); -diff --git a/src/main/java/org/bukkit/NetherWartsState.java b/src/main/java/org/bukkit/NetherWartsState.java -index f43209cf7b752c26718c303ca8c3e1c7d9912ad3..f0094e6fb05e526736629ad3181c8d2c16ba6ca4 100644 ---- a/src/main/java/org/bukkit/NetherWartsState.java -+++ b/src/main/java/org/bukkit/NetherWartsState.java -@@ -1,5 +1,11 @@ - package org.bukkit; - -+// Paper start -+/** -+ * @deprecated use {@link org.bukkit.block.data.BlockData} and {@link org.bukkit.block.data.Ageable} -+ */ -+@Deprecated -+// Paper end - public enum NetherWartsState { - - /** -diff --git a/src/main/java/org/bukkit/Note.java b/src/main/java/org/bukkit/Note.java -index 48aecc9421c500137bbef1dfe3bec8de277c3ff9..aff858346776386f1288b648b221404f7f412399 100644 ---- a/src/main/java/org/bukkit/Note.java -+++ b/src/main/java/org/bukkit/Note.java -@@ -39,9 +39,9 @@ public class Note { - * Returns the not sharped id of this tone. - * - * @return the not sharped id of this tone. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getId() { - return getId(false); - } -@@ -53,9 +53,9 @@ public class Note { - * - * @param sharped Set to true to return the sharped id. - * @return the id of this tone. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getId(boolean sharped) { - byte id = (byte) (sharped && sharpable ? this.id + 1 : this.id); - -@@ -78,9 +78,9 @@ public class Note { - * @return if the tone id is the sharped id of the tone. - * @throws IllegalArgumentException if neither the tone nor the - * semitone have the id. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public boolean isSharped(byte id) { - if (id == getId(false)) { - return false; -@@ -97,9 +97,9 @@ public class Note { - * - * @param id the id of the tone. - * @return the tone to id. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Tone getById(byte id) { - return BY_DATA.get(id); -@@ -222,9 +222,9 @@ public class Note { - * Returns the internal id of this note. - * - * @return the internal id of this note. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getId() { - return note; - } -diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 4f8c54a84c9f737dad3feff9ffd7daf22854e97f..a04d279561676e825905f5512c399d14a3d8f828 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -201,14 +201,12 @@ public interface Registry extends Iterable { - * - * @see TrimMaterial - */ -- @ApiStatus.Experimental - Registry TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class); - /** - * Trim patterns. - * - * @see TrimPattern - */ -- @ApiStatus.Experimental - Registry TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class); - /** - * Damage types. -@@ -310,8 +308,11 @@ public interface Registry extends Iterable { - * - * @param input non-null input - * @return registered object or null if does not exist -+ * @deprecated this method's behavior is broken and not useful. If you want to get an object -+ * based on its vanilla name, or a key, wrap it in a {@link NamespacedKey} object and use {@link #get(NamespacedKey)} - */ - @Nullable -+ @Deprecated(forRemoval = true) // Paper - default T match(@NotNull String input) { - Preconditions.checkArgument(input != null, "input must not be null"); - -diff --git a/src/main/java/org/bukkit/SandstoneType.java b/src/main/java/org/bukkit/SandstoneType.java -index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da45ab28e2f 100644 ---- a/src/main/java/org/bukkit/SandstoneType.java -+++ b/src/main/java/org/bukkit/SandstoneType.java -@@ -6,7 +6,9 @@ import org.jetbrains.annotations.Nullable; - - /** - * Represents the three different types of Sandstone -+ * @deprecated use {@link org.bukkit.block.data.BlockData} - */ -+@Deprecated // Paper - public enum SandstoneType { - CRACKED(0x0), - GLYPHED(0x1), -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 69f236d965c631510b008a7eb38aa1b62a4e196a..2382322bc4f30ff3163b2941650692d9a13328ac 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -730,9 +730,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * - * @param id the id of the map to get - * @return a map view if it exists, or null otherwise -- * @deprecated Magic value - */ -- @Deprecated -+ //@Deprecated // Paper - Not a magic value - @Nullable - public MapView getMap(int id); - -@@ -799,8 +798,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * Returns the primary logger associated with this server instance. - * - * @return Logger associated with this server -+ * @see org.bukkit.plugin.Plugin#getSLF4JLogger() -+ * @apiNote This logger is for the Minecraft server software, not for specific plugins. You should -+ * use a logger for a specific plugin, either via {@link org.bukkit.plugin.Plugin#getSLF4JLogger()} -+ * or {@link org.bukkit.plugin.Plugin#getLogger()} or create a specific logger for a class via slf4j. -+ * That way, log messages contain contextual information about the source of the message. - */ - @NotNull -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - internalize Bukkit#getLogger - public Logger getLogger(); - - /** -@@ -1137,10 +1142,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @param name the name the player to retrieve - * @return an offline player - * @see #getOfflinePlayer(java.util.UUID) -- * @deprecated Persistent storage of users should be by UUID as names are no longer -- * unique past a single session. - */ -- @Deprecated -+ // @Deprecated // Paper - @NotNull - public OfflinePlayer getOfflinePlayer(@NotNull String name); - -@@ -1649,7 +1652,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * - * @return the scoreboard manager or null if no worlds are loaded. - */ -- @Nullable -+ @NotNull // Paper - ScoreboardManager getScoreboardManager(); - - /** -diff --git a/src/main/java/org/bukkit/UndefinedNullability.java b/src/main/java/org/bukkit/UndefinedNullability.java -index 4d4265c237179470e1fd017721a8dd595f114013..3babc9df26276300392d3f92ee6e317c33643b0b 100644 ---- a/src/main/java/org/bukkit/UndefinedNullability.java -+++ b/src/main/java/org/bukkit/UndefinedNullability.java -@@ -14,6 +14,7 @@ import org.jetbrains.annotations.ApiStatus; - * suggests a bad API design. - */ - @Retention(RetentionPolicy.CLASS) -+@java.lang.annotation.Documented // Paper - @ApiStatus.Internal - @Deprecated - public @interface UndefinedNullability { -diff --git a/src/main/java/org/bukkit/Vibration.java b/src/main/java/org/bukkit/Vibration.java -index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114306c57cb 100644 ---- a/src/main/java/org/bukkit/Vibration.java -+++ b/src/main/java/org/bukkit/Vibration.java -@@ -13,6 +13,14 @@ public class Vibration { - private final Destination destination; - private final int arrivalTime; - -+ // Paper start -+ public Vibration(@NotNull Destination destination, @NotNull int arrivalTime) { -+ this.destination = destination; -+ this.arrivalTime = arrivalTime; -+ this.origin = new Location(null, 0, 0, 0); // Dummy origin because getter expects null -+ } -+ -+ @Deprecated(forRemoval = true) // Paper end - public Vibration(@NotNull Location origin, @NotNull Destination destination, int arrivalTime) { - this.origin = origin; - this.destination = destination; -@@ -22,9 +30,11 @@ public class Vibration { - /** - * Get the origin of the vibration. - * -+ * @deprecated unused as of 1.19 - * @return origin - */ - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public Location getOrigin() { - return origin; - } -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index b6ca63afb74b345e381d35646cc8faf52a2c7cbc..a523d1725f175c924ab1a7d544d389ec81b68bcf 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -418,9 +418,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * @param z Z-coordinate of the chunk - * @return Whether the chunk was actually refreshed - * -- * @deprecated This method is not guaranteed to work suitably across all client implementations. - */ -- @Deprecated -+ //@Deprecated // Paper - public boolean refreshChunk(int x, int z); - - /** -@@ -3770,6 +3769,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); - - // Spigot start -+ @Deprecated(forRemoval = true) // Paper - public class Spigot { - - /** -@@ -3803,7 +3803,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - } - } - -+ /** -+ * @deprecated Unsupported api -+ */ - @NotNull -+ @Deprecated // Paper - Spigot spigot(); - // Spigot end - -@@ -4021,9 +4025,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * Gets the dimension ID of this environment - * - * @return dimension ID -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getId() { - return id; - } -@@ -4033,9 +4037,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * - * @param id The ID of the environment - * @return The environment -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Environment getEnvironment(int id) { - return lookup.get(id); -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index a71001677e2b1b0b6225a7be63b8ea5ce4456862..c7ef0386a09a07a2317c56274ed41218dfd7153d 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -526,7 +526,7 @@ public interface Block extends Metadatable, Translatable { - * @return a list of dropped items for this type of block - */ - @NotNull -- Collection getDrops(@NotNull ItemStack tool, @Nullable Entity entity); -+ Collection getDrops(@Nullable ItemStack tool, @Nullable Entity entity); // Paper - - /** - * Returns if the given item is a preferred choice to break this Block. -diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java -index 3e07fc1bc0e08d0cfd998711c7fd547b2b7b6b73..fd4a9bdcfb6775dfbdb7492e6c9eb90722d2ecdc 100644 ---- a/src/main/java/org/bukkit/block/BlockState.java -+++ b/src/main/java/org/bukkit/block/BlockState.java -@@ -36,8 +36,10 @@ public interface BlockState extends Metadatable { - * Gets the metadata for this block state. - * - * @return block specific metadata -+ * @deprecated use {@link #getBlockData()} - */ - @NotNull -+ @Deprecated // Paper - MaterialData getData(); - - /** -@@ -151,7 +153,9 @@ public interface BlockState extends Metadatable { - * Sets the metadata for this block state. - * - * @param data New block specific metadata -+ * @deprecated use {@link #setBlockData(BlockData)} - */ -+ @Deprecated // Paper - void setData(@NotNull MaterialData data); - - /** -diff --git a/src/main/java/org/bukkit/block/BrushableBlock.java b/src/main/java/org/bukkit/block/BrushableBlock.java -index 4bd127b3646307398e0c937c3e36ab671235b72b..f2557a87f468ee20c2d276dbfc0e9a976656c75c 100644 ---- a/src/main/java/org/bukkit/block/BrushableBlock.java -+++ b/src/main/java/org/bukkit/block/BrushableBlock.java -@@ -15,7 +15,7 @@ public interface BrushableBlock extends Lootable, TileState { - * - * @return the item - */ -- @Nullable -+ @org.jetbrains.annotations.NotNull // Paper - public ItemStack getItem(); - - /** -diff --git a/src/main/java/org/bukkit/block/PistonMoveReaction.java b/src/main/java/org/bukkit/block/PistonMoveReaction.java -index b90f5dc345ad2cdd3ae353dc57f42a14c231d18a..a7b915ded9154d53ac8ca599119c1699cfca2265 100644 ---- a/src/main/java/org/bukkit/block/PistonMoveReaction.java -+++ b/src/main/java/org/bukkit/block/PistonMoveReaction.java -@@ -48,9 +48,9 @@ public enum PistonMoveReaction { - - /** - * @return The ID of the move reaction -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getId() { - return this.id; - } -@@ -58,9 +58,9 @@ public enum PistonMoveReaction { - /** - * @param id An ID - * @return The move reaction with that ID -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static PistonMoveReaction getById(int id) { - return byId.get(id); -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index a82d6f469aca02fb28b1b3ad84dc40415f1f1ade..f4ec7891bdcedc73bff6938e3eddb7ee43d23ec1 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -273,7 +273,7 @@ public abstract class Enchantment implements Keyed, Translatable { - * @deprecated enchantment groupings are now managed by tags, not categories - */ - @NotNull -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.5") @org.jetbrains.annotations.Contract("-> fail") // Paper - public abstract EnchantmentTarget getItemTarget(); - - /** -diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java -index 3afe2787de576f7190d87c796bea0ab34dc30248..58191017244f3949f6174fb108e3a245738a53c4 100644 ---- a/src/main/java/org/bukkit/entity/Enderman.java -+++ b/src/main/java/org/bukkit/entity/Enderman.java -@@ -25,15 +25,19 @@ public interface Enderman extends Monster { - * Gets the id and data of the block that the Enderman is carrying. - * - * @return MaterialData containing the id and data of the block -+ * @deprecated use {@link #getCarriedBlock()} - */ - @NotNull -+ @Deprecated // Paper - public MaterialData getCarriedMaterial(); - - /** - * Sets the id and data of the block that the Enderman is carrying. - * - * @param material data to set the carried block to -+ * @deprecated use {@link #setCarriedBlock(BlockData)} - */ -+ @Deprecated // Paper - public void setCarriedMaterial(@NotNull MaterialData material); - - /** -diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index c308f6a9f36ae8d108d583179464e078e09bf051..dd410ff2cad3dc34ef9d2a37d72417c7b213de63 100644 ---- a/src/main/java/org/bukkit/entity/EntityType.java -+++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -393,9 +393,9 @@ public enum EntityType implements Keyed, Translatable { - * - * @param name the entity type's name - * @return the matching entity type or null -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Contract("null -> null") - @Nullable - public static EntityType fromName(@Nullable String name) { -diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java -index b27447d7a2833f84cf05946c851f5b6740a578e3..5afeb2f6c82e8f752229462c2d7846f6ae7a4b44 100644 ---- a/src/main/java/org/bukkit/entity/LightningStrike.java -+++ b/src/main/java/org/bukkit/entity/LightningStrike.java -@@ -84,6 +84,10 @@ public interface LightningStrike extends Entity { - public void setCausingPlayer(@Nullable Player player); - - // Spigot start -+ /** -+ * @deprecated Unsupported api -+ */ -+ @Deprecated // Paper - public class Spigot extends Entity.Spigot { - - /** -@@ -98,8 +102,12 @@ public interface LightningStrike extends Entity { - } - } - -+ /** -+ * @deprecated Unsupported api -+ */ - @NotNull - @Override -+ @Deprecated // Paper - Spigot spigot(); - // Spigot end - } -diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java -index bafef53c1d449135f1300c8c8fbb06f482ba67e1..f50aaddf8582be55fd4860ad374d8f2206991897 100644 ---- a/src/main/java/org/bukkit/entity/LingeringPotion.java -+++ b/src/main/java/org/bukkit/entity/LingeringPotion.java -@@ -3,7 +3,8 @@ package org.bukkit.entity; - /** - * Represents a thrown lingering potion bottle - * -- * @deprecated lingering status depends on only on the potion item. -+ * @deprecated should not be used for anything, use {@link ThrownPotion} and -+ * set the potion via the methods there. - */ --@Deprecated -+@Deprecated(forRemoval = true) // Paper - public interface LingeringPotion extends ThrownPotion { } -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 8cd525dd8ded0ddbd405c66e9c0fbeb40f788521..2b791a093a1220be80eb6b9d7202f6596fcf2dd6 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -716,7 +716,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * This may have unexpected results if the entity is not in water. - * - * @param swimming True if the entity is swimming. -+ * @deprecated This does nothing and is immediately reverted by the server, in the next tick - */ -+ @Deprecated // Paper - public void setSwimming(boolean swimming); - - /** -@@ -971,7 +973,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @deprecated entity groupings are now managed by tags, not categories - */ - @NotNull -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.5") @org.jetbrains.annotations.Contract("-> fail") // Paper - public EntityCategory getCategory(); - - /** -diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java -index 95c79c5fa0c4e30201f887da6467ce5f81c8a255..7f9c4d4b430a3f0276461346ff2621bacf864075 100644 ---- a/src/main/java/org/bukkit/entity/Minecart.java -+++ b/src/main/java/org/bukkit/entity/Minecart.java -@@ -101,7 +101,9 @@ public interface Minecart extends Vehicle { - * Passing a null value will set the minecart to have no display block. - * - * @param material the material to set as display block. -+ * @deprecated use {@link #setDisplayBlockData(BlockData)} - */ -+ @Deprecated // Paper - public void setDisplayBlock(@Nullable MaterialData material); - - /** -@@ -109,8 +111,10 @@ public interface Minecart extends Vehicle { - * This function will return the type AIR if none is set. - * - * @return the block displayed by this minecart. -+ * @deprecated use {@link #getDisplayBlockData()} - */ - @NotNull -+ @Deprecated // Paper - public MaterialData getDisplayBlock(); - - /** -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 92a83edc03fa8d11f026ac312b989329fa6a7e88..33547e9e3f8f7c906a5d91b75eb62327cc1f2a3a 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1635,11 +1635,8 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - - /** - * Forces an update of the player's entire inventory. -- * -- * @apiNote It should not be necessary for plugins to use this method. If it -- * is required for some reason, it is probably a bug. - */ -- @ApiStatus.Internal -+ // @ApiStatus.Internal // Paper - is valid API - public void updateInventory(); - - /** -diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java -index 906b33b7569fff5dd78258f9765e879180a52834..06e3ad9cd8f39de0ef6ead794df1492415bc4302 100644 ---- a/src/main/java/org/bukkit/entity/Projectile.java -+++ b/src/main/java/org/bukkit/entity/Projectile.java -@@ -29,7 +29,7 @@ public interface Projectile extends Entity { - * @return true if it should bounce. - * @deprecated does not do anything - */ -- @Deprecated -+ @Deprecated(forRemoval = true) - public boolean doesBounce(); - - /** -@@ -39,6 +39,6 @@ public interface Projectile extends Entity { - * @param doesBounce whether or not it should bounce. - * @deprecated does not do anything - */ -- @Deprecated -+ @Deprecated(forRemoval = true) - public void setBounce(boolean doesBounce); - } -diff --git a/src/main/java/org/bukkit/entity/SplashPotion.java b/src/main/java/org/bukkit/entity/SplashPotion.java -index 9cb08fe7201a9f91e88c7b1ee22c17889a7bf1c3..c0fcfccdf476106b48e626a099658c04244ebff8 100644 ---- a/src/main/java/org/bukkit/entity/SplashPotion.java -+++ b/src/main/java/org/bukkit/entity/SplashPotion.java -@@ -3,7 +3,8 @@ package org.bukkit.entity; - /** - * Represents a thrown splash potion bottle - * -- * @deprecated splash status depends on only on the potion item. -+ * @deprecated should not be used for anything, use {@link ThrownPotion} and -+ * set the potion via the methods there. - */ --@Deprecated -+@Deprecated(forRemoval = true) // Paper - public interface SplashPotion extends ThrownPotion { } -diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java -index 8f601e85df580ef8106eaff8b9eafb5691a4874b..d615c006c9153fb65024241604b744fbfc383efc 100644 ---- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java -+++ b/src/main/java/org/bukkit/entity/memory/MemoryKey.java -@@ -69,6 +69,12 @@ public final class MemoryKey implements Keyed { - public static final MemoryKey LIKED_NOTEBLOCK_POSITION = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock"), Location.class); - public static final MemoryKey LIKED_NOTEBLOCK_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("liked_noteblock_cooldown_ticks"), Integer.class); - public static final MemoryKey ITEM_PICKUP_COOLDOWN_TICKS = new MemoryKey<>(NamespacedKey.minecraft("item_pickup_cooldown_ticks"), Integer.class); -+ /** -+ * @deprecated this constant uses the wrong generic type, the sniffer now stores different positions -+ * from possibly different worlds. Use the relevant methods in {@link org.bukkit.entity.Sniffer} directly -+ * for now. -+ */ -+ @Deprecated // Paper - public static final MemoryKey SNIFFER_EXPLORED_POSITIONS = new MemoryKey<>(NamespacedKey.minecraft("sniffer_explored_positions"), Location.class); - - /** -diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -index 9e54ef5b60bf5583c12e1edfa76f19013a5b2a65..37be83184cae203d5e99518b0ff5c708fafb0331 100644 ---- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -@@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Called when a brewing stand starts to brew. - */ -+@org.jetbrains.annotations.ApiStatus.Experimental // Paper - public class BrewingStartEvent extends InventoryBlockStartEvent { - - private static final HandlerList handlers = new HandlerList(); -diff --git a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java -index 53119742beda00a38111063243665bb995ae2188..2d084214e991fecc51f8e18e3d733e43b1dca248 100644 ---- a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java -@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Called when a Campfire starts to cook. - */ -+@org.jetbrains.annotations.ApiStatus.Experimental // Paper - public class CampfireStartEvent extends InventoryBlockStartEvent { - - private static final HandlerList handlers = new HandlerList(); -diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java -index f2edd4a9357832e9dec3fb0aafa006335d7b289b..f05ce4fd6c4bbd79edc5f65e7edd1e4a63e93fb8 100644 ---- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java -+++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java -@@ -23,7 +23,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab - private boolean cancelled; - private final Player enchanter; - -- public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @NotNull final EnchantmentOffer[] offers, final int bonus) { -+ public PrepareItemEnchantEvent(@NotNull final Player enchanter, @NotNull InventoryView view, @NotNull final Block table, @NotNull final ItemStack item, @org.jetbrains.annotations.Nullable final EnchantmentOffer @NotNull [] offers, final int bonus) { // Paper - offers can contain null values - super(view); - this.enchanter = enchanter; - this.table = table; -@@ -86,8 +86,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab - * - * @return list of available enchantment offers - */ -- @NotNull -- public EnchantmentOffer[] getOffers() { -+ public @org.jetbrains.annotations.Nullable EnchantmentOffer @NotNull [] getOffers() { // Paper offers can contain null values - return offers; - } - -diff --git a/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java -index 090ec6f96ca9b7f760389994da988c44c32b9976..e6b4d4c1722bf4a11744a421d09646b22745b138 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityTargetLivingEntityEvent.java -@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable; - * LivingEntity's. - */ - public class EntityTargetLivingEntityEvent extends EntityTargetEvent { -- public EntityTargetLivingEntityEvent(@NotNull final Entity entity, @Nullable final LivingEntity target, @Nullable final TargetReason reason) { -+ public EntityTargetLivingEntityEvent(@NotNull final Entity entity, @Nullable final LivingEntity target, @NotNull final TargetReason reason) { // Paper - super(entity, target, reason); - } - -diff --git a/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java b/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java -index e1123295b9511a2c610a1baf7195638f7f3e64c4..273ae8e5da0a858d3b82d1b0f5992318ff49f145 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityToggleSwimEvent.java -@@ -24,6 +24,14 @@ public class EntityToggleSwimEvent extends EntityEvent implements Cancellable { - return cancel; - } - -+ /** -+ * @deprecated This does nothing, the server and the client doesn't work -+ * correctly when the server try to bypass this. A current workaround -+ * exists. If you want to cancel the switch from the ground state to the -+ * swimming state you need to disable the sprinting flag for the player after -+ * the cancel action. -+ */ -+ @Deprecated // Paper - @Override - public void setCancelled(boolean cancel) { - this.cancel = cancel; -diff --git a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java -index 775e3223aa5054f1883403e50c8f2241d97b1285..5d4817d2a3b709f1a1a1162309a1c923bd09cc1d 100644 ---- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java -+++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java -@@ -19,22 +19,27 @@ public class ProjectileHitEvent extends EntityEvent implements Cancellable { - private final BlockFace hitFace; - private boolean cancel = false; - -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public ProjectileHitEvent(@NotNull final Projectile projectile) { -- this(projectile, null, null); -+ this(projectile, null, null, null); // Paper - } - -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity) { -- this(projectile, hitEntity, null); -+ this(projectile, hitEntity, null, null); // Paper - } - -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Block hitBlock) { -- this(projectile, null, hitBlock); -+ this(projectile, null, hitBlock, null); // Paper - } - -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock) { - this(projectile, hitEntity, hitBlock, null); - } - -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public ProjectileHitEvent(@NotNull final Projectile projectile, @Nullable Entity hitEntity, @Nullable Block hitBlock, @Nullable BlockFace hitFace) { - super(projectile); - this.hitEntity = hitEntity; -diff --git a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -index 9353f0d09272404f42167ab8b7ad83a03620c436..f3ec8f67328b266defb31a44a36d31401d5e9371 100644 ---- a/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -+++ b/src/main/java/org/bukkit/event/entity/SpawnerSpawnEvent.java -@@ -12,12 +12,19 @@ import org.jetbrains.annotations.NotNull; - public class SpawnerSpawnEvent extends EntitySpawnEvent { - private final CreatureSpawner spawner; - -- public SpawnerSpawnEvent(@NotNull final Entity spawnee, @NotNull final CreatureSpawner spawner) { -+ public SpawnerSpawnEvent(@NotNull final Entity spawnee, @org.jetbrains.annotations.Nullable final CreatureSpawner spawner) { // Paper - super(spawnee); - this.spawner = spawner; - } - -- @NotNull -+ /** -+ * Gets the spawner tile state, or null -+ * when the entity is spawned from a minecart -+ * spawner. -+ * -+ * @return the spawner tile state -+ */ -+ @org.jetbrains.annotations.Nullable // Paper - public CreatureSpawner getSpawner() { - return spawner; - } -diff --git a/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java b/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java -index 68517811f63838bdad41073ee26be82f95042a8e..454885e47611edd707358ddfe0a01b7acf9ad5c8 100644 ---- a/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java -+++ b/src/main/java/org/bukkit/event/hanging/HangingBreakByEntityEvent.java -@@ -11,22 +11,21 @@ import org.jetbrains.annotations.Nullable; - public class HangingBreakByEntityEvent extends HangingBreakEvent { - private final Entity remover; - -- public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @Nullable final Entity remover) { -+ public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @NotNull final Entity remover) { // Paper - this(hanging, remover, HangingBreakEvent.RemoveCause.ENTITY); - } - -- public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @Nullable final Entity remover, @NotNull final HangingBreakEvent.RemoveCause cause) { -+ public HangingBreakByEntityEvent(@NotNull final Hanging hanging, @NotNull final Entity remover, @NotNull final HangingBreakEvent.RemoveCause cause) { // Paper - super(hanging, cause); - this.remover = remover; - } - - /** - * Gets the entity that removed the hanging entity. -- * May be null, for example when broken by an explosion. - * - * @return the entity that removed the hanging entity - */ -- @Nullable -+ @NotNull // Paper - public Entity getRemover() { - return remover; - } -diff --git a/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java b/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java -index 80a0a4ad813d6453b30273d25942e6612bb05c1b..18bb808e73c7a78f367ccdb44d5fe12bc54672cb 100644 ---- a/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/HopperInventorySearchEvent.java -@@ -34,7 +34,7 @@ public class HopperInventorySearchEvent extends BlockEvent { - DESTINATION; - } - -- public HopperInventorySearchEvent(@NotNull Inventory inventory, @NotNull ContainerType containerType, @NotNull Block hopper, @NotNull Block searchBlock) { -+ public HopperInventorySearchEvent(@Nullable Inventory inventory, @NotNull ContainerType containerType, @NotNull Block hopper, @NotNull Block searchBlock) { // Paper - super(hopper); - this.inventory = inventory; - this.containerType = containerType; -diff --git a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -index f2a2a2ad9930499c5bf624e73571a3294a90db14..c8540a42ab44647fdd112ce4f731f3dc0df552f4 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryClickEvent.java -@@ -88,7 +88,7 @@ public class InventoryClickEvent extends InventoryInteractEvent { - * - * @return the cursor ItemStack - */ -- @Nullable -+ @NotNull // Paper - fix nullability - public ItemStack getCursor() { - return getView().getCursor(); - } -diff --git a/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java -index 1cb70b5c8776863f44f1c4cdde152c35cb51edb5..f09b378508fcc6299e7cb40f174028f6f88ba067 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerBedLeaveEvent.java -@@ -43,7 +43,10 @@ public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable { - * {@link Player#setBedSpawnLocation(Location)}. - * - * @return true if the spawn location will be changed -+ * @deprecated the respawn point is now set when the player enter the bed and -+ * this option doesn't work since MC 1.15. - */ -+ @Deprecated(forRemoval = true) // Paper - Unused - public boolean shouldSetSpawnLocation() { - return setBedSpawn; - } -@@ -59,7 +62,10 @@ public class PlayerBedLeaveEvent extends PlayerEvent implements Cancellable { - * {@link Player#setBedSpawnLocation(Location)}. - * - * @param setBedSpawn true to change the new spawn location -+ * @deprecated the respawn point is now set when the player enter the bed and -+ * this option doesn't work since MC 1.15. - */ -+ @Deprecated(forRemoval = true) // Paper - Unused - public void setSpawnLocation(boolean setBedSpawn) { - this.setBedSpawn = setBedSpawn; - } -diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java -index 1b2267f4e8ebded198773ec80e2bff2c861c7084..1a58734d919fae247eeb85dd785fd59990856505 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java -@@ -78,7 +78,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable { - * - * @return Location the player moved to - */ -- @Nullable -+ @NotNull // Paper - public Location getTo() { - return to; - } -diff --git a/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java b/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java -index cd58dd7de781823804701fc023706e805c0142a8..1b8bb5241efcf4a90fd098f2000f8394072dca4a 100644 ---- a/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java -+++ b/src/main/java/org/bukkit/event/raid/RaidSpawnWaveEvent.java -@@ -19,7 +19,7 @@ public class RaidSpawnWaveEvent extends RaidEvent { - private final List raiders; - private final Raider leader; - -- public RaidSpawnWaveEvent(@NotNull Raid raid, @NotNull World world, @Nullable Raider leader, @NotNull List raiders) { -+ public RaidSpawnWaveEvent(@NotNull Raid raid, @NotNull World world, @NotNull Raider leader, @NotNull List raiders) { // Paper - super(raid, world); - this.raiders = raiders; - this.leader = leader; -@@ -30,7 +30,7 @@ public class RaidSpawnWaveEvent extends RaidEvent { - * - * @return {@link Raider} - */ -- @Nullable -+ @NotNull // Paper - public Raider getPatrolLeader() { - return leader; - } -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java -index 6bafc62e2235a6b783cbf96f4dabeeaf02bd5178..50c762d777ac90a05772501a28cacff8fd3f5126 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java -@@ -36,18 +36,22 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement - this.cancelled = cancel; - } - -+ @Deprecated(forRemoval = true) // Paper - Unused - public boolean isPickupCancelled() { - return cancelledPickup; - } - -+ @Deprecated(forRemoval = true) // Paper - Unused - public void setPickupCancelled(boolean cancel) { - cancelledPickup = cancel; - } - -+ @Deprecated(forRemoval = true) // Paper - Unused - public boolean isCollisionCancelled() { - return cancelledCollision; - } - -+ @Deprecated(forRemoval = true) // Paper - Unused - public void setCollisionCancelled(boolean cancel) { - cancelledCollision = cancel; - } -diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java -index c0b749a5bbf4980d01fed74768bb61909b579cb9..7e7a53b41013f1bf8956c0e278820f18d77b2f0d 100644 ---- a/src/main/java/org/bukkit/generator/ChunkGenerator.java -+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java -@@ -656,7 +656,9 @@ public abstract class ChunkGenerator { - * @param y the y location in the chunk from minHeight (inclusive) - maxHeight (exclusive) - * @param z the z location in the chunk from 0-15 inclusive - * @param material the type to set the block to -+ * @deprecated use {@link #setBlock(int, int, int, BlockData)} - */ -+ @Deprecated // Paper - public void setBlock(int x, int y, int z, @NotNull MaterialData material); - - /** -@@ -700,7 +702,9 @@ public abstract class ChunkGenerator { - * @param yMax maximum y location (exclusive) in the chunk to set - * @param zMax maximum z location (exclusive) in the chunk to set - * @param material the type to set the blocks to -+ * @deprecated use {@link #setRegion(int, int, int, int, int, int, BlockData)} - */ -+ @Deprecated // Paper - public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull MaterialData material); - - /** -@@ -741,8 +745,10 @@ public abstract class ChunkGenerator { - * @param y the y location in the chunk from minHeight (inclusive) - maxHeight (exclusive) - * @param z the z location in the chunk from 0-15 inclusive - * @return the type and data of the block or the MaterialData for air if x, y or z are outside the chunk's bounds -+ * @deprecated use {@link #getBlockData(int, int, int)} - */ - @NotNull -+ @Deprecated // Paper - public MaterialData getTypeAndData(int x, int y, int z); - - /** -diff --git a/src/main/java/org/bukkit/inventory/CookingRecipe.java b/src/main/java/org/bukkit/inventory/CookingRecipe.java -index 571652ba8843a9493f1843523e24145baa958637..f7fa79393aef40027446b78bac8e9490cfafd8bc 100644 ---- a/src/main/java/org/bukkit/inventory/CookingRecipe.java -+++ b/src/main/java/org/bukkit/inventory/CookingRecipe.java -@@ -68,7 +68,9 @@ public abstract class CookingRecipe implements Recipe, - * Get the input material. - * - * @return The input material. -+ * @deprecated Use {@link #getInputChoice()} instead for more complete data. - */ -+ @Deprecated // Paper - @NotNull - public ItemStack getInput() { - return this.ingredient.getItemStack(); -diff --git a/src/main/java/org/bukkit/inventory/CraftingInventory.java b/src/main/java/org/bukkit/inventory/CraftingInventory.java -index df81bac9ecff697f98941e5c8490e10391e90090..a32977ba3ba60a1c9aee6e469d5d6cd1887c55a2 100644 ---- a/src/main/java/org/bukkit/inventory/CraftingInventory.java -+++ b/src/main/java/org/bukkit/inventory/CraftingInventory.java -@@ -21,8 +21,7 @@ public interface CraftingInventory extends Inventory { - * - * @return The contents. Individual entries may be null. - */ -- @NotNull -- ItemStack[] getMatrix(); -+ @Nullable ItemStack @NotNull [] getMatrix(); // Paper - make array elements nullable instead array - - /** - * Set the item in the result slot of the crafting inventory. -@@ -38,7 +37,7 @@ public interface CraftingInventory extends Inventory { - * @throws IllegalArgumentException if the length of contents is greater - * than the size of the crafting matrix. - */ -- void setMatrix(@NotNull ItemStack[] contents); -+ void setMatrix(@Nullable ItemStack @NotNull [] contents); // Paper - make array elements nullable instead array - - /** - * Get the current recipe formed on the crafting inventory, if any. -diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java -index 2dde946443fee1f6e79b882cbcb448549dc0c99c..127302aa7c22f59438de66fffa0b03ae84a2a8ad 100644 ---- a/src/main/java/org/bukkit/inventory/EntityEquipment.java -+++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java -@@ -525,6 +525,6 @@ public interface EntityEquipment { - * - * @return the entity this EntityEquipment belongs to - */ -- @Nullable -+ @NotNull // Paper - Entity getHolder(); - } -diff --git a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java -index 1d442dc16cbb0fed21714d47007f3f11e30c57d4..af8f7b88edf0fa790edcf16356a030c4834f531e 100644 ---- a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java -+++ b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java -@@ -67,8 +67,10 @@ public class FurnaceRecipe extends CookingRecipe { - * - * @param input The input material. - * @return The changed recipe, so you can chain calls. -+ * @deprecated use {@link #setInputChoice(RecipeChoice)} - */ - @NotNull -+ @Deprecated - public FurnaceRecipe setInput(@NotNull MaterialData input) { - return setInput(input.getItemType(), input.getData()); - } -diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java -index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ecd93dcd54 100644 ---- a/src/main/java/org/bukkit/inventory/Inventory.java -+++ b/src/main/java/org/bukkit/inventory/Inventory.java -@@ -161,8 +161,7 @@ public interface Inventory extends Iterable { - * - * @return An array of ItemStacks from the inventory. Individual items may be null. - */ -- @NotNull -- public ItemStack[] getContents(); -+ public @Nullable ItemStack @NotNull [] getContents(); // Paper - make array elements nullable instead array - - /** - * Completely replaces the inventory's contents. Removes all existing -@@ -173,7 +172,7 @@ public interface Inventory extends Iterable { - * @throws IllegalArgumentException If the array has more items than the - * inventory. - */ -- public void setContents(@NotNull ItemStack[] items) throws IllegalArgumentException; -+ public void setContents(@Nullable ItemStack @NotNull [] items) throws IllegalArgumentException; // Paper - make array elements nullable instead array - - /** - * Return the contents from the section of the inventory where items can -@@ -186,8 +185,7 @@ public interface Inventory extends Iterable { - * - * @return inventory storage contents. Individual items may be null. - */ -- @NotNull -- public ItemStack[] getStorageContents(); -+ public @Nullable ItemStack @NotNull [] getStorageContents(); // Paper - make array elements nullable instead array - - /** - * Put the given ItemStacks into the storage slots -@@ -196,7 +194,7 @@ public interface Inventory extends Iterable { - * @throws IllegalArgumentException If the array has more items than the - * inventory. - */ -- public void setStorageContents(@NotNull ItemStack[] items) throws IllegalArgumentException; -+ public void setStorageContents(@Nullable ItemStack @NotNull [] items) throws IllegalArgumentException; // Paper - make array elements nullable instead array - - /** - * Checks if the inventory contains any ItemStacks with the given -diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java -index 002acfbdce1db10f7ba1b6a013e678f504ac6e69..8d14426eb1ebea27058d5f22ea652f22d00fccb9 100644 ---- a/src/main/java/org/bukkit/inventory/InventoryView.java -+++ b/src/main/java/org/bukkit/inventory/InventoryView.java -@@ -126,9 +126,9 @@ public abstract class InventoryView { - * Gets the id of this view. - * - * @return the id of this view -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public int getId() { - return id; - } -@@ -210,10 +210,10 @@ public abstract class InventoryView { - /** - * Get the item on the cursor of one of the viewing players. - * -- * @return The item on the player's cursor, or null if they aren't holding -- * one. -+ * @return The item on the player's cursor, or an empty stack -+ * if they aren't holding one. - */ -- @Nullable -+ @NotNull // Paper - fix nullability - public final ItemStack getCursor() { - return getPlayer().getItemOnCursor(); - } -diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index 898c256140cc7fee2c0cc65cca33a0e86275f115..e34c89a945a0f12cdc4be8cc232c8de986474372 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFactory.java -+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -30,7 +30,7 @@ public interface ItemFactory { - * @return a new ItemMeta that could be applied to an item stack of the - * specified material - */ -- @Nullable -+ @org.bukkit.UndefinedNullability // Paper - ItemMeta getItemMeta(@NotNull final Material material); - - /** -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index e388239d6d960af2102111d2ae90b2a655b2a94a..276cfd52817115981fe7dc46363278f8b8c5aee3 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -8,6 +8,7 @@ import java.util.Map; - import org.bukkit.Bukkit; - import org.bukkit.Material; - import org.bukkit.Translatable; -+import org.bukkit.UndefinedNullability; - import org.bukkit.Utility; - import org.bukkit.configuration.serialization.ConfigurationSerializable; - import org.bukkit.enchantments.Enchantment; -@@ -170,8 +171,10 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - * Gets the MaterialData for this stack of items - * - * @return MaterialData for this item -+ * @deprecated cast to {@link org.bukkit.inventory.meta.BlockDataMeta} and use {@link org.bukkit.inventory.meta.BlockDataMeta#getBlockData(Material)} - */ - @Nullable -+ @Deprecated // Paper - public MaterialData getData() { - Material mat = Bukkit.getUnsafe().toLegacy(getType()); - if (data == null && mat != null && mat.getData() != null) { -@@ -185,7 +188,9 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - * Sets the MaterialData for this stack of items - * - * @param data New MaterialData for this item -+ * @deprecated cast to {@link org.bukkit.inventory.meta.BlockDataMeta} and use {@link org.bukkit.inventory.meta.BlockDataMeta#setBlockData(org.bukkit.block.data.BlockData)} - */ -+ @Deprecated // Paper - public void setData(@Nullable MaterialData data) { - if (data == null) { - this.data = data; -@@ -561,7 +566,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - * - * @return a copy of the current ItemStack's ItemData - */ -- @Nullable -+ @UndefinedNullability // Paper - public ItemMeta getItemMeta() { - return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone(); - } -diff --git a/src/main/java/org/bukkit/inventory/PlayerInventory.java b/src/main/java/org/bukkit/inventory/PlayerInventory.java -index 476fe14faa39f02444cab8ad95d4401033dc6938..2c54660dc1fbc7c1232096797a23cae1262888e9 100644 ---- a/src/main/java/org/bukkit/inventory/PlayerInventory.java -+++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java -@@ -16,8 +16,7 @@ public interface PlayerInventory extends Inventory { - * null and are returned in a fixed order starting from the boots and going - * up to the helmet - */ -- @NotNull -- public ItemStack[] getArmorContents(); -+ public @Nullable ItemStack @NotNull [] getArmorContents(); // Paper - make array elements nullable instead array - - /** - * Get all additional ItemStacks stored in this inventory. -@@ -28,8 +27,7 @@ public interface PlayerInventory extends Inventory { - * - * @return All additional ItemStacks. Individual items can be null. - */ -- @NotNull -- public ItemStack[] getExtraContents(); -+ public @Nullable ItemStack @NotNull [] getExtraContents(); // Paper - make array elements nullable instead array - - /** - * Return the ItemStack from the helmet slot -@@ -106,9 +104,9 @@ public interface PlayerInventory extends Inventory { - * - * @param slot the slot to get the ItemStack - * -- * @return the ItemStack in the given slot or null if there is not one -+ * @return the ItemStack in the given slot - */ -- @Nullable -+ @NotNull // Paper - public ItemStack getItem(@NotNull EquipmentSlot slot); - - /** -diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java -index 97d5d9c6347bc401e3f4ab7c0ba1391ad5b0449a..da878c6d4928ddbc16b50ace86d992685a2b7873 100644 ---- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java -+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java -@@ -100,8 +100,10 @@ public class ShapedRecipe extends CraftingRecipe { - * @param ingredient The ingredient. - * @return The changed recipe, so you can chain calls. - * @throws IllegalArgumentException if the {@code key} does not appear in the shape. -+ * @deprecated use {@link #setIngredient(char, RecipeChoice)} - */ - @NotNull -+ @Deprecated // Paper - public ShapedRecipe setIngredient(char key, @NotNull MaterialData ingredient) { - return setIngredient(key, ingredient.getItemType(), ingredient.getData()); - } -@@ -179,7 +181,9 @@ public class ShapedRecipe extends CraftingRecipe { - * Get a copy of the ingredients map. - * - * @return The mapping of character to ingredients. -+ * @deprecated Use {@link #getChoiceMap()} instead for more complete data. - */ -+ @Deprecated // Paper - @NotNull - public Map getIngredientMap() { - HashMap result = new HashMap(); -diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -index b8ac602cd2718d615ec243ce648951a1a46c26ec..beb798482479c58a8628c314b510ab6349576ce8 100644 ---- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java -@@ -43,8 +43,10 @@ public class ShapelessRecipe extends CraftingRecipe { - * - * @param ingredient The ingredient to add. - * @return The changed recipe, so you can chain calls. -+ * @deprecated use {@link #addIngredient(RecipeChoice)} - */ - @NotNull -+ @Deprecated - public ShapelessRecipe addIngredient(@NotNull MaterialData ingredient) { - return addIngredient(1, ingredient); - } -@@ -80,8 +82,10 @@ public class ShapelessRecipe extends CraftingRecipe { - * @param count How many to add (can't be more than 9!) - * @param ingredient The ingredient to add. - * @return The changed recipe, so you can chain calls. -+ * @deprecated use {@link #addIngredient(int, Material)} - */ - @NotNull -+ @Deprecated // Paper - public ShapelessRecipe addIngredient(int count, @NotNull MaterialData ingredient) { - return addIngredient(count, ingredient.getItemType(), ingredient.getData()); - } -@@ -198,8 +202,10 @@ public class ShapelessRecipe extends CraftingRecipe { - * - * @param ingredient The ingredient to remove - * @return The changed recipe. -+ * @deprecated use {@link #removeIngredient(Material)} - */ - @NotNull -+ @Deprecated // Paper - public ShapelessRecipe removeIngredient(@NotNull MaterialData ingredient) { - return removeIngredient(ingredient.getItemType(), ingredient.getData()); - } -@@ -226,8 +232,10 @@ public class ShapelessRecipe extends CraftingRecipe { - * @param count The number of copies to remove. - * @param ingredient The ingredient to remove. - * @return The changed recipe. -+ * @deprecated use {@link #removeIngredient(int, Material)} - */ - @NotNull -+ @Deprecated // Paper - public ShapelessRecipe removeIngredient(int count, @NotNull MaterialData ingredient) { - return removeIngredient(count, ingredient.getItemType(), ingredient.getData()); - } -@@ -277,7 +285,9 @@ public class ShapelessRecipe extends CraftingRecipe { - * Get the list of ingredients used for this recipe. - * - * @return The input list -+ * @deprecated Use {@link #getChoiceList()} instead for more complete data. - */ -+ @Deprecated // Paper - @NotNull - public List getIngredientList() { - ArrayList result = new ArrayList(ingredients.size()); -diff --git a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java -index 597a18a767b68b47e81454b7d44613c7178c1366..bc3440eb72127824b3961fbdae583bb61385f65e 100644 ---- a/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java -+++ b/src/main/java/org/bukkit/inventory/StonecuttingRecipe.java -@@ -57,7 +57,9 @@ public class StonecuttingRecipe implements Recipe, Keyed { - * Get the input material. - * - * @return The input material. -+ * @deprecated Use {@link #getInputChoice()} instead for more complete data. - */ -+ @Deprecated // Paper - @NotNull - public ItemStack getInput() { - return this.ingredient.getItemStack(); -diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bfbe1ff7fd 100644 ---- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -141,6 +141,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - /** - * Checks for existence of a localized name. - * -+ * @deprecated Use {@link ItemMeta#displayName()} and check if it is instanceof a {@link net.kyori.adventure.text.TranslatableComponent}. - * @return true if this has a localized name - * @deprecated meta no longer exists - */ -@@ -153,6 +154,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - * Plugins should check that hasLocalizedName() returns true - * before calling this method. - * -+ * @deprecated Use {@link ItemMeta#displayName()} and cast it to a {@link net.kyori.adventure.text.TranslatableComponent}. No longer used by the client. - * @return the localized name that is set - * @deprecated meta no longer exists - */ -@@ -163,6 +165,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - /** - * Sets the localized name. - * -+ * @deprecated Use {@link ItemMeta#displayName(Component)} with a {@link net.kyori.adventure.text.TranslatableComponent}. No longer used by the client. - * @param name the name to set - * @deprecated meta no longer exists - */ -diff --git a/src/main/java/org/bukkit/inventory/meta/MapMeta.java b/src/main/java/org/bukkit/inventory/meta/MapMeta.java -index 32055a8890425e0b819930f3059da5ea9dfca553..26a336dade83baee97d20eb39a058925659f5777 100644 ---- a/src/main/java/org/bukkit/inventory/meta/MapMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/MapMeta.java -@@ -16,13 +16,8 @@ public interface MapMeta extends ItemMeta { - * - * @return true if this has a map ID number. - * @see #hasMapView() -- * @deprecated These methods are poor API: They rely on the caller to pass -- * in an only an integer property, and have poorly defined implementation -- * behavior if that integer is not a valid map (the current implementation -- * for example will generate a new map with a different ID). The xxxMapView -- * family of methods should be used instead. - */ -- @Deprecated -+ //@Deprecated // Paper - boolean hasMapId(); - - /** -@@ -34,13 +29,8 @@ public interface MapMeta extends ItemMeta { - * - * @return the map ID that is set - * @see #getMapView() -- * @deprecated These methods are poor API: They rely on the caller to pass -- * in an only an integer property, and have poorly defined implementation -- * behavior if that integer is not a valid map (the current implementation -- * for example will generate a new map with a different ID). The xxxMapView -- * family of methods should be used instead. - */ -- @Deprecated -+ //@Deprecated // Paper - int getMapId(); - - /** -diff --git a/src/main/java/org/bukkit/map/MapCanvas.java b/src/main/java/org/bukkit/map/MapCanvas.java -index edef478786bb7456af29ca960009873095830050..e8ac449e6280827beb6d2699df75b1d52a922c9b 100644 ---- a/src/main/java/org/bukkit/map/MapCanvas.java -+++ b/src/main/java/org/bukkit/map/MapCanvas.java -@@ -95,9 +95,9 @@ public interface MapCanvas { - * @param x The x coordinate, from 0 to 127. - * @param y The y coordinate, from 0 to 127. - * @return The color. See {@link MapPalette}. -- * @deprecated Magic value, use {@link #getPixelColor(int, int)} -+ * @deprecated use {@link #getPixelColor(int, int)} - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - public byte getPixel(int x, int y); - - /** -@@ -106,9 +106,9 @@ public interface MapCanvas { - * @param x The x coordinate, from 0 to 127. - * @param y The y coordinate, from 0 to 127. - * @return The color. See {@link MapPalette}. -- * @deprecated Magic value, use {@link #getBasePixelColor(int, int)} -+ * @deprecated use {@link #getBasePixelColor(int, int)} - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - public byte getBasePixel(int x, int y); - - /** -diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java -index f973f0f3925819765412f6f134e553d7d74f1467..1afa33ca0d900d9301d52ace3ddb0bd50b5ce4e8 100644 ---- a/src/main/java/org/bukkit/map/MapCursor.java -+++ b/src/main/java/org/bukkit/map/MapCursor.java -@@ -158,9 +158,9 @@ public final class MapCursor { - * Get the type of this cursor. - * - * @return The type (color/style) of the map cursor. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getRawType() { - return type; - } -@@ -217,9 +217,9 @@ public final class MapCursor { - * Set the type of this cursor. - * - * @param type The type (color/style) of the map cursor. -- * @deprecated Magic value -+ * @deprecated use {@link #setType(Type)} - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - public void setRawType(byte type) { - if (type < 0 || type > 26) { - throw new IllegalArgumentException("Type must be in the range 0-26"); -@@ -339,9 +339,9 @@ public final class MapCursor { - * Gets the internal value of the cursor. - * - * @return the value -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getValue() { - return value; - } -@@ -351,9 +351,9 @@ public final class MapCursor { - * - * @param value the value - * @return the matching type -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Type byValue(byte value) { - for (Type t : values()) { -diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java -index 3a9aaca2e76411a9c27f9f5e0f22d060d5a66d06..c80faa079eca1564847070f0338fc98024639829 100644 ---- a/src/main/java/org/bukkit/map/MapPalette.java -+++ b/src/main/java/org/bukkit/map/MapPalette.java -@@ -197,9 +197,9 @@ public final class MapPalette { - * - * @param image The image to convert. - * @return A byte[] containing the pixels of the image. -- * @deprecated Magic value -+ * @deprecated use color-related methods - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - @NotNull - public static byte[] imageToBytes(@NotNull Image image) { - BufferedImage temp = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); -@@ -225,9 +225,9 @@ public final class MapPalette { - * @param b The blue component of the color. - * @param g The green component of the color. - * @return The index in the palette. -- * @deprecated Magic value -+ * @deprecated use color-related methods - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - public static byte matchColor(int r, int g, int b) { - return matchColor(new Color(r, g, b)); - } -@@ -238,9 +238,9 @@ public final class MapPalette { - * - * @param color The Color to match. - * @return The index in the palette. -- * @deprecated Magic value -+ * @deprecated use color-related methods - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - public static byte matchColor(@NotNull Color color) { - if (color.getAlpha() < 128) return 0; - -@@ -268,9 +268,9 @@ public final class MapPalette { - * - * @param index The index in the palette. - * @return The Color of the palette entry. -- * @deprecated Magic value -+ * @deprecated use color directly - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - @NotNull - public static Color getColor(byte index) { - // Minecraft has 143 colors, some of which have negative byte representations -@@ -311,9 +311,9 @@ public final class MapPalette { - * @param color The Color to match. - * @return The index in the palette. - * @throws IllegalStateException if {@link #isCached()} returns false -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - byte matchColor(@NotNull Color color); - } - } -diff --git a/src/main/java/org/bukkit/map/MapView.java b/src/main/java/org/bukkit/map/MapView.java -index 9b8b68b66dc15b06800251702c2722623c8462a0..e998c5d871e02564c24260a8205dcfafb6e703d9 100644 ---- a/src/main/java/org/bukkit/map/MapView.java -+++ b/src/main/java/org/bukkit/map/MapView.java -@@ -32,9 +32,9 @@ public interface MapView { - * - * @param value The raw scale - * @return The enum scale, or null for an invalid input -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Scale valueOf(byte value) { - switch (value) { -@@ -51,9 +51,9 @@ public interface MapView { - * Get the raw value of this scale level. - * - * @return The scale value -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getValue() { - return value; - } -diff --git a/src/main/java/org/bukkit/material/Openable.java b/src/main/java/org/bukkit/material/Openable.java -index 0ae54f973d11df74abb3105cf9226afb130b4f33..597036bad6bc61b4aa63a61b45e886dd74a0b7f6 100644 ---- a/src/main/java/org/bukkit/material/Openable.java -+++ b/src/main/java/org/bukkit/material/Openable.java -@@ -1,5 +1,6 @@ - package org.bukkit.material; - -+@Deprecated // Paper - public interface Openable { - - /** -diff --git a/src/main/java/org/bukkit/material/Redstone.java b/src/main/java/org/bukkit/material/Redstone.java -index 3e46603f8cd38041394e0e1baf788d9009b3ffc7..b15c141f1db07296bb349f11c6f39b0fbe53e7b1 100644 ---- a/src/main/java/org/bukkit/material/Redstone.java -+++ b/src/main/java/org/bukkit/material/Redstone.java -@@ -3,6 +3,7 @@ package org.bukkit.material; - /** - * Indicated a Material that may carry or create a Redstone current - */ -+@Deprecated // Paper - public interface Redstone { - - /** -diff --git a/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java b/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java -index 0ea9c6b2420a0f990bd1fdf50fc015e37a7060d8..e99644eae1c662b117aa19060d2484aca19fe0a4 100644 ---- a/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java -+++ b/src/main/java/org/bukkit/material/types/MushroomBlockTexture.java -@@ -7,7 +7,9 @@ import org.jetbrains.annotations.Nullable; - - /** - * Represents the different textured blocks of mushroom. -+ * @deprecated use BlockData - */ -+@Deprecated // Paper - public enum MushroomBlockTexture { - - /** -diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java -index 7feeb33f8938be968b20c19437723d8c968690fa..e045e6a74821f291938cc6af86e313c1f1c4626c 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffectType.java -+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java -@@ -270,9 +270,9 @@ public abstract class PotionEffectType implements Keyed, Translatable { - * Returns the unique ID of this type. - * - * @return Unique ID -- * @deprecated Magic value -+ * @deprecated use {@link #key()} - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.2") // Paper - public abstract int getId(); - - /** -@@ -308,9 +308,9 @@ public abstract class PotionEffectType implements Keyed, Translatable { - * - * @param id Unique ID to fetch - * @return Resulting type, or null if not found. -- * @deprecated Magic value -+ * @apiNote Internal Use Only - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static PotionEffectType getById(int id) { - PotionEffectType type = ID_MAP.get(id); -diff --git a/src/test/java/org/bukkit/materials/MaterialDataTest.java b/src/test/java/org/bukkit/materials/MaterialDataTest.java -index 8d78435cc42a9e668b2d4d674b79b4094c3bd1b1..24a8ce4387b897c717b55405f363ffafff45894d 100644 ---- a/src/test/java/org/bukkit/materials/MaterialDataTest.java -+++ b/src/test/java/org/bukkit/materials/MaterialDataTest.java -@@ -22,6 +22,7 @@ import org.bukkit.material.WoodenStep; - import org.bukkit.material.types.MushroomBlockTexture; - import org.junit.jupiter.api.Test; - -+@Deprecated // Paper - public class MaterialDataTest { - - @Test diff --git a/patches/api/0172-Server-Tick-Events.patch b/patches/api/0172-Server-Tick-Events.patch new file mode 100644 index 0000000000..cc46a9f29a --- /dev/null +++ b/patches/api/0172-Server-Tick-Events.patch @@ -0,0 +1,116 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 27 Mar 2019 21:58:55 -0400 +Subject: [PATCH] Server Tick Events + +Fires event at start and end of a server tick + +diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..17e9f39ce1cc7489e936c96f95b8b0579528b222 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java +@@ -0,0 +1,62 @@ ++package com.destroystokyo.paper.event.server; ++ ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when the server has finished ticking the main loop ++ */ ++public class ServerTickEndEvent extends Event { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final int tickNumber; ++ private final double tickDuration; ++ private final long timeEnd; ++ ++ @ApiStatus.Internal ++ public ServerTickEndEvent(int tickNumber, double tickDuration, long timeRemaining) { ++ this.tickNumber = tickNumber; ++ this.tickDuration = tickDuration; ++ this.timeEnd = System.nanoTime() + timeRemaining; ++ } ++ ++ /** ++ * @return What tick this was since start (first tick = 1) ++ */ ++ public int getTickNumber() { ++ return this.tickNumber; ++ } ++ ++ /** ++ * @return Time in milliseconds of how long this tick took ++ */ ++ public double getTickDuration() { ++ return this.tickDuration; ++ } ++ ++ /** ++ * Amount of nanoseconds remaining before the next tick should start. ++ *

++ * If this value is negative, then that means the server has exceeded the tick time limit and TPS has been lost. ++ *

++ * Method will continuously return the updated time remaining value. (return value is not static) ++ * ++ * @return Amount of nanoseconds remaining before the next tick should start ++ */ ++ public long getTimeRemaining() { ++ return this.timeEnd - System.nanoTime(); ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..fb5bbfffea8b883e4c8769484a2b64dd895cb617 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java +@@ -0,0 +1,35 @@ ++package com.destroystokyo.paper.event.server; ++ ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++public class ServerTickStartEvent extends Event { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final int tickNumber; ++ ++ @ApiStatus.Internal ++ public ServerTickStartEvent(int tickNumber) { ++ this.tickNumber = tickNumber; ++ } ++ ++ /** ++ * @return What tick this is going be since start (first tick = 1) ++ */ ++ public int getTickNumber() { ++ return this.tickNumber; ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0173-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0173-PlayerDeathEvent-getItemsToKeep.patch new file mode 100644 index 0000000000..cf8c6281f8 --- /dev/null +++ b/patches/api/0173-PlayerDeathEvent-getItemsToKeep.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 11 Mar 2013 20:04:34 -0400 +Subject: [PATCH] PlayerDeathEvent#getItemsToKeep + +Exposes a mutable array on items a player should keep on death + +Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 + +diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +index 38f81772edacb178e21c3f273e8c41ed46177d6d..9719e183036c361b909b203593c067a551b82264 100644 +--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +@@ -37,7 +37,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { + } + // Paper end - adventure + +- @Deprecated // Paper + public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, @Nullable final String deathMessage) { + this(player, drops, droppedExp, 0, deathMessage); + } +@@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent { + this.deathMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage); // Paper + } + ++ @Deprecated // Paper ++ // Paper start ++ private List itemsToKeep = new java.util.ArrayList<>(); ++ ++ /** ++ * A mutable collection to add items that the player should retain in their inventory on death (Similar to KeepInventory game rule) ++ * ++ * You MUST remove the item from the .getDrops() collection too or it will duplicate! ++ *

{@code
++     *    {@literal @EventHandler(ignoreCancelled = true)}
++     *     public void onPlayerDeath(PlayerDeathEvent event) {
++     *         for (Iterator iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
++     *             ItemStack drop = iterator.next();
++     *             List lore = drop.getLore();
++     *             if (lore != null && !lore.isEmpty()) {
++     *                 if (lore.get(0).contains("(SOULBOUND)")) {
++     *                     iterator.remove();
++     *                     event.getItemsToKeep().add(drop);
++     *                 }
++     *             }
++     *         }
++     *     }
++     * }
++ * ++ * Adding an item to this list that the player did not previously have will give them the item on death. ++ * An example case could be a "Note" that "You died at X/Y/Z coordinates" ++ * ++ * @return The list to hold items to keep ++ */ ++ @NotNull ++ public List getItemsToKeep() { ++ return itemsToKeep; ++ } ++ // Paper end ++ + @NotNull + @Override + public Player getEntity() { diff --git a/patches/api/0173-Server-Tick-Events.patch b/patches/api/0173-Server-Tick-Events.patch deleted file mode 100644 index cc46a9f29a..0000000000 --- a/patches/api/0173-Server-Tick-Events.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 27 Mar 2019 21:58:55 -0400 -Subject: [PATCH] Server Tick Events - -Fires event at start and end of a server tick - -diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..17e9f39ce1cc7489e936c96f95b8b0579528b222 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java -@@ -0,0 +1,62 @@ -+package com.destroystokyo.paper.event.server; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when the server has finished ticking the main loop -+ */ -+public class ServerTickEndEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int tickNumber; -+ private final double tickDuration; -+ private final long timeEnd; -+ -+ @ApiStatus.Internal -+ public ServerTickEndEvent(int tickNumber, double tickDuration, long timeRemaining) { -+ this.tickNumber = tickNumber; -+ this.tickDuration = tickDuration; -+ this.timeEnd = System.nanoTime() + timeRemaining; -+ } -+ -+ /** -+ * @return What tick this was since start (first tick = 1) -+ */ -+ public int getTickNumber() { -+ return this.tickNumber; -+ } -+ -+ /** -+ * @return Time in milliseconds of how long this tick took -+ */ -+ public double getTickDuration() { -+ return this.tickDuration; -+ } -+ -+ /** -+ * Amount of nanoseconds remaining before the next tick should start. -+ *

-+ * If this value is negative, then that means the server has exceeded the tick time limit and TPS has been lost. -+ *

-+ * Method will continuously return the updated time remaining value. (return value is not static) -+ * -+ * @return Amount of nanoseconds remaining before the next tick should start -+ */ -+ public long getTimeRemaining() { -+ return this.timeEnd - System.nanoTime(); -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..fb5bbfffea8b883e4c8769484a2b64dd895cb617 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java -@@ -0,0 +1,35 @@ -+package com.destroystokyo.paper.event.server; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+public class ServerTickStartEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int tickNumber; -+ -+ @ApiStatus.Internal -+ public ServerTickStartEvent(int tickNumber) { -+ this.tickNumber = tickNumber; -+ } -+ -+ /** -+ * @return What tick this is going be since start (first tick = 1) -+ */ -+ public int getTickNumber() { -+ return this.tickNumber; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0174-Add-Heightmap-API.patch b/patches/api/0174-Add-Heightmap-API.patch new file mode 100644 index 0000000000..9c0ab69035 --- /dev/null +++ b/patches/api/0174-Add-Heightmap-API.patch @@ -0,0 +1,195 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sat, 1 Dec 2018 19:00:36 -0800 +Subject: [PATCH] Add Heightmap API + +Changed to use upstream's heightmap API - Machine_Maker + +diff --git a/src/main/java/com/destroystokyo/paper/HeightmapType.java b/src/main/java/com/destroystokyo/paper/HeightmapType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1c832d69bb3717dcfccf21e45f6f060a64eb4f11 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/HeightmapType.java +@@ -0,0 +1,39 @@ ++package com.destroystokyo.paper; ++ ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster ++ * than using an iterative search for a block in a given x, z coordinate. ++ * ++ * @deprecated Upstream has added their own API for using the game heightmaps. See {@link org.bukkit.HeightMap} and the ++ * non-deprecated getHighestBlock methods on World such as {@link org.bukkit.World#getHighestBlockAt(org.bukkit.Location, org.bukkit.HeightMap)}. ++ */ ++@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++public enum HeightmapType { ++ ++ /** ++ * The highest block used for lighting in the world. Also the block returned by {@link org.bukkit.World#getHighestBlockYAt(int, int)}} ++ */ ++ LIGHT_BLOCKING, ++ ++ /** ++ * References the highest block in the world. ++ */ ++ ANY, ++ ++ /** ++ * References the highest solid block in a world. ++ */ ++ SOLID, ++ ++ /** ++ * References the highest solid or liquid block in a world. ++ */ ++ SOLID_OR_LIQUID, ++ ++ /** ++ * References the highest solid or liquid block in a world, excluding leaves. ++ */ ++ SOLID_OR_LIQUID_NO_LEAVES; ++} +diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java +index f0878c7539696cc0676e6010e88914d3850acf20..c6049747fc286acb4e8053901fcc517e5170afa2 100644 +--- a/src/main/java/org/bukkit/Location.java ++++ b/src/main/java/org/bukkit/Location.java +@@ -649,6 +649,46 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm + } + // Paper end - expand Location API + ++ // Paper start - Add heightmap api ++ /** ++ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ()) ++ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ()) ++ * @throws NullPointerException if {{@link #getWorld()}} is {@code null} ++ */ ++ @NotNull ++ public Location toHighestLocation() { ++ return this.toHighestLocation(HeightMap.WORLD_SURFACE); ++ } ++ ++ /** ++ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap) ++ * @param heightmap The heightmap to use for finding the highest y location. ++ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap) ++ * @throws NullPointerException if {{@link #getWorld()}} is {@code null} ++ * @throws UnsupportedOperationException if {@link World#getHighestBlockYAt(int, int, com.destroystokyo.paper.HeightmapType)} does not support the specified heightmap ++ * @deprecated Use {@link org.bukkit.Location#toHighestLocation(HeightMap)} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) { ++ final Location ret = this.clone(); ++ ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap)); ++ return ret; ++ } ++ ++ /** ++ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap) ++ * @param heightMap The heightmap to use for finding the highest y location. ++ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap) ++ */ ++ @NotNull ++ public Location toHighestLocation(@NotNull final HeightMap heightMap) { ++ final Location ret = this.clone(); ++ ret.setY(this.getWorld().getHighestBlockYAt(this, heightMap)); ++ return ret; ++ } ++ // Paper end - Add heightmap api ++ + // Paper start - Expand Explosions API + /** + * Creates explosion at this location with given power +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index a523d1725f175c924ab1a7d544d389ec81b68bcf..77314fdbd99a5cc34e7a1df4692ba8a1685ef002 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -153,6 +153,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @NotNull + public Block getHighestBlockAt(@NotNull Location location); + ++ // Paper start - Add heightmap API ++ /** ++ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

++ * ++ * @param x The block's x-coordinate. ++ * @param z The block's z-coordinate. ++ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} ++ * @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions. ++ * @throws UnsupportedOperationException If the heightmap type is not supported. ++ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(int, int, HeightMap)} ++ * ++ * @see com.destroystokyo.paper.HeightmapType ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException; ++ ++ /** ++ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. ++ * Note that the y-coordinate of the specified location is ignored. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

++ * ++ * @param location The specified block coordinates. ++ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} ++ * @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions. ++ * @throws UnsupportedOperationException If the heightmap type is not supported. ++ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(Location, HeightMap)} ++ * @see com.destroystokyo.paper.HeightmapType ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { ++ return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap); ++ } ++ ++ /** ++ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

++ * @param x The block's x-coordinate. ++ * @param z The block's z-coordinate. ++ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} ++ * @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions. ++ * @throws UnsupportedOperationException If the heightmap type is not supported. ++ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(int, int, HeightMap)} ++ * @see com.destroystokyo.paper.HeightmapType ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ @NotNull ++ default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { ++ return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z); ++ } ++ ++ /** ++ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions. ++ * Note that the y-coordinate of the specified location is ignored. ++ *

++ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to ++ * throwing an {@code UnsupportedOperationException}. ++ *

++ * @param location The specified block coordinates. ++ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} ++ * @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions. ++ * @throws UnsupportedOperationException If the heightmap type is not supported. ++ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(Location, HeightMap)} ++ * @see com.destroystokyo.paper.HeightmapType ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ @NotNull ++ default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { ++ return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap); ++ } ++ // Paper end ++ + /** + * Gets the highest block corresponding to the {@link HeightMap} at the + * given coordinates. diff --git a/patches/api/0174-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0174-PlayerDeathEvent-getItemsToKeep.patch deleted file mode 100644 index cf8c6281f8..0000000000 --- a/patches/api/0174-PlayerDeathEvent-getItemsToKeep.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 11 Mar 2013 20:04:34 -0400 -Subject: [PATCH] PlayerDeathEvent#getItemsToKeep - -Exposes a mutable array on items a player should keep on death - -Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 - -diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 38f81772edacb178e21c3f273e8c41ed46177d6d..9719e183036c361b909b203593c067a551b82264 100644 ---- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -@@ -37,7 +37,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { - } - // Paper end - adventure - -- @Deprecated // Paper - public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, @Nullable final String deathMessage) { - this(player, drops, droppedExp, 0, deathMessage); - } -@@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent { - this.deathMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage); // Paper - } - -+ @Deprecated // Paper -+ // Paper start -+ private List itemsToKeep = new java.util.ArrayList<>(); -+ -+ /** -+ * A mutable collection to add items that the player should retain in their inventory on death (Similar to KeepInventory game rule) -+ * -+ * You MUST remove the item from the .getDrops() collection too or it will duplicate! -+ *
{@code
-+     *    {@literal @EventHandler(ignoreCancelled = true)}
-+     *     public void onPlayerDeath(PlayerDeathEvent event) {
-+     *         for (Iterator iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
-+     *             ItemStack drop = iterator.next();
-+     *             List lore = drop.getLore();
-+     *             if (lore != null && !lore.isEmpty()) {
-+     *                 if (lore.get(0).contains("(SOULBOUND)")) {
-+     *                     iterator.remove();
-+     *                     event.getItemsToKeep().add(drop);
-+     *                 }
-+     *             }
-+     *         }
-+     *     }
-+     * }
-+ * -+ * Adding an item to this list that the player did not previously have will give them the item on death. -+ * An example case could be a "Note" that "You died at X/Y/Z coordinates" -+ * -+ * @return The list to hold items to keep -+ */ -+ @NotNull -+ public List getItemsToKeep() { -+ return itemsToKeep; -+ } -+ // Paper end -+ - @NotNull - @Override - public Player getEntity() { diff --git a/patches/api/0175-Add-Heightmap-API.patch b/patches/api/0175-Add-Heightmap-API.patch deleted file mode 100644 index 9c0ab69035..0000000000 --- a/patches/api/0175-Add-Heightmap-API.patch +++ /dev/null @@ -1,195 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sat, 1 Dec 2018 19:00:36 -0800 -Subject: [PATCH] Add Heightmap API - -Changed to use upstream's heightmap API - Machine_Maker - -diff --git a/src/main/java/com/destroystokyo/paper/HeightmapType.java b/src/main/java/com/destroystokyo/paper/HeightmapType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..1c832d69bb3717dcfccf21e45f6f060a64eb4f11 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/HeightmapType.java -@@ -0,0 +1,39 @@ -+package com.destroystokyo.paper; -+ -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster -+ * than using an iterative search for a block in a given x, z coordinate. -+ * -+ * @deprecated Upstream has added their own API for using the game heightmaps. See {@link org.bukkit.HeightMap} and the -+ * non-deprecated getHighestBlock methods on World such as {@link org.bukkit.World#getHighestBlockAt(org.bukkit.Location, org.bukkit.HeightMap)}. -+ */ -+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+public enum HeightmapType { -+ -+ /** -+ * The highest block used for lighting in the world. Also the block returned by {@link org.bukkit.World#getHighestBlockYAt(int, int)}} -+ */ -+ LIGHT_BLOCKING, -+ -+ /** -+ * References the highest block in the world. -+ */ -+ ANY, -+ -+ /** -+ * References the highest solid block in a world. -+ */ -+ SOLID, -+ -+ /** -+ * References the highest solid or liquid block in a world. -+ */ -+ SOLID_OR_LIQUID, -+ -+ /** -+ * References the highest solid or liquid block in a world, excluding leaves. -+ */ -+ SOLID_OR_LIQUID_NO_LEAVES; -+} -diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index f0878c7539696cc0676e6010e88914d3850acf20..c6049747fc286acb4e8053901fcc517e5170afa2 100644 ---- a/src/main/java/org/bukkit/Location.java -+++ b/src/main/java/org/bukkit/Location.java -@@ -649,6 +649,46 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - } - // Paper end - expand Location API - -+ // Paper start - Add heightmap api -+ /** -+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ()) -+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ()) -+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null} -+ */ -+ @NotNull -+ public Location toHighestLocation() { -+ return this.toHighestLocation(HeightMap.WORLD_SURFACE); -+ } -+ -+ /** -+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap) -+ * @param heightmap The heightmap to use for finding the highest y location. -+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap) -+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null} -+ * @throws UnsupportedOperationException if {@link World#getHighestBlockYAt(int, int, com.destroystokyo.paper.HeightmapType)} does not support the specified heightmap -+ * @deprecated Use {@link org.bukkit.Location#toHighestLocation(HeightMap)} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) { -+ final Location ret = this.clone(); -+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap)); -+ return ret; -+ } -+ -+ /** -+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap) -+ * @param heightMap The heightmap to use for finding the highest y location. -+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap) -+ */ -+ @NotNull -+ public Location toHighestLocation(@NotNull final HeightMap heightMap) { -+ final Location ret = this.clone(); -+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightMap)); -+ return ret; -+ } -+ // Paper end - Add heightmap api -+ - // Paper start - Expand Explosions API - /** - * Creates explosion at this location with given power -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index a523d1725f175c924ab1a7d544d389ec81b68bcf..77314fdbd99a5cc34e7a1df4692ba8a1685ef002 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -153,6 +153,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public Block getHighestBlockAt(@NotNull Location location); - -+ // Paper start - Add heightmap API -+ /** -+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. -+ *

-+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. -+ *

-+ * -+ * @param x The block's x-coordinate. -+ * @param z The block's z-coordinate. -+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} -+ * @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions. -+ * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(int, int, HeightMap)} -+ * -+ * @see com.destroystokyo.paper.HeightmapType -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException; -+ -+ /** -+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions. -+ * Note that the y-coordinate of the specified location is ignored. -+ *

-+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. -+ *

-+ * -+ * @param location The specified block coordinates. -+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} -+ * @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions. -+ * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(Location, HeightMap)} -+ * @see com.destroystokyo.paper.HeightmapType -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { -+ return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap); -+ } -+ -+ /** -+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions. -+ *

-+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. -+ *

-+ * @param x The block's x-coordinate. -+ * @param z The block's z-coordinate. -+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} -+ * @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions. -+ * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(int, int, HeightMap)} -+ * @see com.destroystokyo.paper.HeightmapType -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ @NotNull -+ default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { -+ return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z); -+ } -+ -+ /** -+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions. -+ * Note that the y-coordinate of the specified location is ignored. -+ *

-+ * implNote: Implementations are recommended to use an iterative search as a fallback before resorting to -+ * throwing an {@code UnsupportedOperationException}. -+ *

-+ * @param location The specified block coordinates. -+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType} -+ * @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions. -+ * @throws UnsupportedOperationException If the heightmap type is not supported. -+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(Location, HeightMap)} -+ * @see com.destroystokyo.paper.HeightmapType -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ @NotNull -+ default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException { -+ return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap); -+ } -+ // Paper end -+ - /** - * Gets the highest block corresponding to the {@link HeightMap} at the - * given coordinates. diff --git a/patches/api/0175-Mob-Spawner-API-Enhancements.patch b/patches/api/0175-Mob-Spawner-API-Enhancements.patch new file mode 100644 index 0000000000..4607e8b4bf --- /dev/null +++ b/patches/api/0175-Mob-Spawner-API-Enhancements.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Fri, 19 Apr 2019 12:41:19 -0500 +Subject: [PATCH] Mob Spawner API Enhancements + + +diff --git a/src/main/java/org/bukkit/block/CreatureSpawner.java b/src/main/java/org/bukkit/block/CreatureSpawner.java +index c33f6573a9cb0a1516539a1947760a093aa08051..1896adcb15479eb8f26fe7185e4755ca7271a75a 100644 +--- a/src/main/java/org/bukkit/block/CreatureSpawner.java ++++ b/src/main/java/org/bukkit/block/CreatureSpawner.java +@@ -277,4 +277,30 @@ public interface CreatureSpawner extends TileState { + */ + @NotNull + public List getPotentialSpawns(); ++ ++ // Paper start ++ /** ++ * Check if spawner is activated (a player is close enough) ++ * ++ * @return True if a player is close enough to activate it ++ */ ++ public boolean isActivated(); ++ ++ /** ++ * Resets the spawn delay timer within the min/max range ++ */ ++ public void resetTimer(); ++ ++ /** ++ * Sets the {@link EntityType} to {@link EntityType#ITEM} and sets the data to the given ++ * {@link org.bukkit.inventory.ItemStack ItemStack}. ++ *

++ * {@link #setSpawnCount(int)} does not dictate the amount of items in the stack spawned, but rather how many ++ * stacks should be spawned. ++ * ++ * @param itemStack The item to spawn. Must not {@link org.bukkit.Material#isAir be air}. ++ * @see #setSpawnedType(EntityType) ++ */ ++ void setSpawnedItem(org.bukkit.inventory.@org.jetbrains.annotations.NotNull ItemStack itemStack); ++ // Paper end + } diff --git a/patches/api/0176-Add-BlockSoundGroup-interface.patch b/patches/api/0176-Add-BlockSoundGroup-interface.patch new file mode 100644 index 0000000000..91f609d1e3 --- /dev/null +++ b/patches/api/0176-Add-BlockSoundGroup-interface.patch @@ -0,0 +1,107 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: simpleauthority +Date: Tue, 28 May 2019 03:41:28 -0700 +Subject: [PATCH] Add BlockSoundGroup interface + +This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup + +diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ec36942128cbacae171584c89480b4aae3ae3e2f +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java +@@ -0,0 +1,64 @@ ++package com.destroystokyo.paper.block; ++ ++import org.bukkit.Sound; ++import org.bukkit.block.Block; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents the sounds that a {@link Block} makes in certain situations ++ *

++ * The sound group includes break, step, place, hit, and fall sounds. ++ * @deprecated use {@link org.bukkit.SoundGroup} ++ */ ++@Deprecated(forRemoval = true) ++public interface BlockSoundGroup { ++ /** ++ * Gets the sound that plays when breaking this block ++ * ++ * @return The break sound ++ * @deprecated use {@link org.bukkit.SoundGroup#getBreakSound()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ Sound getBreakSound(); ++ ++ /** ++ * Gets the sound that plays when stepping on this block ++ * ++ * @return The step sound ++ * @deprecated use {@link org.bukkit.SoundGroup#getStepSound()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ Sound getStepSound(); ++ ++ /** ++ * Gets the sound that plays when placing this block ++ * ++ * @return The place sound ++ * @deprecated use {@link org.bukkit.SoundGroup#getPlaceSound()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ Sound getPlaceSound(); ++ ++ /** ++ * Gets the sound that plays when hitting this block ++ * ++ * @return The hit sound ++ * @deprecated use {@link org.bukkit.SoundGroup#getHitSound()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ Sound getHitSound(); ++ ++ /** ++ * Gets the sound that plays when this block falls ++ * ++ * @return The fall sound ++ * @deprecated use {@link org.bukkit.SoundGroup#getFallSound()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ Sound getFallSound(); ++} +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index c7ef0386a09a07a2317c56274ed41218dfd7153d..f468e9751f75fd355512e033c180de967de5b2d8 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -616,4 +616,25 @@ public interface Block extends Metadatable, Translatable { + * @return true if the block data can be placed here + */ + boolean canPlace(@NotNull BlockData data); ++ ++ // Paper start ++ /** ++ * Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block. ++ *

++ * This object contains the block, step, place, hit, and fall sounds. ++ * ++ * @return the sound group for this block ++ * @deprecated use {@link #getBlockSoundGroup()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup(); ++ ++ /** ++ * Gets the {@link org.bukkit.SoundGroup} for this block. ++ * ++ * @return the sound group for this block ++ */ ++ @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); ++ // Paper end + } diff --git a/patches/api/0176-Mob-Spawner-API-Enhancements.patch b/patches/api/0176-Mob-Spawner-API-Enhancements.patch deleted file mode 100644 index 4607e8b4bf..0000000000 --- a/patches/api/0176-Mob-Spawner-API-Enhancements.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Fri, 19 Apr 2019 12:41:19 -0500 -Subject: [PATCH] Mob Spawner API Enhancements - - -diff --git a/src/main/java/org/bukkit/block/CreatureSpawner.java b/src/main/java/org/bukkit/block/CreatureSpawner.java -index c33f6573a9cb0a1516539a1947760a093aa08051..1896adcb15479eb8f26fe7185e4755ca7271a75a 100644 ---- a/src/main/java/org/bukkit/block/CreatureSpawner.java -+++ b/src/main/java/org/bukkit/block/CreatureSpawner.java -@@ -277,4 +277,30 @@ public interface CreatureSpawner extends TileState { - */ - @NotNull - public List getPotentialSpawns(); -+ -+ // Paper start -+ /** -+ * Check if spawner is activated (a player is close enough) -+ * -+ * @return True if a player is close enough to activate it -+ */ -+ public boolean isActivated(); -+ -+ /** -+ * Resets the spawn delay timer within the min/max range -+ */ -+ public void resetTimer(); -+ -+ /** -+ * Sets the {@link EntityType} to {@link EntityType#ITEM} and sets the data to the given -+ * {@link org.bukkit.inventory.ItemStack ItemStack}. -+ *

-+ * {@link #setSpawnCount(int)} does not dictate the amount of items in the stack spawned, but rather how many -+ * stacks should be spawned. -+ * -+ * @param itemStack The item to spawn. Must not {@link org.bukkit.Material#isAir be air}. -+ * @see #setSpawnedType(EntityType) -+ */ -+ void setSpawnedItem(org.bukkit.inventory.@org.jetbrains.annotations.NotNull ItemStack itemStack); -+ // Paper end - } diff --git a/patches/api/0177-Add-BlockSoundGroup-interface.patch b/patches/api/0177-Add-BlockSoundGroup-interface.patch deleted file mode 100644 index 91f609d1e3..0000000000 --- a/patches/api/0177-Add-BlockSoundGroup-interface.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: simpleauthority -Date: Tue, 28 May 2019 03:41:28 -0700 -Subject: [PATCH] Add BlockSoundGroup interface - -This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup - -diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ec36942128cbacae171584c89480b4aae3ae3e2f ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java -@@ -0,0 +1,64 @@ -+package com.destroystokyo.paper.block; -+ -+import org.bukkit.Sound; -+import org.bukkit.block.Block; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents the sounds that a {@link Block} makes in certain situations -+ *

-+ * The sound group includes break, step, place, hit, and fall sounds. -+ * @deprecated use {@link org.bukkit.SoundGroup} -+ */ -+@Deprecated(forRemoval = true) -+public interface BlockSoundGroup { -+ /** -+ * Gets the sound that plays when breaking this block -+ * -+ * @return The break sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getBreakSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ Sound getBreakSound(); -+ -+ /** -+ * Gets the sound that plays when stepping on this block -+ * -+ * @return The step sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getStepSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ Sound getStepSound(); -+ -+ /** -+ * Gets the sound that plays when placing this block -+ * -+ * @return The place sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getPlaceSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ Sound getPlaceSound(); -+ -+ /** -+ * Gets the sound that plays when hitting this block -+ * -+ * @return The hit sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getHitSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ Sound getHitSound(); -+ -+ /** -+ * Gets the sound that plays when this block falls -+ * -+ * @return The fall sound -+ * @deprecated use {@link org.bukkit.SoundGroup#getFallSound()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ Sound getFallSound(); -+} -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index c7ef0386a09a07a2317c56274ed41218dfd7153d..f468e9751f75fd355512e033c180de967de5b2d8 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -616,4 +616,25 @@ public interface Block extends Metadatable, Translatable { - * @return true if the block data can be placed here - */ - boolean canPlace(@NotNull BlockData data); -+ -+ // Paper start -+ /** -+ * Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block. -+ *

-+ * This object contains the block, step, place, hit, and fall sounds. -+ * -+ * @return the sound group for this block -+ * @deprecated use {@link #getBlockSoundGroup()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup(); -+ -+ /** -+ * Gets the {@link org.bukkit.SoundGroup} for this block. -+ * -+ * @return the sound group for this block -+ */ -+ @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); -+ // Paper end - } diff --git a/patches/api/0177-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch b/patches/api/0177-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch new file mode 100644 index 0000000000..b5148c5574 --- /dev/null +++ b/patches/api/0177-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: simpleauthority +Date: Thu, 11 Jul 2019 10:35:56 -0700 +Subject: [PATCH] Amend PlayerInteractAtEntityEvent javadoc for ArmorStands + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java +index 1075dbb8135d2fd2fd69d1e821dd1ba7f90824d5..3f24d302e28170f7f6e5885b5b9abb22cbbb7d66 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java +@@ -13,6 +13,9 @@ import org.jetbrains.annotations.NotNull; + *
+ * Note that the client may sometimes spuriously send this packet in addition to {@link PlayerInteractEntityEvent}. + * Users are advised to listen to this (parent) class unless specifically required. ++ *
++ * Note that interacting with Armor Stands fires this event only and not its parent and as such users are expressly required ++ * to listen to this event for that scenario. + */ + public class PlayerInteractAtEntityEvent extends PlayerInteractEntityEvent { + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0178-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch b/patches/api/0178-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch deleted file mode 100644 index b5148c5574..0000000000 --- a/patches/api/0178-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: simpleauthority -Date: Thu, 11 Jul 2019 10:35:56 -0700 -Subject: [PATCH] Amend PlayerInteractAtEntityEvent javadoc for ArmorStands - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java -index 1075dbb8135d2fd2fd69d1e821dd1ba7f90824d5..3f24d302e28170f7f6e5885b5b9abb22cbbb7d66 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java -@@ -13,6 +13,9 @@ import org.jetbrains.annotations.NotNull; - *
- * Note that the client may sometimes spuriously send this packet in addition to {@link PlayerInteractEntityEvent}. - * Users are advised to listen to this (parent) class unless specifically required. -+ *
-+ * Note that interacting with Armor Stands fires this event only and not its parent and as such users are expressly required -+ * to listen to this event for that scenario. - */ - public class PlayerInteractAtEntityEvent extends PlayerInteractEntityEvent { - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0178-Set-true-custom-payload-channel-size-limit.patch b/patches/api/0178-Set-true-custom-payload-channel-size-limit.patch new file mode 100644 index 0000000000..c524e2aaa0 --- /dev/null +++ b/patches/api/0178-Set-true-custom-payload-channel-size-limit.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Fri, 18 Oct 2019 17:39:05 +0100 +Subject: [PATCH] Set true custom payload channel size limit + +This fixes compatibility with some mods that are sending very long channel names. Also gives developers the ability to send longer channel names. + +diff --git a/src/main/java/org/bukkit/plugin/messaging/Messenger.java b/src/main/java/org/bukkit/plugin/messaging/Messenger.java +index 9d2c68c826f3b867d407e7f13c6394a899cc8ee8..aec70aa740152c34297c42ad6e06c8b54523e78b 100644 +--- a/src/main/java/org/bukkit/plugin/messaging/Messenger.java ++++ b/src/main/java/org/bukkit/plugin/messaging/Messenger.java +@@ -24,7 +24,7 @@ public interface Messenger { + /** + * Represents the largest size that a Plugin Channel may be. + */ +- public static final int MAX_CHANNEL_SIZE = 64; ++ public static final int MAX_CHANNEL_SIZE = Integer.getInteger("paper.maxCustomChannelName", java.lang.Short.MAX_VALUE); // Paper - set true max channel size + + /** + * Checks if the specified channel is a reserved name. diff --git a/patches/api/0179-Expose-the-internal-current-tick.patch b/patches/api/0179-Expose-the-internal-current-tick.patch new file mode 100644 index 0000000000..7cd95c46f8 --- /dev/null +++ b/patches/api/0179-Expose-the-internal-current-tick.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 20 Apr 2019 19:47:29 -0500 +Subject: [PATCH] Expose the internal current tick + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 395d7245aac45a1b805e15ee1fdb9949574f3f59..d1e1c49ecf6a1ede71548fbac6143e38ba6dfea1 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2498,6 +2498,10 @@ public final class Bukkit { + public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { + return server.createProfileExact(uuid, name); + } ++ ++ public static int getCurrentTick() { ++ return server.getCurrentTick(); ++ } + // Paper end + + @NotNull +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 2382322bc4f30ff3163b2941650692d9a13328ac..cf242e2e6d538d3d38b7b10321ab375e018b24b1 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2174,5 +2174,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + @NotNull + com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); ++ ++ /** ++ * Get the current internal server tick ++ * ++ * @return Current tick ++ */ ++ int getCurrentTick(); + // Paper end + } diff --git a/patches/api/0179-Set-true-custom-payload-channel-size-limit.patch b/patches/api/0179-Set-true-custom-payload-channel-size-limit.patch deleted file mode 100644 index c524e2aaa0..0000000000 --- a/patches/api/0179-Set-true-custom-payload-channel-size-limit.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Fri, 18 Oct 2019 17:39:05 +0100 -Subject: [PATCH] Set true custom payload channel size limit - -This fixes compatibility with some mods that are sending very long channel names. Also gives developers the ability to send longer channel names. - -diff --git a/src/main/java/org/bukkit/plugin/messaging/Messenger.java b/src/main/java/org/bukkit/plugin/messaging/Messenger.java -index 9d2c68c826f3b867d407e7f13c6394a899cc8ee8..aec70aa740152c34297c42ad6e06c8b54523e78b 100644 ---- a/src/main/java/org/bukkit/plugin/messaging/Messenger.java -+++ b/src/main/java/org/bukkit/plugin/messaging/Messenger.java -@@ -24,7 +24,7 @@ public interface Messenger { - /** - * Represents the largest size that a Plugin Channel may be. - */ -- public static final int MAX_CHANNEL_SIZE = 64; -+ public static final int MAX_CHANNEL_SIZE = Integer.getInteger("paper.maxCustomChannelName", java.lang.Short.MAX_VALUE); // Paper - set true max channel size - - /** - * Checks if the specified channel is a reserved name. diff --git a/patches/api/0180-Expose-the-internal-current-tick.patch b/patches/api/0180-Expose-the-internal-current-tick.patch deleted file mode 100644 index 7cd95c46f8..0000000000 --- a/patches/api/0180-Expose-the-internal-current-tick.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 20 Apr 2019 19:47:29 -0500 -Subject: [PATCH] Expose the internal current tick - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 395d7245aac45a1b805e15ee1fdb9949574f3f59..d1e1c49ecf6a1ede71548fbac6143e38ba6dfea1 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2498,6 +2498,10 @@ public final class Bukkit { - public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { - return server.createProfileExact(uuid, name); - } -+ -+ public static int getCurrentTick() { -+ return server.getCurrentTick(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 2382322bc4f30ff3163b2941650692d9a13328ac..cf242e2e6d538d3d38b7b10321ab375e018b24b1 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2174,5 +2174,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull - com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); -+ -+ /** -+ * Get the current internal server tick -+ * -+ * @return Current tick -+ */ -+ int getCurrentTick(); - // Paper end - } diff --git a/patches/api/0180-Improve-Block-breakNaturally-API.patch b/patches/api/0180-Improve-Block-breakNaturally-API.patch new file mode 100644 index 0000000000..54820995ca --- /dev/null +++ b/patches/api/0180-Improve-Block-breakNaturally-API.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 2 Jan 2020 12:25:16 -0600 +Subject: [PATCH] Improve Block#breakNaturally API + +Adds bool param to trigger world particle effects + +Adds bool param to trigger exp drops for blocks + +Co-authored-by: William Blake Galbreath + +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index f468e9751f75fd355512e033c180de967de5b2d8..bf29d9b733afc7c62725d259f4920c4f211cc6d0 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -481,6 +481,52 @@ public interface Block extends Metadatable, Translatable { + */ + boolean breakNaturally(@Nullable ItemStack tool); + ++ // Paper start ++ /** ++ * Breaks the block and spawns item drops as if a player had broken it ++ * ++ * @param triggerEffect Play the block break particle effect and sound ++ * @return true if the block was destroyed ++ * @see #breakNaturally(boolean, boolean) to trigger exp drops ++ */ ++ default boolean breakNaturally(boolean triggerEffect) { ++ return this.breakNaturally(triggerEffect, false); ++ } ++ ++ /** ++ * Breaks the block and spawns item drops as if a player had broken it ++ * ++ * @param triggerEffect Play the block break particle effect and sound ++ * @param dropExperience drop exp if the block normally does so ++ * @return true if the block was destroyed ++ */ ++ boolean breakNaturally(boolean triggerEffect, boolean dropExperience); ++ ++ /** ++ * Breaks the block and spawns item drops as if a player had broken it ++ * with a specific tool ++ * ++ * @param tool The tool or item in hand used for digging ++ * @param triggerEffect Play the block break particle effect and sound ++ * @return true if the block was destroyed ++ * @see #breakNaturally(ItemStack, boolean, boolean) to trigger exp drops ++ */ ++ default boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect) { ++ return this.breakNaturally(tool, triggerEffect, false); ++ } ++ ++ /** ++ * Breaks the block and spawns item drops as if a player had broken it ++ * with a specific tool ++ * ++ * @param tool The tool or item in hand used for digging ++ * @param triggerEffect Play the block break particle effect and sound ++ * @param dropExperience drop exp if the block normally does so ++ * @return true if the block was destroyed ++ */ ++ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience); ++ // Paper end ++ + /** + * Simulate bone meal application to this block (if possible). + * diff --git a/patches/api/0181-Improve-Block-breakNaturally-API.patch b/patches/api/0181-Improve-Block-breakNaturally-API.patch deleted file mode 100644 index 54820995ca..0000000000 --- a/patches/api/0181-Improve-Block-breakNaturally-API.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 2 Jan 2020 12:25:16 -0600 -Subject: [PATCH] Improve Block#breakNaturally API - -Adds bool param to trigger world particle effects - -Adds bool param to trigger exp drops for blocks - -Co-authored-by: William Blake Galbreath - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index f468e9751f75fd355512e033c180de967de5b2d8..bf29d9b733afc7c62725d259f4920c4f211cc6d0 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -481,6 +481,52 @@ public interface Block extends Metadatable, Translatable { - */ - boolean breakNaturally(@Nullable ItemStack tool); - -+ // Paper start -+ /** -+ * Breaks the block and spawns item drops as if a player had broken it -+ * -+ * @param triggerEffect Play the block break particle effect and sound -+ * @return true if the block was destroyed -+ * @see #breakNaturally(boolean, boolean) to trigger exp drops -+ */ -+ default boolean breakNaturally(boolean triggerEffect) { -+ return this.breakNaturally(triggerEffect, false); -+ } -+ -+ /** -+ * Breaks the block and spawns item drops as if a player had broken it -+ * -+ * @param triggerEffect Play the block break particle effect and sound -+ * @param dropExperience drop exp if the block normally does so -+ * @return true if the block was destroyed -+ */ -+ boolean breakNaturally(boolean triggerEffect, boolean dropExperience); -+ -+ /** -+ * Breaks the block and spawns item drops as if a player had broken it -+ * with a specific tool -+ * -+ * @param tool The tool or item in hand used for digging -+ * @param triggerEffect Play the block break particle effect and sound -+ * @return true if the block was destroyed -+ * @see #breakNaturally(ItemStack, boolean, boolean) to trigger exp drops -+ */ -+ default boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect) { -+ return this.breakNaturally(tool, triggerEffect, false); -+ } -+ -+ /** -+ * Breaks the block and spawns item drops as if a player had broken it -+ * with a specific tool -+ * -+ * @param tool The tool or item in hand used for digging -+ * @param triggerEffect Play the block break particle effect and sound -+ * @param dropExperience drop exp if the block normally does so -+ * @return true if the block was destroyed -+ */ -+ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience); -+ // Paper end -+ - /** - * Simulate bone meal application to this block (if possible). - * diff --git a/patches/api/0181-PlayerDeathEvent-shouldDropExperience.patch b/patches/api/0181-PlayerDeathEvent-shouldDropExperience.patch new file mode 100644 index 0000000000..fafa02c732 --- /dev/null +++ b/patches/api/0181-PlayerDeathEvent-shouldDropExperience.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Tue, 24 Dec 2019 00:35:31 +0000 +Subject: [PATCH] PlayerDeathEvent#shouldDropExperience + + +diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +index 9719e183036c361b909b203593c067a551b82264..66e9d65a8dd05bed05d0ab46ec64206a6dae0507 100644 +--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +@@ -16,6 +16,7 @@ public class PlayerDeathEvent extends EntityDeathEvent { + private int newTotalExp = 0; + private boolean keepLevel = false; + private boolean keepInventory = false; ++ private boolean doExpDrop; // Paper - shouldDropExperience API + // Paper start - adventure + @org.jetbrains.annotations.ApiStatus.Internal + public PlayerDeathEvent(final @NotNull Player player, final @NotNull List drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) { +@@ -29,11 +30,18 @@ public class PlayerDeathEvent extends EntityDeathEvent { + + @org.jetbrains.annotations.ApiStatus.Internal + public PlayerDeathEvent(final @NotNull Player player, final @NotNull List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage) { ++ // Paper start - shouldDropExperience API ++ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true); ++ } ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public PlayerDeathEvent(final @NotNull Player player, final @NotNull List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage, final boolean doExpDrop) { ++ // Paper end - shouldDropExperience API + super(player, drops, droppedExp); + this.newExp = newExp; + this.newTotalExp = newTotalExp; + this.newLevel = newLevel; + this.deathMessage = deathMessage; ++ this.doExpDrop = doExpDrop; // Paper - shouldDropExperience API + } + // Paper end - adventure + +@@ -48,11 +56,19 @@ public class PlayerDeathEvent extends EntityDeathEvent { + + @Deprecated // Paper + public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) { ++ // Paper start - shouldDropExperience API ++ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true); ++ } ++ ++ @Deprecated // Paper ++ public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage, boolean doExpDrop) { ++ // Paper end - shouldDropExperience API + super(player, drops, droppedExp); + this.newExp = newExp; + this.newTotalExp = newTotalExp; + this.newLevel = newLevel; + this.deathMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage); // Paper ++ this.doExpDrop = doExpDrop; // Paper - shouldDropExperience API + } + + @Deprecated // Paper +@@ -90,6 +106,22 @@ public class PlayerDeathEvent extends EntityDeathEvent { + } + // Paper end + ++ // Paper start - shouldDropExperience API ++ /** ++ * @return should experience be dropped from this death ++ */ ++ public boolean shouldDropExperience() { ++ return doExpDrop; ++ } ++ ++ /** ++ * @param doExpDrop sets if experience should be dropped from this death ++ */ ++ public void setShouldDropExperience(boolean doExpDrop) { ++ this.doExpDrop = doExpDrop; ++ } ++ // Paper end - shouldDropExperience API ++ + @NotNull + @Override + public Player getEntity() { diff --git a/patches/api/0182-Add-ThrownEggHatchEvent.patch b/patches/api/0182-Add-ThrownEggHatchEvent.patch new file mode 100644 index 0000000000..8636b6d6df --- /dev/null +++ b/patches/api/0182-Add-ThrownEggHatchEvent.patch @@ -0,0 +1,134 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 9 Feb 2020 00:19:08 -0600 +Subject: [PATCH] Add ThrownEggHatchEvent + +Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement +(dispensers can throw eggs to hatch them, too). + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..092bab9be36acc0f04c7ea5b3510879169a0a125 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java +@@ -0,0 +1,120 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.entity.Egg; ++import org.bukkit.entity.EntityType; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a thrown egg might hatch. ++ *

++ * This event fires for all thrown eggs that may hatch, players, dispensers, etc. ++ */ ++public class ThrownEggHatchEvent extends Event { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Egg egg; ++ private boolean hatching; ++ private byte numHatches; ++ private EntityType hatchType; ++ ++ @ApiStatus.Internal ++ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) { ++ this.egg = egg; ++ this.hatching = hatching; ++ this.numHatches = numHatches; ++ this.hatchType = hatchingType; ++ } ++ ++ /** ++ * Gets the egg involved in this event. ++ * ++ * @return the egg involved in this event ++ */ ++ @NotNull ++ public Egg getEgg() { ++ return this.egg; ++ } ++ ++ /** ++ * Gets whether the egg is hatching or not. Will be what the server ++ * would've done without interaction. ++ * ++ * @return boolean Whether the egg is going to hatch or not ++ */ ++ public boolean isHatching() { ++ return this.hatching; ++ } ++ ++ /** ++ * Sets whether the egg will hatch or not. ++ * ++ * @param hatching {@code true} if you want the egg to hatch, {@code false} if you want it ++ * not to ++ */ ++ public void setHatching(boolean hatching) { ++ this.hatching = hatching; ++ } ++ ++ /** ++ * Get the type of the mob being hatched ({@link EntityType#CHICKEN} by default) ++ * ++ * @return The type of the mob being hatched by the egg ++ */ ++ @NotNull ++ public EntityType getHatchingType() { ++ return this.hatchType; ++ } ++ ++ /** ++ * Change the type of mob being hatched by the egg ++ * ++ * @param hatchType The type of the mob being hatched by the egg ++ */ ++ public void setHatchingType(@NotNull EntityType hatchType) { ++ Preconditions.checkArgument(hatchType.isSpawnable(), "Can't spawn that entity type from an egg!"); ++ this.hatchType = hatchType; ++ } ++ ++ /** ++ * Get the number of mob hatches from the egg. By default the number will ++ * be the number the server would've done ++ *

    ++ *
  • 7/8 chance of being 0 ++ *
  • 31/256 ~= 1/8 chance to be 1 ++ *
  • 1/256 chance to be 4 ++ *
++ * ++ * @return The number of mobs going to be hatched by the egg ++ */ ++ public byte getNumHatches() { ++ return this.numHatches; ++ } ++ ++ /** ++ * Change the number of mobs coming out of the hatched egg ++ *

++ * The boolean hatching will override this number. I.e. If hatching is ++ * {@code false}, this number will not matter ++ * ++ * @param numHatches The number of mobs coming out of the egg ++ */ ++ public void setNumHatches(byte numHatches) { ++ this.numHatches = numHatches; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0182-PlayerDeathEvent-shouldDropExperience.patch b/patches/api/0182-PlayerDeathEvent-shouldDropExperience.patch deleted file mode 100644 index fafa02c732..0000000000 --- a/patches/api/0182-PlayerDeathEvent-shouldDropExperience.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Tue, 24 Dec 2019 00:35:31 +0000 -Subject: [PATCH] PlayerDeathEvent#shouldDropExperience - - -diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 9719e183036c361b909b203593c067a551b82264..66e9d65a8dd05bed05d0ab46ec64206a6dae0507 100644 ---- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -@@ -16,6 +16,7 @@ public class PlayerDeathEvent extends EntityDeathEvent { - private int newTotalExp = 0; - private boolean keepLevel = false; - private boolean keepInventory = false; -+ private boolean doExpDrop; // Paper - shouldDropExperience API - // Paper start - adventure - @org.jetbrains.annotations.ApiStatus.Internal - public PlayerDeathEvent(final @NotNull Player player, final @NotNull List drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) { -@@ -29,11 +30,18 @@ public class PlayerDeathEvent extends EntityDeathEvent { - - @org.jetbrains.annotations.ApiStatus.Internal - public PlayerDeathEvent(final @NotNull Player player, final @NotNull List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage) { -+ // Paper start - shouldDropExperience API -+ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true); -+ } -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public PlayerDeathEvent(final @NotNull Player player, final @NotNull List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, final @Nullable net.kyori.adventure.text.Component deathMessage, final boolean doExpDrop) { -+ // Paper end - shouldDropExperience API - super(player, drops, droppedExp); - this.newExp = newExp; - this.newTotalExp = newTotalExp; - this.newLevel = newLevel; - this.deathMessage = deathMessage; -+ this.doExpDrop = doExpDrop; // Paper - shouldDropExperience API - } - // Paper end - adventure - -@@ -48,11 +56,19 @@ public class PlayerDeathEvent extends EntityDeathEvent { - - @Deprecated // Paper - public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage) { -+ // Paper start - shouldDropExperience API -+ this(player, drops, droppedExp, newExp, newTotalExp, newLevel, deathMessage, true); -+ } -+ -+ @Deprecated // Paper -+ public PlayerDeathEvent(@NotNull final Player player, @NotNull final List drops, final int droppedExp, final int newExp, final int newTotalExp, final int newLevel, @Nullable final String deathMessage, boolean doExpDrop) { -+ // Paper end - shouldDropExperience API - super(player, drops, droppedExp); - this.newExp = newExp; - this.newTotalExp = newTotalExp; - this.newLevel = newLevel; - this.deathMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(deathMessage); // Paper -+ this.doExpDrop = doExpDrop; // Paper - shouldDropExperience API - } - - @Deprecated // Paper -@@ -90,6 +106,22 @@ public class PlayerDeathEvent extends EntityDeathEvent { - } - // Paper end - -+ // Paper start - shouldDropExperience API -+ /** -+ * @return should experience be dropped from this death -+ */ -+ public boolean shouldDropExperience() { -+ return doExpDrop; -+ } -+ -+ /** -+ * @param doExpDrop sets if experience should be dropped from this death -+ */ -+ public void setShouldDropExperience(boolean doExpDrop) { -+ this.doExpDrop = doExpDrop; -+ } -+ // Paper end - shouldDropExperience API -+ - @NotNull - @Override - public Player getEntity() { diff --git a/patches/api/0183-Add-ThrownEggHatchEvent.patch b/patches/api/0183-Add-ThrownEggHatchEvent.patch deleted file mode 100644 index 8636b6d6df..0000000000 --- a/patches/api/0183-Add-ThrownEggHatchEvent.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 9 Feb 2020 00:19:08 -0600 -Subject: [PATCH] Add ThrownEggHatchEvent - -Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement -(dispensers can throw eggs to hatch them, too). - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..092bab9be36acc0f04c7ea5b3510879169a0a125 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java -@@ -0,0 +1,120 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Egg; -+import org.bukkit.entity.EntityType; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a thrown egg might hatch. -+ *

-+ * This event fires for all thrown eggs that may hatch, players, dispensers, etc. -+ */ -+public class ThrownEggHatchEvent extends Event { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Egg egg; -+ private boolean hatching; -+ private byte numHatches; -+ private EntityType hatchType; -+ -+ @ApiStatus.Internal -+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) { -+ this.egg = egg; -+ this.hatching = hatching; -+ this.numHatches = numHatches; -+ this.hatchType = hatchingType; -+ } -+ -+ /** -+ * Gets the egg involved in this event. -+ * -+ * @return the egg involved in this event -+ */ -+ @NotNull -+ public Egg getEgg() { -+ return this.egg; -+ } -+ -+ /** -+ * Gets whether the egg is hatching or not. Will be what the server -+ * would've done without interaction. -+ * -+ * @return boolean Whether the egg is going to hatch or not -+ */ -+ public boolean isHatching() { -+ return this.hatching; -+ } -+ -+ /** -+ * Sets whether the egg will hatch or not. -+ * -+ * @param hatching {@code true} if you want the egg to hatch, {@code false} if you want it -+ * not to -+ */ -+ public void setHatching(boolean hatching) { -+ this.hatching = hatching; -+ } -+ -+ /** -+ * Get the type of the mob being hatched ({@link EntityType#CHICKEN} by default) -+ * -+ * @return The type of the mob being hatched by the egg -+ */ -+ @NotNull -+ public EntityType getHatchingType() { -+ return this.hatchType; -+ } -+ -+ /** -+ * Change the type of mob being hatched by the egg -+ * -+ * @param hatchType The type of the mob being hatched by the egg -+ */ -+ public void setHatchingType(@NotNull EntityType hatchType) { -+ Preconditions.checkArgument(hatchType.isSpawnable(), "Can't spawn that entity type from an egg!"); -+ this.hatchType = hatchType; -+ } -+ -+ /** -+ * Get the number of mob hatches from the egg. By default the number will -+ * be the number the server would've done -+ *

    -+ *
  • 7/8 chance of being 0 -+ *
  • 31/256 ~= 1/8 chance to be 1 -+ *
  • 1/256 chance to be 4 -+ *
-+ * -+ * @return The number of mobs going to be hatched by the egg -+ */ -+ public byte getNumHatches() { -+ return this.numHatches; -+ } -+ -+ /** -+ * Change the number of mobs coming out of the hatched egg -+ *

-+ * The boolean hatching will override this number. I.e. If hatching is -+ * {@code false}, this number will not matter -+ * -+ * @param numHatches The number of mobs coming out of the egg -+ */ -+ public void setNumHatches(byte numHatches) { -+ this.numHatches = numHatches; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0183-Entity-Jump-API.patch b/patches/api/0183-Entity-Jump-API.patch new file mode 100644 index 0000000000..fb5b69da63 --- /dev/null +++ b/patches/api/0183-Entity-Jump-API.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sat, 8 Feb 2020 23:26:18 -0600 +Subject: [PATCH] Entity Jump API + + +diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a6306c957fcacdcbcc8037b4ee33a167d21ff29e +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java +@@ -0,0 +1,50 @@ ++package com.destroystokyo.paper.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when an entity jumps ++ *

++ * Cancelling the event will stop the entity from jumping ++ */ ++public class EntityJumpEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityJumpEvent(@NotNull LivingEntity entity) { ++ super(entity); ++ } ++ ++ @NotNull ++ @Override ++ public LivingEntity getEntity() { ++ return (LivingEntity) super.getEntity(); ++ } ++ ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 2b791a093a1220be80eb6b9d7202f6596fcf2dd6..d134a7406e3960e12e811085257a1e0052abb499 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1149,4 +1149,26 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + return this.getActiveItemHand(); + } + // Paper end - active item API ++ ++ // Paper start - entity jump API ++ /** ++ * Get entity jump state. ++ *

++ * Jump state will be true when the entity has been marked to jump. ++ * ++ * @return entity jump state. ++ */ ++ boolean isJumping(); ++ ++ /** ++ * Set entity jump state ++ *

++ * Setting to true will mark the entity to jump. ++ *

++ * Setting to false will unmark the entity to jump but will not stop a jump already in-progress. ++ * ++ * @param jumping entity jump state ++ */ ++ void setJumping(boolean jumping); ++ // Paper end - entity jump API + } diff --git a/patches/api/0184-Entity-Jump-API.patch b/patches/api/0184-Entity-Jump-API.patch deleted file mode 100644 index fb5b69da63..0000000000 --- a/patches/api/0184-Entity-Jump-API.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sat, 8 Feb 2020 23:26:18 -0600 -Subject: [PATCH] Entity Jump API - - -diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a6306c957fcacdcbcc8037b4ee33a167d21ff29e ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityJumpEvent.java -@@ -0,0 +1,50 @@ -+package com.destroystokyo.paper.event.entity; -+ -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when an entity jumps -+ *

-+ * Cancelling the event will stop the entity from jumping -+ */ -+public class EntityJumpEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityJumpEvent(@NotNull LivingEntity entity) { -+ super(entity); -+ } -+ -+ @NotNull -+ @Override -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 2b791a093a1220be80eb6b9d7202f6596fcf2dd6..d134a7406e3960e12e811085257a1e0052abb499 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1149,4 +1149,26 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - return this.getActiveItemHand(); - } - // Paper end - active item API -+ -+ // Paper start - entity jump API -+ /** -+ * Get entity jump state. -+ *

-+ * Jump state will be true when the entity has been marked to jump. -+ * -+ * @return entity jump state. -+ */ -+ boolean isJumping(); -+ -+ /** -+ * Set entity jump state -+ *

-+ * Setting to true will mark the entity to jump. -+ *

-+ * Setting to false will unmark the entity to jump but will not stop a jump already in-progress. -+ * -+ * @param jumping entity jump state -+ */ -+ void setJumping(boolean jumping); -+ // Paper end - entity jump API - } diff --git a/patches/api/0184-add-hand-to-BlockMultiPlaceEvent.patch b/patches/api/0184-add-hand-to-BlockMultiPlaceEvent.patch new file mode 100644 index 0000000000..f15b482d62 --- /dev/null +++ b/patches/api/0184-add-hand-to-BlockMultiPlaceEvent.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Sun, 1 Mar 2020 22:43:34 +0100 +Subject: [PATCH] add hand to BlockMultiPlaceEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java +index fe2ec79dd6084509cb8cbb8155a356f4162466fd..7ca2b1b321447289c50c210a608a88db9c4b4f99 100644 +--- a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java +@@ -18,9 +18,17 @@ import org.jetbrains.annotations.NotNull; + public class BlockMultiPlaceEvent extends BlockPlaceEvent { + private final List states; + ++ @Deprecated // Paper + public BlockMultiPlaceEvent(@NotNull List states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) { +- super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild); ++ // Paper start - add hand to BlockMultiPlaceEvent ++ this(states, clicked, itemInHand, thePlayer, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); ++ } ++ ++ ++ public BlockMultiPlaceEvent(@NotNull List states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull org.bukkit.inventory.EquipmentSlot hand) { ++ super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild, hand); + this.states = ImmutableList.copyOf(states); ++ // Paper end + } + + /** diff --git a/patches/api/0185-Add-tick-times-API.patch b/patches/api/0185-Add-tick-times-API.patch new file mode 100644 index 0000000000..40cbc279eb --- /dev/null +++ b/patches/api/0185-Add-tick-times-API.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 5 Apr 2020 22:22:58 -0500 +Subject: [PATCH] Add tick times API + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index d1e1c49ecf6a1ede71548fbac6143e38ba6dfea1..385be33869f3850f8b1d3e690c8e0fc43adcbdce 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2170,6 +2170,25 @@ public final class Bukkit { + public static double[] getTPS() { + return server.getTPS(); + } ++ ++ /** ++ * Get a sample of the servers last tick times (in nanos) ++ * ++ * @return A sample of the servers last tick times (in nanos) ++ */ ++ @NotNull ++ public static long[] getTickTimes() { ++ return server.getTickTimes(); ++ } ++ ++ /** ++ * Get the average tick time (in millis) ++ * ++ * @return Average tick time (in millis) ++ */ ++ public static double getAverageTickTime() { ++ return server == null ? 0D : server.getAverageTickTime(); ++ } + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index cf242e2e6d538d3d38b7b10321ab375e018b24b1..d6d83b22389aee98967adda2631fa65ecbf00781 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1836,6 +1836,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + @NotNull + public double[] getTPS(); ++ ++ /** ++ * Get a sample of the servers last tick times (in nanos) ++ * ++ * @return A sample of the servers last tick times (in nanos) ++ */ ++ @NotNull ++ long[] getTickTimes(); ++ ++ /** ++ * Get the average tick time (in millis) ++ * ++ * @return Average tick time (in millis) ++ */ ++ double getAverageTickTime(); + // Paper end + + // Paper start diff --git a/patches/api/0185-add-hand-to-BlockMultiPlaceEvent.patch b/patches/api/0185-add-hand-to-BlockMultiPlaceEvent.patch deleted file mode 100644 index f15b482d62..0000000000 --- a/patches/api/0185-add-hand-to-BlockMultiPlaceEvent.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary -Date: Sun, 1 Mar 2020 22:43:34 +0100 -Subject: [PATCH] add hand to BlockMultiPlaceEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java -index fe2ec79dd6084509cb8cbb8155a356f4162466fd..7ca2b1b321447289c50c210a608a88db9c4b4f99 100644 ---- a/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockMultiPlaceEvent.java -@@ -18,9 +18,17 @@ import org.jetbrains.annotations.NotNull; - public class BlockMultiPlaceEvent extends BlockPlaceEvent { - private final List states; - -+ @Deprecated // Paper - public BlockMultiPlaceEvent(@NotNull List states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) { -- super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild); -+ // Paper start - add hand to BlockMultiPlaceEvent -+ this(states, clicked, itemInHand, thePlayer, canBuild, org.bukkit.inventory.EquipmentSlot.HAND); -+ } -+ -+ -+ public BlockMultiPlaceEvent(@NotNull List states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull org.bukkit.inventory.EquipmentSlot hand) { -+ super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild, hand); - this.states = ImmutableList.copyOf(states); -+ // Paper end - } - - /** diff --git a/patches/api/0186-Add-tick-times-API.patch b/patches/api/0186-Add-tick-times-API.patch deleted file mode 100644 index 40cbc279eb..0000000000 --- a/patches/api/0186-Add-tick-times-API.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 5 Apr 2020 22:22:58 -0500 -Subject: [PATCH] Add tick times API - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index d1e1c49ecf6a1ede71548fbac6143e38ba6dfea1..385be33869f3850f8b1d3e690c8e0fc43adcbdce 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2170,6 +2170,25 @@ public final class Bukkit { - public static double[] getTPS() { - return server.getTPS(); - } -+ -+ /** -+ * Get a sample of the servers last tick times (in nanos) -+ * -+ * @return A sample of the servers last tick times (in nanos) -+ */ -+ @NotNull -+ public static long[] getTickTimes() { -+ return server.getTickTimes(); -+ } -+ -+ /** -+ * Get the average tick time (in millis) -+ * -+ * @return Average tick time (in millis) -+ */ -+ public static double getAverageTickTime() { -+ return server == null ? 0D : server.getAverageTickTime(); -+ } - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index cf242e2e6d538d3d38b7b10321ab375e018b24b1..d6d83b22389aee98967adda2631fa65ecbf00781 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -1836,6 +1836,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull - public double[] getTPS(); -+ -+ /** -+ * Get a sample of the servers last tick times (in nanos) -+ * -+ * @return A sample of the servers last tick times (in nanos) -+ */ -+ @NotNull -+ long[] getTickTimes(); -+ -+ /** -+ * Get the average tick time (in millis) -+ * -+ * @return Average tick time (in millis) -+ */ -+ double getAverageTickTime(); - // Paper end - - // Paper start diff --git a/patches/api/0186-Expose-MinecraftServer-isRunning.patch b/patches/api/0186-Expose-MinecraftServer-isRunning.patch new file mode 100644 index 0000000000..0f50363b31 --- /dev/null +++ b/patches/api/0186-Expose-MinecraftServer-isRunning.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Fri, 10 Apr 2020 21:24:35 -0400 +Subject: [PATCH] Expose MinecraftServer#isRunning + +This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 385be33869f3850f8b1d3e690c8e0fc43adcbdce..f24d57a89dc4fdf73298bbb4cc187794c7bd6706 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2521,6 +2521,15 @@ public final class Bukkit { + public static int getCurrentTick() { + return server.getCurrentTick(); + } ++ ++ /** ++ * Checks if the server is in the process of being shutdown. ++ * ++ * @return true if server is in the process of being shutdown ++ */ ++ public static boolean isStopping() { ++ return server.isStopping(); ++ } + // Paper end + + @NotNull +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index d6d83b22389aee98967adda2631fa65ecbf00781..015f1167bdc752fe6665807866caa0cda5ba0571 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2196,5 +2196,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * @return Current tick + */ + int getCurrentTick(); ++ ++ /** ++ * Checks if the server is in the process of being shutdown. ++ * ++ * @return true if server is in the process of being shutdown ++ */ ++ boolean isStopping(); + // Paper end + } diff --git a/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch new file mode 100644 index 0000000000..68a57597a7 --- /dev/null +++ b/patches/api/0187-Add-Raw-Byte-ItemStack-Serialization.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Thu, 30 Apr 2020 16:56:31 +0200 +Subject: [PATCH] Add Raw Byte ItemStack Serialization + +Serializes using NBT which is safer for server data migrations than bukkits format. + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 4ac6f5488eb988486ee40473b9b0db84b5fe35c4..77a06e58f86f908916e68e80ce365ae25884e5a2 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -154,5 +154,9 @@ public interface UnsafeValues { + default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { + return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher(); + } ++ ++ byte[] serializeItem(ItemStack item); ++ ++ ItemStack deserializeItem(byte[] data); + // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 276cfd52817115981fe7dc46363278f8b8c5aee3..e82eeadc7cb53572351670761c4e592a33345c6b 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -653,6 +653,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return Bukkit.getServer().getItemFactory().ensureServerConversions(this); + } + ++ /** ++ * Deserializes this itemstack from raw NBT bytes. NBT is safer for data migrations as it will ++ * use the built in data converter instead of bukkits dangerous serialization system. ++ * ++ * This expects that the DataVersion was stored on the root of the Compound, as saved from ++ * the {@link #serializeAsBytes()} API returned. ++ * @param bytes bytes representing an item in NBT ++ * @return ItemStack migrated to this version of Minecraft if needed. ++ */ ++ @NotNull ++ public static ItemStack deserializeBytes(@NotNull byte[] bytes) { ++ return org.bukkit.Bukkit.getUnsafe().deserializeItem(bytes); ++ } ++ ++ /** ++ * Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will ++ * use the built in data converter instead of bukkits dangerous serialization system. ++ * @return bytes representing this item in NBT. ++ */ ++ @NotNull ++ public byte[] serializeAsBytes() { ++ return org.bukkit.Bukkit.getUnsafe().serializeItem(this); ++ } ++ + /** + * Gets the Display name as seen in the Client. + * Currently the server only supports the English language. To override this, diff --git a/patches/api/0187-Expose-MinecraftServer-isRunning.patch b/patches/api/0187-Expose-MinecraftServer-isRunning.patch deleted file mode 100644 index 0f50363b31..0000000000 --- a/patches/api/0187-Expose-MinecraftServer-isRunning.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JRoy -Date: Fri, 10 Apr 2020 21:24:35 -0400 -Subject: [PATCH] Expose MinecraftServer#isRunning - -This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 385be33869f3850f8b1d3e690c8e0fc43adcbdce..f24d57a89dc4fdf73298bbb4cc187794c7bd6706 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2521,6 +2521,15 @@ public final class Bukkit { - public static int getCurrentTick() { - return server.getCurrentTick(); - } -+ -+ /** -+ * Checks if the server is in the process of being shutdown. -+ * -+ * @return true if server is in the process of being shutdown -+ */ -+ public static boolean isStopping() { -+ return server.isStopping(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index d6d83b22389aee98967adda2631fa65ecbf00781..015f1167bdc752fe6665807866caa0cda5ba0571 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2196,5 +2196,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @return Current tick - */ - int getCurrentTick(); -+ -+ /** -+ * Checks if the server is in the process of being shutdown. -+ * -+ * @return true if server is in the process of being shutdown -+ */ -+ boolean isStopping(); - // Paper end - } diff --git a/patches/api/0188-Add-Player-Client-Options-API.patch b/patches/api/0188-Add-Player-Client-Options-API.patch new file mode 100644 index 0000000000..e4057fe25a --- /dev/null +++ b/patches/api/0188-Add-Player-Client-Options-API.patch @@ -0,0 +1,250 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MiniDigger +Date: Mon, 20 Jan 2020 21:38:34 +0100 +Subject: [PATCH] Add Player Client Options API + + +diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f89bfeba29e6988db849957a508ca97ff5322242 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/ClientOption.java +@@ -0,0 +1,52 @@ ++package com.destroystokyo.paper; ++ ++import net.kyori.adventure.translation.Translatable; ++import net.kyori.adventure.util.Index; ++import org.jetbrains.annotations.NotNull; ++ ++import org.bukkit.inventory.MainHand; ++ ++public final class ClientOption { ++ ++ public static final ClientOption SKIN_PARTS = new ClientOption<>(SkinParts.class); ++ public static final ClientOption CHAT_COLORS_ENABLED = new ClientOption<>(Boolean.class); ++ public static final ClientOption CHAT_VISIBILITY = new ClientOption<>(ChatVisibility.class); ++ public static final ClientOption LOCALE = new ClientOption<>(String.class); ++ public static final ClientOption MAIN_HAND = new ClientOption<>(MainHand.class); ++ public static final ClientOption VIEW_DISTANCE = new ClientOption<>(Integer.class); ++ public static final ClientOption ALLOW_SERVER_LISTINGS = new ClientOption<>(Boolean.class); ++ public static final ClientOption TEXT_FILTERING_ENABLED = new ClientOption<>(Boolean.class); ++ ++ private final Class type; ++ ++ private ClientOption(@NotNull Class type) { ++ this.type = type; ++ } ++ ++ @NotNull ++ public Class getType() { ++ return type; ++ } ++ ++ public enum ChatVisibility implements Translatable { ++ FULL("full"), ++ SYSTEM("system"), ++ HIDDEN("hidden"), ++ UNKNOWN("unknown"); ++ ++ public static Index NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name); ++ private final String name; ++ ++ ChatVisibility(String name) { ++ this.name = name; ++ } ++ ++ @Override ++ public @NotNull String translationKey() { ++ if (this == UNKNOWN) { ++ throw new UnsupportedOperationException(this.name + " doesn't have a translation key"); ++ } ++ return "options.chat.visibility." + this.name; ++ } ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4a0c39405d4fbed457787e3c6ded4cc6591bc8c2 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/SkinParts.java +@@ -0,0 +1,20 @@ ++package com.destroystokyo.paper; ++ ++public interface SkinParts { ++ ++ boolean hasCapeEnabled(); ++ ++ boolean hasJacketEnabled(); ++ ++ boolean hasLeftSleeveEnabled(); ++ ++ boolean hasRightSleeveEnabled(); ++ ++ boolean hasLeftPantsEnabled(); ++ ++ boolean hasRightPantsEnabled(); ++ ++ boolean hasHatsEnabled(); ++ ++ int getRaw(); ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1757055d821d9ec7c728aa6c1b52fa6aea591ae5 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java +@@ -0,0 +1,136 @@ ++package com.destroystokyo.paper.event.player; ++ ++import com.destroystokyo.paper.ClientOption; ++import com.destroystokyo.paper.ClientOption.ChatVisibility; ++import com.destroystokyo.paper.SkinParts; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.MainHand; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Map; ++ ++/** ++ * Called when the player changes their client settings ++ */ ++public class PlayerClientOptionsChangeEvent extends PlayerEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final String locale; ++ private final int viewDistance; ++ private final ChatVisibility chatVisibility; ++ private final boolean chatColors; ++ private final SkinParts skinparts; ++ private final MainHand mainHand; ++ private final boolean allowsServerListings; ++ private final boolean textFilteringEnabled; ++ ++ @Deprecated ++ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull String locale, int viewDistance, @NotNull ChatVisibility chatVisibility, boolean chatColors, @NotNull SkinParts skinParts, @NotNull MainHand mainHand) { ++ super(player); ++ this.locale = locale; ++ this.viewDistance = viewDistance; ++ this.chatVisibility = chatVisibility; ++ this.chatColors = chatColors; ++ this.skinparts = skinParts; ++ this.mainHand = mainHand; ++ this.allowsServerListings = false; ++ this.textFilteringEnabled = false; ++ } ++ ++ @ApiStatus.Internal ++ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull Map, ?> options) { ++ super(player); ++ ++ this.locale = (String) options.get(ClientOption.LOCALE); ++ this.viewDistance = (int) options.get(ClientOption.VIEW_DISTANCE); ++ this.chatVisibility = (ChatVisibility) options.get(ClientOption.CHAT_VISIBILITY); ++ this.chatColors = (boolean) options.get(ClientOption.CHAT_COLORS_ENABLED); ++ this.skinparts = (SkinParts) options.get(ClientOption.SKIN_PARTS); ++ this.mainHand = (MainHand) options.get(ClientOption.MAIN_HAND); ++ this.allowsServerListings = (boolean) options.get(ClientOption.ALLOW_SERVER_LISTINGS); ++ this.textFilteringEnabled = (boolean) options.get(ClientOption.TEXT_FILTERING_ENABLED); ++ } ++ ++ @NotNull ++ public String getLocale() { ++ return this.locale; ++ } ++ ++ public boolean hasLocaleChanged() { ++ return !this.locale.equals(this.player.getClientOption(ClientOption.LOCALE)); ++ } ++ ++ public int getViewDistance() { ++ return this.viewDistance; ++ } ++ ++ public boolean hasViewDistanceChanged() { ++ return this.viewDistance != this.player.getClientOption(ClientOption.VIEW_DISTANCE); ++ } ++ ++ @NotNull ++ public ChatVisibility getChatVisibility() { ++ return this.chatVisibility; ++ } ++ ++ public boolean hasChatVisibilityChanged() { ++ return this.chatVisibility != this.player.getClientOption(ClientOption.CHAT_VISIBILITY); ++ } ++ ++ public boolean hasChatColorsEnabled() { ++ return this.chatColors; ++ } ++ ++ public boolean hasChatColorsEnabledChanged() { ++ return this.chatColors != this.player.getClientOption(ClientOption.CHAT_COLORS_ENABLED); ++ } ++ ++ @NotNull ++ public SkinParts getSkinParts() { ++ return this.skinparts; ++ } ++ ++ public boolean hasSkinPartsChanged() { ++ return this.skinparts.getRaw() != this.player.getClientOption(ClientOption.SKIN_PARTS).getRaw(); ++ } ++ ++ @NotNull ++ public MainHand getMainHand() { ++ return this.mainHand; ++ } ++ ++ public boolean hasMainHandChanged() { ++ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND); ++ } ++ ++ public boolean allowsServerListings() { ++ return this.allowsServerListings; ++ } ++ ++ public boolean hasAllowServerListingsChanged() { ++ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS); ++ } ++ ++ public boolean hasTextFilteringEnabled() { ++ return this.textFilteringEnabled; ++ } ++ ++ public boolean hasTextFilteringChanged() { ++ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED); ++ } ++ ++ @Override ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 33547e9e3f8f7c906a5d91b75eb62327cc1f2a3a..7429666fd1af4f4a924cf93572df5b826782af05 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3282,6 +3282,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + void resetCooldown(); + // Paper end - attack cooldown API + ++ // Paper start - client option API ++ /** ++ * @return the client option value of the player ++ */ ++ @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption option); ++ // Paper end - client option API ++ + // Spigot start + public class Spigot extends Entity.Spigot { + diff --git a/patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch deleted file mode 100644 index dc654da7f0..0000000000 --- a/patches/api/0188-Add-Raw-Byte-ItemStack-Serialization.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Thu, 30 Apr 2020 16:56:31 +0200 -Subject: [PATCH] Add Raw Byte ItemStack Serialization - -Serializes using NBT which is safer for server data migrations than bukkits format. - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index d69e5fa40702c283c370a2f712b51dc2ea3a1fa0..30d869a7c4bba79b4c05de7860b31c14f47b341a 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -153,5 +153,9 @@ public interface UnsafeValues { - default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { - return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher(); - } -+ -+ byte[] serializeItem(ItemStack item); -+ -+ ItemStack deserializeItem(byte[] data); - // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 276cfd52817115981fe7dc46363278f8b8c5aee3..e82eeadc7cb53572351670761c4e592a33345c6b 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -653,6 +653,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return Bukkit.getServer().getItemFactory().ensureServerConversions(this); - } - -+ /** -+ * Deserializes this itemstack from raw NBT bytes. NBT is safer for data migrations as it will -+ * use the built in data converter instead of bukkits dangerous serialization system. -+ * -+ * This expects that the DataVersion was stored on the root of the Compound, as saved from -+ * the {@link #serializeAsBytes()} API returned. -+ * @param bytes bytes representing an item in NBT -+ * @return ItemStack migrated to this version of Minecraft if needed. -+ */ -+ @NotNull -+ public static ItemStack deserializeBytes(@NotNull byte[] bytes) { -+ return org.bukkit.Bukkit.getUnsafe().deserializeItem(bytes); -+ } -+ -+ /** -+ * Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will -+ * use the built in data converter instead of bukkits dangerous serialization system. -+ * @return bytes representing this item in NBT. -+ */ -+ @NotNull -+ public byte[] serializeAsBytes() { -+ return org.bukkit.Bukkit.getUnsafe().serializeItem(this); -+ } -+ - /** - * Gets the Display name as seen in the Client. - * Currently the server only supports the English language. To override this, diff --git a/patches/api/0189-Add-Player-Client-Options-API.patch b/patches/api/0189-Add-Player-Client-Options-API.patch deleted file mode 100644 index e4057fe25a..0000000000 --- a/patches/api/0189-Add-Player-Client-Options-API.patch +++ /dev/null @@ -1,250 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger -Date: Mon, 20 Jan 2020 21:38:34 +0100 -Subject: [PATCH] Add Player Client Options API - - -diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f89bfeba29e6988db849957a508ca97ff5322242 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java -@@ -0,0 +1,52 @@ -+package com.destroystokyo.paper; -+ -+import net.kyori.adventure.translation.Translatable; -+import net.kyori.adventure.util.Index; -+import org.jetbrains.annotations.NotNull; -+ -+import org.bukkit.inventory.MainHand; -+ -+public final class ClientOption { -+ -+ public static final ClientOption SKIN_PARTS = new ClientOption<>(SkinParts.class); -+ public static final ClientOption CHAT_COLORS_ENABLED = new ClientOption<>(Boolean.class); -+ public static final ClientOption CHAT_VISIBILITY = new ClientOption<>(ChatVisibility.class); -+ public static final ClientOption LOCALE = new ClientOption<>(String.class); -+ public static final ClientOption MAIN_HAND = new ClientOption<>(MainHand.class); -+ public static final ClientOption VIEW_DISTANCE = new ClientOption<>(Integer.class); -+ public static final ClientOption ALLOW_SERVER_LISTINGS = new ClientOption<>(Boolean.class); -+ public static final ClientOption TEXT_FILTERING_ENABLED = new ClientOption<>(Boolean.class); -+ -+ private final Class type; -+ -+ private ClientOption(@NotNull Class type) { -+ this.type = type; -+ } -+ -+ @NotNull -+ public Class getType() { -+ return type; -+ } -+ -+ public enum ChatVisibility implements Translatable { -+ FULL("full"), -+ SYSTEM("system"), -+ HIDDEN("hidden"), -+ UNKNOWN("unknown"); -+ -+ public static Index NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name); -+ private final String name; -+ -+ ChatVisibility(String name) { -+ this.name = name; -+ } -+ -+ @Override -+ public @NotNull String translationKey() { -+ if (this == UNKNOWN) { -+ throw new UnsupportedOperationException(this.name + " doesn't have a translation key"); -+ } -+ return "options.chat.visibility." + this.name; -+ } -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java -new file mode 100644 -index 0000000000000000000000000000000000000000..4a0c39405d4fbed457787e3c6ded4cc6591bc8c2 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/SkinParts.java -@@ -0,0 +1,20 @@ -+package com.destroystokyo.paper; -+ -+public interface SkinParts { -+ -+ boolean hasCapeEnabled(); -+ -+ boolean hasJacketEnabled(); -+ -+ boolean hasLeftSleeveEnabled(); -+ -+ boolean hasRightSleeveEnabled(); -+ -+ boolean hasLeftPantsEnabled(); -+ -+ boolean hasRightPantsEnabled(); -+ -+ boolean hasHatsEnabled(); -+ -+ int getRaw(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..1757055d821d9ec7c728aa6c1b52fa6aea591ae5 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java -@@ -0,0 +1,136 @@ -+package com.destroystokyo.paper.event.player; -+ -+import com.destroystokyo.paper.ClientOption; -+import com.destroystokyo.paper.ClientOption.ChatVisibility; -+import com.destroystokyo.paper.SkinParts; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.MainHand; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Map; -+ -+/** -+ * Called when the player changes their client settings -+ */ -+public class PlayerClientOptionsChangeEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final String locale; -+ private final int viewDistance; -+ private final ChatVisibility chatVisibility; -+ private final boolean chatColors; -+ private final SkinParts skinparts; -+ private final MainHand mainHand; -+ private final boolean allowsServerListings; -+ private final boolean textFilteringEnabled; -+ -+ @Deprecated -+ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull String locale, int viewDistance, @NotNull ChatVisibility chatVisibility, boolean chatColors, @NotNull SkinParts skinParts, @NotNull MainHand mainHand) { -+ super(player); -+ this.locale = locale; -+ this.viewDistance = viewDistance; -+ this.chatVisibility = chatVisibility; -+ this.chatColors = chatColors; -+ this.skinparts = skinParts; -+ this.mainHand = mainHand; -+ this.allowsServerListings = false; -+ this.textFilteringEnabled = false; -+ } -+ -+ @ApiStatus.Internal -+ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull Map, ?> options) { -+ super(player); -+ -+ this.locale = (String) options.get(ClientOption.LOCALE); -+ this.viewDistance = (int) options.get(ClientOption.VIEW_DISTANCE); -+ this.chatVisibility = (ChatVisibility) options.get(ClientOption.CHAT_VISIBILITY); -+ this.chatColors = (boolean) options.get(ClientOption.CHAT_COLORS_ENABLED); -+ this.skinparts = (SkinParts) options.get(ClientOption.SKIN_PARTS); -+ this.mainHand = (MainHand) options.get(ClientOption.MAIN_HAND); -+ this.allowsServerListings = (boolean) options.get(ClientOption.ALLOW_SERVER_LISTINGS); -+ this.textFilteringEnabled = (boolean) options.get(ClientOption.TEXT_FILTERING_ENABLED); -+ } -+ -+ @NotNull -+ public String getLocale() { -+ return this.locale; -+ } -+ -+ public boolean hasLocaleChanged() { -+ return !this.locale.equals(this.player.getClientOption(ClientOption.LOCALE)); -+ } -+ -+ public int getViewDistance() { -+ return this.viewDistance; -+ } -+ -+ public boolean hasViewDistanceChanged() { -+ return this.viewDistance != this.player.getClientOption(ClientOption.VIEW_DISTANCE); -+ } -+ -+ @NotNull -+ public ChatVisibility getChatVisibility() { -+ return this.chatVisibility; -+ } -+ -+ public boolean hasChatVisibilityChanged() { -+ return this.chatVisibility != this.player.getClientOption(ClientOption.CHAT_VISIBILITY); -+ } -+ -+ public boolean hasChatColorsEnabled() { -+ return this.chatColors; -+ } -+ -+ public boolean hasChatColorsEnabledChanged() { -+ return this.chatColors != this.player.getClientOption(ClientOption.CHAT_COLORS_ENABLED); -+ } -+ -+ @NotNull -+ public SkinParts getSkinParts() { -+ return this.skinparts; -+ } -+ -+ public boolean hasSkinPartsChanged() { -+ return this.skinparts.getRaw() != this.player.getClientOption(ClientOption.SKIN_PARTS).getRaw(); -+ } -+ -+ @NotNull -+ public MainHand getMainHand() { -+ return this.mainHand; -+ } -+ -+ public boolean hasMainHandChanged() { -+ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND); -+ } -+ -+ public boolean allowsServerListings() { -+ return this.allowsServerListings; -+ } -+ -+ public boolean hasAllowServerListingsChanged() { -+ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS); -+ } -+ -+ public boolean hasTextFilteringEnabled() { -+ return this.textFilteringEnabled; -+ } -+ -+ public boolean hasTextFilteringChanged() { -+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED); -+ } -+ -+ @Override -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 33547e9e3f8f7c906a5d91b75eb62327cc1f2a3a..7429666fd1af4f4a924cf93572df5b826782af05 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3282,6 +3282,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void resetCooldown(); - // Paper end - attack cooldown API - -+ // Paper start - client option API -+ /** -+ * @return the client option value of the player -+ */ -+ @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption option); -+ // Paper end - client option API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/0189-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/api/0189-Add-PlayerAttackEntityCooldownResetEvent.patch new file mode 100644 index 0000000000..c3cfd0642b --- /dev/null +++ b/patches/api/0189-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nossr50 +Date: Thu, 26 Mar 2020 19:30:58 -0700 +Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5ceaff1a499d08575ddcdcbead8e2cef6cfbea47 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java +@@ -0,0 +1,77 @@ ++package com.destroystokyo.paper.event.player; ++ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when processing a player's attack on an entity when the player's attack strength cooldown is reset ++ */ ++public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final Entity attackedEntity; ++ private final float cooledAttackStrength; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerAttackEntityCooldownResetEvent(@NotNull Player player, @NotNull Entity attackedEntity, float cooledAttackStrength) { ++ super(player); ++ this.attackedEntity = attackedEntity; ++ this.cooledAttackStrength = cooledAttackStrength; ++ } ++ ++ /** ++ * Get the value of the players cooldown attack strength when they initiated the attack ++ * ++ * @return returns the original player cooldown value ++ */ ++ public float getCooledAttackStrength() { ++ return this.cooledAttackStrength; ++ } ++ ++ /** ++ * Returns the entity attacked by the player ++ * ++ * @return the entity attacked by the player ++ */ ++ @NotNull ++ public Entity getAttackedEntity() { ++ return this.attackedEntity; ++ } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset. ++ */ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0190-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/api/0190-Add-PlayerAttackEntityCooldownResetEvent.patch deleted file mode 100644 index c3cfd0642b..0000000000 --- a/patches/api/0190-Add-PlayerAttackEntityCooldownResetEvent.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: nossr50 -Date: Thu, 26 Mar 2020 19:30:58 -0700 -Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5ceaff1a499d08575ddcdcbead8e2cef6cfbea47 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java -@@ -0,0 +1,77 @@ -+package com.destroystokyo.paper.event.player; -+ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when processing a player's attack on an entity when the player's attack strength cooldown is reset -+ */ -+public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final Entity attackedEntity; -+ private final float cooledAttackStrength; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerAttackEntityCooldownResetEvent(@NotNull Player player, @NotNull Entity attackedEntity, float cooledAttackStrength) { -+ super(player); -+ this.attackedEntity = attackedEntity; -+ this.cooledAttackStrength = cooledAttackStrength; -+ } -+ -+ /** -+ * Get the value of the players cooldown attack strength when they initiated the attack -+ * -+ * @return returns the original player cooldown value -+ */ -+ public float getCooledAttackStrength() { -+ return this.cooledAttackStrength; -+ } -+ -+ /** -+ * Returns the entity attacked by the player -+ * -+ * @return the entity attacked by the player -+ */ -+ @NotNull -+ public Entity getAttackedEntity() { -+ return this.attackedEntity; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset. -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0190-Add-item-slot-convenience-methods.patch b/patches/api/0190-Add-item-slot-convenience-methods.patch new file mode 100644 index 0000000000..20638212e8 --- /dev/null +++ b/patches/api/0190-Add-item-slot-convenience-methods.patch @@ -0,0 +1,330 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 25 Apr 2020 23:31:28 +0200 +Subject: [PATCH] Add item slot convenience methods + +Co-authored-by: Janet Blackquill + +diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java +index 52519cd877017704b53d36088d4d4c28f8f27397..c60be4fd24c7fdf65251dd6169e5e1ac3b588d95 100644 +--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java ++++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java +@@ -63,4 +63,64 @@ public interface AnvilInventory extends Inventory { + * @param levels the maximum experience cost + */ + void setMaximumRepairCost(int levels); ++ ++ // Paper start ++ /** ++ * Gets the item in the left input slot. ++ * ++ * @return item in the first slot ++ */ ++ @Nullable ++ default ItemStack getFirstItem() { ++ return getItem(0); ++ } ++ ++ /** ++ * Sets the item in the left input slot. ++ * ++ * @param firstItem item to set ++ */ ++ default void setFirstItem(@Nullable ItemStack firstItem) { ++ setItem(0, firstItem); ++ } ++ ++ /** ++ * Gets the item in the right input slot. ++ * ++ * @return item in the second slot ++ */ ++ @Nullable ++ default ItemStack getSecondItem() { ++ return getItem(1); ++ } ++ ++ /** ++ * Sets the item in the right input slot. ++ * ++ * @param secondItem item to set ++ */ ++ default void setSecondItem(@Nullable ItemStack secondItem) { ++ setItem(1, secondItem); ++ } ++ ++ /** ++ * Gets the item in the result slot. ++ * ++ * @return item in the result slot ++ */ ++ @Nullable ++ default ItemStack getResult() { ++ return getItem(2); ++ } ++ ++ /** ++ * Sets the item in the result slot. ++ * Note that the client might not be able to take out the item if it does not match the input items. ++ * ++ * @param result item to set ++ */ ++ default void setResult(@Nullable ItemStack result) { ++ setItem(2, result); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/CartographyInventory.java b/src/main/java/org/bukkit/inventory/CartographyInventory.java +index 29c9b2682b92433f468d434d25d3c2495b5ac91b..d040ecea3a086711acbf5a852def090ba6c51fae 100644 +--- a/src/main/java/org/bukkit/inventory/CartographyInventory.java ++++ b/src/main/java/org/bukkit/inventory/CartographyInventory.java +@@ -3,4 +3,25 @@ package org.bukkit.inventory; + /** + * Interface to the inventory of a Cartography table. + */ +-public interface CartographyInventory extends Inventory { } ++public interface CartographyInventory extends Inventory { ++ // Paper begin - add getResult/setResult to CartographyInventory ++ /** ++ * Check what item is in the result slot of this smithing table. ++ * ++ * @return the result item ++ */ ++ @org.jetbrains.annotations.Nullable ++ default ItemStack getResult() { ++ return this.getItem(2); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT ++ } ++ ++ /** ++ * Set the item in the result slot of the smithing table ++ * ++ * @param newResult the new result item ++ */ ++ default void setResult(final @org.jetbrains.annotations.Nullable ItemStack newResult) { ++ this.setItem(2, newResult); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT ++ } ++ // Paper end - add getResult/setResult to CartographyInventory ++} +diff --git a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java +index 9048892c8768c6b4d6cea03da73339f13bfbe82e..1c750108f55a0a31ad23433b333e0ea486a63ff2 100644 +--- a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java ++++ b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java +@@ -1,6 +1,68 @@ + package org.bukkit.inventory; + ++import org.jetbrains.annotations.Nullable; // Paper ++ + /** + * Interface to the inventory of a Grindstone. + */ +-public interface GrindstoneInventory extends Inventory { } ++public interface GrindstoneInventory extends Inventory { ++ ++ // Paper start ++ /** ++ * Gets the upper input item. ++ * ++ * @return upper input item ++ */ ++ @Nullable ++ default ItemStack getUpperItem() { ++ return getItem(0); ++ } ++ ++ /** ++ * Sets the upper input item. ++ * ++ * @param upperItem item to set ++ */ ++ default void setUpperItem(@Nullable ItemStack upperItem) { ++ setItem(0, upperItem); ++ } ++ ++ /** ++ * Gets the lower input item. ++ * ++ * @return lower input item ++ */ ++ @Nullable ++ default ItemStack getLowerItem() { ++ return getItem(1); ++ } ++ ++ /** ++ * Sets the lower input item. ++ * ++ * @param lowerItem item to set ++ */ ++ default void setLowerItem(@Nullable ItemStack lowerItem) { ++ setItem(1, lowerItem); ++ } ++ ++ /** ++ * Gets the result. ++ * ++ * @return result ++ */ ++ @Nullable ++ default ItemStack getResult() { ++ return getItem(2); ++ } ++ ++ /** ++ * Sets the result. ++ * ++ * @param result item to set ++ */ ++ default void setResult(@Nullable ItemStack result) { ++ setItem(2, result); ++ } ++ // Paper end ++} +diff --git a/src/main/java/org/bukkit/inventory/LecternInventory.java b/src/main/java/org/bukkit/inventory/LecternInventory.java +index 4a0c43acc2714e095973eb78536041bb1a179ddc..acf2244f77133df53eb5f862c8e713c85192f13d 100644 +--- a/src/main/java/org/bukkit/inventory/LecternInventory.java ++++ b/src/main/java/org/bukkit/inventory/LecternInventory.java +@@ -11,4 +11,25 @@ public interface LecternInventory extends Inventory { + @Nullable + @Override + public Lectern getHolder(); ++ ++ // Paper start ++ /** ++ * Gets the lectern's held book. ++ * ++ * @return book set in the lectern ++ */ ++ @Nullable ++ default ItemStack getBook() { ++ return getItem(0); ++ } ++ ++ /** ++ * Sets the lectern's held book. ++ * ++ * @param book the new book ++ */ ++ default void setBook(@Nullable ItemStack book) { ++ setItem(0, book); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/SmithingInventory.java b/src/main/java/org/bukkit/inventory/SmithingInventory.java +index 96d526b7b153e56c9a97de42ce3270b6638510e4..5ed72b7305428f6be98a86fa9aa174d1b8ad4c17 100644 +--- a/src/main/java/org/bukkit/inventory/SmithingInventory.java ++++ b/src/main/java/org/bukkit/inventory/SmithingInventory.java +@@ -30,4 +30,59 @@ public interface SmithingInventory extends Inventory { + */ + @Nullable + Recipe getRecipe(); ++ ++ // Paper start ++ /** ++ * Gets the input template (first slot). ++ * ++ * @return input template item ++ */ ++ default @Nullable ItemStack getInputTemplate() { ++ return this.getItem(0); ++ } ++ ++ /** ++ * Sets the input template (first slot). ++ * ++ * @param itemStack item to set ++ */ ++ default void setInputTemplate(@Nullable ItemStack itemStack) { ++ this.setItem(0, itemStack); ++ } ++ /** ++ * Gets the input equipment (second slot). ++ * ++ * @return input equipment item ++ */ ++ default @Nullable ItemStack getInputEquipment() { ++ return this.getItem(1); ++ } ++ ++ /** ++ * Sets the input equipment (second slot). ++ * ++ * @param itemStack item to set ++ */ ++ default void setInputEquipment(@Nullable ItemStack itemStack) { ++ this.setItem(1, itemStack); ++ } ++ ++ /** ++ * Gets the input mineral (third slot). ++ * ++ * @return input mineral item ++ */ ++ default @Nullable ItemStack getInputMineral() { ++ return this.getItem(2); ++ } ++ ++ /** ++ * Sets the input mineral (third slot). ++ * ++ * @param itemStack item to set ++ */ ++ default void setInputMineral(@Nullable ItemStack itemStack) { ++ this.setItem(2, itemStack); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/StonecutterInventory.java b/src/main/java/org/bukkit/inventory/StonecutterInventory.java +index dbb034fae3b8bfaf40e6341460e274c21e321a3b..e7a8e7188bf8b9840de56dc80c2b79d64a9389cb 100644 +--- a/src/main/java/org/bukkit/inventory/StonecutterInventory.java ++++ b/src/main/java/org/bukkit/inventory/StonecutterInventory.java +@@ -1,6 +1,49 @@ + package org.bukkit.inventory; + ++import org.jetbrains.annotations.Nullable; // Paper ++ + /** + * Interface to the inventory of a Stonecutter. + */ +-public interface StonecutterInventory extends Inventory { } ++public interface StonecutterInventory extends Inventory { ++ ++ // Paper start ++ /** ++ * Gets the input item. ++ * ++ * @return input item ++ */ ++ @Nullable ++ default ItemStack getInputItem() { ++ return getItem(0); ++ } ++ ++ /** ++ * Sets the input item. ++ * ++ * @param itemStack item to set ++ */ ++ default void setInputItem(@Nullable ItemStack itemStack) { ++ setItem(0, itemStack); ++ } ++ ++ /** ++ * Gets the result item. ++ * ++ * @return result ++ */ ++ @Nullable ++ default ItemStack getResult() { ++ return getItem(1); ++ } ++ ++ /** ++ * Sets the result item. ++ * ++ * @param itemStack item to set ++ */ ++ default void setResult(@Nullable ItemStack itemStack) { ++ setItem(1, itemStack); ++ } ++ // Paper end ++} diff --git a/patches/api/0191-Add-item-slot-convenience-methods.patch b/patches/api/0191-Add-item-slot-convenience-methods.patch deleted file mode 100644 index 20638212e8..0000000000 --- a/patches/api/0191-Add-item-slot-convenience-methods.patch +++ /dev/null @@ -1,330 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sat, 25 Apr 2020 23:31:28 +0200 -Subject: [PATCH] Add item slot convenience methods - -Co-authored-by: Janet Blackquill - -diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java -index 52519cd877017704b53d36088d4d4c28f8f27397..c60be4fd24c7fdf65251dd6169e5e1ac3b588d95 100644 ---- a/src/main/java/org/bukkit/inventory/AnvilInventory.java -+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java -@@ -63,4 +63,64 @@ public interface AnvilInventory extends Inventory { - * @param levels the maximum experience cost - */ - void setMaximumRepairCost(int levels); -+ -+ // Paper start -+ /** -+ * Gets the item in the left input slot. -+ * -+ * @return item in the first slot -+ */ -+ @Nullable -+ default ItemStack getFirstItem() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the item in the left input slot. -+ * -+ * @param firstItem item to set -+ */ -+ default void setFirstItem(@Nullable ItemStack firstItem) { -+ setItem(0, firstItem); -+ } -+ -+ /** -+ * Gets the item in the right input slot. -+ * -+ * @return item in the second slot -+ */ -+ @Nullable -+ default ItemStack getSecondItem() { -+ return getItem(1); -+ } -+ -+ /** -+ * Sets the item in the right input slot. -+ * -+ * @param secondItem item to set -+ */ -+ default void setSecondItem(@Nullable ItemStack secondItem) { -+ setItem(1, secondItem); -+ } -+ -+ /** -+ * Gets the item in the result slot. -+ * -+ * @return item in the result slot -+ */ -+ @Nullable -+ default ItemStack getResult() { -+ return getItem(2); -+ } -+ -+ /** -+ * Sets the item in the result slot. -+ * Note that the client might not be able to take out the item if it does not match the input items. -+ * -+ * @param result item to set -+ */ -+ default void setResult(@Nullable ItemStack result) { -+ setItem(2, result); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/CartographyInventory.java b/src/main/java/org/bukkit/inventory/CartographyInventory.java -index 29c9b2682b92433f468d434d25d3c2495b5ac91b..d040ecea3a086711acbf5a852def090ba6c51fae 100644 ---- a/src/main/java/org/bukkit/inventory/CartographyInventory.java -+++ b/src/main/java/org/bukkit/inventory/CartographyInventory.java -@@ -3,4 +3,25 @@ package org.bukkit.inventory; - /** - * Interface to the inventory of a Cartography table. - */ --public interface CartographyInventory extends Inventory { } -+public interface CartographyInventory extends Inventory { -+ // Paper begin - add getResult/setResult to CartographyInventory -+ /** -+ * Check what item is in the result slot of this smithing table. -+ * -+ * @return the result item -+ */ -+ @org.jetbrains.annotations.Nullable -+ default ItemStack getResult() { -+ return this.getItem(2); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT -+ } -+ -+ /** -+ * Set the item in the result slot of the smithing table -+ * -+ * @param newResult the new result item -+ */ -+ default void setResult(final @org.jetbrains.annotations.Nullable ItemStack newResult) { -+ this.setItem(2, newResult); // net.minecraft.world.inventory.CartographyTableMenu.RESULT_SLOT -+ } -+ // Paper end - add getResult/setResult to CartographyInventory -+} -diff --git a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java -index 9048892c8768c6b4d6cea03da73339f13bfbe82e..1c750108f55a0a31ad23433b333e0ea486a63ff2 100644 ---- a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java -+++ b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java -@@ -1,6 +1,68 @@ - package org.bukkit.inventory; - -+import org.jetbrains.annotations.Nullable; // Paper -+ - /** - * Interface to the inventory of a Grindstone. - */ --public interface GrindstoneInventory extends Inventory { } -+public interface GrindstoneInventory extends Inventory { -+ -+ // Paper start -+ /** -+ * Gets the upper input item. -+ * -+ * @return upper input item -+ */ -+ @Nullable -+ default ItemStack getUpperItem() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the upper input item. -+ * -+ * @param upperItem item to set -+ */ -+ default void setUpperItem(@Nullable ItemStack upperItem) { -+ setItem(0, upperItem); -+ } -+ -+ /** -+ * Gets the lower input item. -+ * -+ * @return lower input item -+ */ -+ @Nullable -+ default ItemStack getLowerItem() { -+ return getItem(1); -+ } -+ -+ /** -+ * Sets the lower input item. -+ * -+ * @param lowerItem item to set -+ */ -+ default void setLowerItem(@Nullable ItemStack lowerItem) { -+ setItem(1, lowerItem); -+ } -+ -+ /** -+ * Gets the result. -+ * -+ * @return result -+ */ -+ @Nullable -+ default ItemStack getResult() { -+ return getItem(2); -+ } -+ -+ /** -+ * Sets the result. -+ * -+ * @param result item to set -+ */ -+ default void setResult(@Nullable ItemStack result) { -+ setItem(2, result); -+ } -+ // Paper end -+} -diff --git a/src/main/java/org/bukkit/inventory/LecternInventory.java b/src/main/java/org/bukkit/inventory/LecternInventory.java -index 4a0c43acc2714e095973eb78536041bb1a179ddc..acf2244f77133df53eb5f862c8e713c85192f13d 100644 ---- a/src/main/java/org/bukkit/inventory/LecternInventory.java -+++ b/src/main/java/org/bukkit/inventory/LecternInventory.java -@@ -11,4 +11,25 @@ public interface LecternInventory extends Inventory { - @Nullable - @Override - public Lectern getHolder(); -+ -+ // Paper start -+ /** -+ * Gets the lectern's held book. -+ * -+ * @return book set in the lectern -+ */ -+ @Nullable -+ default ItemStack getBook() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the lectern's held book. -+ * -+ * @param book the new book -+ */ -+ default void setBook(@Nullable ItemStack book) { -+ setItem(0, book); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/SmithingInventory.java b/src/main/java/org/bukkit/inventory/SmithingInventory.java -index 96d526b7b153e56c9a97de42ce3270b6638510e4..5ed72b7305428f6be98a86fa9aa174d1b8ad4c17 100644 ---- a/src/main/java/org/bukkit/inventory/SmithingInventory.java -+++ b/src/main/java/org/bukkit/inventory/SmithingInventory.java -@@ -30,4 +30,59 @@ public interface SmithingInventory extends Inventory { - */ - @Nullable - Recipe getRecipe(); -+ -+ // Paper start -+ /** -+ * Gets the input template (first slot). -+ * -+ * @return input template item -+ */ -+ default @Nullable ItemStack getInputTemplate() { -+ return this.getItem(0); -+ } -+ -+ /** -+ * Sets the input template (first slot). -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputTemplate(@Nullable ItemStack itemStack) { -+ this.setItem(0, itemStack); -+ } -+ /** -+ * Gets the input equipment (second slot). -+ * -+ * @return input equipment item -+ */ -+ default @Nullable ItemStack getInputEquipment() { -+ return this.getItem(1); -+ } -+ -+ /** -+ * Sets the input equipment (second slot). -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputEquipment(@Nullable ItemStack itemStack) { -+ this.setItem(1, itemStack); -+ } -+ -+ /** -+ * Gets the input mineral (third slot). -+ * -+ * @return input mineral item -+ */ -+ default @Nullable ItemStack getInputMineral() { -+ return this.getItem(2); -+ } -+ -+ /** -+ * Sets the input mineral (third slot). -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputMineral(@Nullable ItemStack itemStack) { -+ this.setItem(2, itemStack); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/StonecutterInventory.java b/src/main/java/org/bukkit/inventory/StonecutterInventory.java -index dbb034fae3b8bfaf40e6341460e274c21e321a3b..e7a8e7188bf8b9840de56dc80c2b79d64a9389cb 100644 ---- a/src/main/java/org/bukkit/inventory/StonecutterInventory.java -+++ b/src/main/java/org/bukkit/inventory/StonecutterInventory.java -@@ -1,6 +1,49 @@ - package org.bukkit.inventory; - -+import org.jetbrains.annotations.Nullable; // Paper -+ - /** - * Interface to the inventory of a Stonecutter. - */ --public interface StonecutterInventory extends Inventory { } -+public interface StonecutterInventory extends Inventory { -+ -+ // Paper start -+ /** -+ * Gets the input item. -+ * -+ * @return input item -+ */ -+ @Nullable -+ default ItemStack getInputItem() { -+ return getItem(0); -+ } -+ -+ /** -+ * Sets the input item. -+ * -+ * @param itemStack item to set -+ */ -+ default void setInputItem(@Nullable ItemStack itemStack) { -+ setItem(0, itemStack); -+ } -+ -+ /** -+ * Gets the result item. -+ * -+ * @return result -+ */ -+ @Nullable -+ default ItemStack getResult() { -+ return getItem(1); -+ } -+ -+ /** -+ * Sets the result item. -+ * -+ * @param itemStack item to set -+ */ -+ default void setResult(@Nullable ItemStack itemStack) { -+ setItem(1, itemStack); -+ } -+ // Paper end -+} diff --git a/patches/api/0191-Villager-Restocks-API.patch b/patches/api/0191-Villager-Restocks-API.patch new file mode 100644 index 0000000000..5b3898429d --- /dev/null +++ b/patches/api/0191-Villager-Restocks-API.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: zbk +Date: Sun, 26 Apr 2020 23:49:03 -0400 +Subject: [PATCH] Villager Restocks API + + +diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java +index a91400cd8bb4c72d1f3200a17f6de025540fe09d..4128b848ec739308694d54d9e859c28185f42a63 100644 +--- a/src/main/java/org/bukkit/entity/Villager.java ++++ b/src/main/java/org/bukkit/entity/Villager.java +@@ -78,6 +78,20 @@ public interface Villager extends AbstractVillager { + */ + public void setVillagerExperience(int experience); + ++ // Paper start ++ /** ++ * Gets the amount of times a villager has restocked their trades today ++ * @return The amount of trade restocks. ++ */ ++ public int getRestocksToday(); ++ ++ /** ++ * Sets the amount of times a villager has restocked their trades today ++ * @param restocksToday new restock count ++ */ ++ public void setRestocksToday(int restocksToday); ++ // Paper end ++ + /** + * Attempts to make this villager sleep at the given location. + *
diff --git a/patches/api/0192-Expose-game-version.patch b/patches/api/0192-Expose-game-version.patch new file mode 100644 index 0000000000..785d8563d2 --- /dev/null +++ b/patches/api/0192-Expose-game-version.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa +Date: Fri, 1 May 2020 17:39:02 +0300 +Subject: [PATCH] Expose game version + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index f24d57a89dc4fdf73298bbb4cc187794c7bd6706..b608a6dc26bfc6d08f1e31107fed8ef1aaf90e1d 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -161,6 +161,18 @@ public final class Bukkit { + return server.getBukkitVersion(); + } + ++ // Paper start - expose game version ++ /** ++ * Gets the version of game this server implements ++ * ++ * @return version of game ++ */ ++ @NotNull ++ public static String getMinecraftVersion() { ++ return server.getMinecraftVersion(); ++ } ++ // Paper end ++ + /** + * Gets a view of all currently logged in players. This {@linkplain + * Collections#unmodifiableCollection(Collection) view} is a reused +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 015f1167bdc752fe6665807866caa0cda5ba0571..987e01f48f7f8b19fd6292a11988b1aeb90a09f6 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -119,6 +119,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @NotNull + public String getBukkitVersion(); + ++ // Paper start - expose game version ++ /** ++ * Gets the version of game this server implements ++ * ++ * @return version of game ++ */ ++ @NotNull ++ String getMinecraftVersion(); ++ // Paper end ++ + /** + * Gets a view of all currently logged in players. This {@linkplain + * Collections#unmodifiableCollection(Collection) view} is a reused diff --git a/patches/api/0192-Villager-Restocks-API.patch b/patches/api/0192-Villager-Restocks-API.patch deleted file mode 100644 index 5b3898429d..0000000000 --- a/patches/api/0192-Villager-Restocks-API.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: zbk -Date: Sun, 26 Apr 2020 23:49:03 -0400 -Subject: [PATCH] Villager Restocks API - - -diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index a91400cd8bb4c72d1f3200a17f6de025540fe09d..4128b848ec739308694d54d9e859c28185f42a63 100644 ---- a/src/main/java/org/bukkit/entity/Villager.java -+++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -78,6 +78,20 @@ public interface Villager extends AbstractVillager { - */ - public void setVillagerExperience(int experience); - -+ // Paper start -+ /** -+ * Gets the amount of times a villager has restocked their trades today -+ * @return The amount of trade restocks. -+ */ -+ public int getRestocksToday(); -+ -+ /** -+ * Sets the amount of times a villager has restocked their trades today -+ * @param restocksToday new restock count -+ */ -+ public void setRestocksToday(int restocksToday); -+ // Paper end -+ - /** - * Attempts to make this villager sleep at the given location. - *
diff --git a/patches/api/0193-Add-Mob-Goal-API.patch b/patches/api/0193-Add-Mob-Goal-API.patch new file mode 100644 index 0000000000..102b780fac --- /dev/null +++ b/patches/api/0193-Add-Mob-Goal-API.patch @@ -0,0 +1,266 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MiniDigger +Date: Fri, 3 Jan 2020 16:24:46 +0100 +Subject: [PATCH] Add Mob Goal API + + +diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c57c5416c88e2070a082403ab0dda9d7f08d2a57 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java +@@ -0,0 +1,66 @@ ++package com.destroystokyo.paper.entity.ai; ++ ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.EnumSet; ++ ++import org.bukkit.entity.Mob; ++ ++/** ++ * Represents an AI goal of an entity ++ */ ++public interface Goal { ++ ++ /** ++ * Checks if this goal should be activated ++ * ++ * @return if this goal should be activated ++ */ ++ boolean shouldActivate(); ++ ++ /** ++ * Checks if this goal should stay active, defaults to {@link Goal#shouldActivate()} ++ * ++ * @return if this goal should stay active ++ */ ++ default boolean shouldStayActive() { ++ return shouldActivate(); ++ } ++ ++ /** ++ * Called when this goal gets activated ++ */ ++ default void start() { ++ } ++ ++ /** ++ * Called when this goal gets stopped ++ */ ++ default void stop() { ++ } ++ ++ /** ++ * Called each tick the goal is activated ++ */ ++ default void tick() { ++ } ++ ++ /** ++ * A unique key that identifies this type of goal. Plugins should use their own namespace, not the minecraft ++ * namespace. Additionally, this key also specifies to what mobs this goal can be applied to ++ * ++ * @return the goal key ++ */ ++ @NotNull ++ GoalKey getKey(); ++ ++ /** ++ * Returns a list of all applicable flags for this goal.
++ * ++ * This method is only called on construction. ++ * ++ * @return the subtypes. ++ */ ++ @NotNull ++ EnumSet getTypes(); ++} +diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9cd98c6fcfa3eb439d9013ef76ef4661175a0e5a +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java +@@ -0,0 +1,64 @@ ++package com.destroystokyo.paper.entity.ai; ++ ++import com.google.common.base.Objects; ++ ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.StringJoiner; ++ ++import org.bukkit.NamespacedKey; ++import org.bukkit.entity.Mob; ++ ++/** ++ * ++ * Used to identify a Goal. Consists of a {@link NamespacedKey} and the type of mob the goal can be applied to ++ * ++ * @param the type of mob the goal can be applied to ++ */ ++public class GoalKey { ++ ++ private final Class entityClass; ++ private final NamespacedKey namespacedKey; ++ ++ private GoalKey(@NotNull Class entityClass, @NotNull NamespacedKey namespacedKey) { ++ this.entityClass = entityClass; ++ this.namespacedKey = namespacedKey; ++ } ++ ++ @NotNull ++ public Class getEntityClass() { ++ return entityClass; ++ } ++ ++ @NotNull ++ public NamespacedKey getNamespacedKey() { ++ return namespacedKey; ++ } ++ ++ @Override ++ public boolean equals(Object o) { ++ if (this == o) return true; ++ if (o == null || getClass() != o.getClass()) return false; ++ GoalKey goalKey = (GoalKey) o; ++ return Objects.equal(entityClass, goalKey.entityClass) && ++ Objects.equal(namespacedKey, goalKey.namespacedKey); ++ } ++ ++ @Override ++ public int hashCode() { ++ return Objects.hashCode(entityClass, namespacedKey); ++ } ++ ++ @Override ++ public String toString() { ++ return new StringJoiner(", ", GoalKey.class.getSimpleName() + "[", "]") ++ .add("entityClass=" + entityClass) ++ .add("namespacedKey=" + namespacedKey) ++ .toString(); ++ } ++ ++ @NotNull ++ public static GoalKey of(@NotNull Class entityClass, @NotNull NamespacedKey namespacedKey) { ++ return new GoalKey<>(entityClass, namespacedKey); ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7024c8f484d2460abf3abfe65a29771d814105ec +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java +@@ -0,0 +1,17 @@ ++package com.destroystokyo.paper.entity.ai; ++ ++/** ++ * Represents the subtype of a goal. Used by minecraft to disable certain types of goals if needed. ++ */ ++public enum GoalType { ++ ++ MOVE, ++ LOOK, ++ JUMP, ++ TARGET, ++ /** ++ * Used to map vanilla goals, that are a behavior goal but don't have a type set... ++ */ ++ UNKNOWN_BEHAVIOR, ++ ++} +diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e21f7574763dd4f13794f91bbef192ef66a8f5e9 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java +@@ -0,0 +1,50 @@ ++package com.destroystokyo.paper.entity.ai; ++ ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.Collection; ++ ++import org.bukkit.entity.Mob; ++ ++/** ++ * Represents a part of the "brain" of a mob. It tracks all tasks (running or not), allows adding and removing goals ++ */ ++public interface MobGoals { ++ ++ void addGoal(@NotNull T mob, int priority, @NotNull Goal goal); ++ ++ void removeGoal(@NotNull T mob, @NotNull Goal goal); ++ ++ void removeAllGoals(@NotNull T mob); ++ ++ void removeAllGoals(@NotNull T mob, @NotNull GoalType type); ++ ++ void removeGoal(@NotNull T mob, @NotNull GoalKey key); ++ ++ boolean hasGoal(@NotNull T mob, @NotNull GoalKey key); ++ ++ @Nullable ++ Goal getGoal(@NotNull T mob, @NotNull GoalKey key); ++ ++ @NotNull ++ Collection> getGoals(@NotNull T mob, @NotNull GoalKey key); ++ ++ @NotNull ++ Collection> getAllGoals(@NotNull T mob); ++ ++ @NotNull ++ Collection> getAllGoals(@NotNull T mob, @NotNull GoalType type); ++ ++ @NotNull ++ Collection> getAllGoalsWithout(@NotNull T mob, @NotNull GoalType type); ++ ++ @NotNull ++ Collection> getRunningGoals(@NotNull T mob); ++ ++ @NotNull ++ Collection> getRunningGoals(@NotNull T mob, @NotNull GoalType type); ++ ++ @NotNull ++ Collection> getRunningGoalsWithout(@NotNull T mob, @NotNull GoalType type); ++} +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index b608a6dc26bfc6d08f1e31107fed8ef1aaf90e1d..79db7b5c25a7c824b107a5c79f40c61983d2757c 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2542,6 +2542,16 @@ public final class Bukkit { + public static boolean isStopping() { + return server.isStopping(); + } ++ ++ /** ++ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager ++ * ++ * @return the mob goals manager ++ */ ++ @NotNull ++ public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { ++ return server.getMobGoals(); ++ } + // Paper end + + @NotNull +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 987e01f48f7f8b19fd6292a11988b1aeb90a09f6..8aba385b9d1a9b71c3304f1d802f18d4434f34d5 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2213,5 +2213,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * @return true if server is in the process of being shutdown + */ + boolean isStopping(); ++ ++ /** ++ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager ++ * ++ * @return the mob goals manager ++ */ ++ @NotNull ++ com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); + // Paper end + } diff --git a/patches/api/0193-Expose-game-version.patch b/patches/api/0193-Expose-game-version.patch deleted file mode 100644 index 785d8563d2..0000000000 --- a/patches/api/0193-Expose-game-version.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Fri, 1 May 2020 17:39:02 +0300 -Subject: [PATCH] Expose game version - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index f24d57a89dc4fdf73298bbb4cc187794c7bd6706..b608a6dc26bfc6d08f1e31107fed8ef1aaf90e1d 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -161,6 +161,18 @@ public final class Bukkit { - return server.getBukkitVersion(); - } - -+ // Paper start - expose game version -+ /** -+ * Gets the version of game this server implements -+ * -+ * @return version of game -+ */ -+ @NotNull -+ public static String getMinecraftVersion() { -+ return server.getMinecraftVersion(); -+ } -+ // Paper end -+ - /** - * Gets a view of all currently logged in players. This {@linkplain - * Collections#unmodifiableCollection(Collection) view} is a reused -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 015f1167bdc752fe6665807866caa0cda5ba0571..987e01f48f7f8b19fd6292a11988b1aeb90a09f6 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -119,6 +119,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public String getBukkitVersion(); - -+ // Paper start - expose game version -+ /** -+ * Gets the version of game this server implements -+ * -+ * @return version of game -+ */ -+ @NotNull -+ String getMinecraftVersion(); -+ // Paper end -+ - /** - * Gets a view of all currently logged in players. This {@linkplain - * Collections#unmodifiableCollection(Collection) view} is a reused diff --git a/patches/api/0194-Add-Mob-Goal-API.patch b/patches/api/0194-Add-Mob-Goal-API.patch deleted file mode 100644 index 102b780fac..0000000000 --- a/patches/api/0194-Add-Mob-Goal-API.patch +++ /dev/null @@ -1,266 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger -Date: Fri, 3 Jan 2020 16:24:46 +0100 -Subject: [PATCH] Add Mob Goal API - - -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c57c5416c88e2070a082403ab0dda9d7f08d2a57 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java -@@ -0,0 +1,66 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.EnumSet; -+ -+import org.bukkit.entity.Mob; -+ -+/** -+ * Represents an AI goal of an entity -+ */ -+public interface Goal { -+ -+ /** -+ * Checks if this goal should be activated -+ * -+ * @return if this goal should be activated -+ */ -+ boolean shouldActivate(); -+ -+ /** -+ * Checks if this goal should stay active, defaults to {@link Goal#shouldActivate()} -+ * -+ * @return if this goal should stay active -+ */ -+ default boolean shouldStayActive() { -+ return shouldActivate(); -+ } -+ -+ /** -+ * Called when this goal gets activated -+ */ -+ default void start() { -+ } -+ -+ /** -+ * Called when this goal gets stopped -+ */ -+ default void stop() { -+ } -+ -+ /** -+ * Called each tick the goal is activated -+ */ -+ default void tick() { -+ } -+ -+ /** -+ * A unique key that identifies this type of goal. Plugins should use their own namespace, not the minecraft -+ * namespace. Additionally, this key also specifies to what mobs this goal can be applied to -+ * -+ * @return the goal key -+ */ -+ @NotNull -+ GoalKey getKey(); -+ -+ /** -+ * Returns a list of all applicable flags for this goal.
-+ * -+ * This method is only called on construction. -+ * -+ * @return the subtypes. -+ */ -+ @NotNull -+ EnumSet getTypes(); -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9cd98c6fcfa3eb439d9013ef76ef4661175a0e5a ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java -@@ -0,0 +1,64 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+import com.google.common.base.Objects; -+ -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.StringJoiner; -+ -+import org.bukkit.NamespacedKey; -+import org.bukkit.entity.Mob; -+ -+/** -+ * -+ * Used to identify a Goal. Consists of a {@link NamespacedKey} and the type of mob the goal can be applied to -+ * -+ * @param the type of mob the goal can be applied to -+ */ -+public class GoalKey { -+ -+ private final Class entityClass; -+ private final NamespacedKey namespacedKey; -+ -+ private GoalKey(@NotNull Class entityClass, @NotNull NamespacedKey namespacedKey) { -+ this.entityClass = entityClass; -+ this.namespacedKey = namespacedKey; -+ } -+ -+ @NotNull -+ public Class getEntityClass() { -+ return entityClass; -+ } -+ -+ @NotNull -+ public NamespacedKey getNamespacedKey() { -+ return namespacedKey; -+ } -+ -+ @Override -+ public boolean equals(Object o) { -+ if (this == o) return true; -+ if (o == null || getClass() != o.getClass()) return false; -+ GoalKey goalKey = (GoalKey) o; -+ return Objects.equal(entityClass, goalKey.entityClass) && -+ Objects.equal(namespacedKey, goalKey.namespacedKey); -+ } -+ -+ @Override -+ public int hashCode() { -+ return Objects.hashCode(entityClass, namespacedKey); -+ } -+ -+ @Override -+ public String toString() { -+ return new StringJoiner(", ", GoalKey.class.getSimpleName() + "[", "]") -+ .add("entityClass=" + entityClass) -+ .add("namespacedKey=" + namespacedKey) -+ .toString(); -+ } -+ -+ @NotNull -+ public static
GoalKey of(@NotNull Class entityClass, @NotNull NamespacedKey namespacedKey) { -+ return new GoalKey<>(entityClass, namespacedKey); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7024c8f484d2460abf3abfe65a29771d814105ec ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java -@@ -0,0 +1,17 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+/** -+ * Represents the subtype of a goal. Used by minecraft to disable certain types of goals if needed. -+ */ -+public enum GoalType { -+ -+ MOVE, -+ LOOK, -+ JUMP, -+ TARGET, -+ /** -+ * Used to map vanilla goals, that are a behavior goal but don't have a type set... -+ */ -+ UNKNOWN_BEHAVIOR, -+ -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e21f7574763dd4f13794f91bbef192ef66a8f5e9 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java -@@ -0,0 +1,50 @@ -+package com.destroystokyo.paper.entity.ai; -+ -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.util.Collection; -+ -+import org.bukkit.entity.Mob; -+ -+/** -+ * Represents a part of the "brain" of a mob. It tracks all tasks (running or not), allows adding and removing goals -+ */ -+public interface MobGoals { -+ -+ void addGoal(@NotNull T mob, int priority, @NotNull Goal goal); -+ -+ void removeGoal(@NotNull T mob, @NotNull Goal goal); -+ -+ void removeAllGoals(@NotNull T mob); -+ -+ void removeAllGoals(@NotNull T mob, @NotNull GoalType type); -+ -+ void removeGoal(@NotNull T mob, @NotNull GoalKey key); -+ -+ boolean hasGoal(@NotNull T mob, @NotNull GoalKey key); -+ -+ @Nullable -+ Goal getGoal(@NotNull T mob, @NotNull GoalKey key); -+ -+ @NotNull -+ Collection> getGoals(@NotNull T mob, @NotNull GoalKey key); -+ -+ @NotNull -+ Collection> getAllGoals(@NotNull T mob); -+ -+ @NotNull -+ Collection> getAllGoals(@NotNull T mob, @NotNull GoalType type); -+ -+ @NotNull -+ Collection> getAllGoalsWithout(@NotNull T mob, @NotNull GoalType type); -+ -+ @NotNull -+ Collection> getRunningGoals(@NotNull T mob); -+ -+ @NotNull -+ Collection> getRunningGoals(@NotNull T mob, @NotNull GoalType type); -+ -+ @NotNull -+ Collection> getRunningGoalsWithout(@NotNull T mob, @NotNull GoalType type); -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index b608a6dc26bfc6d08f1e31107fed8ef1aaf90e1d..79db7b5c25a7c824b107a5c79f40c61983d2757c 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2542,6 +2542,16 @@ public final class Bukkit { - public static boolean isStopping() { - return server.isStopping(); - } -+ -+ /** -+ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager -+ * -+ * @return the mob goals manager -+ */ -+ @NotNull -+ public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { -+ return server.getMobGoals(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 987e01f48f7f8b19fd6292a11988b1aeb90a09f6..8aba385b9d1a9b71c3304f1d802f18d4434f34d5 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2213,5 +2213,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @return true if server is in the process of being shutdown - */ - boolean isStopping(); -+ -+ /** -+ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager -+ * -+ * @return the mob goals manager -+ */ -+ @NotNull -+ com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); - // Paper end - } diff --git a/patches/api/0194-Add-villager-reputation-API.patch b/patches/api/0194-Add-villager-reputation-API.patch new file mode 100644 index 0000000000..4a2093aab9 --- /dev/null +++ b/patches/api/0194-Add-villager-reputation-API.patch @@ -0,0 +1,175 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Wed, 22 Apr 2020 23:13:49 +0200 +Subject: [PATCH] Add villager reputation API + + +diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0a69e21b0b3001c9cc50951b4b8bd593f6fa74be +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java +@@ -0,0 +1,57 @@ ++package com.destroystokyo.paper.entity.villager; ++ ++import com.google.common.base.Preconditions; ++ ++import java.util.EnumMap; ++import java.util.Map; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A reputation score for a player on a villager. ++ */ ++public final class Reputation { ++ ++ @NotNull ++ private final Map reputation; ++ ++ public Reputation() { ++ this(new EnumMap<>(ReputationType.class)); ++ } ++ ++ public Reputation(@NotNull Map reputation) { ++ Preconditions.checkNotNull(reputation, "reputation cannot be null"); ++ this.reputation = reputation; ++ } ++ ++ /** ++ * Gets the reputation value for a specific {@link ReputationType}. ++ * ++ * @param type The {@link ReputationType type} of reputation to get. ++ * @return The value of the {@link ReputationType type}. ++ */ ++ public int getReputation(@NotNull ReputationType type) { ++ Preconditions.checkNotNull(type, "the reputation type cannot be null"); ++ return this.reputation.getOrDefault(type, 0); ++ } ++ ++ /** ++ * Sets the reputation value for a specific {@link ReputationType}. ++ * ++ * @param type The {@link ReputationType type} of reputation to set. ++ * @param value The value of the {@link ReputationType type}. ++ */ ++ public void setReputation(@NotNull ReputationType type, int value) { ++ Preconditions.checkNotNull(type, "the reputation type cannot be null"); ++ this.reputation.put(type, value); ++ } ++ ++ /** ++ * Gets if a reputation value is currently set for a specific {@link ReputationType}. ++ * ++ * @param type The {@link ReputationType type} to check ++ * @return If there is a value for this {@link ReputationType type} set. ++ */ ++ public boolean hasReputationSet(@NotNull ReputationType type) { ++ return this.reputation.containsKey(type); ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5600fcdc9795a9f49091db48d73bbd4964b8b737 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java +@@ -0,0 +1,36 @@ ++package com.destroystokyo.paper.entity.villager; ++ ++/** ++ * A type of reputation gained with a {@link org.bukkit.entity.Villager Villager}. ++ *

++ * All types but {@link #MAJOR_POSITIVE} are shared to other villagers. ++ */ ++public enum ReputationType { ++ /** ++ * A gossip with a majorly negative effect. This is only gained through killing a nearby ++ * villager. ++ */ ++ MAJOR_NEGATIVE, ++ ++ /** ++ * A gossip with a minor negative effect. This is only gained through damaging a villager. ++ */ ++ MINOR_NEGATIVE, ++ ++ /** ++ * A gossip with a minor positive effect. This is only gained through curing a zombie ++ * villager. ++ */ ++ MINOR_POSITIVE, ++ ++ /** ++ * A gossip with a major positive effect. This is only gained through curing a zombie ++ * villager. ++ */ ++ MAJOR_POSITIVE, ++ ++ /** ++ * A gossip with a minor positive effect. This is only gained through trading with a villager. ++ */ ++ TRADING, ++} +diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java +index 4128b848ec739308694d54d9e859c28185f42a63..d841d94d46462e0ceb7c6b04cc8fc36792bd9201 100644 +--- a/src/main/java/org/bukkit/entity/Villager.java ++++ b/src/main/java/org/bukkit/entity/Villager.java +@@ -1,6 +1,8 @@ + package org.bukkit.entity; + + import java.util.Locale; ++import java.util.Map; // Paper ++import java.util.UUID; // Paper + import org.bukkit.Keyed; + import org.bukkit.Location; + import org.bukkit.NamespacedKey; +@@ -242,4 +244,50 @@ public interface Villager extends AbstractVillager { + return key; + } + } ++ ++ // Paper start - Add villager reputation API ++ /** ++ * Get the {@link com.destroystokyo.paper.entity.villager.Reputation reputation} ++ * for a specific player by {@link UUID}. ++ * ++ * @param uniqueId The {@link UUID} of the player to get the reputation of. ++ * @return The player's copied reputation with this villager. ++ */ ++ @Nullable ++ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId); ++ ++ /** ++ * Get all {@link com.destroystokyo.paper.entity.villager.Reputation reputations} ++ * for all players mapped by their {@link UUID unique IDs}. ++ * ++ * @return All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} for all players ++ * in a copied map. ++ */ ++ @NotNull ++ public Map getReputations(); ++ ++ /** ++ * Set the {@link com.destroystokyo.paper.entity.villager.Reputation reputation} ++ * for a specific player by {@link UUID}. ++ * ++ * @param uniqueId The {@link UUID} of the player to set the reputation of. ++ * @param reputation The {@link com.destroystokyo.paper.entity.villager.Reputation reputation} to set. ++ */ ++ public void setReputation(@NotNull UUID uniqueId, @NotNull com.destroystokyo.paper.entity.villager.Reputation reputation); ++ ++ /** ++ * Set all {@link com.destroystokyo.paper.entity.villager.Reputation reputations} ++ * for all players mapped by their {@link UUID unique IDs}. ++ * ++ * @param reputations All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} ++ * for all players mapped by their {@link UUID unique IDs}. ++ */ ++ public void setReputations(@NotNull Map reputations); ++ ++ /** ++ * Clear all reputations from this villager. This removes every single ++ * reputation regardless of its impact and the player associated. ++ */ ++ public void clearReputations(); ++ // Paper end + } diff --git a/patches/api/0195-Add-villager-reputation-API.patch b/patches/api/0195-Add-villager-reputation-API.patch deleted file mode 100644 index 4a2093aab9..0000000000 --- a/patches/api/0195-Add-villager-reputation-API.patch +++ /dev/null @@ -1,175 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Wed, 22 Apr 2020 23:13:49 +0200 -Subject: [PATCH] Add villager reputation API - - -diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0a69e21b0b3001c9cc50951b4b8bd593f6fa74be ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/villager/Reputation.java -@@ -0,0 +1,57 @@ -+package com.destroystokyo.paper.entity.villager; -+ -+import com.google.common.base.Preconditions; -+ -+import java.util.EnumMap; -+import java.util.Map; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * A reputation score for a player on a villager. -+ */ -+public final class Reputation { -+ -+ @NotNull -+ private final Map reputation; -+ -+ public Reputation() { -+ this(new EnumMap<>(ReputationType.class)); -+ } -+ -+ public Reputation(@NotNull Map reputation) { -+ Preconditions.checkNotNull(reputation, "reputation cannot be null"); -+ this.reputation = reputation; -+ } -+ -+ /** -+ * Gets the reputation value for a specific {@link ReputationType}. -+ * -+ * @param type The {@link ReputationType type} of reputation to get. -+ * @return The value of the {@link ReputationType type}. -+ */ -+ public int getReputation(@NotNull ReputationType type) { -+ Preconditions.checkNotNull(type, "the reputation type cannot be null"); -+ return this.reputation.getOrDefault(type, 0); -+ } -+ -+ /** -+ * Sets the reputation value for a specific {@link ReputationType}. -+ * -+ * @param type The {@link ReputationType type} of reputation to set. -+ * @param value The value of the {@link ReputationType type}. -+ */ -+ public void setReputation(@NotNull ReputationType type, int value) { -+ Preconditions.checkNotNull(type, "the reputation type cannot be null"); -+ this.reputation.put(type, value); -+ } -+ -+ /** -+ * Gets if a reputation value is currently set for a specific {@link ReputationType}. -+ * -+ * @param type The {@link ReputationType type} to check -+ * @return If there is a value for this {@link ReputationType type} set. -+ */ -+ public boolean hasReputationSet(@NotNull ReputationType type) { -+ return this.reputation.containsKey(type); -+ } -+} -diff --git a/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5600fcdc9795a9f49091db48d73bbd4964b8b737 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/entity/villager/ReputationType.java -@@ -0,0 +1,36 @@ -+package com.destroystokyo.paper.entity.villager; -+ -+/** -+ * A type of reputation gained with a {@link org.bukkit.entity.Villager Villager}. -+ *

-+ * All types but {@link #MAJOR_POSITIVE} are shared to other villagers. -+ */ -+public enum ReputationType { -+ /** -+ * A gossip with a majorly negative effect. This is only gained through killing a nearby -+ * villager. -+ */ -+ MAJOR_NEGATIVE, -+ -+ /** -+ * A gossip with a minor negative effect. This is only gained through damaging a villager. -+ */ -+ MINOR_NEGATIVE, -+ -+ /** -+ * A gossip with a minor positive effect. This is only gained through curing a zombie -+ * villager. -+ */ -+ MINOR_POSITIVE, -+ -+ /** -+ * A gossip with a major positive effect. This is only gained through curing a zombie -+ * villager. -+ */ -+ MAJOR_POSITIVE, -+ -+ /** -+ * A gossip with a minor positive effect. This is only gained through trading with a villager. -+ */ -+ TRADING, -+} -diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index 4128b848ec739308694d54d9e859c28185f42a63..d841d94d46462e0ceb7c6b04cc8fc36792bd9201 100644 ---- a/src/main/java/org/bukkit/entity/Villager.java -+++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -1,6 +1,8 @@ - package org.bukkit.entity; - - import java.util.Locale; -+import java.util.Map; // Paper -+import java.util.UUID; // Paper - import org.bukkit.Keyed; - import org.bukkit.Location; - import org.bukkit.NamespacedKey; -@@ -242,4 +244,50 @@ public interface Villager extends AbstractVillager { - return key; - } - } -+ -+ // Paper start - Add villager reputation API -+ /** -+ * Get the {@link com.destroystokyo.paper.entity.villager.Reputation reputation} -+ * for a specific player by {@link UUID}. -+ * -+ * @param uniqueId The {@link UUID} of the player to get the reputation of. -+ * @return The player's copied reputation with this villager. -+ */ -+ @Nullable -+ public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId); -+ -+ /** -+ * Get all {@link com.destroystokyo.paper.entity.villager.Reputation reputations} -+ * for all players mapped by their {@link UUID unique IDs}. -+ * -+ * @return All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} for all players -+ * in a copied map. -+ */ -+ @NotNull -+ public Map getReputations(); -+ -+ /** -+ * Set the {@link com.destroystokyo.paper.entity.villager.Reputation reputation} -+ * for a specific player by {@link UUID}. -+ * -+ * @param uniqueId The {@link UUID} of the player to set the reputation of. -+ * @param reputation The {@link com.destroystokyo.paper.entity.villager.Reputation reputation} to set. -+ */ -+ public void setReputation(@NotNull UUID uniqueId, @NotNull com.destroystokyo.paper.entity.villager.Reputation reputation); -+ -+ /** -+ * Set all {@link com.destroystokyo.paper.entity.villager.Reputation reputations} -+ * for all players mapped by their {@link UUID unique IDs}. -+ * -+ * @param reputations All {@link com.destroystokyo.paper.entity.villager.Reputation reputations} -+ * for all players mapped by their {@link UUID unique IDs}. -+ */ -+ public void setReputations(@NotNull Map reputations); -+ -+ /** -+ * Clear all reputations from this villager. This removes every single -+ * reputation regardless of its impact and the player associated. -+ */ -+ public void clearReputations(); -+ // Paper end - } diff --git a/patches/api/0195-Spawn-Reason-API.patch b/patches/api/0195-Spawn-Reason-API.patch new file mode 100644 index 0000000000..97edb6ab3f --- /dev/null +++ b/patches/api/0195-Spawn-Reason-API.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 10 Apr 2014 23:18:28 -0400 +Subject: [PATCH] Spawn Reason API + + +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index 458119a9ef7ce8e1f59bd47caa5b4bc698715440..316d04db78c23ec236cc6f8d5c17e328cbd8ec75 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -326,8 +326,31 @@ public interface RegionAccessor { + * @throws IllegalArgumentException if either parameter is null or the + * {@link Entity} requested cannot be spawned + */ +- @NotNull +- T spawn(@NotNull Location location, @NotNull Class clazz, @Nullable Consumer function) throws IllegalArgumentException; ++ // Paper start ++ default @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz, final @Nullable Consumer function) throws IllegalArgumentException { ++ return this.spawn(location, clazz, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM, function); ++ } ++ ++ default @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException { ++ return this.spawn(location, clazz, reason, null); ++ } ++ ++ default @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason, final @Nullable Consumer function) throws IllegalArgumentException { ++ return this.spawn(location, clazz, function, reason); ++ } ++ ++ default @NotNull Entity spawnEntity(final @NotNull Location loc, final @NotNull EntityType type, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason) { ++ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null, "%s is not a valid EntityType, must have an entity class", type); ++ return this.spawn(loc, type.getEntityClass(), reason, null); ++ } ++ ++ default @NotNull Entity spawnEntity(final @NotNull Location loc, final @NotNull EntityType type, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason, final @Nullable Consumer function) { ++ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null, "%s is not a valid EntityType, must have an entity class", type); ++ return this.spawn(loc, type.getEntityClass(), reason, function); ++ } ++ ++ @NotNull T spawn(@NotNull Location location, @NotNull Class clazz, @Nullable Consumer function, org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException; ++ // Paper end + + /** + * Creates a new entity at the given {@link Location} with the supplied diff --git a/patches/api/0196-Potential-bed-API.patch b/patches/api/0196-Potential-bed-API.patch new file mode 100644 index 0000000000..a842554f35 --- /dev/null +++ b/patches/api/0196-Potential-bed-API.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Sun, 10 May 2020 23:06:41 -0400 +Subject: [PATCH] Potential bed API + +Adds a new method to fetch the location of a player's bed without generating any sync loads. + +getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. + +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index c66130be13bf01b5834a6391864b865c0123fa5c..2557ddcc0528d4f9d811883b3ddc61148ebc3998 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -269,6 +269,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + */ + public int getSleepTicks(); + ++ ++ // Paper start - Potential bed api ++ /** ++ * Gets the Location of the player's bed, null if they have not slept ++ * in one. This method will not attempt to validate if the current bed ++ * is still valid. ++ * ++ * @return Bed Location if has slept in one, otherwise null. ++ */ ++ @Nullable ++ public Location getPotentialBedLocation(); ++ // Paper end ++ + /** + * Attempts to make the entity sleep at the given location. + *
diff --git a/patches/api/0196-Spawn-Reason-API.patch b/patches/api/0196-Spawn-Reason-API.patch deleted file mode 100644 index 97edb6ab3f..0000000000 --- a/patches/api/0196-Spawn-Reason-API.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 10 Apr 2014 23:18:28 -0400 -Subject: [PATCH] Spawn Reason API - - -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 458119a9ef7ce8e1f59bd47caa5b4bc698715440..316d04db78c23ec236cc6f8d5c17e328cbd8ec75 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -326,8 +326,31 @@ public interface RegionAccessor { - * @throws IllegalArgumentException if either parameter is null or the - * {@link Entity} requested cannot be spawned - */ -- @NotNull -- T spawn(@NotNull Location location, @NotNull Class clazz, @Nullable Consumer function) throws IllegalArgumentException; -+ // Paper start -+ default @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz, final @Nullable Consumer function) throws IllegalArgumentException { -+ return this.spawn(location, clazz, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CUSTOM, function); -+ } -+ -+ default @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException { -+ return this.spawn(location, clazz, reason, null); -+ } -+ -+ default @NotNull T spawn(final @NotNull Location location, final @NotNull Class clazz, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason, final @Nullable Consumer function) throws IllegalArgumentException { -+ return this.spawn(location, clazz, function, reason); -+ } -+ -+ default @NotNull Entity spawnEntity(final @NotNull Location loc, final @NotNull EntityType type, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason) { -+ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null, "%s is not a valid EntityType, must have an entity class", type); -+ return this.spawn(loc, type.getEntityClass(), reason, null); -+ } -+ -+ default @NotNull Entity spawnEntity(final @NotNull Location loc, final @NotNull EntityType type, final org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason, final @Nullable Consumer function) { -+ com.google.common.base.Preconditions.checkArgument(type.getEntityClass() != null, "%s is not a valid EntityType, must have an entity class", type); -+ return this.spawn(loc, type.getEntityClass(), reason, function); -+ } -+ -+ @NotNull T spawn(@NotNull Location location, @NotNull Class clazz, @Nullable Consumer function, org.bukkit.event.entity.CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException; -+ // Paper end - - /** - * Creates a new entity at the given {@link Location} with the supplied diff --git a/patches/api/0197-Inventory-getHolder-method-without-block-snapshot.patch b/patches/api/0197-Inventory-getHolder-method-without-block-snapshot.patch new file mode 100644 index 0000000000..d834d6cdb3 --- /dev/null +++ b/patches/api/0197-Inventory-getHolder-method-without-block-snapshot.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Phoenix616 +Date: Wed, 10 Jun 2020 23:55:16 +0100 +Subject: [PATCH] Inventory getHolder method without block snapshot + + +diff --git a/src/main/java/org/bukkit/block/DoubleChest.java b/src/main/java/org/bukkit/block/DoubleChest.java +index 83a4642119c3f33749e04c774cf2b39839f797e2..a39d2f1acbbd84ae0e2cf29f85594e09e55e9355 100644 +--- a/src/main/java/org/bukkit/block/DoubleChest.java ++++ b/src/main/java/org/bukkit/block/DoubleChest.java +@@ -34,6 +34,18 @@ public class DoubleChest implements InventoryHolder { + return inventory.getRightSide().getHolder(); + } + ++ // Paper start - getHolder without snapshot ++ @Nullable ++ public InventoryHolder getLeftSide(boolean useSnapshot) { ++ return inventory.getLeftSide().getHolder(useSnapshot); ++ } ++ ++ @Nullable ++ public InventoryHolder getRightSide(boolean useSnapshot) { ++ return inventory.getRightSide().getHolder(useSnapshot); ++ } ++ // Paper end ++ + @NotNull + public Location getLocation() { + return getInventory().getLocation(); +diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java +index 466d1bd7089b76f48f953e1a51c611ecd93dcd54..129b5ab5062beeb9bb52465a788bc3a3aee9c49e 100644 +--- a/src/main/java/org/bukkit/inventory/Inventory.java ++++ b/src/main/java/org/bukkit/inventory/Inventory.java +@@ -385,6 +385,17 @@ public interface Inventory extends Iterable { + @Nullable + public InventoryHolder getHolder(); + ++ // Paper start - getHolder without snapshot ++ /** ++ * Gets the block or entity belonging to the open inventory ++ * ++ * @param useSnapshot Create a snapshot if the holder is a tile entity ++ * @return The holder of the inventory; null if it has no holder. ++ */ ++ @Nullable ++ public InventoryHolder getHolder(boolean useSnapshot); ++ // Paper end ++ + @NotNull + @Override + public ListIterator iterator(); diff --git a/patches/api/0197-Potential-bed-API.patch b/patches/api/0197-Potential-bed-API.patch deleted file mode 100644 index a842554f35..0000000000 --- a/patches/api/0197-Potential-bed-API.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JRoy -Date: Sun, 10 May 2020 23:06:41 -0400 -Subject: [PATCH] Potential bed API - -Adds a new method to fetch the location of a player's bed without generating any sync loads. - -getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index c66130be13bf01b5834a6391864b865c0123fa5c..2557ddcc0528d4f9d811883b3ddc61148ebc3998 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -269,6 +269,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - */ - public int getSleepTicks(); - -+ -+ // Paper start - Potential bed api -+ /** -+ * Gets the Location of the player's bed, null if they have not slept -+ * in one. This method will not attempt to validate if the current bed -+ * is still valid. -+ * -+ * @return Bed Location if has slept in one, otherwise null. -+ */ -+ @Nullable -+ public Location getPotentialBedLocation(); -+ // Paper end -+ - /** - * Attempts to make the entity sleep at the given location. - *
diff --git a/patches/api/0198-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/api/0198-Add-and-implement-PlayerRecipeBookClickEvent.patch new file mode 100644 index 0000000000..4fe75c486c --- /dev/null +++ b/patches/api/0198-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -0,0 +1,116 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: LordKorea +Date: Mon, 11 May 2020 22:38:10 -0400 +Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c38ac6d0e0ac4ecbdc73d2bedd7731ff34c9d192 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java +@@ -0,0 +1,89 @@ ++package com.destroystokyo.paper.event.player; ++ ++import org.bukkit.NamespacedKey; ++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.NotNull; ++ ++/** ++ * Called when a player clicks a recipe in the recipe book ++ */ ++public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private NamespacedKey recipe; ++ private boolean makeAll; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerRecipeBookClickEvent(@NotNull Player player, @NotNull NamespacedKey recipe, boolean makeAll) { ++ super(player); ++ this.recipe = recipe; ++ this.makeAll = makeAll; ++ } ++ ++ /** ++ * Gets the namespaced key of the recipe that was clicked by the player ++ * ++ * @return The namespaced key of the recipe ++ */ ++ @NotNull ++ public NamespacedKey getRecipe() { ++ return this.recipe; ++ } ++ ++ /** ++ * Changes what recipe is requested. This sets the requested recipe to the recipe with the given key ++ * ++ * @param recipe The key of the recipe that should be requested ++ */ ++ public void setRecipe(@NotNull NamespacedKey recipe) { ++ this.recipe = recipe; ++ } ++ ++ /** ++ * Gets a boolean which indicates whether the player requested to make the maximum amount of results. This is ++ * {@code true} if shift is pressed while the recipe is clicked in the recipe book ++ * ++ * @return {@code true} if shift is pressed while the recipe is clicked ++ */ ++ public boolean isMakeAll() { ++ return this.makeAll; ++ } ++ ++ /** ++ * Sets whether the maximum amount of results should be made. If this is {@code true}, the request is handled as if ++ * the player had pressed shift while clicking on the recipe ++ * ++ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results ++ */ ++ public void setMakeAll(boolean makeAll) { ++ this.makeAll = makeAll; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java +index eb8623184f69e213196558b077bd0004f08832af..a843f7347308a15b9fba4a3676f60bafafd83a66 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java +@@ -9,7 +9,10 @@ import org.jetbrains.annotations.NotNull; + + /** + * Called when a player clicks a recipe in the recipe book. ++ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent} + */ ++@Deprecated(forRemoval = true) // Paper ++@org.bukkit.Warning(false) // Paper + public class PlayerRecipeBookClickEvent extends PlayerEvent { + + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0198-Inventory-getHolder-method-without-block-snapshot.patch b/patches/api/0198-Inventory-getHolder-method-without-block-snapshot.patch deleted file mode 100644 index d834d6cdb3..0000000000 --- a/patches/api/0198-Inventory-getHolder-method-without-block-snapshot.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Phoenix616 -Date: Wed, 10 Jun 2020 23:55:16 +0100 -Subject: [PATCH] Inventory getHolder method without block snapshot - - -diff --git a/src/main/java/org/bukkit/block/DoubleChest.java b/src/main/java/org/bukkit/block/DoubleChest.java -index 83a4642119c3f33749e04c774cf2b39839f797e2..a39d2f1acbbd84ae0e2cf29f85594e09e55e9355 100644 ---- a/src/main/java/org/bukkit/block/DoubleChest.java -+++ b/src/main/java/org/bukkit/block/DoubleChest.java -@@ -34,6 +34,18 @@ public class DoubleChest implements InventoryHolder { - return inventory.getRightSide().getHolder(); - } - -+ // Paper start - getHolder without snapshot -+ @Nullable -+ public InventoryHolder getLeftSide(boolean useSnapshot) { -+ return inventory.getLeftSide().getHolder(useSnapshot); -+ } -+ -+ @Nullable -+ public InventoryHolder getRightSide(boolean useSnapshot) { -+ return inventory.getRightSide().getHolder(useSnapshot); -+ } -+ // Paper end -+ - @NotNull - public Location getLocation() { - return getInventory().getLocation(); -diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java -index 466d1bd7089b76f48f953e1a51c611ecd93dcd54..129b5ab5062beeb9bb52465a788bc3a3aee9c49e 100644 ---- a/src/main/java/org/bukkit/inventory/Inventory.java -+++ b/src/main/java/org/bukkit/inventory/Inventory.java -@@ -385,6 +385,17 @@ public interface Inventory extends Iterable { - @Nullable - public InventoryHolder getHolder(); - -+ // Paper start - getHolder without snapshot -+ /** -+ * Gets the block or entity belonging to the open inventory -+ * -+ * @param useSnapshot Create a snapshot if the holder is a tile entity -+ * @return The holder of the inventory; null if it has no holder. -+ */ -+ @Nullable -+ public InventoryHolder getHolder(boolean useSnapshot); -+ // Paper end -+ - @NotNull - @Override - public ListIterator iterator(); diff --git a/patches/api/0199-Add-and-implement-PlayerRecipeBookClickEvent.patch b/patches/api/0199-Add-and-implement-PlayerRecipeBookClickEvent.patch deleted file mode 100644 index 4fe75c486c..0000000000 --- a/patches/api/0199-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: LordKorea -Date: Mon, 11 May 2020 22:38:10 -0400 -Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c38ac6d0e0ac4ecbdc73d2bedd7731ff34c9d192 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java -@@ -0,0 +1,89 @@ -+package com.destroystokyo.paper.event.player; -+ -+import org.bukkit.NamespacedKey; -+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.NotNull; -+ -+/** -+ * Called when a player clicks a recipe in the recipe book -+ */ -+public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private NamespacedKey recipe; -+ private boolean makeAll; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerRecipeBookClickEvent(@NotNull Player player, @NotNull NamespacedKey recipe, boolean makeAll) { -+ super(player); -+ this.recipe = recipe; -+ this.makeAll = makeAll; -+ } -+ -+ /** -+ * Gets the namespaced key of the recipe that was clicked by the player -+ * -+ * @return The namespaced key of the recipe -+ */ -+ @NotNull -+ public NamespacedKey getRecipe() { -+ return this.recipe; -+ } -+ -+ /** -+ * Changes what recipe is requested. This sets the requested recipe to the recipe with the given key -+ * -+ * @param recipe The key of the recipe that should be requested -+ */ -+ public void setRecipe(@NotNull NamespacedKey recipe) { -+ this.recipe = recipe; -+ } -+ -+ /** -+ * Gets a boolean which indicates whether the player requested to make the maximum amount of results. This is -+ * {@code true} if shift is pressed while the recipe is clicked in the recipe book -+ * -+ * @return {@code true} if shift is pressed while the recipe is clicked -+ */ -+ public boolean isMakeAll() { -+ return this.makeAll; -+ } -+ -+ /** -+ * Sets whether the maximum amount of results should be made. If this is {@code true}, the request is handled as if -+ * the player had pressed shift while clicking on the recipe -+ * -+ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results -+ */ -+ public void setMakeAll(boolean makeAll) { -+ this.makeAll = makeAll; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java -index eb8623184f69e213196558b077bd0004f08832af..a843f7347308a15b9fba4a3676f60bafafd83a66 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerRecipeBookClickEvent.java -@@ -9,7 +9,10 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when a player clicks a recipe in the recipe book. -+ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent} - */ -+@Deprecated(forRemoval = true) // Paper -+@org.bukkit.Warning(false) // Paper - public class PlayerRecipeBookClickEvent extends PlayerEvent { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0199-Support-components-in-ItemMeta.patch b/patches/api/0199-Support-components-in-ItemMeta.patch new file mode 100644 index 0000000000..8a3122ea24 --- /dev/null +++ b/patches/api/0199-Support-components-in-ItemMeta.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MiniDigger +Date: Sat, 6 Jun 2020 18:13:16 +0200 +Subject: [PATCH] Support components in ItemMeta + + +diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566a97865cf 100644 +--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +@@ -5,6 +5,7 @@ import java.util.Collection; + import java.util.List; + import java.util.Map; + import java.util.Set; ++import net.kyori.adventure.text.Component; + import org.bukkit.attribute.Attribute; + import org.bukkit.attribute.AttributeModifier; + import org.bukkit.configuration.serialization.ConfigurationSerializable; +@@ -65,6 +66,20 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + @NotNull + String getDisplayName(); + ++ // Paper start ++ /** ++ * Gets the display name that is set. ++ *

++ * Plugins should check that hasDisplayName() returns true ++ * before calling this method. ++ * ++ * @return the display name that is set ++ * @deprecated use {@link #displayName()} ++ */ ++ @NotNull ++ @Deprecated ++ net.md_5.bungee.api.chat.BaseComponent[] getDisplayNameComponent(); ++ // Paper end + /** + * Sets the display name. + * +@@ -74,6 +89,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + @Deprecated // Paper + void setDisplayName(@Nullable String name); + ++ // Paper start ++ /** ++ * Sets the display name. ++ * ++ * @param component the name component to set ++ * @deprecated use {@link #displayName(Component)} ++ */ ++ @Deprecated ++ void setDisplayNameComponent(@Nullable net.md_5.bungee.api.chat.BaseComponent[] component); ++ // Paper end + /** + * Checks for existence of an item name. + *
+@@ -210,6 +235,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + @Nullable + List getLore(); + ++ /** ++ * Gets the lore that is set. ++ *

++ * Plugins should check if hasLore() returns true before ++ * calling this method. ++ * ++ * @return a list of lore that is set ++ * @deprecated use {@link #lore()} ++ */ ++ @Nullable ++ @Deprecated ++ List getLoreComponents(); ++ + /** + * Sets the lore for this item. + * Removes lore when given null. +@@ -220,6 +258,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + @Deprecated // Paper + void setLore(@Nullable List lore); + ++ /** ++ * Sets the lore for this item. ++ * Removes lore when given null. ++ * ++ * @param lore the lore that will be set ++ * @deprecated use {@link #lore(List)} ++ */ ++ @Deprecated ++ void setLoreComponents(@Nullable List lore); ++ + /** + * Checks for existence of custom model data. + *

diff --git a/patches/api/0200-Support-components-in-ItemMeta.patch b/patches/api/0200-Support-components-in-ItemMeta.patch deleted file mode 100644 index 8a3122ea24..0000000000 --- a/patches/api/0200-Support-components-in-ItemMeta.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger -Date: Sat, 6 Jun 2020 18:13:16 +0200 -Subject: [PATCH] Support components in ItemMeta - - -diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566a97865cf 100644 ---- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -@@ -5,6 +5,7 @@ import java.util.Collection; - import java.util.List; - import java.util.Map; - import java.util.Set; -+import net.kyori.adventure.text.Component; - import org.bukkit.attribute.Attribute; - import org.bukkit.attribute.AttributeModifier; - import org.bukkit.configuration.serialization.ConfigurationSerializable; -@@ -65,6 +66,20 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - @NotNull - String getDisplayName(); - -+ // Paper start -+ /** -+ * Gets the display name that is set. -+ *

-+ * Plugins should check that hasDisplayName() returns true -+ * before calling this method. -+ * -+ * @return the display name that is set -+ * @deprecated use {@link #displayName()} -+ */ -+ @NotNull -+ @Deprecated -+ net.md_5.bungee.api.chat.BaseComponent[] getDisplayNameComponent(); -+ // Paper end - /** - * Sets the display name. - * -@@ -74,6 +89,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - @Deprecated // Paper - void setDisplayName(@Nullable String name); - -+ // Paper start -+ /** -+ * Sets the display name. -+ * -+ * @param component the name component to set -+ * @deprecated use {@link #displayName(Component)} -+ */ -+ @Deprecated -+ void setDisplayNameComponent(@Nullable net.md_5.bungee.api.chat.BaseComponent[] component); -+ // Paper end - /** - * Checks for existence of an item name. - *
-@@ -210,6 +235,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - @Nullable - List getLore(); - -+ /** -+ * Gets the lore that is set. -+ *

-+ * Plugins should check if hasLore() returns true before -+ * calling this method. -+ * -+ * @return a list of lore that is set -+ * @deprecated use {@link #lore()} -+ */ -+ @Nullable -+ @Deprecated -+ List getLoreComponents(); -+ - /** - * Sets the lore for this item. - * Removes lore when given null. -@@ -220,6 +258,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste - @Deprecated // Paper - void setLore(@Nullable List lore); - -+ /** -+ * Sets the lore for this item. -+ * Removes lore when given null. -+ * -+ * @param lore the lore that will be set -+ * @deprecated use {@link #lore(List)} -+ */ -+ @Deprecated -+ void setLoreComponents(@Nullable List lore); -+ - /** - * Checks for existence of custom model data. - *

diff --git a/patches/api/0200-added-2-new-TargetReasons-for-1.16-mob-behavior.patch b/patches/api/0200-added-2-new-TargetReasons-for-1.16-mob-behavior.patch new file mode 100644 index 0000000000..6c725bc833 --- /dev/null +++ b/patches/api/0200-added-2-new-TargetReasons-for-1.16-mob-behavior.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 3 Jul 2020 15:05:54 -0700 +Subject: [PATCH] added 2 new TargetReasons for 1.16 mob behavior + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java b/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java +index c6e4d69eecd2789b1d78fe99fe590932e9758ba1..85b318d9ee56a3c22c6b7c9ac408f021e51cb609 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java +@@ -159,6 +159,14 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable { + * as wheat in its hand. + */ + TEMPT, ++ /** ++ * When the target is in a different dimension ++ */ ++ TARGET_OTHER_LEVEL, // Paper ++ /** ++ * When the target is in creative or spectator gamemode, or the difficulty is peaceful, or other reasons ++ */ ++ TARGET_INVALID, // Paper + /** + * A currently unknown reason for the entity changing target. + */ diff --git a/patches/api/0201-Add-entity-liquid-API.patch b/patches/api/0201-Add-entity-liquid-API.patch new file mode 100644 index 0000000000..a1ac30dc85 --- /dev/null +++ b/patches/api/0201-Add-entity-liquid-API.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Thu, 2 Jul 2020 18:11:33 -0500 +Subject: [PATCH] Add entity liquid API + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 66716da0b475524917d4153e481100b795ea11a9..6a9cd00110988a0d0bd89f0252cc0f21c36982c0 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -859,5 +859,40 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + @NotNull + org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason(); ++ ++ /** ++ * Check if entity is underwater ++ */ ++ boolean isUnderWater(); ++ ++ /** ++ * Check if entity is in rain ++ */ ++ boolean isInRain(); ++ ++ /** ++ * Check if entity is in bubble column ++ */ ++ boolean isInBubbleColumn(); ++ ++ /** ++ * Check if entity is in water or rain ++ */ ++ boolean isInWaterOrRain(); ++ ++ /** ++ * Check if entity is in water or bubble column ++ */ ++ boolean isInWaterOrBubbleColumn(); ++ ++ /** ++ * Check if entity is in water or rain or bubble column ++ */ ++ boolean isInWaterOrRainOrBubbleColumn(); ++ ++ /** ++ * Check if entity is in lava ++ */ ++ boolean isInLava(); + // Paper end + } diff --git a/patches/api/0201-added-2-new-TargetReasons-for-1.16-mob-behavior.patch b/patches/api/0201-added-2-new-TargetReasons-for-1.16-mob-behavior.patch deleted file mode 100644 index 6c725bc833..0000000000 --- a/patches/api/0201-added-2-new-TargetReasons-for-1.16-mob-behavior.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 3 Jul 2020 15:05:54 -0700 -Subject: [PATCH] added 2 new TargetReasons for 1.16 mob behavior - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java b/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java -index c6e4d69eecd2789b1d78fe99fe590932e9758ba1..85b318d9ee56a3c22c6b7c9ac408f021e51cb609 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityTargetEvent.java -@@ -159,6 +159,14 @@ public class EntityTargetEvent extends EntityEvent implements Cancellable { - * as wheat in its hand. - */ - TEMPT, -+ /** -+ * When the target is in a different dimension -+ */ -+ TARGET_OTHER_LEVEL, // Paper -+ /** -+ * When the target is in creative or spectator gamemode, or the difficulty is peaceful, or other reasons -+ */ -+ TARGET_INVALID, // Paper - /** - * A currently unknown reason for the entity changing target. - */ diff --git a/patches/api/0202-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/0202-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch new file mode 100644 index 0000000000..3906e443da --- /dev/null +++ b/patches/api/0202-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch @@ -0,0 +1,204 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Fri, 3 Jul 2020 11:58:56 -0500 +Subject: [PATCH] Add PrepareResultEvent / PrepareGrindstoneEvent + +Adds a new event for all crafting stations that generate a result slot item + +Anvil, Grindstone and Smithing now extend this event + +Grindstone is a backwards compat from a previous PrepareGrindstoneEvent + +diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b31e6777f5d163c61309da9ff204ad5773ba7f54 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java +@@ -0,0 +1,31 @@ ++package com.destroystokyo.paper.event.inventory; ++ ++import org.bukkit.Warning; ++import org.bukkit.inventory.GrindstoneInventory; ++import org.bukkit.inventory.InventoryView; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when an item is put in a slot for grinding in a Grindstone ++ * ++ * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent} ++ */ ++@Deprecated ++@Warning ++public class PrepareGrindstoneEvent extends PrepareResultEvent { ++ ++ @ApiStatus.Internal ++ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { ++ super(inventory, result); ++ } ++ ++ @NotNull ++ @Override ++ public GrindstoneInventory getInventory() { ++ return (GrindstoneInventory) super.getInventory(); ++ } ++ ++} +diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c305c606bef93866993095cec5f50e191c5a382a +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java +@@ -0,0 +1,40 @@ ++package com.destroystokyo.paper.event.inventory; ++ ++import org.bukkit.event.inventory.PrepareInventoryResultEvent; ++import org.bukkit.inventory.InventoryView; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when an item is put in an inventory containing a result slot ++ */ ++public class PrepareResultEvent extends PrepareInventoryResultEvent { ++ ++ // HandlerList on PrepareInventoryResultEvent to ensure api compat ++ ++ @ApiStatus.Internal ++ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { ++ super(inventory, result); ++ } ++ ++ /** ++ * Get result item, may be {@code null}. ++ * ++ * @return result item ++ */ ++ @Nullable ++ public ItemStack getResult() { ++ return super.getResult(); ++ } ++ ++ /** ++ * Set result item, may be {@code null}. ++ * ++ * @param result result item ++ */ ++ public void setResult(@Nullable ItemStack result) { ++ super.setResult(result); ++ } ++} +diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +index 8977f7609431c3c46324a82de84d4a32f4b71c57..d884ecf40af964e718168ac055dd6c672d108eb1 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java +@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; + /** + * Called when an item is put in a slot for repair by an anvil. + */ +-public class PrepareAnvilEvent extends PrepareInventoryResultEvent { ++public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - move HandlerList to PrepareInventoryResultEvent + + public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { + super(inventory, result); +@@ -38,14 +38,5 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { + super.setResult(result); + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - move HandlerList to PrepareInventoryResultEvent + } +diff --git a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java +index fb172479ce28edbf969b9492236e30fb04395bf9..a7e03600099b8d6a117b8f5455fee24eed03e3a3 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java +@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; + /** + * Called when an item is put in a slot for repair or unenchanting in a grindstone. + */ +-public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { ++public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - move HandlerList to PrepareInventoryResultEvent + + public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { + super(inventory, result); +@@ -24,14 +24,5 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { + return (GrindstoneInventory) super.getInventory(); + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - move HandlerList to PrepareInventoryResultEvent + } +diff --git a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java +index b543bc17fb9354d1939c67c1fb6c92d88fdbe4ec..0b58ffff39845b658dee7c35dcae6cdb333f20b3 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java +@@ -8,7 +8,9 @@ import org.jetbrains.annotations.Nullable; + + /** + * Called when an item is put in a slot and the result is calculated. ++ * @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent} + */ ++@Deprecated @org.bukkit.Warning(false) // Paper + public class PrepareInventoryResultEvent extends InventoryEvent { + + private static final HandlerList handlers = new HandlerList(); +diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java +index 901774e03f8789dddff4e7695ac599ff69cc97a5..8d7924fa81e9b53514fa534f0572fd7effef73c4 100644 +--- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java +@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; + /** + * Called when an item is put in a slot for upgrade by a Smithing Table. + */ +-public class PrepareSmithingEvent extends PrepareInventoryResultEvent { ++public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - move HandlerList ot PrepareInventoryResultEvent + + public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { + super(inventory, result); +@@ -24,14 +24,5 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent { + return (SmithingInventory) super.getInventory(); + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - move HandlerList to PrepareInventoryResultEvent + } diff --git a/patches/api/0202-Add-entity-liquid-API.patch b/patches/api/0202-Add-entity-liquid-API.patch deleted file mode 100644 index a1ac30dc85..0000000000 --- a/patches/api/0202-Add-entity-liquid-API.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Thu, 2 Jul 2020 18:11:33 -0500 -Subject: [PATCH] Add entity liquid API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 66716da0b475524917d4153e481100b795ea11a9..6a9cd00110988a0d0bd89f0252cc0f21c36982c0 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -859,5 +859,40 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - @NotNull - org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason(); -+ -+ /** -+ * Check if entity is underwater -+ */ -+ boolean isUnderWater(); -+ -+ /** -+ * Check if entity is in rain -+ */ -+ boolean isInRain(); -+ -+ /** -+ * Check if entity is in bubble column -+ */ -+ boolean isInBubbleColumn(); -+ -+ /** -+ * Check if entity is in water or rain -+ */ -+ boolean isInWaterOrRain(); -+ -+ /** -+ * Check if entity is in water or bubble column -+ */ -+ boolean isInWaterOrBubbleColumn(); -+ -+ /** -+ * Check if entity is in water or rain or bubble column -+ */ -+ boolean isInWaterOrRainOrBubbleColumn(); -+ -+ /** -+ * Check if entity is in lava -+ */ -+ boolean isInLava(); - // Paper end - } diff --git a/patches/api/0203-Add-BellRingEvent.patch b/patches/api/0203-Add-BellRingEvent.patch new file mode 100644 index 0000000000..2d5cb2a8b3 --- /dev/null +++ b/patches/api/0203-Add-BellRingEvent.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Eearslya Sleiarion +Date: Mon, 24 Jun 2019 21:27:39 -0700 +Subject: [PATCH] Add BellRingEvent + +Add a new event, BellRingEvent, to trigger whenever a player rings a +village bell. Passes along the bell block and the player who rang it. + +diff --git a/src/main/java/io/papermc/paper/event/block/BellRingEvent.java b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7d3f04d5ab620f37d2253b575ae370d95ecf21ef +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java +@@ -0,0 +1,22 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.block.BlockFace; ++import org.bukkit.entity.Entity; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when a bell is rung. ++ * ++ * @deprecated use {@link org.bukkit.event.block.BellRingEvent} ++ */ ++@Deprecated ++public class BellRingEvent extends org.bukkit.event.block.BellRingEvent { ++ ++ @ApiStatus.Internal ++ public BellRingEvent(@NotNull Block block, @NotNull BlockFace direction, @Nullable Entity entity) { ++ super(block, direction, entity); ++ } ++} diff --git a/patches/api/0203-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch b/patches/api/0203-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch deleted file mode 100644 index 3906e443da..0000000000 --- a/patches/api/0203-Add-PrepareResultEvent-PrepareGrindstoneEvent.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Fri, 3 Jul 2020 11:58:56 -0500 -Subject: [PATCH] Add PrepareResultEvent / PrepareGrindstoneEvent - -Adds a new event for all crafting stations that generate a result slot item - -Anvil, Grindstone and Smithing now extend this event - -Grindstone is a backwards compat from a previous PrepareGrindstoneEvent - -diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..b31e6777f5d163c61309da9ff204ad5773ba7f54 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java -@@ -0,0 +1,31 @@ -+package com.destroystokyo.paper.event.inventory; -+ -+import org.bukkit.Warning; -+import org.bukkit.inventory.GrindstoneInventory; -+import org.bukkit.inventory.InventoryView; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when an item is put in a slot for grinding in a Grindstone -+ * -+ * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent} -+ */ -+@Deprecated -+@Warning -+public class PrepareGrindstoneEvent extends PrepareResultEvent { -+ -+ @ApiStatus.Internal -+ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { -+ super(inventory, result); -+ } -+ -+ @NotNull -+ @Override -+ public GrindstoneInventory getInventory() { -+ return (GrindstoneInventory) super.getInventory(); -+ } -+ -+} -diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c305c606bef93866993095cec5f50e191c5a382a ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java -@@ -0,0 +1,40 @@ -+package com.destroystokyo.paper.event.inventory; -+ -+import org.bukkit.event.inventory.PrepareInventoryResultEvent; -+import org.bukkit.inventory.InventoryView; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when an item is put in an inventory containing a result slot -+ */ -+public class PrepareResultEvent extends PrepareInventoryResultEvent { -+ -+ // HandlerList on PrepareInventoryResultEvent to ensure api compat -+ -+ @ApiStatus.Internal -+ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { -+ super(inventory, result); -+ } -+ -+ /** -+ * Get result item, may be {@code null}. -+ * -+ * @return result item -+ */ -+ @Nullable -+ public ItemStack getResult() { -+ return super.getResult(); -+ } -+ -+ /** -+ * Set result item, may be {@code null}. -+ * -+ * @param result result item -+ */ -+ public void setResult(@Nullable ItemStack result) { -+ super.setResult(result); -+ } -+} -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -index 8977f7609431c3c46324a82de84d4a32f4b71c57..d884ecf40af964e718168ac055dd6c672d108eb1 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java -@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when an item is put in a slot for repair by an anvil. - */ --public class PrepareAnvilEvent extends PrepareInventoryResultEvent { -+public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - move HandlerList to PrepareInventoryResultEvent - - public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { - super(inventory, result); -@@ -38,14 +38,5 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent { - super.setResult(result); - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - move HandlerList to PrepareInventoryResultEvent - } -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java -index fb172479ce28edbf969b9492236e30fb04395bf9..a7e03600099b8d6a117b8f5455fee24eed03e3a3 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java -@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when an item is put in a slot for repair or unenchanting in a grindstone. - */ --public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { -+public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - move HandlerList to PrepareInventoryResultEvent - - public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { - super(inventory, result); -@@ -24,14 +24,5 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent { - return (GrindstoneInventory) super.getInventory(); - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - move HandlerList to PrepareInventoryResultEvent - } -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java -index b543bc17fb9354d1939c67c1fb6c92d88fdbe4ec..0b58ffff39845b658dee7c35dcae6cdb333f20b3 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java -@@ -8,7 +8,9 @@ import org.jetbrains.annotations.Nullable; - - /** - * Called when an item is put in a slot and the result is calculated. -+ * @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent} - */ -+@Deprecated @org.bukkit.Warning(false) // Paper - public class PrepareInventoryResultEvent extends InventoryEvent { - - private static final HandlerList handlers = new HandlerList(); -diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -index 901774e03f8789dddff4e7695ac599ff69cc97a5..8d7924fa81e9b53514fa534f0572fd7effef73c4 100644 ---- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java -@@ -10,9 +10,9 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when an item is put in a slot for upgrade by a Smithing Table. - */ --public class PrepareSmithingEvent extends PrepareInventoryResultEvent { -+public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent { - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - move HandlerList ot PrepareInventoryResultEvent - - public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) { - super(inventory, result); -@@ -24,14 +24,5 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent { - return (SmithingInventory) super.getInventory(); - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - move HandlerList to PrepareInventoryResultEvent - } diff --git a/patches/api/0204-Add-BellRingEvent.patch b/patches/api/0204-Add-BellRingEvent.patch deleted file mode 100644 index 2d5cb2a8b3..0000000000 --- a/patches/api/0204-Add-BellRingEvent.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Eearslya Sleiarion -Date: Mon, 24 Jun 2019 21:27:39 -0700 -Subject: [PATCH] Add BellRingEvent - -Add a new event, BellRingEvent, to trigger whenever a player rings a -village bell. Passes along the bell block and the player who rang it. - -diff --git a/src/main/java/io/papermc/paper/event/block/BellRingEvent.java b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7d3f04d5ab620f37d2253b575ae370d95ecf21ef ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java -@@ -0,0 +1,22 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when a bell is rung. -+ * -+ * @deprecated use {@link org.bukkit.event.block.BellRingEvent} -+ */ -+@Deprecated -+public class BellRingEvent extends org.bukkit.event.block.BellRingEvent { -+ -+ @ApiStatus.Internal -+ public BellRingEvent(@NotNull Block block, @NotNull BlockFace direction, @Nullable Entity entity) { -+ super(block, direction, entity); -+ } -+} diff --git a/patches/api/0204-Brand-support.patch b/patches/api/0204-Brand-support.patch new file mode 100644 index 0000000000..31a2278550 --- /dev/null +++ b/patches/api/0204-Brand-support.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DigitalRegent +Date: Mon, 6 Apr 2020 20:30:09 +0200 +Subject: [PATCH] Brand support + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 7429666fd1af4f4a924cf93572df5b826782af05..b0c0fd6687af5676d85094304ced25c1c444bc90 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3395,6 +3395,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + // Paper end + } + ++ // Paper start - brand support ++ /** ++ * Returns player's client brand name. If the client didn't send this information, the brand name will be null.
++ * For the Notchian client this name defaults to vanilla. Some modified clients report other names such as forge.
++ * @return client brand name ++ */ ++ @Nullable ++ String getClientBrandName(); ++ // Paper end ++ + @NotNull + @Override + Spigot spigot(); diff --git a/patches/api/0205-Add-moon-phase-API.patch b/patches/api/0205-Add-moon-phase-API.patch new file mode 100644 index 0000000000..d949b274a6 --- /dev/null +++ b/patches/api/0205-Add-moon-phase-API.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 16:32:03 +0200 +Subject: [PATCH] Add moon phase API + + +diff --git a/src/main/java/io/papermc/paper/world/MoonPhase.java b/src/main/java/io/papermc/paper/world/MoonPhase.java +new file mode 100644 +index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e5f008f7e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/world/MoonPhase.java +@@ -0,0 +1,36 @@ ++package io.papermc.paper.world; ++ ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.HashMap; ++import java.util.Map; ++ ++public enum MoonPhase { ++ FULL_MOON(0L), ++ WANING_GIBBOUS(1L), ++ LAST_QUARTER(2L), ++ WANING_CRESCENT(3L), ++ NEW_MOON(4L), ++ WAXING_CRESCENT(5L), ++ FIRST_QUARTER(6L), ++ WAXING_GIBBOUS(7L); ++ ++ private final long day; ++ ++ MoonPhase(long day) { ++ this.day = day; ++ } ++ ++ private static final Map BY_DAY = new HashMap<>(); ++ ++ static { ++ for (MoonPhase phase : values()) { ++ BY_DAY.put(phase.day, phase); ++ } ++ } ++ ++ @NotNull ++ public static MoonPhase getPhase(long day) { ++ return BY_DAY.get(day % 8L); ++ } ++} +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index 316d04db78c23ec236cc6f8d5c17e328cbd8ec75..27eff0826d5b5b48697fefd9571886e7bbce74b1 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -445,4 +445,12 @@ public interface RegionAccessor { + */ + @NotNull + public T addEntity(@NotNull T entity); ++ ++ // Paper start ++ /** ++ * @return the current moon phase at the current time in the world ++ */ ++ @NotNull ++ io.papermc.paper.world.MoonPhase getMoonPhase(); ++ // Paper end + } diff --git a/patches/api/0205-Brand-support.patch b/patches/api/0205-Brand-support.patch deleted file mode 100644 index 31a2278550..0000000000 --- a/patches/api/0205-Brand-support.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DigitalRegent -Date: Mon, 6 Apr 2020 20:30:09 +0200 -Subject: [PATCH] Brand support - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 7429666fd1af4f4a924cf93572df5b826782af05..b0c0fd6687af5676d85094304ced25c1c444bc90 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3395,6 +3395,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - // Paper end - } - -+ // Paper start - brand support -+ /** -+ * Returns player's client brand name. If the client didn't send this information, the brand name will be null.
-+ * For the Notchian client this name defaults to vanilla. Some modified clients report other names such as forge.
-+ * @return client brand name -+ */ -+ @Nullable -+ String getClientBrandName(); -+ // Paper end -+ - @NotNull - @Override - Spigot spigot(); diff --git a/patches/api/0206-Add-moon-phase-API.patch b/patches/api/0206-Add-moon-phase-API.patch deleted file mode 100644 index d949b274a6..0000000000 --- a/patches/api/0206-Add-moon-phase-API.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 23 Aug 2020 16:32:03 +0200 -Subject: [PATCH] Add moon phase API - - -diff --git a/src/main/java/io/papermc/paper/world/MoonPhase.java b/src/main/java/io/papermc/paper/world/MoonPhase.java -new file mode 100644 -index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e5f008f7e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/world/MoonPhase.java -@@ -0,0 +1,36 @@ -+package io.papermc.paper.world; -+ -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.HashMap; -+import java.util.Map; -+ -+public enum MoonPhase { -+ FULL_MOON(0L), -+ WANING_GIBBOUS(1L), -+ LAST_QUARTER(2L), -+ WANING_CRESCENT(3L), -+ NEW_MOON(4L), -+ WAXING_CRESCENT(5L), -+ FIRST_QUARTER(6L), -+ WAXING_GIBBOUS(7L); -+ -+ private final long day; -+ -+ MoonPhase(long day) { -+ this.day = day; -+ } -+ -+ private static final Map BY_DAY = new HashMap<>(); -+ -+ static { -+ for (MoonPhase phase : values()) { -+ BY_DAY.put(phase.day, phase); -+ } -+ } -+ -+ @NotNull -+ public static MoonPhase getPhase(long day) { -+ return BY_DAY.get(day % 8L); -+ } -+} -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 316d04db78c23ec236cc6f8d5c17e328cbd8ec75..27eff0826d5b5b48697fefd9571886e7bbce74b1 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -445,4 +445,12 @@ public interface RegionAccessor { - */ - @NotNull - public T addEntity(@NotNull T entity); -+ -+ // Paper start -+ /** -+ * @return the current moon phase at the current time in the world -+ */ -+ @NotNull -+ io.papermc.paper.world.MoonPhase getMoonPhase(); -+ // Paper end - } diff --git a/patches/api/0206-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/0206-Add-playPickupItemAnimation-to-LivingEntity.patch new file mode 100644 index 0000000000..8530c705f9 --- /dev/null +++ b/patches/api/0206-Add-playPickupItemAnimation-to-LivingEntity.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sun, 23 Aug 2020 19:36:08 +0200 +Subject: [PATCH] Add playPickupItemAnimation to LivingEntity + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index d134a7406e3960e12e811085257a1e0052abb499..c71bc11f7a0a72d4e5d609e333ab99031ea813d2 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1171,4 +1171,29 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + void setJumping(boolean jumping); + // Paper end - entity jump API ++ ++ // Paper start - pickup animation API ++ /** ++ * Plays pickup item animation towards this entity. ++ *

++ * This will remove the item on the client. ++ *

++ * Quantity is inferred to be that of the {@link Item}. ++ * ++ * @param item item to pickup ++ */ ++ default void playPickupItemAnimation(@NotNull Item item) { ++ playPickupItemAnimation(item, item.getItemStack().getAmount()); ++ } ++ ++ /** ++ * Plays pickup item animation towards this entity. ++ *

++ * This will remove the item on the client. ++ * ++ * @param item item to pickup ++ * @param quantity quantity of item ++ */ ++ void playPickupItemAnimation(@NotNull Item item, int quantity); ++ // Paper end - pickup animation API + } diff --git a/patches/api/0207-Add-more-Evoker-API.patch b/patches/api/0207-Add-more-Evoker-API.patch new file mode 100644 index 0000000000..0d6f0f7328 --- /dev/null +++ b/patches/api/0207-Add-more-Evoker-API.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 15:22:44 +0200 +Subject: [PATCH] Add more Evoker API + + +diff --git a/src/main/java/org/bukkit/entity/Evoker.java b/src/main/java/org/bukkit/entity/Evoker.java +index f8d173adc09197418883dc7bc66dd8bfff8c5c72..76f81cd124090337876c9e5e469862a1c8da4ec8 100644 +--- a/src/main/java/org/bukkit/entity/Evoker.java ++++ b/src/main/java/org/bukkit/entity/Evoker.java +@@ -64,4 +64,19 @@ public interface Evoker extends Spellcaster { + */ + @Deprecated + void setCurrentSpell(@Nullable Spell spell); ++ ++ // Paper start ++ /** ++ * @return the sheep being targeted by the {@link Spell#WOLOLO wololo spell}, or {@code null} if none ++ */ ++ @Nullable ++ Sheep getWololoTarget(); ++ ++ /** ++ * Set the sheep to be the target of the {@link Spell#WOLOLO wololo spell}, or {@code null} to clear. ++ * ++ * @param sheep new wololo target ++ */ ++ void setWololoTarget(@Nullable Sheep sheep); ++ // Paper end + } diff --git a/patches/api/0207-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/0207-Add-playPickupItemAnimation-to-LivingEntity.patch deleted file mode 100644 index 8530c705f9..0000000000 --- a/patches/api/0207-Add-playPickupItemAnimation-to-LivingEntity.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sun, 23 Aug 2020 19:36:08 +0200 -Subject: [PATCH] Add playPickupItemAnimation to LivingEntity - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index d134a7406e3960e12e811085257a1e0052abb499..c71bc11f7a0a72d4e5d609e333ab99031ea813d2 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1171,4 +1171,29 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - void setJumping(boolean jumping); - // Paper end - entity jump API -+ -+ // Paper start - pickup animation API -+ /** -+ * Plays pickup item animation towards this entity. -+ *

-+ * This will remove the item on the client. -+ *

-+ * Quantity is inferred to be that of the {@link Item}. -+ * -+ * @param item item to pickup -+ */ -+ default void playPickupItemAnimation(@NotNull Item item) { -+ playPickupItemAnimation(item, item.getItemStack().getAmount()); -+ } -+ -+ /** -+ * Plays pickup item animation towards this entity. -+ *

-+ * This will remove the item on the client. -+ * -+ * @param item item to pickup -+ * @param quantity quantity of item -+ */ -+ void playPickupItemAnimation(@NotNull Item item, int quantity); -+ // Paper end - pickup animation API - } diff --git a/patches/api/0208-Add-methods-to-get-translation-keys.patch b/patches/api/0208-Add-methods-to-get-translation-keys.patch new file mode 100644 index 0000000000..282a4c0520 --- /dev/null +++ b/patches/api/0208-Add-methods-to-get-translation-keys.patch @@ -0,0 +1,519 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 11 Aug 2020 19:17:46 +0200 +Subject: [PATCH] Add methods to get translation keys + +Co-authored-by: MeFisto94 + +diff --git a/src/main/java/org/bukkit/Difficulty.java b/src/main/java/org/bukkit/Difficulty.java +index f35801783538d3377b04131b8bf6effd7eb8e1a5..427ce8cfd6f63e5c7ec7b264b15ab4111b947729 100644 +--- a/src/main/java/org/bukkit/Difficulty.java ++++ b/src/main/java/org/bukkit/Difficulty.java +@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents the various difficulty levels that are available. + */ +-public enum Difficulty { ++public enum Difficulty implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations + /** + * Players regain health over time, hostile mobs don't spawn, the hunger + * bar does not deplete. +@@ -51,6 +51,12 @@ public enum Difficulty { + return value; + } + ++ // Paper start ++ @Override ++ public @org.jetbrains.annotations.NotNull String translationKey() { ++ return "options.difficulty." + this.name().toLowerCase(java.util.Locale.ENGLISH); ++ } ++ // Paper end + /** + * Gets the Difficulty represented by the specified value + * +diff --git a/src/main/java/org/bukkit/FireworkEffect.java b/src/main/java/org/bukkit/FireworkEffect.java +index bf7db5b3e7c2ac15016a48e520fba674726718ee..637fa73d4366c2d88e2716e5c8d3465706d788a7 100644 +--- a/src/main/java/org/bukkit/FireworkEffect.java ++++ b/src/main/java/org/bukkit/FireworkEffect.java +@@ -18,28 +18,44 @@ public final class FireworkEffect implements ConfigurationSerializable { + /** + * The type or shape of the effect. + */ +- public enum Type { ++ public enum Type implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations + /** + * A small ball effect. + */ +- BALL, ++ BALL("small_ball"), // Paper - add name + /** + * A large ball effect. + */ +- BALL_LARGE, ++ BALL_LARGE("large_ball"), // Paper - add name + /** + * A star-shaped effect. + */ +- STAR, ++ STAR("star"), // Paper - add name + /** + * A burst effect. + */ +- BURST, ++ BURST("burst"), // Paper - add name + /** + * A creeper-face effect. + */ +- CREEPER, ++ CREEPER("creeper"), // Paper - add name + ; ++ // Paper start ++ /** ++ * The name map. ++ */ ++ public static final net.kyori.adventure.util.Index NAMES = net.kyori.adventure.util.Index.create(Type.class, type -> type.name); ++ private final String name; ++ ++ Type(final String name) { ++ this.name = name; ++ } ++ ++ @Override ++ public @NotNull String translationKey() { ++ return "item.minecraft.firework_star.shape." + this.name; ++ } ++ // Paper end + } + + /** +diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java +index 81e45984a88fc84acd0f76d825abf4ddaed0ac3b..fdc42a79c5af30fdade41ee99245e6641f353571 100644 +--- a/src/main/java/org/bukkit/GameMode.java ++++ b/src/main/java/org/bukkit/GameMode.java +@@ -9,7 +9,7 @@ import org.jetbrains.annotations.Nullable; + * Represents the various type of game modes that {@link HumanEntity}s may + * have + */ +-public enum GameMode { ++public enum GameMode implements net.kyori.adventure.translation.Translatable { // Paper - implement Translatable + /** + * Creative mode may fly, build instantly, become invulnerable and create + * free items. +@@ -35,9 +35,18 @@ public enum GameMode { + + private final int value; + private static final Map BY_ID = Maps.newHashMap(); ++ // Paper start - translation keys ++ private final String translationKey; ++ ++ @Override ++ public @org.jetbrains.annotations.NotNull String translationKey() { ++ return this.translationKey; ++ } ++ // Paper end + + private GameMode(final int value) { + this.value = value; ++ this.translationKey = "gameMode." + this.name().toLowerCase(java.util.Locale.ENGLISH); // Paper + } + + /** +diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java +index dc66bd69646ac949d1386ce8f6ff913e9475439d..4482e8f2c617c2f51b2b53762e775d118002363a 100644 +--- a/src/main/java/org/bukkit/GameRule.java ++++ b/src/main/java/org/bukkit/GameRule.java +@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable; + * + * @param type of rule (Boolean or Integer) + */ +-public final class GameRule { ++public final class GameRule implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations + + private static Map> gameRules = new HashMap<>(); + // Boolean rules +@@ -355,4 +355,11 @@ public final class GameRule { + public static GameRule[] values() { + return gameRules.values().toArray(new GameRule[gameRules.size()]); + } ++ ++ // Paper start ++ @Override ++ public @NotNull String translationKey() { ++ return "gamerule." + this.name; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index c605da711c032f7091390e50b4a5d332c992d3d1..61e0739f002a949a204c7591dfa3074560d1459e 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -126,7 +126,7 @@ import org.jetbrains.annotations.Nullable; + * An enum of all material IDs accepted by the official server and client + */ + @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper +-public enum Material implements Keyed, Translatable { ++public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper + // + AIR(9648, 0), + STONE(22948), +@@ -4740,6 +4740,15 @@ public enum Material implements Keyed, Translatable { + } + return false; + } ++ ++ @Override ++ public @NotNull String translationKey() { ++ if (this.isItem()) { ++ return Bukkit.getUnsafe().getItemTranslationKey(this); ++ } else { ++ return Bukkit.getUnsafe().getBlockTranslationKey(this); ++ } ++ } + // Paper end + + /** +@@ -11481,9 +11490,11 @@ public enum Material implements Keyed, Translatable { + * material + * @see #getBlockTranslationKey() + * @see #getItemTranslationKey() ++ * @deprecated use {@link #translationKey()} + */ + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + if (this.isItem()) { + return Bukkit.getUnsafe().getItemTranslationKey(this); +diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java +index eae90e72b1dff5ab3b1a4fdcfe57187e85fe4d49..62d2b3f950860dee0898d77b0a29635c3f9a7e23 100644 +--- a/src/main/java/org/bukkit/MusicInstrument.java ++++ b/src/main/java/org/bukkit/MusicInstrument.java +@@ -7,7 +7,7 @@ import java.util.Collections; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + +-public abstract class MusicInstrument implements Keyed { ++public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys + + public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn"); + public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn"); +@@ -52,4 +52,11 @@ public abstract class MusicInstrument implements Keyed { + + return instrument; + } ++ ++ // Paper start - translation key ++ @Override ++ public @NotNull String translationKey() { ++ return "instrument.minecraft." + this.getKey().value(); ++ } ++ // Paper end - translation key + } +diff --git a/src/main/java/org/bukkit/Translatable.java b/src/main/java/org/bukkit/Translatable.java +index e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d17235080a 100644 +--- a/src/main/java/org/bukkit/Translatable.java ++++ b/src/main/java/org/bukkit/Translatable.java +@@ -5,14 +5,18 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents an object with a text representation that can be translated by the + * Minecraft client. ++ * @deprecated use {@link net.kyori.adventure.translation.Translatable} + */ ++@Deprecated(forRemoval = true) // Paper + public interface Translatable { + + /** + * Get the translation key, suitable for use in a translation component. + * + * @return the translation key ++ * @deprecated look for a {@code translationKey()} method instead + */ + @NotNull ++ @Deprecated(forRemoval = true) // Paper + String getTranslationKey(); + } +diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java +index 3a7f6fd862dc2dd72366089ce99a0e96d07c0fdc..063cb21e33d039933e9ef295564db595cfd9f8c9 100644 +--- a/src/main/java/org/bukkit/attribute/Attribute.java ++++ b/src/main/java/org/bukkit/attribute/Attribute.java +@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Types of attributes which may be present on an {@link Attributable}. + */ +-public enum Attribute implements Keyed, Translatable { ++public enum Attribute implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations + + /** + * Maximum health of an Entity. +@@ -117,4 +117,12 @@ public enum Attribute implements Keyed, Translatable { + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); + } ++ ++ // Paper start ++ @SuppressWarnings("deprecation") ++ @Override ++ public @NotNull String translationKey() { ++ return Bukkit.getUnsafe().getTranslationKey(this); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java +index d3087d60378822cdd7cea25fd63d3f496e3cd2fb..5d8fa5b39a5d50cca48ba63af3a84b80f279b649 100644 +--- a/src/main/java/org/bukkit/block/Biome.java ++++ b/src/main/java/org/bukkit/block/Biome.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Holds all accepted Biomes in the default server + */ +-public enum Biome implements Keyed { ++public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable { // Paper + OCEAN, + PLAINS, + DESERT, +@@ -89,4 +89,11 @@ public enum Biome implements Keyed { + public NamespacedKey getKey() { + return key; + } ++ ++ // Paper start ++ @Override ++ public @NotNull String translationKey() { ++ return "biome.minecraft." + this.key.getKey(); ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index bf29d9b733afc7c62725d259f4920c4f211cc6d0..1d3812db989a55b6f31bb30dffe70323eb592a15 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; + * (i.e. lighting and power) may not be able to be safely accessed during world + * generation when used in cases like BlockPhysicsEvent!!!! + */ +-public interface Block extends Metadatable, Translatable { ++public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable + + /** + * Gets the metadata for this block +@@ -682,5 +682,12 @@ public interface Block extends Metadatable, Translatable { + * @return the sound group for this block + */ + @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); ++ ++ /** ++ * @deprecated use {@link #translationKey()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ String getTranslationKey(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java +index f4ec7891bdcedc73bff6938e3eddb7ee43d23ec1..4e41980dfbb256356231bc9565f6a90ea66aab76 100644 +--- a/src/main/java/org/bukkit/enchantments/Enchantment.java ++++ b/src/main/java/org/bukkit/enchantments/Enchantment.java +@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; + /** + * The various type of enchantments that may be added to armour or weapons + */ +-public abstract class Enchantment implements Keyed, Translatable { ++public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations + /** + * Provides protection against environmental damage + */ +diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +index c4f86ba1037f3f0e5d697a0962d71d6f8c7c1fbe..ac0371285370594d4de1554871b19bbcd2311730 100644 +--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java ++++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +@@ -26,5 +26,10 @@ public abstract class EnchantmentWrapper extends Enchantment { + public net.kyori.adventure.text.Component displayName(int level) { + return getEnchantment().displayName(level); + } ++ ++ @Override ++ public @NotNull String translationKey() { ++ return getEnchantment().translationKey(); ++ } + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java +index dd410ff2cad3dc34ef9d2a37d72417c7b213de63..b7a454ca11d484209d08d0003d4c19a431456687 100644 +--- a/src/main/java/org/bukkit/entity/EntityType.java ++++ b/src/main/java/org/bukkit/entity/EntityType.java +@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Contract; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + +-public enum EntityType implements Keyed, Translatable { ++public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable + + // These strings MUST match the strings in nms.EntityTypes and are case sensitive. + /** +@@ -439,10 +439,22 @@ public enum EntityType implements Keyed, Translatable { + + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); + } + ++ // Paper start ++ /** ++ * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity) ++ */ ++ @Override ++ public @NotNull String translationKey() { ++ Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); ++ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); ++ } ++ // Paper end ++ + /** + * Gets if this EntityType is enabled by feature in a world. + * +diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java +index d841d94d46462e0ceb7c6b04cc8fc36792bd9201..8c8176121cafed0ed09239b6a7b392dc846438e2 100644 +--- a/src/main/java/org/bukkit/entity/Villager.java ++++ b/src/main/java/org/bukkit/entity/Villager.java +@@ -160,7 +160,7 @@ public interface Villager extends AbstractVillager { + * Represents the various different Villager professions there may be. + * Villagers have different trading options depending on their profession, + */ +- public enum Profession implements Keyed { ++ public enum Profession implements Keyed, net.kyori.adventure.translation.Translatable { // Paper + NONE, + /** + * Armorer profession. Wears a black apron. Armorers primarily trade for +@@ -243,6 +243,13 @@ public interface Villager extends AbstractVillager { + public NamespacedKey getKey() { + return key; + } ++ ++ // Paper start ++ @Override ++ public @NotNull String translationKey() { ++ return "entity.minecraft.villager." + this.key.getKey(); ++ } ++ // Paper end + } + + // Paper start - Add villager reputation API +diff --git a/src/main/java/org/bukkit/inventory/CreativeCategory.java b/src/main/java/org/bukkit/inventory/CreativeCategory.java +index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054dbe7603694 100644 +--- a/src/main/java/org/bukkit/inventory/CreativeCategory.java ++++ b/src/main/java/org/bukkit/inventory/CreativeCategory.java +@@ -3,51 +3,64 @@ package org.bukkit.inventory; + /** + * Represents a category in the creative inventory. + */ +-public enum CreativeCategory { ++public enum CreativeCategory implements net.kyori.adventure.translation.Translatable { // Paper + + /** + * An assortment of building blocks including dirt, bricks, planks, ores + * slabs, etc. + */ +- BUILDING_BLOCKS, ++ BUILDING_BLOCKS("buildingBlocks"), // Paper + /** + * Blocks and items typically used for decorative purposes including + * candles, saplings, flora, fauna, fences, walls, carpets, etc. + */ +- DECORATIONS, ++ DECORATIONS("decorations"), // Paper + /** + * Blocks used and associated with redstone contraptions including buttons, + * levers, pressure plates, redstone components, pistons, etc. + */ +- REDSTONE, ++ REDSTONE("redstone"), // Paper + /** + * Items pertaining to transportation including minecarts, rails, boats, + * elytra, etc. + */ +- TRANSPORTATION, ++ TRANSPORTATION("transportation"), // Paper + /** + * Miscellaneous items and blocks that do not fit into other categories + * including gems, dyes, spawn eggs, discs, banner patterns, etc. + */ +- MISC, ++ MISC("misc"), // Paper + /** + * Food items consumable by the player including meats, berries, edible + * drops from creatures, etc. + */ +- FOOD, ++ FOOD("food"), // Paper + /** + * Equipment items meant for general utility including pickaxes, axes, hoes, + * flint and steel, and useful enchantment books for said tools. + */ +- TOOLS, ++ TOOLS("tools"), // Paper + /** + * Equipment items meant for combat including armor, swords, bows, tipped + * arrows, and useful enchantment books for said equipment. + */ +- COMBAT, ++ COMBAT("combat"), // Paper + /** + * All items related to brewing and potions including all types of potions, + * their variants, and ingredients to brew them. + */ +- BREWING; ++ BREWING("brewing"); // Paper ++ // Paper start ++ private final String translationKey; ++ ++ CreativeCategory(String translationKey) { ++ this.translationKey = "itemGroup." + translationKey; ++ } ++ ++ @Override ++ public @org.jetbrains.annotations.NotNull String translationKey() { ++ return this.translationKey; ++ } ++ // Paper end ++ + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index e82eeadc7cb53572351670761c4e592a33345c6b..645cff10eef90826bb44bbe937b141289f182cde 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; + * use this class to encapsulate Materials for which {@link Material#isItem()} + * returns false. + */ +-public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource { // Paper ++public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.translation.Translatable { // Paper + private Material type = Material.AIR; + private int amount = 0; + private MaterialData data = null; +@@ -620,6 +620,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + + @Override + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public String getTranslationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); + } +@@ -879,5 +880,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + ItemMeta itemMeta = getItemMeta(); + return itemMeta != null && itemMeta.hasItemFlag(flag); + } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * This is not the same as getting the translation key ++ * for the material of this itemstack. ++ */ ++ @Override ++ public @NotNull String translationKey() { ++ return Bukkit.getUnsafe().getTranslationKey(this); ++ } + // Paper end + } diff --git a/patches/api/0208-Add-more-Evoker-API.patch b/patches/api/0208-Add-more-Evoker-API.patch deleted file mode 100644 index 0d6f0f7328..0000000000 --- a/patches/api/0208-Add-more-Evoker-API.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Sun, 23 Aug 2020 15:22:44 +0200 -Subject: [PATCH] Add more Evoker API - - -diff --git a/src/main/java/org/bukkit/entity/Evoker.java b/src/main/java/org/bukkit/entity/Evoker.java -index f8d173adc09197418883dc7bc66dd8bfff8c5c72..76f81cd124090337876c9e5e469862a1c8da4ec8 100644 ---- a/src/main/java/org/bukkit/entity/Evoker.java -+++ b/src/main/java/org/bukkit/entity/Evoker.java -@@ -64,4 +64,19 @@ public interface Evoker extends Spellcaster { - */ - @Deprecated - void setCurrentSpell(@Nullable Spell spell); -+ -+ // Paper start -+ /** -+ * @return the sheep being targeted by the {@link Spell#WOLOLO wololo spell}, or {@code null} if none -+ */ -+ @Nullable -+ Sheep getWololoTarget(); -+ -+ /** -+ * Set the sheep to be the target of the {@link Spell#WOLOLO wololo spell}, or {@code null} to clear. -+ * -+ * @param sheep new wololo target -+ */ -+ void setWololoTarget(@Nullable Sheep sheep); -+ // Paper end - } diff --git a/patches/api/0209-Add-methods-to-get-translation-keys.patch b/patches/api/0209-Add-methods-to-get-translation-keys.patch deleted file mode 100644 index 282a4c0520..0000000000 --- a/patches/api/0209-Add-methods-to-get-translation-keys.patch +++ /dev/null @@ -1,519 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 11 Aug 2020 19:17:46 +0200 -Subject: [PATCH] Add methods to get translation keys - -Co-authored-by: MeFisto94 - -diff --git a/src/main/java/org/bukkit/Difficulty.java b/src/main/java/org/bukkit/Difficulty.java -index f35801783538d3377b04131b8bf6effd7eb8e1a5..427ce8cfd6f63e5c7ec7b264b15ab4111b947729 100644 ---- a/src/main/java/org/bukkit/Difficulty.java -+++ b/src/main/java/org/bukkit/Difficulty.java -@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents the various difficulty levels that are available. - */ --public enum Difficulty { -+public enum Difficulty implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - /** - * Players regain health over time, hostile mobs don't spawn, the hunger - * bar does not deplete. -@@ -51,6 +51,12 @@ public enum Difficulty { - return value; - } - -+ // Paper start -+ @Override -+ public @org.jetbrains.annotations.NotNull String translationKey() { -+ return "options.difficulty." + this.name().toLowerCase(java.util.Locale.ENGLISH); -+ } -+ // Paper end - /** - * Gets the Difficulty represented by the specified value - * -diff --git a/src/main/java/org/bukkit/FireworkEffect.java b/src/main/java/org/bukkit/FireworkEffect.java -index bf7db5b3e7c2ac15016a48e520fba674726718ee..637fa73d4366c2d88e2716e5c8d3465706d788a7 100644 ---- a/src/main/java/org/bukkit/FireworkEffect.java -+++ b/src/main/java/org/bukkit/FireworkEffect.java -@@ -18,28 +18,44 @@ public final class FireworkEffect implements ConfigurationSerializable { - /** - * The type or shape of the effect. - */ -- public enum Type { -+ public enum Type implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - /** - * A small ball effect. - */ -- BALL, -+ BALL("small_ball"), // Paper - add name - /** - * A large ball effect. - */ -- BALL_LARGE, -+ BALL_LARGE("large_ball"), // Paper - add name - /** - * A star-shaped effect. - */ -- STAR, -+ STAR("star"), // Paper - add name - /** - * A burst effect. - */ -- BURST, -+ BURST("burst"), // Paper - add name - /** - * A creeper-face effect. - */ -- CREEPER, -+ CREEPER("creeper"), // Paper - add name - ; -+ // Paper start -+ /** -+ * The name map. -+ */ -+ public static final net.kyori.adventure.util.Index NAMES = net.kyori.adventure.util.Index.create(Type.class, type -> type.name); -+ private final String name; -+ -+ Type(final String name) { -+ this.name = name; -+ } -+ -+ @Override -+ public @NotNull String translationKey() { -+ return "item.minecraft.firework_star.shape." + this.name; -+ } -+ // Paper end - } - - /** -diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java -index 81e45984a88fc84acd0f76d825abf4ddaed0ac3b..fdc42a79c5af30fdade41ee99245e6641f353571 100644 ---- a/src/main/java/org/bukkit/GameMode.java -+++ b/src/main/java/org/bukkit/GameMode.java -@@ -9,7 +9,7 @@ import org.jetbrains.annotations.Nullable; - * Represents the various type of game modes that {@link HumanEntity}s may - * have - */ --public enum GameMode { -+public enum GameMode implements net.kyori.adventure.translation.Translatable { // Paper - implement Translatable - /** - * Creative mode may fly, build instantly, become invulnerable and create - * free items. -@@ -35,9 +35,18 @@ public enum GameMode { - - private final int value; - private static final Map BY_ID = Maps.newHashMap(); -+ // Paper start - translation keys -+ private final String translationKey; -+ -+ @Override -+ public @org.jetbrains.annotations.NotNull String translationKey() { -+ return this.translationKey; -+ } -+ // Paper end - - private GameMode(final int value) { - this.value = value; -+ this.translationKey = "gameMode." + this.name().toLowerCase(java.util.Locale.ENGLISH); // Paper - } - - /** -diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java -index dc66bd69646ac949d1386ce8f6ff913e9475439d..4482e8f2c617c2f51b2b53762e775d118002363a 100644 ---- a/src/main/java/org/bukkit/GameRule.java -+++ b/src/main/java/org/bukkit/GameRule.java -@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable; - * - * @param type of rule (Boolean or Integer) - */ --public final class GameRule { -+public final class GameRule implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - - private static Map> gameRules = new HashMap<>(); - // Boolean rules -@@ -355,4 +355,11 @@ public final class GameRule { - public static GameRule[] values() { - return gameRules.values().toArray(new GameRule[gameRules.size()]); - } -+ -+ // Paper start -+ @Override -+ public @NotNull String translationKey() { -+ return "gamerule." + this.name; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index c605da711c032f7091390e50b4a5d332c992d3d1..61e0739f002a949a204c7591dfa3074560d1459e 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -126,7 +126,7 @@ import org.jetbrains.annotations.Nullable; - * An enum of all material IDs accepted by the official server and client - */ - @SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper --public enum Material implements Keyed, Translatable { -+public enum Material implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - // - AIR(9648, 0), - STONE(22948), -@@ -4740,6 +4740,15 @@ public enum Material implements Keyed, Translatable { - } - return false; - } -+ -+ @Override -+ public @NotNull String translationKey() { -+ if (this.isItem()) { -+ return Bukkit.getUnsafe().getItemTranslationKey(this); -+ } else { -+ return Bukkit.getUnsafe().getBlockTranslationKey(this); -+ } -+ } - // Paper end - - /** -@@ -11481,9 +11490,11 @@ public enum Material implements Keyed, Translatable { - * material - * @see #getBlockTranslationKey() - * @see #getItemTranslationKey() -+ * @deprecated use {@link #translationKey()} - */ - @Override - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public String getTranslationKey() { - if (this.isItem()) { - return Bukkit.getUnsafe().getItemTranslationKey(this); -diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java -index eae90e72b1dff5ab3b1a4fdcfe57187e85fe4d49..62d2b3f950860dee0898d77b0a29635c3f9a7e23 100644 ---- a/src/main/java/org/bukkit/MusicInstrument.java -+++ b/src/main/java/org/bukkit/MusicInstrument.java -@@ -7,7 +7,7 @@ import java.util.Collections; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public abstract class MusicInstrument implements Keyed { -+public abstract class MusicInstrument implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translation keys - - public static final MusicInstrument PONDER_GOAT_HORN = getInstrument("ponder_goat_horn"); - public static final MusicInstrument SING_GOAT_HORN = getInstrument("sing_goat_horn"); -@@ -52,4 +52,11 @@ public abstract class MusicInstrument implements Keyed { - - return instrument; - } -+ -+ // Paper start - translation key -+ @Override -+ public @NotNull String translationKey() { -+ return "instrument.minecraft." + this.getKey().value(); -+ } -+ // Paper end - translation key - } -diff --git a/src/main/java/org/bukkit/Translatable.java b/src/main/java/org/bukkit/Translatable.java -index e3faa2c675c85a9cbdbbb1debec0ff81c58a1bbd..fd1629c2d2028a88fb3d56b0aeb833d17235080a 100644 ---- a/src/main/java/org/bukkit/Translatable.java -+++ b/src/main/java/org/bukkit/Translatable.java -@@ -5,14 +5,18 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents an object with a text representation that can be translated by the - * Minecraft client. -+ * @deprecated use {@link net.kyori.adventure.translation.Translatable} - */ -+@Deprecated(forRemoval = true) // Paper - public interface Translatable { - - /** - * Get the translation key, suitable for use in a translation component. - * - * @return the translation key -+ * @deprecated look for a {@code translationKey()} method instead - */ - @NotNull -+ @Deprecated(forRemoval = true) // Paper - String getTranslationKey(); - } -diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java -index 3a7f6fd862dc2dd72366089ce99a0e96d07c0fdc..063cb21e33d039933e9ef295564db595cfd9f8c9 100644 ---- a/src/main/java/org/bukkit/attribute/Attribute.java -+++ b/src/main/java/org/bukkit/attribute/Attribute.java -@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Types of attributes which may be present on an {@link Attributable}. - */ --public enum Attribute implements Keyed, Translatable { -+public enum Attribute implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - - /** - * Maximum health of an Entity. -@@ -117,4 +117,12 @@ public enum Attribute implements Keyed, Translatable { - public String getTranslationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } -+ -+ // Paper start -+ @SuppressWarnings("deprecation") -+ @Override -+ public @NotNull String translationKey() { -+ return Bukkit.getUnsafe().getTranslationKey(this); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java -index d3087d60378822cdd7cea25fd63d3f496e3cd2fb..5d8fa5b39a5d50cca48ba63af3a84b80f279b649 100644 ---- a/src/main/java/org/bukkit/block/Biome.java -+++ b/src/main/java/org/bukkit/block/Biome.java -@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Holds all accepted Biomes in the default server - */ --public enum Biome implements Keyed { -+public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - OCEAN, - PLAINS, - DESERT, -@@ -89,4 +89,11 @@ public enum Biome implements Keyed { - public NamespacedKey getKey() { - return key; - } -+ -+ // Paper start -+ @Override -+ public @NotNull String translationKey() { -+ return "biome.minecraft." + this.key.getKey(); -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index bf29d9b733afc7c62725d259f4920c4f211cc6d0..1d3812db989a55b6f31bb30dffe70323eb592a15 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; - * (i.e. lighting and power) may not be able to be safely accessed during world - * generation when used in cases like BlockPhysicsEvent!!!! - */ --public interface Block extends Metadatable, Translatable { -+public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable - - /** - * Gets the metadata for this block -@@ -682,5 +682,12 @@ public interface Block extends Metadatable, Translatable { - * @return the sound group for this block - */ - @NotNull org.bukkit.SoundGroup getBlockSoundGroup(); -+ -+ /** -+ * @deprecated use {@link #translationKey()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ String getTranslationKey(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index f4ec7891bdcedc73bff6938e3eddb7ee43d23ec1..4e41980dfbb256356231bc9565f6a90ea66aab76 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; - /** - * The various type of enchantments that may be added to armour or weapons - */ --public abstract class Enchantment implements Keyed, Translatable { -+public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations - /** - * Provides protection against environmental damage - */ -diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -index c4f86ba1037f3f0e5d697a0962d71d6f8c7c1fbe..ac0371285370594d4de1554871b19bbcd2311730 100644 ---- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -@@ -26,5 +26,10 @@ public abstract class EnchantmentWrapper extends Enchantment { - public net.kyori.adventure.text.Component displayName(int level) { - return getEnchantment().displayName(level); - } -+ -+ @Override -+ public @NotNull String translationKey() { -+ return getEnchantment().translationKey(); -+ } - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index dd410ff2cad3dc34ef9d2a37d72417c7b213de63..b7a454ca11d484209d08d0003d4c19a431456687 100644 ---- a/src/main/java/org/bukkit/entity/EntityType.java -+++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Contract; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public enum EntityType implements Keyed, Translatable { -+public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable - - // These strings MUST match the strings in nms.EntityTypes and are case sensitive. - /** -@@ -439,10 +439,22 @@ public enum EntityType implements Keyed, Translatable { - - @Override - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public String getTranslationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } - -+ // Paper start -+ /** -+ * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity) -+ */ -+ @Override -+ public @NotNull String translationKey() { -+ Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); -+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); -+ } -+ // Paper end -+ - /** - * Gets if this EntityType is enabled by feature in a world. - * -diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index d841d94d46462e0ceb7c6b04cc8fc36792bd9201..8c8176121cafed0ed09239b6a7b392dc846438e2 100644 ---- a/src/main/java/org/bukkit/entity/Villager.java -+++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -160,7 +160,7 @@ public interface Villager extends AbstractVillager { - * Represents the various different Villager professions there may be. - * Villagers have different trading options depending on their profession, - */ -- public enum Profession implements Keyed { -+ public enum Profession implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - NONE, - /** - * Armorer profession. Wears a black apron. Armorers primarily trade for -@@ -243,6 +243,13 @@ public interface Villager extends AbstractVillager { - public NamespacedKey getKey() { - return key; - } -+ -+ // Paper start -+ @Override -+ public @NotNull String translationKey() { -+ return "entity.minecraft.villager." + this.key.getKey(); -+ } -+ // Paper end - } - - // Paper start - Add villager reputation API -diff --git a/src/main/java/org/bukkit/inventory/CreativeCategory.java b/src/main/java/org/bukkit/inventory/CreativeCategory.java -index 5bd252c0ae3b09fe141d131360c67bb9bfbf5422..78587d9fabe6371a23a7963917b054dbe7603694 100644 ---- a/src/main/java/org/bukkit/inventory/CreativeCategory.java -+++ b/src/main/java/org/bukkit/inventory/CreativeCategory.java -@@ -3,51 +3,64 @@ package org.bukkit.inventory; - /** - * Represents a category in the creative inventory. - */ --public enum CreativeCategory { -+public enum CreativeCategory implements net.kyori.adventure.translation.Translatable { // Paper - - /** - * An assortment of building blocks including dirt, bricks, planks, ores - * slabs, etc. - */ -- BUILDING_BLOCKS, -+ BUILDING_BLOCKS("buildingBlocks"), // Paper - /** - * Blocks and items typically used for decorative purposes including - * candles, saplings, flora, fauna, fences, walls, carpets, etc. - */ -- DECORATIONS, -+ DECORATIONS("decorations"), // Paper - /** - * Blocks used and associated with redstone contraptions including buttons, - * levers, pressure plates, redstone components, pistons, etc. - */ -- REDSTONE, -+ REDSTONE("redstone"), // Paper - /** - * Items pertaining to transportation including minecarts, rails, boats, - * elytra, etc. - */ -- TRANSPORTATION, -+ TRANSPORTATION("transportation"), // Paper - /** - * Miscellaneous items and blocks that do not fit into other categories - * including gems, dyes, spawn eggs, discs, banner patterns, etc. - */ -- MISC, -+ MISC("misc"), // Paper - /** - * Food items consumable by the player including meats, berries, edible - * drops from creatures, etc. - */ -- FOOD, -+ FOOD("food"), // Paper - /** - * Equipment items meant for general utility including pickaxes, axes, hoes, - * flint and steel, and useful enchantment books for said tools. - */ -- TOOLS, -+ TOOLS("tools"), // Paper - /** - * Equipment items meant for combat including armor, swords, bows, tipped - * arrows, and useful enchantment books for said equipment. - */ -- COMBAT, -+ COMBAT("combat"), // Paper - /** - * All items related to brewing and potions including all types of potions, - * their variants, and ingredients to brew them. - */ -- BREWING; -+ BREWING("brewing"); // Paper -+ // Paper start -+ private final String translationKey; -+ -+ CreativeCategory(String translationKey) { -+ this.translationKey = "itemGroup." + translationKey; -+ } -+ -+ @Override -+ public @org.jetbrains.annotations.NotNull String translationKey() { -+ return this.translationKey; -+ } -+ // Paper end -+ - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index e82eeadc7cb53572351670761c4e592a33345c6b..645cff10eef90826bb44bbe937b141289f182cde 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; - * use this class to encapsulate Materials for which {@link Material#isItem()} - * returns false. - */ --public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource { // Paper -+public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource, net.kyori.adventure.translation.Translatable { // Paper - private Material type = Material.AIR; - private int amount = 0; - private MaterialData data = null; -@@ -620,6 +620,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - - @Override - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public String getTranslationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } -@@ -879,5 +880,16 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - ItemMeta itemMeta = getItemMeta(); - return itemMeta != null && itemMeta.hasItemFlag(flag); - } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * This is not the same as getting the translation key -+ * for the material of this itemstack. -+ */ -+ @Override -+ public @NotNull String translationKey() { -+ return Bukkit.getUnsafe().getTranslationKey(this); -+ } - // Paper end - } diff --git a/patches/api/0209-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/api/0209-Create-HoverEvent-from-ItemStack-Entity.patch new file mode 100644 index 0000000000..ff14019e55 --- /dev/null +++ b/patches/api/0209-Create-HoverEvent-from-ItemStack-Entity.patch @@ -0,0 +1,76 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ysl3000 +Date: Mon, 6 Jul 2020 22:17:37 +0200 +Subject: [PATCH] Create HoverEvent from ItemStack Entity + + +diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java +index e34c89a945a0f12cdc4be8cc232c8de986474372..dbebaf8172ec6872f56958b9583affde4f8400a4 100644 +--- a/src/main/java/org/bukkit/inventory/ItemFactory.java ++++ b/src/main/java/org/bukkit/inventory/ItemFactory.java +@@ -265,4 +265,65 @@ public interface ItemFactory { + @NotNull + ItemStack ensureServerConversions(@NotNull ItemStack item); + // Paper end - ensure server conversions API ++ ++ // Paper start - bungee hover events ++ /** ++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack for displaying. ++ * ++ * @param itemStack the itemstack ++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack ++ * @deprecated use {@link ItemStack#asHoverEvent()} ++ */ ++ @NotNull ++ @Deprecated // Paper ++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull ItemStack itemStack); ++ ++ /** ++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. ++ * Uses the display name of the entity, if present. ++ * ++ * @param entity Entity to create the HoverEvent for ++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} ++ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent()} ++ */ ++ @NotNull ++ @Deprecated ++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity); ++ ++ /** ++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. ++ * ++ * @param entity Entity to create the HoverEvent for ++ * @param customName a custom name that should be displayed, if not passed entity name will be displayed ++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} ++ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent(java.util.function.UnaryOperator)} ++ */ ++ @NotNull ++ @Deprecated ++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @Nullable String customName); ++ ++ /** ++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. ++ * ++ * @param entity Entity to create the HoverEvent for ++ * @param customName a custom name that should be displayed, if not passed entity name will be displayed ++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} ++ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent(java.util.function.UnaryOperator)} ++ */ ++ @NotNull ++ @Deprecated ++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @Nullable net.md_5.bungee.api.chat.BaseComponent customName); ++ ++ /** ++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. ++ * ++ * @param entity Entity to create the HoverEvent for ++ * @param customName a custom name that should be displayed, if not passed entity name will be displayed ++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} ++ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent(java.util.function.UnaryOperator)} ++ */ ++ @NotNull ++ @Deprecated ++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName); ++ // Paper end - bungee hover events + } diff --git a/patches/api/0210-Add-additional-open-container-api-to-HumanEntity.patch b/patches/api/0210-Add-additional-open-container-api-to-HumanEntity.patch new file mode 100644 index 0000000000..43e6937d05 --- /dev/null +++ b/patches/api/0210-Add-additional-open-container-api-to-HumanEntity.patch @@ -0,0 +1,103 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Wed, 26 Aug 2020 02:11:58 -0400 +Subject: [PATCH] Add additional open container api to HumanEntity + + +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index 2557ddcc0528d4f9d811883b3ddc61148ebc3998..5ecfb98540c00da05b13bc5370debb89c52cc76f 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -174,6 +174,92 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + @Nullable + public InventoryView openMerchant(@NotNull Merchant merchant, boolean force); + ++ // Paper start - Add additional containers ++ /** ++ * Opens an empty anvil inventory window with the player's inventory ++ * on the bottom. ++ * ++ * @param location The location to attach it to. If null, the player's ++ * location is used. ++ * @param force If false, and there is no anvil block at the location, ++ * no inventory will be opened and null will be returned. ++ * @return The newly opened inventory view, or null if it could not be ++ * opened. ++ */ ++ @Nullable ++ public InventoryView openAnvil(@Nullable Location location, boolean force); ++ ++ /** ++ * Opens an empty cartography table inventory window with the player's inventory ++ * on the bottom. ++ * ++ * @param location The location to attach it to. If null, the player's ++ * location is used. ++ * @param force If false, and there is no cartography table block at the location, ++ * no inventory will be opened and null will be returned. ++ * @return The newly opened inventory view, or null if it could not be ++ * opened. ++ */ ++ @Nullable ++ public InventoryView openCartographyTable(@Nullable Location location, boolean force); ++ ++ /** ++ * Opens an empty grindstone inventory window with the player's inventory ++ * on the bottom. ++ * ++ * @param location The location to attach it to. If null, the player's ++ * location is used. ++ * @param force If false, and there is no grindstone block at the location, ++ * no inventory will be opened and null will be returned. ++ * @return The newly opened inventory view, or null if it could not be ++ * opened. ++ */ ++ @Nullable ++ public InventoryView openGrindstone(@Nullable Location location, boolean force); ++ ++ /** ++ * Opens an empty loom inventory window with the player's inventory ++ * on the bottom. ++ * ++ * @param location The location to attach it to. If null, the player's ++ * location is used. ++ * @param force If false, and there is no loom block at the location, ++ * no inventory will be opened and null will be returned. ++ * @return The newly opened inventory view, or null if it could not be ++ * opened. ++ */ ++ @Nullable ++ public InventoryView openLoom(@Nullable Location location, boolean force); ++ ++ /** ++ * Opens an empty smithing table inventory window with the player's inventory ++ * on the bottom. ++ * ++ * @param location The location to attach it to. If null, the player's ++ * location is used. ++ * @param force If false, and there is no smithing table block at the location, ++ * no inventory will be opened and null will be returned. ++ * @return The newly opened inventory view, or null if it could not be ++ * opened. ++ */ ++ @Nullable ++ public InventoryView openSmithingTable(@Nullable Location location, boolean force); ++ ++ /** ++ * Opens an empty stonecutter inventory window with the player's inventory ++ * on the bottom. ++ * ++ * @param location The location to attach it to. If null, the player's ++ * location is used. ++ * @param force If false, and there is no stonecutter block at the location, ++ * no inventory will be opened and null will be returned. ++ * @return The newly opened inventory view, or null if it could not be ++ * opened. ++ */ ++ @Nullable ++ public InventoryView openStonecutter(@Nullable Location location, boolean force); ++ // Paper end ++ + /** + * Force-closes the currently open inventory view for this player, if any. + */ diff --git a/patches/api/0210-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/api/0210-Create-HoverEvent-from-ItemStack-Entity.patch deleted file mode 100644 index ff14019e55..0000000000 --- a/patches/api/0210-Create-HoverEvent-from-ItemStack-Entity.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ysl3000 -Date: Mon, 6 Jul 2020 22:17:37 +0200 -Subject: [PATCH] Create HoverEvent from ItemStack Entity - - -diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index e34c89a945a0f12cdc4be8cc232c8de986474372..dbebaf8172ec6872f56958b9583affde4f8400a4 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFactory.java -+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -265,4 +265,65 @@ public interface ItemFactory { - @NotNull - ItemStack ensureServerConversions(@NotNull ItemStack item); - // Paper end - ensure server conversions API -+ -+ // Paper start - bungee hover events -+ /** -+ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack for displaying. -+ * -+ * @param itemStack the itemstack -+ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack -+ * @deprecated use {@link ItemStack#asHoverEvent()} -+ */ -+ @NotNull -+ @Deprecated // Paper -+ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull ItemStack itemStack); -+ -+ /** -+ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. -+ * Uses the display name of the entity, if present. -+ * -+ * @param entity Entity to create the HoverEvent for -+ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} -+ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent()} -+ */ -+ @NotNull -+ @Deprecated -+ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity); -+ -+ /** -+ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. -+ * -+ * @param entity Entity to create the HoverEvent for -+ * @param customName a custom name that should be displayed, if not passed entity name will be displayed -+ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} -+ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent(java.util.function.UnaryOperator)} -+ */ -+ @NotNull -+ @Deprecated -+ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @Nullable String customName); -+ -+ /** -+ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. -+ * -+ * @param entity Entity to create the HoverEvent for -+ * @param customName a custom name that should be displayed, if not passed entity name will be displayed -+ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} -+ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent(java.util.function.UnaryOperator)} -+ */ -+ @NotNull -+ @Deprecated -+ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @Nullable net.md_5.bungee.api.chat.BaseComponent customName); -+ -+ /** -+ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying. -+ * -+ * @param entity Entity to create the HoverEvent for -+ * @param customName a custom name that should be displayed, if not passed entity name will be displayed -+ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} -+ * @deprecated use {@link org.bukkit.entity.Entity#asHoverEvent(java.util.function.UnaryOperator)} -+ */ -+ @NotNull -+ @Deprecated -+ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName); -+ // Paper end - bungee hover events - } diff --git a/patches/api/0211-Add-additional-open-container-api-to-HumanEntity.patch b/patches/api/0211-Add-additional-open-container-api-to-HumanEntity.patch deleted file mode 100644 index 43e6937d05..0000000000 --- a/patches/api/0211-Add-additional-open-container-api-to-HumanEntity.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JRoy -Date: Wed, 26 Aug 2020 02:11:58 -0400 -Subject: [PATCH] Add additional open container api to HumanEntity - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 2557ddcc0528d4f9d811883b3ddc61148ebc3998..5ecfb98540c00da05b13bc5370debb89c52cc76f 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -174,6 +174,92 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - @Nullable - public InventoryView openMerchant(@NotNull Merchant merchant, boolean force); - -+ // Paper start - Add additional containers -+ /** -+ * Opens an empty anvil inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no anvil block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openAnvil(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty cartography table inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no cartography table block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openCartographyTable(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty grindstone inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no grindstone block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openGrindstone(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty loom inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no loom block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openLoom(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty smithing table inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no smithing table block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openSmithingTable(@Nullable Location location, boolean force); -+ -+ /** -+ * Opens an empty stonecutter inventory window with the player's inventory -+ * on the bottom. -+ * -+ * @param location The location to attach it to. If null, the player's -+ * location is used. -+ * @param force If false, and there is no stonecutter block at the location, -+ * no inventory will be opened and null will be returned. -+ * @return The newly opened inventory view, or null if it could not be -+ * opened. -+ */ -+ @Nullable -+ public InventoryView openStonecutter(@Nullable Location location, boolean force); -+ // Paper end -+ - /** - * Force-closes the currently open inventory view for this player, if any. - */ diff --git a/patches/api/0211-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/api/0211-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch new file mode 100644 index 0000000000..2bd8553c32 --- /dev/null +++ b/patches/api/0211-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MeFisto94 +Date: Fri, 28 Aug 2020 01:41:31 +0200 +Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and + non-conflicting Entity Ids + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 77a06e58f86f908916e68e80ce365ae25884e5a2..5e817e3372edc381bc1d3b993686cbeaa5daac34 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -158,5 +158,12 @@ public interface UnsafeValues { + byte[] serializeItem(ItemStack item); + + ItemStack deserializeItem(byte[] data); ++ ++ /** ++ * Creates and returns the next EntityId available. ++ *

++ * Use this when sending custom packets, so that there are no collisions on the client or server. ++ */ ++ public int nextEntityId(); + // Paper end + } diff --git a/patches/api/0212-Entity-isTicking.patch b/patches/api/0212-Entity-isTicking.patch new file mode 100644 index 0000000000..37d0f8dce3 --- /dev/null +++ b/patches/api/0212-Entity-isTicking.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 3 Oct 2020 21:39:07 -0500 +Subject: [PATCH] Entity#isTicking + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 6a9cd00110988a0d0bd89f0252cc0f21c36982c0..e9c3c5c4099f7bf7f83bde0b47fd193a3b401f0a 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -894,5 +894,10 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * Check if entity is in lava + */ + boolean isInLava(); ++ ++ /** ++ * Check if entity is inside a ticking chunk ++ */ ++ boolean isTicking(); + // Paper end + } diff --git a/patches/api/0212-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/api/0212-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch deleted file mode 100644 index 75dff33979..0000000000 --- a/patches/api/0212-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MeFisto94 -Date: Fri, 28 Aug 2020 01:41:31 +0200 -Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and - non-conflicting Entity Ids - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 30d869a7c4bba79b4c05de7860b31c14f47b341a..241cb853476ea35dad73d0234b2d030e9af23476 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -157,5 +157,12 @@ public interface UnsafeValues { - byte[] serializeItem(ItemStack item); - - ItemStack deserializeItem(byte[] data); -+ -+ /** -+ * Creates and returns the next EntityId available. -+ *

-+ * Use this when sending custom packets, so that there are no collisions on the client or server. -+ */ -+ public int nextEntityId(); - // Paper end - } diff --git a/patches/api/0213-Entity-isTicking.patch b/patches/api/0213-Entity-isTicking.patch deleted file mode 100644 index 37d0f8dce3..0000000000 --- a/patches/api/0213-Entity-isTicking.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Sat, 3 Oct 2020 21:39:07 -0500 -Subject: [PATCH] Entity#isTicking - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 6a9cd00110988a0d0bd89f0252cc0f21c36982c0..e9c3c5c4099f7bf7f83bde0b47fd193a3b401f0a 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -894,5 +894,10 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * Check if entity is in lava - */ - boolean isInLava(); -+ -+ /** -+ * Check if entity is inside a ticking chunk -+ */ -+ boolean isTicking(); - // Paper end - } diff --git a/patches/api/0213-Villager-resetOffers.patch b/patches/api/0213-Villager-resetOffers.patch new file mode 100644 index 0000000000..60fedfba0f --- /dev/null +++ b/patches/api/0213-Villager-resetOffers.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Mon, 7 Oct 2019 00:15:28 -0500 +Subject: [PATCH] Villager#resetOffers + + +diff --git a/src/main/java/org/bukkit/entity/AbstractVillager.java b/src/main/java/org/bukkit/entity/AbstractVillager.java +index d2b0c08554dba4d34b37b440f1d77ae0e64cb99e..7fbe31c4fd69d4fca7ef96c0a56b0e0204d60cf4 100644 +--- a/src/main/java/org/bukkit/entity/AbstractVillager.java ++++ b/src/main/java/org/bukkit/entity/AbstractVillager.java +@@ -21,4 +21,11 @@ public interface AbstractVillager extends Breedable, NPC, InventoryHolder, Merch + @NotNull + @Override + Inventory getInventory(); ++ ++ // Paper start ++ /** ++ * Reset this villager's trade offers ++ */ ++ public void resetOffers(); ++ // Paper end + } diff --git a/patches/api/0214-Player-elytra-boost-API.patch b/patches/api/0214-Player-elytra-boost-API.patch new file mode 100644 index 0000000000..29d5923494 --- /dev/null +++ b/patches/api/0214-Player-elytra-boost-API.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Tue, 14 Apr 2020 12:06:14 +0200 +Subject: [PATCH] Player elytra boost API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index b0c0fd6687af5676d85094304ced25c1c444bc90..28a811be93b29f105dad1db91a8adccbdf9fcaf7 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3289,6 +3289,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption option); + // Paper end - client option API + ++ // Paper start - elytra boost API ++ /** ++ * Boost a Player that's {@link #isGliding()} using a {@link Firework}. ++ * If the creation of the entity is cancelled, no boosting is done. ++ * This method does not fire {@link com.destroystokyo.paper.event.player.PlayerElytraBoostEvent}. ++ * ++ * @param firework The {@link Material#FIREWORK_ROCKET} to boost the player with ++ * @return The {@link Firework} boosting the Player or null if the spawning of the entity was cancelled ++ * @throws IllegalArgumentException if {@link #isGliding()} is false ++ * or if the {@code firework} isn't a {@link Material#FIREWORK_ROCKET} ++ * @deprecated use {@link HumanEntity#fireworkBoost(ItemStack)} instead. Note that this method does not ++ * check if the player is gliding or not. ++ */ ++ default @Nullable Firework boostElytra(final @NotNull ItemStack firework) { ++ com.google.common.base.Preconditions.checkState(this.isGliding(), "Player must be gliding"); ++ return this.fireworkBoost(firework); ++ } ++ // Paper end - elytra boost API ++ + // Spigot start + public class Spigot extends Entity.Spigot { + diff --git a/patches/api/0214-Villager-resetOffers.patch b/patches/api/0214-Villager-resetOffers.patch deleted file mode 100644 index 60fedfba0f..0000000000 --- a/patches/api/0214-Villager-resetOffers.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Mon, 7 Oct 2019 00:15:28 -0500 -Subject: [PATCH] Villager#resetOffers - - -diff --git a/src/main/java/org/bukkit/entity/AbstractVillager.java b/src/main/java/org/bukkit/entity/AbstractVillager.java -index d2b0c08554dba4d34b37b440f1d77ae0e64cb99e..7fbe31c4fd69d4fca7ef96c0a56b0e0204d60cf4 100644 ---- a/src/main/java/org/bukkit/entity/AbstractVillager.java -+++ b/src/main/java/org/bukkit/entity/AbstractVillager.java -@@ -21,4 +21,11 @@ public interface AbstractVillager extends Breedable, NPC, InventoryHolder, Merch - @NotNull - @Override - Inventory getInventory(); -+ -+ // Paper start -+ /** -+ * Reset this villager's trade offers -+ */ -+ public void resetOffers(); -+ // Paper end - } diff --git a/patches/api/0215-Add-getOfflinePlayerIfCached-String.patch b/patches/api/0215-Add-getOfflinePlayerIfCached-String.patch new file mode 100644 index 0000000000..402eff8c38 --- /dev/null +++ b/patches/api/0215-Add-getOfflinePlayerIfCached-String.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: oxygencraft <21054297+oxygencraft@users.noreply.github.com> +Date: Sun, 25 Oct 2020 18:35:58 +1100 +Subject: [PATCH] Add getOfflinePlayerIfCached(String) + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 79db7b5c25a7c824b107a5c79f40c61983d2757c..732ed3724e784ad659cb4411dbd73b42a8330a2c 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1373,6 +1373,27 @@ public final class Bukkit { + return server.getOfflinePlayer(name); + } + ++ // Paper start ++ /** ++ * Gets the player by the given name, regardless if they are offline or ++ * online. ++ *

++ * This will not make a web request to get the UUID for the given name, ++ * thus this method will not block. However this method will return ++ * {@code null} if the player is not cached. ++ *

++ * ++ * @param name the name of the player to retrieve ++ * @return an offline player if cached, {@code null} otherwise ++ * @see #getOfflinePlayer(String) ++ * @see #getOfflinePlayer(java.util.UUID) ++ */ ++ @Nullable ++ public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) { ++ return server.getOfflinePlayerIfCached(name); ++ } ++ // Paper end ++ + /** + * Gets the player by the given UUID, regardless if they are offline or + * online. +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 8aba385b9d1a9b71c3304f1d802f18d4434f34d5..395f7910f535bfd33a5676b011ab62a53e30e140 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1157,6 +1157,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @NotNull + public OfflinePlayer getOfflinePlayer(@NotNull String name); + ++ // Paper start ++ /** ++ * Gets the player by the given name, regardless if they are offline or ++ * online. ++ *

++ * This will not make a web request to get the UUID for the given name, ++ * thus this method will not block. However this method will return ++ * {@code null} if the player is not cached. ++ *

++ * ++ * @param name the name of the player to retrieve ++ * @return an offline player if cached, {@code null} otherwise ++ * @see #getOfflinePlayer(String) ++ * @see #getOfflinePlayer(java.util.UUID) ++ */ ++ @Nullable ++ public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name); ++ // Paper end ++ + /** + * Gets the player by the given UUID, regardless if they are offline or + * online. diff --git a/patches/api/0215-Player-elytra-boost-API.patch b/patches/api/0215-Player-elytra-boost-API.patch deleted file mode 100644 index 29d5923494..0000000000 --- a/patches/api/0215-Player-elytra-boost-API.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary -Date: Tue, 14 Apr 2020 12:06:14 +0200 -Subject: [PATCH] Player elytra boost API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b0c0fd6687af5676d85094304ced25c1c444bc90..28a811be93b29f105dad1db91a8adccbdf9fcaf7 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3289,6 +3289,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption option); - // Paper end - client option API - -+ // Paper start - elytra boost API -+ /** -+ * Boost a Player that's {@link #isGliding()} using a {@link Firework}. -+ * If the creation of the entity is cancelled, no boosting is done. -+ * This method does not fire {@link com.destroystokyo.paper.event.player.PlayerElytraBoostEvent}. -+ * -+ * @param firework The {@link Material#FIREWORK_ROCKET} to boost the player with -+ * @return The {@link Firework} boosting the Player or null if the spawning of the entity was cancelled -+ * @throws IllegalArgumentException if {@link #isGliding()} is false -+ * or if the {@code firework} isn't a {@link Material#FIREWORK_ROCKET} -+ * @deprecated use {@link HumanEntity#fireworkBoost(ItemStack)} instead. Note that this method does not -+ * check if the player is gliding or not. -+ */ -+ default @Nullable Firework boostElytra(final @NotNull ItemStack firework) { -+ com.google.common.base.Preconditions.checkState(this.isGliding(), "Player must be gliding"); -+ return this.fireworkBoost(firework); -+ } -+ // Paper end - elytra boost API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/0216-Add-getOfflinePlayerIfCached-String.patch b/patches/api/0216-Add-getOfflinePlayerIfCached-String.patch deleted file mode 100644 index 402eff8c38..0000000000 --- a/patches/api/0216-Add-getOfflinePlayerIfCached-String.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: oxygencraft <21054297+oxygencraft@users.noreply.github.com> -Date: Sun, 25 Oct 2020 18:35:58 +1100 -Subject: [PATCH] Add getOfflinePlayerIfCached(String) - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 79db7b5c25a7c824b107a5c79f40c61983d2757c..732ed3724e784ad659cb4411dbd73b42a8330a2c 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1373,6 +1373,27 @@ public final class Bukkit { - return server.getOfflinePlayer(name); - } - -+ // Paper start -+ /** -+ * Gets the player by the given name, regardless if they are offline or -+ * online. -+ *

-+ * This will not make a web request to get the UUID for the given name, -+ * thus this method will not block. However this method will return -+ * {@code null} if the player is not cached. -+ *

-+ * -+ * @param name the name of the player to retrieve -+ * @return an offline player if cached, {@code null} otherwise -+ * @see #getOfflinePlayer(String) -+ * @see #getOfflinePlayer(java.util.UUID) -+ */ -+ @Nullable -+ public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) { -+ return server.getOfflinePlayerIfCached(name); -+ } -+ // Paper end -+ - /** - * Gets the player by the given UUID, regardless if they are offline or - * online. -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 8aba385b9d1a9b71c3304f1d802f18d4434f34d5..395f7910f535bfd33a5676b011ab62a53e30e140 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -1157,6 +1157,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public OfflinePlayer getOfflinePlayer(@NotNull String name); - -+ // Paper start -+ /** -+ * Gets the player by the given name, regardless if they are offline or -+ * online. -+ *

-+ * This will not make a web request to get the UUID for the given name, -+ * thus this method will not block. However this method will return -+ * {@code null} if the player is not cached. -+ *

-+ * -+ * @param name the name of the player to retrieve -+ * @return an offline player if cached, {@code null} otherwise -+ * @see #getOfflinePlayer(String) -+ * @see #getOfflinePlayer(java.util.UUID) -+ */ -+ @Nullable -+ public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name); -+ // Paper end -+ - /** - * Gets the player by the given UUID, regardless if they are offline or - * online. diff --git a/patches/api/0216-Add-ignore-discounts-API.patch b/patches/api/0216-Add-ignore-discounts-API.patch new file mode 100644 index 0000000000..89655ddef8 --- /dev/null +++ b/patches/api/0216-Add-ignore-discounts-API.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Mon, 9 Nov 2020 20:33:38 +0100 +Subject: [PATCH] Add ignore discounts API + + +diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java +index d33b66facf36587d703c29e9085289ce919ae621..afaa21b9347683fa373a938d9b1aa01c2058192a 100644 +--- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java ++++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java +@@ -57,6 +57,7 @@ public class MerchantRecipe implements Recipe { + private int demand; + private int villagerExperience; + private float priceMultiplier; ++ private boolean ignoreDiscounts; // Paper + + public MerchantRecipe(@NotNull ItemStack result, int maxUses) { + this(result, 0, maxUses, false); +@@ -71,6 +72,15 @@ public class MerchantRecipe implements Recipe { + } + + public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice) { ++ // Paper start - add ignoreDiscounts param ++ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, demand, specialPrice, false); ++ } ++ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, boolean ignoreDiscounts) { ++ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, 0, 0, ignoreDiscounts); ++ } ++ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice, boolean ignoreDiscounts) { ++ this.ignoreDiscounts = ignoreDiscounts; ++ // Paper end + this.result = result; + this.uses = uses; + this.maxUses = maxUses; +@@ -283,4 +293,20 @@ public class MerchantRecipe implements Recipe { + public void setPriceMultiplier(float priceMultiplier) { + this.priceMultiplier = priceMultiplier; + } ++ ++ // Paper start ++ /** ++ * @return Whether all discounts on this trade should be ignored. ++ */ ++ public boolean shouldIgnoreDiscounts() { ++ return ignoreDiscounts; ++ } ++ ++ /** ++ * @param ignoreDiscounts Whether all discounts on this trade should be ignored. ++ */ ++ public void setIgnoreDiscounts(boolean ignoreDiscounts) { ++ this.ignoreDiscounts = ignoreDiscounts; ++ } ++ // Paper end + } diff --git a/patches/api/0217-Add-ignore-discounts-API.patch b/patches/api/0217-Add-ignore-discounts-API.patch deleted file mode 100644 index 89655ddef8..0000000000 --- a/patches/api/0217-Add-ignore-discounts-API.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Mon, 9 Nov 2020 20:33:38 +0100 -Subject: [PATCH] Add ignore discounts API - - -diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java -index d33b66facf36587d703c29e9085289ce919ae621..afaa21b9347683fa373a938d9b1aa01c2058192a 100644 ---- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java -+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java -@@ -57,6 +57,7 @@ public class MerchantRecipe implements Recipe { - private int demand; - private int villagerExperience; - private float priceMultiplier; -+ private boolean ignoreDiscounts; // Paper - - public MerchantRecipe(@NotNull ItemStack result, int maxUses) { - this(result, 0, maxUses, false); -@@ -71,6 +72,15 @@ public class MerchantRecipe implements Recipe { - } - - public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice) { -+ // Paper start - add ignoreDiscounts param -+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, demand, specialPrice, false); -+ } -+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, boolean ignoreDiscounts) { -+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, 0, 0, ignoreDiscounts); -+ } -+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, int demand, int specialPrice, boolean ignoreDiscounts) { -+ this.ignoreDiscounts = ignoreDiscounts; -+ // Paper end - this.result = result; - this.uses = uses; - this.maxUses = maxUses; -@@ -283,4 +293,20 @@ public class MerchantRecipe implements Recipe { - public void setPriceMultiplier(float priceMultiplier) { - this.priceMultiplier = priceMultiplier; - } -+ -+ // Paper start -+ /** -+ * @return Whether all discounts on this trade should be ignored. -+ */ -+ public boolean shouldIgnoreDiscounts() { -+ return ignoreDiscounts; -+ } -+ -+ /** -+ * @param ignoreDiscounts Whether all discounts on this trade should be ignored. -+ */ -+ public void setIgnoreDiscounts(boolean ignoreDiscounts) { -+ this.ignoreDiscounts = ignoreDiscounts; -+ } -+ // Paper end - } diff --git a/patches/api/0217-Item-no-age-no-player-pickup.patch b/patches/api/0217-Item-no-age-no-player-pickup.patch new file mode 100644 index 0000000000..d3be2301af --- /dev/null +++ b/patches/api/0217-Item-no-age-no-player-pickup.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alfie Smith +Date: Sat, 7 Nov 2020 01:20:27 +0000 +Subject: [PATCH] Item no age & no player pickup + + +diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java +index bfecd0633458586c0352eeb1a95bb57b12f9101e..6239aec4f6c625a814fa4fd610cdc5ab1a9f6e0f 100644 +--- a/src/main/java/org/bukkit/entity/Item.java ++++ b/src/main/java/org/bukkit/entity/Item.java +@@ -104,5 +104,34 @@ public interface Item extends Entity { + * @param canMobPickup True to allow non-player entity pickup + */ + public void setCanMobPickup(boolean canMobPickup); ++ ++ /** ++ * Gets whether the player can pickup the item or not ++ * ++ * @return True if a player can pickup the item ++ */ ++ public boolean canPlayerPickup(); ++ ++ /** ++ * Sets whether the item can be picked up or not. Modifies the pickup delay value to do so. ++ * ++ * @param canPlayerPickup True if the player can pickup the item ++ */ ++ public void setCanPlayerPickup(boolean canPlayerPickup); ++ ++ /** ++ * Gets whether the item will age and despawn from being on the ground too long ++ * ++ * @return True if the item will age ++ */ ++ public boolean willAge(); ++ ++ /** ++ * Sets whether the item will age or not. If the item is not ageing, it will not despawn ++ * by being on the ground for too long. ++ * ++ * @param willAge True if the item should age ++ */ ++ public void setWillAge(boolean willAge); + // Paper end + } diff --git a/patches/api/0218-Beacon-API-custom-effect-ranges.patch b/patches/api/0218-Beacon-API-custom-effect-ranges.patch new file mode 100644 index 0000000000..effd7b3ae9 --- /dev/null +++ b/patches/api/0218-Beacon-API-custom-effect-ranges.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 24 Jun 2020 12:38:15 -0600 +Subject: [PATCH] Beacon API - custom effect ranges + + +diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java +index 6349fa9da3f96df3553fb9552c1cab95338cecb0..7d212c409035ccb8b22d4ffc322b4a1aea367627 100644 +--- a/src/main/java/org/bukkit/block/Beacon.java ++++ b/src/main/java/org/bukkit/block/Beacon.java +@@ -64,4 +64,26 @@ public interface Beacon extends TileState, Lockable, Nameable { + * @param effect desired secondary effect + */ + void setSecondaryEffect(@Nullable PotionEffectType effect); ++ ++ // Paper start - Custom effect ranges ++ /** ++ * Gets the effect range of this beacon. ++ * A negative range value means the beacon is using its default range based on tier. ++ * @return Either the custom range set with {@link #setEffectRange(double)} or the range based on the beacon tier. ++ */ ++ double getEffectRange(); ++ ++ /** ++ * Sets the effect range of the beacon ++ * A negative range value means the beacon is using its default range based on tier. ++ * @param range Radius of effect range. ++ */ ++ void setEffectRange(double range); ++ ++ /** ++ * Resets the custom range from this beacon and falls back to the range based on the beacon tier. ++ * Shortcut for setting the effect range to a negative number. ++ */ ++ void resetEffectRange(); ++ // Paper end + } diff --git a/patches/api/0218-Item-no-age-no-player-pickup.patch b/patches/api/0218-Item-no-age-no-player-pickup.patch deleted file mode 100644 index d3be2301af..0000000000 --- a/patches/api/0218-Item-no-age-no-player-pickup.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alfie Smith -Date: Sat, 7 Nov 2020 01:20:27 +0000 -Subject: [PATCH] Item no age & no player pickup - - -diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java -index bfecd0633458586c0352eeb1a95bb57b12f9101e..6239aec4f6c625a814fa4fd610cdc5ab1a9f6e0f 100644 ---- a/src/main/java/org/bukkit/entity/Item.java -+++ b/src/main/java/org/bukkit/entity/Item.java -@@ -104,5 +104,34 @@ public interface Item extends Entity { - * @param canMobPickup True to allow non-player entity pickup - */ - public void setCanMobPickup(boolean canMobPickup); -+ -+ /** -+ * Gets whether the player can pickup the item or not -+ * -+ * @return True if a player can pickup the item -+ */ -+ public boolean canPlayerPickup(); -+ -+ /** -+ * Sets whether the item can be picked up or not. Modifies the pickup delay value to do so. -+ * -+ * @param canPlayerPickup True if the player can pickup the item -+ */ -+ public void setCanPlayerPickup(boolean canPlayerPickup); -+ -+ /** -+ * Gets whether the item will age and despawn from being on the ground too long -+ * -+ * @return True if the item will age -+ */ -+ public boolean willAge(); -+ -+ /** -+ * Sets whether the item will age or not. If the item is not ageing, it will not despawn -+ * by being on the ground for too long. -+ * -+ * @param willAge True if the item should age -+ */ -+ public void setWillAge(boolean willAge); - // Paper end - } diff --git a/patches/api/0219-Add-API-for-quit-reason.patch b/patches/api/0219-Add-API-for-quit-reason.patch new file mode 100644 index 0000000000..0350afaf92 --- /dev/null +++ b/patches/api/0219-Add-API-for-quit-reason.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Sat, 14 Nov 2020 16:19:58 +0100 +Subject: [PATCH] Add API for quit reason + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +index 14b27eaaf744736b3e56bb1383481df98a218c43..84703b5d174625b1a4a995a244e6400d2675fbb5 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +@@ -11,16 +11,28 @@ import org.jetbrains.annotations.Nullable; + public class PlayerQuitEvent extends PlayerEvent { + private static final HandlerList handlers = new HandlerList(); + private net.kyori.adventure.text.Component quitMessage; // Paper ++ private final QuitReason reason; // Paper + + @Deprecated // Paper + public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) { ++ // Paper start ++ this(who, quitMessage, null); ++ } ++ @Deprecated // Paper ++ public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) { + super(who); + this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper ++ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; + } + // Paper start ++ @Deprecated + public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) { ++ this(who, quitMessage, null); ++ } ++ public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage, @Nullable QuitReason quitReason) { + super(who); + this.quitMessage = quitMessage; ++ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; + } + + /** +@@ -75,4 +87,39 @@ public class PlayerQuitEvent extends PlayerEvent { + public static HandlerList getHandlerList() { + return handlers; + } ++ ++ // Paper start ++ @NotNull ++ public QuitReason getReason() { ++ return this.reason; ++ } ++ ++ public enum QuitReason { ++ /** ++ * The player left on their own behalf. ++ *

++ * This does not mean they pressed the disconnect button in their client, but rather that the client severed the ++ * connection themselves. This may occur if no keep-alive packet is received on their side, among other things. ++ */ ++ DISCONNECTED, ++ ++ /** ++ * The player was kicked from the server. ++ */ ++ KICKED, ++ ++ /** ++ * The player has timed out. ++ */ ++ TIMED_OUT, ++ ++ /** ++ * The player's connection has entered an erroneous state. ++ *

++ * Reasons for this may include invalid packets, invalid data, and uncaught exceptions in the packet handler, ++ * among others. ++ */ ++ ERRONEOUS_STATE, ++ } ++ // Paper end + } diff --git a/patches/api/0219-Beacon-API-custom-effect-ranges.patch b/patches/api/0219-Beacon-API-custom-effect-ranges.patch deleted file mode 100644 index effd7b3ae9..0000000000 --- a/patches/api/0219-Beacon-API-custom-effect-ranges.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 24 Jun 2020 12:38:15 -0600 -Subject: [PATCH] Beacon API - custom effect ranges - - -diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java -index 6349fa9da3f96df3553fb9552c1cab95338cecb0..7d212c409035ccb8b22d4ffc322b4a1aea367627 100644 ---- a/src/main/java/org/bukkit/block/Beacon.java -+++ b/src/main/java/org/bukkit/block/Beacon.java -@@ -64,4 +64,26 @@ public interface Beacon extends TileState, Lockable, Nameable { - * @param effect desired secondary effect - */ - void setSecondaryEffect(@Nullable PotionEffectType effect); -+ -+ // Paper start - Custom effect ranges -+ /** -+ * Gets the effect range of this beacon. -+ * A negative range value means the beacon is using its default range based on tier. -+ * @return Either the custom range set with {@link #setEffectRange(double)} or the range based on the beacon tier. -+ */ -+ double getEffectRange(); -+ -+ /** -+ * Sets the effect range of the beacon -+ * A negative range value means the beacon is using its default range based on tier. -+ * @param range Radius of effect range. -+ */ -+ void setEffectRange(double range); -+ -+ /** -+ * Resets the custom range from this beacon and falls back to the range based on the beacon tier. -+ * Shortcut for setting the effect range to a negative number. -+ */ -+ void resetEffectRange(); -+ // Paper end - } diff --git a/patches/api/0220-Add-API-for-quit-reason.patch b/patches/api/0220-Add-API-for-quit-reason.patch deleted file mode 100644 index 0350afaf92..0000000000 --- a/patches/api/0220-Add-API-for-quit-reason.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sat, 14 Nov 2020 16:19:58 +0100 -Subject: [PATCH] Add API for quit reason - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -index 14b27eaaf744736b3e56bb1383481df98a218c43..84703b5d174625b1a4a995a244e6400d2675fbb5 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -@@ -11,16 +11,28 @@ import org.jetbrains.annotations.Nullable; - public class PlayerQuitEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); - private net.kyori.adventure.text.Component quitMessage; // Paper -+ private final QuitReason reason; // Paper - - @Deprecated // Paper - public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) { -+ // Paper start -+ this(who, quitMessage, null); -+ } -+ @Deprecated // Paper -+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) { - super(who); - this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper -+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; - } - // Paper start -+ @Deprecated - public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) { -+ this(who, quitMessage, null); -+ } -+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage, @Nullable QuitReason quitReason) { - super(who); - this.quitMessage = quitMessage; -+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; - } - - /** -@@ -75,4 +87,39 @@ public class PlayerQuitEvent extends PlayerEvent { - public static HandlerList getHandlerList() { - return handlers; - } -+ -+ // Paper start -+ @NotNull -+ public QuitReason getReason() { -+ return this.reason; -+ } -+ -+ public enum QuitReason { -+ /** -+ * The player left on their own behalf. -+ *

-+ * This does not mean they pressed the disconnect button in their client, but rather that the client severed the -+ * connection themselves. This may occur if no keep-alive packet is received on their side, among other things. -+ */ -+ DISCONNECTED, -+ -+ /** -+ * The player was kicked from the server. -+ */ -+ KICKED, -+ -+ /** -+ * The player has timed out. -+ */ -+ TIMED_OUT, -+ -+ /** -+ * The player's connection has entered an erroneous state. -+ *

-+ * Reasons for this may include invalid packets, invalid data, and uncaught exceptions in the packet handler, -+ * among others. -+ */ -+ ERRONEOUS_STATE, -+ } -+ // Paper end - } diff --git a/patches/api/0220-Add-Destroy-Speed-API.patch b/patches/api/0220-Add-Destroy-Speed-API.patch new file mode 100644 index 0000000000..cdf304d00b --- /dev/null +++ b/patches/api/0220-Add-Destroy-Speed-API.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ineusia +Date: Mon, 26 Oct 2020 11:37:48 -0500 +Subject: [PATCH] Add Destroy Speed API + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index 1d3812db989a55b6f31bb30dffe70323eb592a15..4aea4be0677d93e17a4ce98dd340dd9921f996a0 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -690,4 +690,31 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr + @Deprecated(forRemoval = true) + String getTranslationKey(); + // Paper end ++ ++ // Paper start - destroy speed API ++ /** ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} ++ *

++ * Default value is 1.0 ++ * ++ * @param itemStack {@link ItemStack} used to mine this Block ++ * @return the speed that this Block will be mined by the given {@link ItemStack} ++ */ ++ default float getDestroySpeed(final @NotNull ItemStack itemStack) { ++ return this.getBlockData().getDestroySpeed(itemStack); ++ } ++ ++ /** ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} ++ *

++ * Default value is 1.0 ++ * ++ * @param itemStack {@link ItemStack} used to mine this Block ++ * @param considerEnchants true to look at enchants on the itemstack ++ * @return the speed that this Block will be mined by the given {@link ItemStack} ++ */ ++ default float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) { ++ return this.getBlockData().getDestroySpeed(itemStack, considerEnchants); ++ } ++ // Paper end - destroy speed API + } +diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java +index cd3b3e05cc825cfedec07f9a2a1e0b7b2a8866d6..8a26e7215672f5fd4555fd455c9b1571488f0259 100644 +--- a/src/main/java/org/bukkit/block/data/BlockData.java ++++ b/src/main/java/org/bukkit/block/data/BlockData.java +@@ -266,4 +266,29 @@ public interface BlockData extends Cloneable { + @NotNull + @ApiStatus.Experimental + BlockState createBlockState(); ++ ++ // Paper start - destroy speed API ++ /** ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} ++ *

++ * Default value is 1.0 ++ * ++ * @param itemStack {@link ItemStack} used to mine this Block ++ * @return the speed that this Block will be mined by the given {@link ItemStack} ++ */ ++ default float getDestroySpeed(final @NotNull ItemStack itemStack) { ++ return this.getDestroySpeed(itemStack, false); ++ } ++ ++ /** ++ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} ++ *

++ * Default value is 1.0 ++ * ++ * @param itemStack {@link ItemStack} used to mine this Block ++ * @param considerEnchants true to look at enchants on the itemstack ++ * @return the speed that this Block will be mined by the given {@link ItemStack} ++ */ ++ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants); ++ // Paper end - destroy speed API + } diff --git a/patches/api/0221-Add-Destroy-Speed-API.patch b/patches/api/0221-Add-Destroy-Speed-API.patch deleted file mode 100644 index cdf304d00b..0000000000 --- a/patches/api/0221-Add-Destroy-Speed-API.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ineusia -Date: Mon, 26 Oct 2020 11:37:48 -0500 -Subject: [PATCH] Add Destroy Speed API - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 1d3812db989a55b6f31bb30dffe70323eb592a15..4aea4be0677d93e17a4ce98dd340dd9921f996a0 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -690,4 +690,31 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - @Deprecated(forRemoval = true) - String getTranslationKey(); - // Paper end -+ -+ // Paper start - destroy speed API -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ */ -+ default float getDestroySpeed(final @NotNull ItemStack itemStack) { -+ return this.getBlockData().getDestroySpeed(itemStack); -+ } -+ -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @param considerEnchants true to look at enchants on the itemstack -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ */ -+ default float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) { -+ return this.getBlockData().getDestroySpeed(itemStack, considerEnchants); -+ } -+ // Paper end - destroy speed API - } -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index cd3b3e05cc825cfedec07f9a2a1e0b7b2a8866d6..8a26e7215672f5fd4555fd455c9b1571488f0259 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -266,4 +266,29 @@ public interface BlockData extends Cloneable { - @NotNull - @ApiStatus.Experimental - BlockState createBlockState(); -+ -+ // Paper start - destroy speed API -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ */ -+ default float getDestroySpeed(final @NotNull ItemStack itemStack) { -+ return this.getDestroySpeed(itemStack, false); -+ } -+ -+ /** -+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack} -+ *

-+ * Default value is 1.0 -+ * -+ * @param itemStack {@link ItemStack} used to mine this Block -+ * @param considerEnchants true to look at enchants on the itemstack -+ * @return the speed that this Block will be mined by the given {@link ItemStack} -+ */ -+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants); -+ // Paper end - destroy speed API - } diff --git a/patches/api/0221-Add-LivingEntity-clearActiveItem.patch b/patches/api/0221-Add-LivingEntity-clearActiveItem.patch new file mode 100644 index 0000000000..03307beabf --- /dev/null +++ b/patches/api/0221-Add-LivingEntity-clearActiveItem.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Anrza +Date: Wed, 15 Jul 2020 12:07:58 +0200 +Subject: [PATCH] Add LivingEntity#clearActiveItem + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index c71bc11f7a0a72d4e5d609e333ab99031ea813d2..ac8d9e3238a4d47170ba8e79bc5f259cbfd3fa33 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1061,6 +1061,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + org.bukkit.inventory.@NotNull ItemStack getActiveItem(); + ++ /** ++ * Interrupts any ongoing active "usage" or consumption or an item. ++ */ ++ void clearActiveItem(); ++ + /** + * Gets the remaining number of ticks for {@link #getActiveItem()}'s usage. + * diff --git a/patches/api/0222-Add-LivingEntity-clearActiveItem.patch b/patches/api/0222-Add-LivingEntity-clearActiveItem.patch deleted file mode 100644 index 03307beabf..0000000000 --- a/patches/api/0222-Add-LivingEntity-clearActiveItem.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anrza -Date: Wed, 15 Jul 2020 12:07:58 +0200 -Subject: [PATCH] Add LivingEntity#clearActiveItem - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index c71bc11f7a0a72d4e5d609e333ab99031ea813d2..ac8d9e3238a4d47170ba8e79bc5f259cbfd3fa33 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1061,6 +1061,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - org.bukkit.inventory.@NotNull ItemStack getActiveItem(); - -+ /** -+ * Interrupts any ongoing active "usage" or consumption or an item. -+ */ -+ void clearActiveItem(); -+ - /** - * Gets the remaining number of ticks for {@link #getActiveItem()}'s usage. - * diff --git a/patches/api/0222-Add-PlayerItemCooldownEvent.patch b/patches/api/0222-Add-PlayerItemCooldownEvent.patch new file mode 100644 index 0000000000..ae5118c7da --- /dev/null +++ b/patches/api/0222-Add-PlayerItemCooldownEvent.patch @@ -0,0 +1,94 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Tue, 25 Aug 2020 13:45:15 +0200 +Subject: [PATCH] Add PlayerItemCooldownEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c2764ffd51831351b934568e1301b2e4073dc0c4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java +@@ -0,0 +1,82 @@ ++package io.papermc.paper.event.player; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.Material; ++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.NotNull; ++ ++/** ++ * Fired when a player receives an item cooldown. ++ */ ++public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull ++ private final Material type; ++ private int cooldown; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull Material type, int cooldown) { ++ super(player); ++ this.type = type; ++ this.cooldown = cooldown; ++ } ++ ++ /** ++ * Get the material affected by the cooldown. ++ * ++ * @return material affected by the cooldown ++ */ ++ @NotNull ++ public Material getType() { ++ return this.type; ++ } ++ ++ /** ++ * Gets the cooldown in ticks. ++ * ++ * @return cooldown in ticks ++ */ ++ public int getCooldown() { ++ return this.cooldown; ++ } ++ ++ /** ++ * Sets the cooldown of the material in ticks. ++ * Setting the cooldown to 0 results in removing an already existing cooldown for the material. ++ * ++ * @param cooldown cooldown in ticks, has to be a positive number ++ */ ++ public void setCooldown(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(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0223-Add-PlayerItemCooldownEvent.patch b/patches/api/0223-Add-PlayerItemCooldownEvent.patch deleted file mode 100644 index ae5118c7da..0000000000 --- a/patches/api/0223-Add-PlayerItemCooldownEvent.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Tue, 25 Aug 2020 13:45:15 +0200 -Subject: [PATCH] Add PlayerItemCooldownEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c2764ffd51831351b934568e1301b2e4073dc0c4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java -@@ -0,0 +1,82 @@ -+package io.papermc.paper.event.player; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.Material; -+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.NotNull; -+ -+/** -+ * Fired when a player receives an item cooldown. -+ */ -+public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull -+ private final Material type; -+ private int cooldown; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull Material type, int cooldown) { -+ super(player); -+ this.type = type; -+ this.cooldown = cooldown; -+ } -+ -+ /** -+ * Get the material affected by the cooldown. -+ * -+ * @return material affected by the cooldown -+ */ -+ @NotNull -+ public Material getType() { -+ return this.type; -+ } -+ -+ /** -+ * Gets the cooldown in ticks. -+ * -+ * @return cooldown in ticks -+ */ -+ public int getCooldown() { -+ return this.cooldown; -+ } -+ -+ /** -+ * Sets the cooldown of the material in ticks. -+ * Setting the cooldown to 0 results in removing an already existing cooldown for the material. -+ * -+ * @param cooldown cooldown in ticks, has to be a positive number -+ */ -+ public void setCooldown(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(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0223-More-lightning-API.patch b/patches/api/0223-More-lightning-API.patch new file mode 100644 index 0000000000..c4924dcdf2 --- /dev/null +++ b/patches/api/0223-More-lightning-API.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sun, 26 Jul 2020 14:44:16 +0200 +Subject: [PATCH] More lightning API + + +diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java +index 5afeb2f6c82e8f752229462c2d7846f6ae7a4b44..924ee7fcc3f87eb8553ef473a7d9671f0f469dd1 100644 +--- a/src/main/java/org/bukkit/entity/LightningStrike.java ++++ b/src/main/java/org/bukkit/entity/LightningStrike.java +@@ -22,7 +22,9 @@ public interface LightningStrike extends Entity { + * removed. By default this value is between 1 and 3. + * + * @return the flashes ++ * @deprecated use {@link #getFlashCount()} + */ ++ @Deprecated // Paper + public int getFlashes(); + + /** +@@ -31,7 +33,9 @@ public interface LightningStrike extends Entity { + * has reduced below 0. + * + * @param flashes the flashes ++ * @deprecated use {@link #setFlashCount(int)} + */ ++ @Deprecated // Paper + public void setFlashes(int flashes); + + /** +@@ -110,4 +114,42 @@ public interface LightningStrike extends Entity { + @Deprecated // Paper + Spigot spigot(); + // Spigot end ++ ++ // Paper start ++ /** ++ * Returns the amount of flash iterations that will be done before the lightning dies. ++ * ++ * @see #getLifeTicks() for how long the current flash will last ++ * @return amount of flashes that will be shown before the lightning dies ++ */ ++ int getFlashCount(); ++ ++ /** ++ * Sets the amount of life iterations that will be done before the lightning dies. ++ * Default number of flashes on creation is between 1-3. ++ * ++ * @param flashes amount of iterations that will be done before the lightning dies, must to be a positive number ++ */ ++ void setFlashCount(int flashes); ++ ++ /** ++ * Returns the potential entity that caused this lightning strike to spawn in the world. ++ *

++ * As of implementing this method, only {@link Player}s are capable of causing a lightning strike, however as this ++ * might change in future minecraft releases, this method does not guarantee a player as the cause of a lightning. ++ * Consumers of this method should hence validate whether or not the entity is a player if they want to use player ++ * specific methods through an {@code instanceOf} check. ++ *

++ *

++ * A player is, as of implementing this method, responsible for a lightning, and will hence be returned here as ++ * a cause, if they channeled a {@link Trident} to summon it or were explicitly defined as the cause of this ++ * lightning through {@link #setCausingPlayer(Player)}. ++ *

++ * ++ * @return the entity that caused this lightning or null if the lightning was not caused by a entity (e.g. normal ++ * weather) ++ */ ++ @org.jetbrains.annotations.Nullable ++ Entity getCausingEntity(); ++ // Paper end + } diff --git a/patches/api/0224-Add-PlayerShearBlockEvent.patch b/patches/api/0224-Add-PlayerShearBlockEvent.patch new file mode 100644 index 0000000000..1506924937 --- /dev/null +++ b/patches/api/0224-Add-PlayerShearBlockEvent.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Thu, 27 Aug 2020 12:32:35 -0400 +Subject: [PATCH] Add PlayerShearBlockEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9bb4a79320eac7d662d9d04765664b6a7e955a4f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java +@@ -0,0 +1,113 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.EquipmentSlot; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.List; ++ ++/** ++ * Called when a player uses sheers on a block. ++ *

++ * This event is not called when breaking blocks with shears but instead only when a ++ * player uses the sheer item on a block to garner drops from said block and/or change its state. ++ *

++ * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb. ++ */ ++public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Block block; ++ private final ItemStack item; ++ private final EquipmentSlot hand; ++ private final List drops; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerShearBlockEvent(@NotNull Player player, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List drops) { ++ super(player); ++ this.block = block; ++ this.item = item; ++ this.hand = hand; ++ this.drops = drops; ++ } ++ ++ /** ++ * Gets the block being sheared in this event. ++ * ++ * @return The {@link Block} which block is being sheared in this event. ++ */ ++ @NotNull ++ public Block getBlock() { ++ return this.block; ++ } ++ ++ /** ++ * Gets the item used to shear the block. ++ * ++ * @return The {@link ItemStack} of the shears. ++ */ ++ @NotNull ++ public ItemStack getItem() { ++ return this.item; ++ } ++ ++ /** ++ * Gets the hand used to shear the block. ++ * ++ * @return Either {@link EquipmentSlot#HAND} OR {@link EquipmentSlot#OFF_HAND}. ++ */ ++ @NotNull ++ public EquipmentSlot getHand() { ++ return this.hand; ++ } ++ ++ /** ++ * Gets the resulting drops of this event. ++ * ++ * @return A {@link List list} of {@link ItemStack items} that will be dropped as result of this event. ++ */ ++ @NotNull ++ public List getDrops() { ++ return this.drops; ++ } ++ ++ /** ++ * Gets whether the shearing of the block should be cancelled or not. ++ * ++ * @return Whether the shearing of the block should be cancelled or not. ++ */ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * Sets whether the shearing of the block should be cancelled or not. ++ * ++ * @param cancel whether the shearing of the block should be cancelled or not. ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0224-More-lightning-API.patch b/patches/api/0224-More-lightning-API.patch deleted file mode 100644 index c4924dcdf2..0000000000 --- a/patches/api/0224-More-lightning-API.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sun, 26 Jul 2020 14:44:16 +0200 -Subject: [PATCH] More lightning API - - -diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java -index 5afeb2f6c82e8f752229462c2d7846f6ae7a4b44..924ee7fcc3f87eb8553ef473a7d9671f0f469dd1 100644 ---- a/src/main/java/org/bukkit/entity/LightningStrike.java -+++ b/src/main/java/org/bukkit/entity/LightningStrike.java -@@ -22,7 +22,9 @@ public interface LightningStrike extends Entity { - * removed. By default this value is between 1 and 3. - * - * @return the flashes -+ * @deprecated use {@link #getFlashCount()} - */ -+ @Deprecated // Paper - public int getFlashes(); - - /** -@@ -31,7 +33,9 @@ public interface LightningStrike extends Entity { - * has reduced below 0. - * - * @param flashes the flashes -+ * @deprecated use {@link #setFlashCount(int)} - */ -+ @Deprecated // Paper - public void setFlashes(int flashes); - - /** -@@ -110,4 +114,42 @@ public interface LightningStrike extends Entity { - @Deprecated // Paper - Spigot spigot(); - // Spigot end -+ -+ // Paper start -+ /** -+ * Returns the amount of flash iterations that will be done before the lightning dies. -+ * -+ * @see #getLifeTicks() for how long the current flash will last -+ * @return amount of flashes that will be shown before the lightning dies -+ */ -+ int getFlashCount(); -+ -+ /** -+ * Sets the amount of life iterations that will be done before the lightning dies. -+ * Default number of flashes on creation is between 1-3. -+ * -+ * @param flashes amount of iterations that will be done before the lightning dies, must to be a positive number -+ */ -+ void setFlashCount(int flashes); -+ -+ /** -+ * Returns the potential entity that caused this lightning strike to spawn in the world. -+ *

-+ * As of implementing this method, only {@link Player}s are capable of causing a lightning strike, however as this -+ * might change in future minecraft releases, this method does not guarantee a player as the cause of a lightning. -+ * Consumers of this method should hence validate whether or not the entity is a player if they want to use player -+ * specific methods through an {@code instanceOf} check. -+ *

-+ *

-+ * A player is, as of implementing this method, responsible for a lightning, and will hence be returned here as -+ * a cause, if they channeled a {@link Trident} to summon it or were explicitly defined as the cause of this -+ * lightning through {@link #setCausingPlayer(Player)}. -+ *

-+ * -+ * @return the entity that caused this lightning or null if the lightning was not caused by a entity (e.g. normal -+ * weather) -+ */ -+ @org.jetbrains.annotations.Nullable -+ Entity getCausingEntity(); -+ // Paper end - } diff --git a/patches/api/0225-Add-PlayerShearBlockEvent.patch b/patches/api/0225-Add-PlayerShearBlockEvent.patch deleted file mode 100644 index 1506924937..0000000000 --- a/patches/api/0225-Add-PlayerShearBlockEvent.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JRoy -Date: Thu, 27 Aug 2020 12:32:35 -0400 -Subject: [PATCH] Add PlayerShearBlockEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9bb4a79320eac7d662d9d04765664b6a7e955a4f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java -@@ -0,0 +1,113 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.EquipmentSlot; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.List; -+ -+/** -+ * Called when a player uses sheers on a block. -+ *

-+ * This event is not called when breaking blocks with shears but instead only when a -+ * player uses the sheer item on a block to garner drops from said block and/or change its state. -+ *

-+ * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb. -+ */ -+public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block block; -+ private final ItemStack item; -+ private final EquipmentSlot hand; -+ private final List drops; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerShearBlockEvent(@NotNull Player player, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List drops) { -+ super(player); -+ this.block = block; -+ this.item = item; -+ this.hand = hand; -+ this.drops = drops; -+ } -+ -+ /** -+ * Gets the block being sheared in this event. -+ * -+ * @return The {@link Block} which block is being sheared in this event. -+ */ -+ @NotNull -+ public Block getBlock() { -+ return this.block; -+ } -+ -+ /** -+ * Gets the item used to shear the block. -+ * -+ * @return The {@link ItemStack} of the shears. -+ */ -+ @NotNull -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets the hand used to shear the block. -+ * -+ * @return Either {@link EquipmentSlot#HAND} OR {@link EquipmentSlot#OFF_HAND}. -+ */ -+ @NotNull -+ public EquipmentSlot getHand() { -+ return this.hand; -+ } -+ -+ /** -+ * Gets the resulting drops of this event. -+ * -+ * @return A {@link List list} of {@link ItemStack items} that will be dropped as result of this event. -+ */ -+ @NotNull -+ public List getDrops() { -+ return this.drops; -+ } -+ -+ /** -+ * Gets whether the shearing of the block should be cancelled or not. -+ * -+ * @return Whether the shearing of the block should be cancelled or not. -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Sets whether the shearing of the block should be cancelled or not. -+ * -+ * @param cancel whether the shearing of the block should be cancelled or not. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0225-Player-Chunk-Load-Unload-Events.patch b/patches/api/0225-Player-Chunk-Load-Unload-Events.patch new file mode 100644 index 0000000000..c1779bb840 --- /dev/null +++ b/patches/api/0225-Player-Chunk-Load-Unload-Events.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ysl3000 +Date: Mon, 5 Oct 2020 21:24:45 +0200 +Subject: [PATCH] Player Chunk Load/Unload Events + + +diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3ddbc099a13df939b3912f30b54e7635840ba5a4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java +@@ -0,0 +1,45 @@ ++package io.papermc.paper.event.packet; ++ ++import org.bukkit.Chunk; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.ChunkEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Is called when a {@link Player} receives a {@link Chunk} ++ *

++ * Can for example be used for spawning a fake entity when the player receives a chunk. ++ *

++ * Should only be used for packet/clientside related stuff. ++ * Not intended for modifying server side state. ++ */ ++public class PlayerChunkLoadEvent extends ChunkEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Player player; ++ ++ @ApiStatus.Internal ++ public PlayerChunkLoadEvent(@NotNull Chunk chunk, @NotNull Player player) { ++ super(chunk); ++ this.player = player; ++ } ++ ++ @NotNull ++ public Player getPlayer() { ++ return this.player; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2cac7e27991c04a9ced261f2dd8ad8657ccddf6b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.event.packet; ++ ++import org.bukkit.Chunk; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.ChunkEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Is called when a {@link Player} receives a chunk unload packet. ++ *

++ * Should only be used for packet/clientside related stuff. ++ * Not intended for modifying server side. ++ */ ++public class PlayerChunkUnloadEvent extends ChunkEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Player player; ++ ++ @ApiStatus.Internal ++ public PlayerChunkUnloadEvent(@NotNull Chunk chunk, @NotNull Player player) { ++ super(chunk); ++ this.player = player; ++ } ++ ++ @NotNull ++ public Player getPlayer() { ++ return this.player; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0226-Expose-LivingEntity-hurt-direction.patch b/patches/api/0226-Expose-LivingEntity-hurt-direction.patch new file mode 100644 index 0000000000..2957bd50ae --- /dev/null +++ b/patches/api/0226-Expose-LivingEntity-hurt-direction.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa +Date: Sun, 13 Dec 2020 05:32:12 +0200 +Subject: [PATCH] Expose LivingEntity hurt direction + + +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index 5ecfb98540c00da05b13bc5370debb89c52cc76f..083d5798ccc7f37c6df5e234c7ef233202102b8f 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -348,6 +348,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + */ + public void setCooldown(@NotNull Material material, int ticks); + ++ // Paper start ++ /** ++ * Sets player hurt direction ++ * ++ * @param hurtDirection hurt direction ++ */ ++ @Override ++ void setHurtDirection(float hurtDirection); ++ // Paper end ++ + /** + * Get the sleep ticks of the player. This value may be capped. + * +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index ac8d9e3238a4d47170ba8e79bc5f259cbfd3fa33..b75b79512a8fd7054f0c0c08e34f6900309e522c 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1201,4 +1201,22 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + void playPickupItemAnimation(@NotNull Item item, int quantity); + // Paper end - pickup animation API ++ ++ // Paper start - hurt direction API ++ /** ++ * Gets player hurt direction ++ * ++ * @return hurt direction ++ */ ++ float getHurtDirection(); ++ ++ /** ++ * Sets player hurt direction ++ * ++ * @param hurtDirection hurt direction ++ * @deprecated use {@link Player#setHurtDirection(float)} ++ */ ++ @Deprecated ++ void setHurtDirection(float hurtDirection); ++ // Paper end - hurt direction API + } diff --git a/patches/api/0226-Player-Chunk-Load-Unload-Events.patch b/patches/api/0226-Player-Chunk-Load-Unload-Events.patch deleted file mode 100644 index c1779bb840..0000000000 --- a/patches/api/0226-Player-Chunk-Load-Unload-Events.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ysl3000 -Date: Mon, 5 Oct 2020 21:24:45 +0200 -Subject: [PATCH] Player Chunk Load/Unload Events - - -diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3ddbc099a13df939b3912f30b54e7635840ba5a4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java -@@ -0,0 +1,45 @@ -+package io.papermc.paper.event.packet; -+ -+import org.bukkit.Chunk; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.ChunkEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Is called when a {@link Player} receives a {@link Chunk} -+ *

-+ * Can for example be used for spawning a fake entity when the player receives a chunk. -+ *

-+ * Should only be used for packet/clientside related stuff. -+ * Not intended for modifying server side state. -+ */ -+public class PlayerChunkLoadEvent extends ChunkEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player player; -+ -+ @ApiStatus.Internal -+ public PlayerChunkLoadEvent(@NotNull Chunk chunk, @NotNull Player player) { -+ super(chunk); -+ this.player = player; -+ } -+ -+ @NotNull -+ public Player getPlayer() { -+ return this.player; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2cac7e27991c04a9ced261f2dd8ad8657ccddf6b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java -@@ -0,0 +1,43 @@ -+package io.papermc.paper.event.packet; -+ -+import org.bukkit.Chunk; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.ChunkEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Is called when a {@link Player} receives a chunk unload packet. -+ *

-+ * Should only be used for packet/clientside related stuff. -+ * Not intended for modifying server side. -+ */ -+public class PlayerChunkUnloadEvent extends ChunkEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player player; -+ -+ @ApiStatus.Internal -+ public PlayerChunkUnloadEvent(@NotNull Chunk chunk, @NotNull Player player) { -+ super(chunk); -+ this.player = player; -+ } -+ -+ @NotNull -+ public Player getPlayer() { -+ return this.player; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0227-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/api/0227-Add-OBSTRUCTED-reason-to-BedEnterResult.patch new file mode 100644 index 0000000000..00552e9137 --- /dev/null +++ b/patches/api/0227-Add-OBSTRUCTED-reason-to-BedEnterResult.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 24 Dec 2020 12:43:30 -0800 +Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java +index fd6b83f1f9bb2e25613e3f88e497b9d57d393937..ced77de350fa53889439e945336343a1cca5b9ba 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java +@@ -42,6 +42,12 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { + * Entering the bed is prevented due to the player being too far away. + */ + TOO_FAR_AWAY, ++ // Paper start ++ /** ++ * Bed was obstructed. ++ */ ++ OBSTRUCTED, ++ // Paper end + /** + * Entering the bed is prevented due to there being monsters nearby. + */ diff --git a/patches/api/0227-Expose-LivingEntity-hurt-direction.patch b/patches/api/0227-Expose-LivingEntity-hurt-direction.patch deleted file mode 100644 index 2957bd50ae..0000000000 --- a/patches/api/0227-Expose-LivingEntity-hurt-direction.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Sun, 13 Dec 2020 05:32:12 +0200 -Subject: [PATCH] Expose LivingEntity hurt direction - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 5ecfb98540c00da05b13bc5370debb89c52cc76f..083d5798ccc7f37c6df5e234c7ef233202102b8f 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -348,6 +348,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - */ - public void setCooldown(@NotNull Material material, int ticks); - -+ // Paper start -+ /** -+ * Sets player hurt direction -+ * -+ * @param hurtDirection hurt direction -+ */ -+ @Override -+ void setHurtDirection(float hurtDirection); -+ // Paper end -+ - /** - * Get the sleep ticks of the player. This value may be capped. - * -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index ac8d9e3238a4d47170ba8e79bc5f259cbfd3fa33..b75b79512a8fd7054f0c0c08e34f6900309e522c 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1201,4 +1201,22 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - void playPickupItemAnimation(@NotNull Item item, int quantity); - // Paper end - pickup animation API -+ -+ // Paper start - hurt direction API -+ /** -+ * Gets player hurt direction -+ * -+ * @return hurt direction -+ */ -+ float getHurtDirection(); -+ -+ /** -+ * Sets player hurt direction -+ * -+ * @param hurtDirection hurt direction -+ * @deprecated use {@link Player#setHurtDirection(float)} -+ */ -+ @Deprecated -+ void setHurtDirection(float hurtDirection); -+ // Paper end - hurt direction API - } diff --git a/patches/api/0228-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/api/0228-Add-OBSTRUCTED-reason-to-BedEnterResult.patch deleted file mode 100644 index 00552e9137..0000000000 --- a/patches/api/0228-Add-OBSTRUCTED-reason-to-BedEnterResult.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 24 Dec 2020 12:43:30 -0800 -Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java -index fd6b83f1f9bb2e25613e3f88e497b9d57d393937..ced77de350fa53889439e945336343a1cca5b9ba 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java -@@ -42,6 +42,12 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable { - * Entering the bed is prevented due to the player being too far away. - */ - TOO_FAR_AWAY, -+ // Paper start -+ /** -+ * Bed was obstructed. -+ */ -+ OBSTRUCTED, -+ // Paper end - /** - * Entering the bed is prevented due to there being monsters nearby. - */ diff --git a/patches/api/0228-Added-PlayerTradeEvent.patch b/patches/api/0228-Added-PlayerTradeEvent.patch new file mode 100644 index 0000000000..11ad019021 --- /dev/null +++ b/patches/api/0228-Added-PlayerTradeEvent.patch @@ -0,0 +1,166 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 2 Jul 2020 16:10:10 -0700 +Subject: [PATCH] Added PlayerTradeEvent + +[Amendment: Alexander ] +PlayerTradeEvent is used for player purchases from villagers and wandering +traders, but not custom merchants created via Bukkit.createMerchant(). During +discussions in Discord it was decided that it'd be better to add a new event +that PlayerTradeEvent inherits from than change getVillager()'s annotation to +@Nullable, especially since that'd also infringe on the implication of the +event being about villager trades. + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43e9b50bfc +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java +@@ -0,0 +1,109 @@ ++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.bukkit.inventory.MerchantRecipe; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a player trades with a standalone merchant GUI. ++ */ ++public class PlayerPurchaseEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean rewardExp; ++ private boolean increaseTradeUses; ++ private MerchantRecipe trade; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerPurchaseEvent(@NotNull Player player, ++ @NotNull MerchantRecipe trade, ++ boolean rewardExp, ++ boolean increaseTradeUses) { ++ super(player); ++ setTrade(trade); ++ this.rewardExp = rewardExp; ++ this.increaseTradeUses = increaseTradeUses; ++ } ++ ++ /** ++ * Gets the associated trade with this event ++ * ++ * @return the trade ++ */ ++ @NotNull ++ public MerchantRecipe getTrade() { ++ return this.trade; ++ } ++ ++ /** ++ * Sets the trade. This is then used to determine the next prices ++ * ++ * @param trade the trade to use ++ */ ++ public void setTrade(@NotNull MerchantRecipe trade) { ++ Preconditions.checkArgument(trade != null, "Trade cannot be null!"); ++ this.trade = trade; ++ } ++ ++ /** ++ * @return will trade try to reward exp ++ */ ++ public boolean isRewardingExp() { ++ return this.rewardExp; ++ } ++ ++ /** ++ * Sets whether the trade will try to reward exp ++ * ++ * @param rewardExp try to reward exp ++ */ ++ public void setRewardExp(boolean rewardExp) { ++ this.rewardExp = rewardExp; ++ } ++ ++ /** ++ * @return whether the trade will count as a use of the trade ++ */ ++ public boolean willIncreaseTradeUses() { ++ return this.increaseTradeUses; ++ } ++ ++ /** ++ * Sets whether the trade will count as a use ++ * ++ * @param increaseTradeUses {@code true} to count, {@code false} otherwise ++ */ ++ public void setIncreaseTradeUses(boolean increaseTradeUses) { ++ this.increaseTradeUses = increaseTradeUses; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java +new file mode 100755 +index 0000000000000000000000000000000000000000..559d1a3c783e6c726f48d1c88b2ff8c0888890ac +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.AbstractVillager; ++import org.bukkit.entity.Player; ++import org.bukkit.inventory.MerchantRecipe; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a player trades with a villager or wandering trader ++ */ ++public class PlayerTradeEvent extends PlayerPurchaseEvent { ++ ++ private final AbstractVillager villager; ++ ++ @ApiStatus.Internal ++ public PlayerTradeEvent(@NotNull Player player, @NotNull AbstractVillager villager, @NotNull MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses) { ++ super(player, trade, rewardExp, increaseTradeUses); ++ this.villager = villager; ++ } ++ ++ /** ++ * Gets the Villager or Wandering trader associated with this event ++ * ++ * @return the villager or wandering trader ++ */ ++ @NotNull ++ public AbstractVillager getVillager() { ++ return this.villager; ++ } ++ ++} diff --git a/patches/api/0229-Add-TargetHitEvent-API.patch b/patches/api/0229-Add-TargetHitEvent-API.patch new file mode 100644 index 0000000000..6c68224363 --- /dev/null +++ b/patches/api/0229-Add-TargetHitEvent-API.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Wed, 25 Nov 2020 23:21:32 -0800 +Subject: [PATCH] Add TargetHitEvent API + + +diff --git a/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5247e7f78e0076089c1e1bdea2afbb455c43732a +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java +@@ -0,0 +1,61 @@ ++package io.papermc.paper.event.block; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.block.Block; ++import org.bukkit.block.BlockFace; ++import org.bukkit.entity.Projectile; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.ProjectileHitEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Range; ++ ++/** ++ * Called when a Target Block is hit by a projectile. ++ *

++ * Cancelling this event will stop the Target from emitting a redstone signal, ++ * and in the case that the shooter is a player, will stop them from receiving ++ * advancement criteria. ++ */ ++public class TargetHitEvent extends ProjectileHitEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private int signalStrength; ++ ++ @ApiStatus.Internal ++ public TargetHitEvent(@NotNull Projectile projectile, @NotNull Block block, @NotNull BlockFace blockFace, int signalStrength) { ++ super(projectile, null, block, blockFace); ++ this.signalStrength = signalStrength; ++ } ++ ++ /** ++ * Gets the strength of the redstone signal to be emitted by the Target block ++ * ++ * @return the strength of the redstone signal to be emitted ++ */ ++ public @Range(from = 0, to = 15) int getSignalStrength() { ++ return this.signalStrength; ++ } ++ ++ /** ++ * Sets the strength of the redstone signal to be emitted by the Target block ++ * ++ * @param signalStrength the strength of the redstone signal to be emitted ++ */ ++ public void setSignalStrength(@Range(from = 0, to = 15) int signalStrength) { ++ Preconditions.checkArgument(signalStrength >= 0 && signalStrength <= 15, "Signal strength out of range (%s), must be in range [0,15]", signalStrength); ++ this.signalStrength = signalStrength; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0229-Added-PlayerTradeEvent.patch b/patches/api/0229-Added-PlayerTradeEvent.patch deleted file mode 100644 index 11ad019021..0000000000 --- a/patches/api/0229-Added-PlayerTradeEvent.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 2 Jul 2020 16:10:10 -0700 -Subject: [PATCH] Added PlayerTradeEvent - -[Amendment: Alexander ] -PlayerTradeEvent is used for player purchases from villagers and wandering -traders, but not custom merchants created via Bukkit.createMerchant(). During -discussions in Discord it was decided that it'd be better to add a new event -that PlayerTradeEvent inherits from than change getVillager()'s annotation to -@Nullable, especially since that'd also infringe on the implication of the -event being about villager trades. - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..61c62877c38e27eacc20aa43ef02dc43e9b50bfc ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerPurchaseEvent.java -@@ -0,0 +1,109 @@ -+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.bukkit.inventory.MerchantRecipe; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a player trades with a standalone merchant GUI. -+ */ -+public class PlayerPurchaseEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean rewardExp; -+ private boolean increaseTradeUses; -+ private MerchantRecipe trade; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerPurchaseEvent(@NotNull Player player, -+ @NotNull MerchantRecipe trade, -+ boolean rewardExp, -+ boolean increaseTradeUses) { -+ super(player); -+ setTrade(trade); -+ this.rewardExp = rewardExp; -+ this.increaseTradeUses = increaseTradeUses; -+ } -+ -+ /** -+ * Gets the associated trade with this event -+ * -+ * @return the trade -+ */ -+ @NotNull -+ public MerchantRecipe getTrade() { -+ return this.trade; -+ } -+ -+ /** -+ * Sets the trade. This is then used to determine the next prices -+ * -+ * @param trade the trade to use -+ */ -+ public void setTrade(@NotNull MerchantRecipe trade) { -+ Preconditions.checkArgument(trade != null, "Trade cannot be null!"); -+ this.trade = trade; -+ } -+ -+ /** -+ * @return will trade try to reward exp -+ */ -+ public boolean isRewardingExp() { -+ return this.rewardExp; -+ } -+ -+ /** -+ * Sets whether the trade will try to reward exp -+ * -+ * @param rewardExp try to reward exp -+ */ -+ public void setRewardExp(boolean rewardExp) { -+ this.rewardExp = rewardExp; -+ } -+ -+ /** -+ * @return whether the trade will count as a use of the trade -+ */ -+ public boolean willIncreaseTradeUses() { -+ return this.increaseTradeUses; -+ } -+ -+ /** -+ * Sets whether the trade will count as a use -+ * -+ * @param increaseTradeUses {@code true} to count, {@code false} otherwise -+ */ -+ public void setIncreaseTradeUses(boolean increaseTradeUses) { -+ this.increaseTradeUses = increaseTradeUses; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+} -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java -new file mode 100755 -index 0000000000000000000000000000000000000000..559d1a3c783e6c726f48d1c88b2ff8c0888890ac ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerTradeEvent.java -@@ -0,0 +1,32 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.AbstractVillager; -+import org.bukkit.entity.Player; -+import org.bukkit.inventory.MerchantRecipe; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a player trades with a villager or wandering trader -+ */ -+public class PlayerTradeEvent extends PlayerPurchaseEvent { -+ -+ private final AbstractVillager villager; -+ -+ @ApiStatus.Internal -+ public PlayerTradeEvent(@NotNull Player player, @NotNull AbstractVillager villager, @NotNull MerchantRecipe trade, boolean rewardExp, boolean increaseTradeUses) { -+ super(player, trade, rewardExp, increaseTradeUses); -+ this.villager = villager; -+ } -+ -+ /** -+ * Gets the Villager or Wandering trader associated with this event -+ * -+ * @return the villager or wandering trader -+ */ -+ @NotNull -+ public AbstractVillager getVillager() { -+ return this.villager; -+ } -+ -+} diff --git a/patches/api/0230-Add-TargetHitEvent-API.patch b/patches/api/0230-Add-TargetHitEvent-API.patch deleted file mode 100644 index 6c68224363..0000000000 --- a/patches/api/0230-Add-TargetHitEvent-API.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 25 Nov 2020 23:21:32 -0800 -Subject: [PATCH] Add TargetHitEvent API - - -diff --git a/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5247e7f78e0076089c1e1bdea2afbb455c43732a ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java -@@ -0,0 +1,61 @@ -+package io.papermc.paper.event.block; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.bukkit.entity.Projectile; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.ProjectileHitEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Range; -+ -+/** -+ * Called when a Target Block is hit by a projectile. -+ *

-+ * Cancelling this event will stop the Target from emitting a redstone signal, -+ * and in the case that the shooter is a player, will stop them from receiving -+ * advancement criteria. -+ */ -+public class TargetHitEvent extends ProjectileHitEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private int signalStrength; -+ -+ @ApiStatus.Internal -+ public TargetHitEvent(@NotNull Projectile projectile, @NotNull Block block, @NotNull BlockFace blockFace, int signalStrength) { -+ super(projectile, null, block, blockFace); -+ this.signalStrength = signalStrength; -+ } -+ -+ /** -+ * Gets the strength of the redstone signal to be emitted by the Target block -+ * -+ * @return the strength of the redstone signal to be emitted -+ */ -+ public @Range(from = 0, to = 15) int getSignalStrength() { -+ return this.signalStrength; -+ } -+ -+ /** -+ * Sets the strength of the redstone signal to be emitted by the Target block -+ * -+ * @param signalStrength the strength of the redstone signal to be emitted -+ */ -+ public void setSignalStrength(@Range(from = 0, to = 15) int signalStrength) { -+ Preconditions.checkArgument(signalStrength >= 0 && signalStrength <= 15, "Signal strength out of range (%s), must be in range [0,15]", signalStrength); -+ this.signalStrength = signalStrength; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0230-Additional-Block-Material-API-s.patch b/patches/api/0230-Additional-Block-Material-API-s.patch new file mode 100644 index 0000000000..ab3e6f9ac6 --- /dev/null +++ b/patches/api/0230-Additional-Block-Material-API-s.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 30 Dec 2020 17:27:27 -0500 +Subject: [PATCH] Additional Block Material API's + +Faster version for isSolid() that utilizes NMS's state for isSolid instead of the slower +process to do this in the Bukkit API + +Adds API for buildable, replaceable, burnable too. + +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index 4aea4be0677d93e17a4ce98dd340dd9921f996a0..c68ed7de2d50da4105dd38c0986f237e8c56b2d6 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -439,6 +439,42 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr + */ + boolean isLiquid(); + ++ // Paper start ++ /** ++ * Check if this block is solid ++ *

++ * Determined by Minecraft, typically a block a player can use to place a new block to build things. ++ * An example of a non buildable block would be liquids, flowers, or fire ++ * ++ * @return true if block is buildable ++ */ ++ boolean isBuildable(); ++ /** ++ * Check if this block is burnable ++ *

++ * Determined by Minecraft, typically a block that fire can destroy (Wool, Wood) ++ * ++ * @return true if block is burnable ++ */ ++ boolean isBurnable(); ++ /** ++ * Check if this block is replaceable ++ *

++ * Determined by Minecraft, representing a block that is not AIR that you can still place a new block at, such as flowers. ++ * @return true if block is replaceable ++ */ ++ boolean isReplaceable(); ++ /** ++ * Check if this block is solid ++ *

++ * Determined by Minecraft, typically a block a player can stand on and can't be passed through. ++ * ++ * This API is faster than accessing Material#isSolid as it avoids a material lookup and switch statement. ++ * @return true if block is solid ++ */ ++ boolean isSolid(); ++ // Paper end ++ + /** + * Gets the temperature of this block. + *

diff --git a/patches/api/0231-Add-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/api/0231-Add-API-to-get-Material-from-Boats-and-Minecarts.patch new file mode 100644 index 0000000000..d297dd5c24 --- /dev/null +++ b/patches/api/0231-Add-API-to-get-Material-from-Boats-and-Minecarts.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Madeline Miller +Date: Thu, 31 Dec 2020 12:48:38 +1000 +Subject: [PATCH] Add API to get Material from Boats and Minecarts + + +diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java +index 88852215d01f3fc4866449f7b826f6603b0ed9d8..f7548098bcdd033d9c530fdc584fc5538c635ca1 100644 +--- a/src/main/java/org/bukkit/entity/Boat.java ++++ b/src/main/java/org/bukkit/entity/Boat.java +@@ -175,4 +175,14 @@ public interface Boat extends Vehicle { + ON_LAND, + IN_AIR; + } ++ ++ // Paper start ++ /** ++ * Gets the {@link Material} that represents this Boat type. ++ * ++ * @return the boat material. ++ */ ++ @NotNull ++ public Material getBoatMaterial(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java +index 7f9c4d4b430a3f0276461346ff2621bacf864075..bc1e62759c995a1463ebcd10d73c7d502c9acc45 100644 +--- a/src/main/java/org/bukkit/entity/Minecart.java ++++ b/src/main/java/org/bukkit/entity/Minecart.java +@@ -1,5 +1,6 @@ + package org.bukkit.entity; + ++import org.bukkit.Material; + import org.bukkit.block.data.BlockData; + import org.bukkit.material.MaterialData; + import org.bukkit.util.Vector; +@@ -147,4 +148,14 @@ public interface Minecart extends Vehicle { + * @return the current block offset for this minecart. + */ + public int getDisplayBlockOffset(); ++ ++ // Paper start ++ /** ++ * Gets the {@link Material} that represents this Minecart type. ++ * ++ * @return the minecart material. ++ */ ++ @NotNull ++ public Material getMinecartMaterial(); ++ // Paper end + } diff --git a/patches/api/0231-Additional-Block-Material-API-s.patch b/patches/api/0231-Additional-Block-Material-API-s.patch deleted file mode 100644 index ab3e6f9ac6..0000000000 --- a/patches/api/0231-Additional-Block-Material-API-s.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 30 Dec 2020 17:27:27 -0500 -Subject: [PATCH] Additional Block Material API's - -Faster version for isSolid() that utilizes NMS's state for isSolid instead of the slower -process to do this in the Bukkit API - -Adds API for buildable, replaceable, burnable too. - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 4aea4be0677d93e17a4ce98dd340dd9921f996a0..c68ed7de2d50da4105dd38c0986f237e8c56b2d6 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -439,6 +439,42 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - */ - boolean isLiquid(); - -+ // Paper start -+ /** -+ * Check if this block is solid -+ *

-+ * Determined by Minecraft, typically a block a player can use to place a new block to build things. -+ * An example of a non buildable block would be liquids, flowers, or fire -+ * -+ * @return true if block is buildable -+ */ -+ boolean isBuildable(); -+ /** -+ * Check if this block is burnable -+ *

-+ * Determined by Minecraft, typically a block that fire can destroy (Wool, Wood) -+ * -+ * @return true if block is burnable -+ */ -+ boolean isBurnable(); -+ /** -+ * Check if this block is replaceable -+ *

-+ * Determined by Minecraft, representing a block that is not AIR that you can still place a new block at, such as flowers. -+ * @return true if block is replaceable -+ */ -+ boolean isReplaceable(); -+ /** -+ * Check if this block is solid -+ *

-+ * Determined by Minecraft, typically a block a player can stand on and can't be passed through. -+ * -+ * This API is faster than accessing Material#isSolid as it avoids a material lookup and switch statement. -+ * @return true if block is solid -+ */ -+ boolean isSolid(); -+ // Paper end -+ - /** - * Gets the temperature of this block. - *

diff --git a/patches/api/0232-Add-API-to-get-Material-from-Boats-and-Minecarts.patch b/patches/api/0232-Add-API-to-get-Material-from-Boats-and-Minecarts.patch deleted file mode 100644 index d297dd5c24..0000000000 --- a/patches/api/0232-Add-API-to-get-Material-from-Boats-and-Minecarts.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Thu, 31 Dec 2020 12:48:38 +1000 -Subject: [PATCH] Add API to get Material from Boats and Minecarts - - -diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java -index 88852215d01f3fc4866449f7b826f6603b0ed9d8..f7548098bcdd033d9c530fdc584fc5538c635ca1 100644 ---- a/src/main/java/org/bukkit/entity/Boat.java -+++ b/src/main/java/org/bukkit/entity/Boat.java -@@ -175,4 +175,14 @@ public interface Boat extends Vehicle { - ON_LAND, - IN_AIR; - } -+ -+ // Paper start -+ /** -+ * Gets the {@link Material} that represents this Boat type. -+ * -+ * @return the boat material. -+ */ -+ @NotNull -+ public Material getBoatMaterial(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java -index 7f9c4d4b430a3f0276461346ff2621bacf864075..bc1e62759c995a1463ebcd10d73c7d502c9acc45 100644 ---- a/src/main/java/org/bukkit/entity/Minecart.java -+++ b/src/main/java/org/bukkit/entity/Minecart.java -@@ -1,5 +1,6 @@ - package org.bukkit.entity; - -+import org.bukkit.Material; - import org.bukkit.block.data.BlockData; - import org.bukkit.material.MaterialData; - import org.bukkit.util.Vector; -@@ -147,4 +148,14 @@ public interface Minecart extends Vehicle { - * @return the current block offset for this minecart. - */ - public int getDisplayBlockOffset(); -+ -+ // Paper start -+ /** -+ * Gets the {@link Material} that represents this Minecart type. -+ * -+ * @return the minecart material. -+ */ -+ @NotNull -+ public Material getMinecartMaterial(); -+ // Paper end - } diff --git a/patches/api/0232-Add-PlayerFlowerPotManipulateEvent.patch b/patches/api/0232-Add-PlayerFlowerPotManipulateEvent.patch new file mode 100644 index 0000000000..cb08fd1404 --- /dev/null +++ b/patches/api/0232-Add-PlayerFlowerPotManipulateEvent.patch @@ -0,0 +1,97 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MisterVector +Date: Tue, 13 Aug 2019 19:44:19 -0700 +Subject: [PATCH] Add PlayerFlowerPotManipulateEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..373a6ec68fb575b82b06bf250768c1a6909efe38 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java +@@ -0,0 +1,85 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a player places an item in or takes an item out of a flowerpot. ++ */ ++public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull ++ private final Block flowerpot; ++ @NotNull ++ private final ItemStack item; ++ private final boolean placing; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerFlowerPotManipulateEvent(@NotNull final Player player, @NotNull final Block flowerpot, @NotNull final ItemStack item, final boolean placing) { ++ super(player); ++ this.flowerpot = flowerpot; ++ this.item = item; ++ this.placing = placing; ++ } ++ ++ /** ++ * Gets the flowerpot that is involved in this event. ++ * ++ * @return the flowerpot that is involved with this event ++ */ ++ @NotNull ++ public Block getFlowerpot() { ++ return this.flowerpot; ++ } ++ ++ /** ++ * Gets the item being placed, or taken from, the flower pot. ++ * Check if placing with {@link #isPlacing()}. ++ * ++ * @return the item placed, or taken from, the flowerpot ++ */ ++ @NotNull ++ public ItemStack getItem() { ++ return this.item; ++ } ++ ++ /** ++ * Gets if the item is being placed into the flowerpot. ++ * ++ * @return if the item is being placed into the flowerpot ++ */ ++ public boolean isPlacing() { ++ return this.placing; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0233-Add-PlayerFlowerPotManipulateEvent.patch b/patches/api/0233-Add-PlayerFlowerPotManipulateEvent.patch deleted file mode 100644 index cb08fd1404..0000000000 --- a/patches/api/0233-Add-PlayerFlowerPotManipulateEvent.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MisterVector -Date: Tue, 13 Aug 2019 19:44:19 -0700 -Subject: [PATCH] Add PlayerFlowerPotManipulateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..373a6ec68fb575b82b06bf250768c1a6909efe38 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java -@@ -0,0 +1,85 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a player places an item in or takes an item out of a flowerpot. -+ */ -+public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull -+ private final Block flowerpot; -+ @NotNull -+ private final ItemStack item; -+ private final boolean placing; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerFlowerPotManipulateEvent(@NotNull final Player player, @NotNull final Block flowerpot, @NotNull final ItemStack item, final boolean placing) { -+ super(player); -+ this.flowerpot = flowerpot; -+ this.item = item; -+ this.placing = placing; -+ } -+ -+ /** -+ * Gets the flowerpot that is involved in this event. -+ * -+ * @return the flowerpot that is involved with this event -+ */ -+ @NotNull -+ public Block getFlowerpot() { -+ return this.flowerpot; -+ } -+ -+ /** -+ * Gets the item being placed, or taken from, the flower pot. -+ * Check if placing with {@link #isPlacing()}. -+ * -+ * @return the item placed, or taken from, the flowerpot -+ */ -+ @NotNull -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets if the item is being placed into the flowerpot. -+ * -+ * @return if the item is being placed into the flowerpot -+ */ -+ public boolean isPlacing() { -+ return this.placing; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0233-Zombie-API-breaking-doors.patch b/patches/api/0233-Zombie-API-breaking-doors.patch new file mode 100644 index 0000000000..24118c13ee --- /dev/null +++ b/patches/api/0233-Zombie-API-breaking-doors.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 18 Nov 2020 11:32:15 -0800 +Subject: [PATCH] Zombie API - breaking doors + + +diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java +index c1a5b625ea602d751a8026d989882c60e80756c9..93de95f68af45dba6a1da350a46adc1d1d058899 100644 +--- a/src/main/java/org/bukkit/entity/Zombie.java ++++ b/src/main/java/org/bukkit/entity/Zombie.java +@@ -100,8 +100,10 @@ public interface Zombie extends Monster, Ageable { + + /** + * Sets whether this zombie can break doors +- * +- * This will be ignored if the entity is a Drowned. Will also stop the action if ++ *

++ * Check {@link #supportsBreakingDoors()} to see ++ * if this zombie type will even be affected by using ++ * this method. Will also stop the action if + * the entity is currently breaking a door. + * + * @param flag Whether this zombie can break doors +@@ -162,5 +164,15 @@ public interface Zombie extends Monster, Ageable { + * @param shouldBurnInDay True to burn in sunlight + */ + void setShouldBurnInDay(boolean shouldBurnInDay); ++ ++ /** ++ * Checks if this zombie type supports breaking doors. ++ * {@link Drowned} do not have support for breaking doors ++ * so using {@link #setCanBreakDoors(boolean)} on them has ++ * no effect. ++ * ++ * @return true if entity supports breaking doors ++ */ ++ boolean supportsBreakingDoors(); + // Paper end + } diff --git a/patches/api/0234-Add-EntityLoadCrossbowEvent.patch b/patches/api/0234-Add-EntityLoadCrossbowEvent.patch new file mode 100644 index 0000000000..2a60c84538 --- /dev/null +++ b/patches/api/0234-Add-EntityLoadCrossbowEvent.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Wed, 7 Oct 2020 12:04:17 -0400 +Subject: [PATCH] Add EntityLoadCrossbowEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8434ea803e3135380f9351c82a414ccb65c478a9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java +@@ -0,0 +1,96 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.bukkit.inventory.EquipmentSlot; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a LivingEntity loads a crossbow with a projectile. ++ */ ++public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final ItemStack crossbow; ++ private final EquipmentSlot hand; ++ ++ private boolean consumeItem = true; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @NotNull ItemStack crossbow, @NotNull EquipmentSlot hand) { ++ super(entity); ++ this.crossbow = crossbow; ++ this.hand = hand; ++ } ++ ++ @NotNull ++ @Override ++ public LivingEntity getEntity() { ++ return (LivingEntity) super.getEntity(); ++ } ++ ++ /** ++ * Gets the crossbow {@link ItemStack} being loaded. ++ * ++ * @return the crossbow involved in this event ++ */ ++ @NotNull ++ public ItemStack getCrossbow() { ++ return this.crossbow; ++ } ++ ++ /** ++ * Gets the hand from which the crossbow was loaded. ++ * ++ * @return the hand ++ */ ++ @NotNull ++ public EquipmentSlot getHand() { ++ return this.hand; ++ } ++ ++ /** ++ * @return should the itemstack be consumed ++ */ ++ public boolean shouldConsumeItem() { ++ return this.consumeItem; ++ } ++ ++ /** ++ * @param consume should the item be consumed ++ */ ++ public void setConsumeItem(boolean consume) { ++ this.consumeItem = consume; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * Set whether to cancel the crossbow being loaded. If canceled, the ++ * projectile that would be loaded into the crossbow will not be consumed. ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0234-Zombie-API-breaking-doors.patch b/patches/api/0234-Zombie-API-breaking-doors.patch deleted file mode 100644 index 24118c13ee..0000000000 --- a/patches/api/0234-Zombie-API-breaking-doors.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 18 Nov 2020 11:32:15 -0800 -Subject: [PATCH] Zombie API - breaking doors - - -diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java -index c1a5b625ea602d751a8026d989882c60e80756c9..93de95f68af45dba6a1da350a46adc1d1d058899 100644 ---- a/src/main/java/org/bukkit/entity/Zombie.java -+++ b/src/main/java/org/bukkit/entity/Zombie.java -@@ -100,8 +100,10 @@ public interface Zombie extends Monster, Ageable { - - /** - * Sets whether this zombie can break doors -- * -- * This will be ignored if the entity is a Drowned. Will also stop the action if -+ *

-+ * Check {@link #supportsBreakingDoors()} to see -+ * if this zombie type will even be affected by using -+ * this method. Will also stop the action if - * the entity is currently breaking a door. - * - * @param flag Whether this zombie can break doors -@@ -162,5 +164,15 @@ public interface Zombie extends Monster, Ageable { - * @param shouldBurnInDay True to burn in sunlight - */ - void setShouldBurnInDay(boolean shouldBurnInDay); -+ -+ /** -+ * Checks if this zombie type supports breaking doors. -+ * {@link Drowned} do not have support for breaking doors -+ * so using {@link #setCanBreakDoors(boolean)} on them has -+ * no effect. -+ * -+ * @return true if entity supports breaking doors -+ */ -+ boolean supportsBreakingDoors(); - // Paper end - } diff --git a/patches/api/0235-Add-EntityLoadCrossbowEvent.patch b/patches/api/0235-Add-EntityLoadCrossbowEvent.patch deleted file mode 100644 index 2a60c84538..0000000000 --- a/patches/api/0235-Add-EntityLoadCrossbowEvent.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JRoy -Date: Wed, 7 Oct 2020 12:04:17 -0400 -Subject: [PATCH] Add EntityLoadCrossbowEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..8434ea803e3135380f9351c82a414ccb65c478a9 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java -@@ -0,0 +1,96 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.inventory.EquipmentSlot; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a LivingEntity loads a crossbow with a projectile. -+ */ -+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack crossbow; -+ private final EquipmentSlot hand; -+ -+ private boolean consumeItem = true; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @NotNull ItemStack crossbow, @NotNull EquipmentSlot hand) { -+ super(entity); -+ this.crossbow = crossbow; -+ this.hand = hand; -+ } -+ -+ @NotNull -+ @Override -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ /** -+ * Gets the crossbow {@link ItemStack} being loaded. -+ * -+ * @return the crossbow involved in this event -+ */ -+ @NotNull -+ public ItemStack getCrossbow() { -+ return this.crossbow; -+ } -+ -+ /** -+ * Gets the hand from which the crossbow was loaded. -+ * -+ * @return the hand -+ */ -+ @NotNull -+ public EquipmentSlot getHand() { -+ return this.hand; -+ } -+ -+ /** -+ * @return should the itemstack be consumed -+ */ -+ public boolean shouldConsumeItem() { -+ return this.consumeItem; -+ } -+ -+ /** -+ * @param consume should the item be consumed -+ */ -+ public void setConsumeItem(boolean consume) { -+ this.consumeItem = consume; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Set whether to cancel the crossbow being loaded. If canceled, the -+ * projectile that would be loaded into the crossbow will not be consumed. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0235-Added-WorldGameRuleChangeEvent.patch b/patches/api/0235-Added-WorldGameRuleChangeEvent.patch new file mode 100644 index 0000000000..348efda0ca --- /dev/null +++ b/patches/api/0235-Added-WorldGameRuleChangeEvent.patch @@ -0,0 +1,104 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 20 Dec 2020 16:41:44 -0800 +Subject: [PATCH] Added WorldGameRuleChangeEvent + + +diff --git a/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2831fb8ad22e457f85523f65be9cba2432109f01 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java +@@ -0,0 +1,92 @@ ++package io.papermc.paper.event.world; ++ ++import org.bukkit.GameRule; ++import org.bukkit.World; ++import org.bukkit.command.CommandSender; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.WorldEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when a world's gamerule is changed, either by command or by api. ++ */ ++public class WorldGameRuleChangeEvent extends WorldEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final CommandSender commandSender; ++ private final GameRule gameRule; ++ private String value; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public WorldGameRuleChangeEvent(@NotNull World world, @Nullable CommandSender commandSender, @NotNull GameRule gameRule, @NotNull String value) { ++ super(world); ++ this.commandSender = commandSender; ++ this.gameRule = gameRule; ++ this.value = value; ++ } ++ ++ /** ++ * Gets the command sender associated with this event. ++ * ++ * @return {@code null} if the gamerule was changed via api, otherwise the {@link CommandSender}. ++ */ ++ @Nullable ++ public CommandSender getCommandSender() { ++ return this.commandSender; ++ } ++ ++ /** ++ * Gets the game rule associated with this event. ++ * ++ * @return the gamerule being changed. ++ */ ++ @NotNull ++ public GameRule getGameRule() { ++ return this.gameRule; ++ } ++ ++ /** ++ * Gets the new value of the gamerule. ++ * ++ * @return the new value of the gamerule. ++ */ ++ @NotNull ++ public String getValue() { ++ return this.value; ++ } ++ ++ /** ++ * Sets the new value of this gamerule. ++ * ++ * @param value the new value of the gamerule. ++ */ ++ public void setValue(@NotNull String value) { ++ this.value = value; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0236-Added-ServerResourcesReloadedEvent.patch b/patches/api/0236-Added-ServerResourcesReloadedEvent.patch new file mode 100644 index 0000000000..150b70e6cc --- /dev/null +++ b/patches/api/0236-Added-ServerResourcesReloadedEvent.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 2 Dec 2020 20:04:16 -0800 +Subject: [PATCH] Added ServerResourcesReloadedEvent + + +diff --git a/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a7ed7d6b6469e175d3949ffa9c502cbfde609215 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java +@@ -0,0 +1,49 @@ ++package io.papermc.paper.event.server; ++ ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.server.ServerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload) ++ *

++ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this. ++ */ ++public class ServerResourcesReloadedEvent extends ServerEvent { ++ ++ public static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Cause cause; ++ ++ @ApiStatus.Internal ++ public ServerResourcesReloadedEvent(@NotNull Cause cause) { ++ this.cause = cause; ++ } ++ ++ /** ++ * Gets the cause of the resource reload. ++ * ++ * @return the reload cause ++ */ ++ @NotNull ++ public Cause getCause() { ++ return this.cause; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public enum Cause { ++ COMMAND, ++ PLUGIN, ++ } ++} diff --git a/patches/api/0236-Added-WorldGameRuleChangeEvent.patch b/patches/api/0236-Added-WorldGameRuleChangeEvent.patch deleted file mode 100644 index 348efda0ca..0000000000 --- a/patches/api/0236-Added-WorldGameRuleChangeEvent.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 20 Dec 2020 16:41:44 -0800 -Subject: [PATCH] Added WorldGameRuleChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2831fb8ad22e457f85523f65be9cba2432109f01 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/WorldGameRuleChangeEvent.java -@@ -0,0 +1,92 @@ -+package io.papermc.paper.event.world; -+ -+import org.bukkit.GameRule; -+import org.bukkit.World; -+import org.bukkit.command.CommandSender; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.WorldEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when a world's gamerule is changed, either by command or by api. -+ */ -+public class WorldGameRuleChangeEvent extends WorldEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final CommandSender commandSender; -+ private final GameRule gameRule; -+ private String value; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WorldGameRuleChangeEvent(@NotNull World world, @Nullable CommandSender commandSender, @NotNull GameRule gameRule, @NotNull String value) { -+ super(world); -+ this.commandSender = commandSender; -+ this.gameRule = gameRule; -+ this.value = value; -+ } -+ -+ /** -+ * Gets the command sender associated with this event. -+ * -+ * @return {@code null} if the gamerule was changed via api, otherwise the {@link CommandSender}. -+ */ -+ @Nullable -+ public CommandSender getCommandSender() { -+ return this.commandSender; -+ } -+ -+ /** -+ * Gets the game rule associated with this event. -+ * -+ * @return the gamerule being changed. -+ */ -+ @NotNull -+ public GameRule getGameRule() { -+ return this.gameRule; -+ } -+ -+ /** -+ * Gets the new value of the gamerule. -+ * -+ * @return the new value of the gamerule. -+ */ -+ @NotNull -+ public String getValue() { -+ return this.value; -+ } -+ -+ /** -+ * Sets the new value of this gamerule. -+ * -+ * @param value the new value of the gamerule. -+ */ -+ public void setValue(@NotNull String value) { -+ this.value = value; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0237-Add-BlockFailedDispenseEvent.patch b/patches/api/0237-Add-BlockFailedDispenseEvent.patch new file mode 100644 index 0000000000..4f480e7417 --- /dev/null +++ b/patches/api/0237-Add-BlockFailedDispenseEvent.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheViperShow <29604693+TheViperShow@users.noreply.github.com> +Date: Wed, 22 Apr 2020 09:40:23 +0200 +Subject: [PATCH] Add BlockFailedDispenseEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d531b034b49b163e5095e840a5c9c4fe5eb73319 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java +@@ -0,0 +1,56 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a block tries to dispense an item, but its inventory is empty. ++ */ ++public class BlockFailedDispenseEvent extends BlockEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean shouldPlayEffect = true; ++ ++ @ApiStatus.Internal ++ public BlockFailedDispenseEvent(@NotNull Block theBlock) { ++ super(theBlock); ++ } ++ ++ /** ++ * @return if the effect should be played ++ */ ++ public boolean shouldPlayEffect() { ++ return this.shouldPlayEffect; ++ } ++ ++ /** ++ * Sets if the effect for empty dispensers should be played ++ * ++ * @param playEffect if the effect should be played ++ */ ++ public void shouldPlayEffect(boolean playEffect) { ++ this.shouldPlayEffect = playEffect; ++ } ++ ++ /** ++ * @return {@link #shouldPlayEffect()} ++ */ ++ @Override ++ public boolean callEvent() { ++ super.callEvent(); ++ return this.shouldPlayEffect(); ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0237-Added-ServerResourcesReloadedEvent.patch b/patches/api/0237-Added-ServerResourcesReloadedEvent.patch deleted file mode 100644 index 150b70e6cc..0000000000 --- a/patches/api/0237-Added-ServerResourcesReloadedEvent.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 2 Dec 2020 20:04:16 -0800 -Subject: [PATCH] Added ServerResourcesReloadedEvent - - -diff --git a/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a7ed7d6b6469e175d3949ffa9c502cbfde609215 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java -@@ -0,0 +1,49 @@ -+package io.papermc.paper.event.server; -+ -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.server.ServerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload) -+ *

-+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this. -+ */ -+public class ServerResourcesReloadedEvent extends ServerEvent { -+ -+ public static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Cause cause; -+ -+ @ApiStatus.Internal -+ public ServerResourcesReloadedEvent(@NotNull Cause cause) { -+ this.cause = cause; -+ } -+ -+ /** -+ * Gets the cause of the resource reload. -+ * -+ * @return the reload cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public enum Cause { -+ COMMAND, -+ PLUGIN, -+ } -+} diff --git a/patches/api/0238-Add-BlockFailedDispenseEvent.patch b/patches/api/0238-Add-BlockFailedDispenseEvent.patch deleted file mode 100644 index 4f480e7417..0000000000 --- a/patches/api/0238-Add-BlockFailedDispenseEvent.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TheViperShow <29604693+TheViperShow@users.noreply.github.com> -Date: Wed, 22 Apr 2020 09:40:23 +0200 -Subject: [PATCH] Add BlockFailedDispenseEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d531b034b49b163e5095e840a5c9c4fe5eb73319 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java -@@ -0,0 +1,56 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a block tries to dispense an item, but its inventory is empty. -+ */ -+public class BlockFailedDispenseEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean shouldPlayEffect = true; -+ -+ @ApiStatus.Internal -+ public BlockFailedDispenseEvent(@NotNull Block theBlock) { -+ super(theBlock); -+ } -+ -+ /** -+ * @return if the effect should be played -+ */ -+ public boolean shouldPlayEffect() { -+ return this.shouldPlayEffect; -+ } -+ -+ /** -+ * Sets if the effect for empty dispensers should be played -+ * -+ * @param playEffect if the effect should be played -+ */ -+ public void shouldPlayEffect(boolean playEffect) { -+ this.shouldPlayEffect = playEffect; -+ } -+ -+ /** -+ * @return {@link #shouldPlayEffect()} -+ */ -+ @Override -+ public boolean callEvent() { -+ super.callEvent(); -+ return this.shouldPlayEffect(); -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0238-Added-PlayerLecternPageChangeEvent.patch b/patches/api/0238-Added-PlayerLecternPageChangeEvent.patch new file mode 100644 index 0000000000..3c9f223aa5 --- /dev/null +++ b/patches/api/0238-Added-PlayerLecternPageChangeEvent.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 23 Nov 2020 12:58:16 -0800 +Subject: [PATCH] Added PlayerLecternPageChangeEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6ed2a6c8c033937d933b6d4834953b8112a98bb3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java +@@ -0,0 +1,117 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.block.Lectern; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++public class PlayerLecternPageChangeEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Lectern lectern; ++ private final ItemStack book; ++ private final PageChangeDirection pageChangeDirection; ++ private final int oldPage; ++ private int newPage; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerLecternPageChangeEvent(@NotNull Player player, @NotNull Lectern lectern, @NotNull ItemStack book, @NotNull PageChangeDirection pageChangeDirection, int oldPage, int newPage) { ++ super(player); ++ this.lectern = lectern; ++ this.book = book; ++ this.pageChangeDirection = pageChangeDirection; ++ this.oldPage = oldPage; ++ this.newPage = newPage; ++ } ++ ++ /** ++ * Gets the lectern involved. ++ * ++ * @return the Lectern ++ */ ++ @NotNull ++ public Lectern getLectern() { ++ return this.lectern; ++ } ++ ++ /** ++ * Gets the current ItemStack on the lectern. ++ * ++ * @return the ItemStack on the Lectern ++ */ ++ @NotNull ++ public ItemStack getBook() { ++ return this.book; ++ } ++ ++ /** ++ * Gets the page change direction. This is essentially returns which button the player clicked, left or right. ++ * ++ * @return the page change direction ++ */ ++ @NotNull ++ public PageChangeDirection getPageChangeDirection() { ++ return this.pageChangeDirection; ++ } ++ ++ /** ++ * Gets the page changed from. Pages are 0-indexed. ++ * ++ * @return the page changed from ++ */ ++ public int getOldPage() { ++ return this.oldPage; ++ } ++ ++ /** ++ * Gets the page changed to. Pages are 0-indexed. ++ * ++ * @return the page changed to ++ */ ++ public int getNewPage() { ++ return this.newPage; ++ } ++ ++ /** ++ * Sets the page changed to. Pages are 0-indexed. ++ * Page indices that are greater than the number of pages will show the last page. ++ * ++ * @param newPage the new paged changed to ++ */ ++ public void setNewPage(int newPage) { ++ this.newPage = newPage; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ public enum PageChangeDirection { ++ LEFT, ++ RIGHT, ++ } ++} diff --git a/patches/api/0239-Added-PlayerLecternPageChangeEvent.patch b/patches/api/0239-Added-PlayerLecternPageChangeEvent.patch deleted file mode 100644 index 3c9f223aa5..0000000000 --- a/patches/api/0239-Added-PlayerLecternPageChangeEvent.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 23 Nov 2020 12:58:16 -0800 -Subject: [PATCH] Added PlayerLecternPageChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6ed2a6c8c033937d933b6d4834953b8112a98bb3 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java -@@ -0,0 +1,117 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Lectern; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+public class PlayerLecternPageChangeEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Lectern lectern; -+ private final ItemStack book; -+ private final PageChangeDirection pageChangeDirection; -+ private final int oldPage; -+ private int newPage; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerLecternPageChangeEvent(@NotNull Player player, @NotNull Lectern lectern, @NotNull ItemStack book, @NotNull PageChangeDirection pageChangeDirection, int oldPage, int newPage) { -+ super(player); -+ this.lectern = lectern; -+ this.book = book; -+ this.pageChangeDirection = pageChangeDirection; -+ this.oldPage = oldPage; -+ this.newPage = newPage; -+ } -+ -+ /** -+ * Gets the lectern involved. -+ * -+ * @return the Lectern -+ */ -+ @NotNull -+ public Lectern getLectern() { -+ return this.lectern; -+ } -+ -+ /** -+ * Gets the current ItemStack on the lectern. -+ * -+ * @return the ItemStack on the Lectern -+ */ -+ @NotNull -+ public ItemStack getBook() { -+ return this.book; -+ } -+ -+ /** -+ * Gets the page change direction. This is essentially returns which button the player clicked, left or right. -+ * -+ * @return the page change direction -+ */ -+ @NotNull -+ public PageChangeDirection getPageChangeDirection() { -+ return this.pageChangeDirection; -+ } -+ -+ /** -+ * Gets the page changed from. Pages are 0-indexed. -+ * -+ * @return the page changed from -+ */ -+ public int getOldPage() { -+ return this.oldPage; -+ } -+ -+ /** -+ * Gets the page changed to. Pages are 0-indexed. -+ * -+ * @return the page changed to -+ */ -+ public int getNewPage() { -+ return this.newPage; -+ } -+ -+ /** -+ * Sets the page changed to. Pages are 0-indexed. -+ * Page indices that are greater than the number of pages will show the last page. -+ * -+ * @param newPage the new paged changed to -+ */ -+ public void setNewPage(int newPage) { -+ this.newPage = newPage; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum PageChangeDirection { -+ LEFT, -+ RIGHT, -+ } -+} diff --git a/patches/api/0239-Added-PlayerLoomPatternSelectEvent.patch b/patches/api/0239-Added-PlayerLoomPatternSelectEvent.patch new file mode 100644 index 0000000000..766e838ec8 --- /dev/null +++ b/patches/api/0239-Added-PlayerLoomPatternSelectEvent.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 25 Nov 2020 16:33:42 -0800 +Subject: [PATCH] Added PlayerLoomPatternSelectEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c614bd1a725adee0c434a9331099d0c35d7411f6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java +@@ -0,0 +1,80 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.block.banner.PatternType; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.LoomInventory; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a player selects a banner patten in a loom inventory. ++ */ ++public class PlayerLoomPatternSelectEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final LoomInventory loomInventory; ++ private PatternType patternType; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerLoomPatternSelectEvent(@NotNull Player player, @NotNull LoomInventory loomInventory, @NotNull PatternType patternType) { ++ super(player); ++ this.loomInventory = loomInventory; ++ this.patternType = patternType; ++ } ++ ++ /** ++ * Gets the loom inventory involved. ++ * ++ * @return the loom inventory ++ */ ++ @NotNull ++ public LoomInventory getLoomInventory() { ++ return this.loomInventory; ++ } ++ ++ /** ++ * Gets the pattern type selected. ++ * ++ * @return the pattern type ++ */ ++ @NotNull ++ public PatternType getPatternType() { ++ return this.patternType; ++ } ++ ++ /** ++ * Sets the pattern type selected. ++ * ++ * @param patternType the pattern type ++ */ ++ public void setPatternType(@NotNull PatternType patternType) { ++ this.patternType = patternType; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0240-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/0240-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch new file mode 100644 index 0000000000..c25fbd796f --- /dev/null +++ b/patches/api/0240-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Madeline Miller +Date: Mon, 4 Jan 2021 16:40:55 +1000 +Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java +index ed72095b5cf669d9f25852e8ef772a710c54012a..ddea08e4de2198a0a7565e2fd7a05571ed48f27b 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java +@@ -1,5 +1,6 @@ + package org.bukkit.event.player; + ++import org.bukkit.Location; + import org.bukkit.Material; + import org.bukkit.block.Block; + import org.bukkit.block.BlockFace; +@@ -234,13 +235,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { + *

+ * All vector components are between 0.0 and 1.0 inclusive. + * ++ * @deprecated misleading, use {@link #getInteractionPoint()} + * @return the clicked position. May be null. + */ + @Nullable ++ @Deprecated // Paper + public Vector getClickedPosition() { + return clickedPosistion; + } + ++ // Paper start ++ /** ++ * The exact point at which the interaction occurred. May be null. ++ * ++ * @return the exact interaction point. May be null. ++ */ ++ @Nullable ++ public Location getInteractionPoint() { ++ if (this.blockClicked == null || this.clickedPosistion == null) { ++ return null; ++ } ++ return this.blockClicked.getLocation().add(this.clickedPosistion); ++ } ++ // Paper end ++ + @NotNull + @Override + public HandlerList getHandlers() { diff --git a/patches/api/0240-Added-PlayerLoomPatternSelectEvent.patch b/patches/api/0240-Added-PlayerLoomPatternSelectEvent.patch deleted file mode 100644 index 766e838ec8..0000000000 --- a/patches/api/0240-Added-PlayerLoomPatternSelectEvent.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 25 Nov 2020 16:33:42 -0800 -Subject: [PATCH] Added PlayerLoomPatternSelectEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c614bd1a725adee0c434a9331099d0c35d7411f6 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java -@@ -0,0 +1,80 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.banner.PatternType; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.LoomInventory; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a player selects a banner patten in a loom inventory. -+ */ -+public class PlayerLoomPatternSelectEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final LoomInventory loomInventory; -+ private PatternType patternType; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerLoomPatternSelectEvent(@NotNull Player player, @NotNull LoomInventory loomInventory, @NotNull PatternType patternType) { -+ super(player); -+ this.loomInventory = loomInventory; -+ this.patternType = patternType; -+ } -+ -+ /** -+ * Gets the loom inventory involved. -+ * -+ * @return the loom inventory -+ */ -+ @NotNull -+ public LoomInventory getLoomInventory() { -+ return this.loomInventory; -+ } -+ -+ /** -+ * Gets the pattern type selected. -+ * -+ * @return the pattern type -+ */ -+ @NotNull -+ public PatternType getPatternType() { -+ return this.patternType; -+ } -+ -+ /** -+ * Sets the pattern type selected. -+ * -+ * @param patternType the pattern type -+ */ -+ public void setPatternType(@NotNull PatternType patternType) { -+ this.patternType = patternType; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0241-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/0241-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch deleted file mode 100644 index c25fbd796f..0000000000 --- a/patches/api/0241-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Mon, 4 Jan 2021 16:40:55 +1000 -Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java -index ed72095b5cf669d9f25852e8ef772a710c54012a..ddea08e4de2198a0a7565e2fd7a05571ed48f27b 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java -@@ -1,5 +1,6 @@ - package org.bukkit.event.player; - -+import org.bukkit.Location; - import org.bukkit.Material; - import org.bukkit.block.Block; - import org.bukkit.block.BlockFace; -@@ -234,13 +235,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { - *

- * All vector components are between 0.0 and 1.0 inclusive. - * -+ * @deprecated misleading, use {@link #getInteractionPoint()} - * @return the clicked position. May be null. - */ - @Nullable -+ @Deprecated // Paper - public Vector getClickedPosition() { - return clickedPosistion; - } - -+ // Paper start -+ /** -+ * The exact point at which the interaction occurred. May be null. -+ * -+ * @return the exact interaction point. May be null. -+ */ -+ @Nullable -+ public Location getInteractionPoint() { -+ if (this.blockClicked == null || this.clickedPosistion == null) { -+ return null; -+ } -+ return this.blockClicked.getLocation().add(this.clickedPosistion); -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/0241-Add-sendOpLevel-API.patch b/patches/api/0241-Add-sendOpLevel-API.patch new file mode 100644 index 0000000000..c6d0eae4c3 --- /dev/null +++ b/patches/api/0241-Add-sendOpLevel-API.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Tue, 29 Dec 2020 15:02:57 +0100 +Subject: [PATCH] Add sendOpLevel API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 28a811be93b29f105dad1db91a8adccbdf9fcaf7..752b2bac47588c0f75a13a7e6ec2be3c2f5a149e 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3308,6 +3308,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + } + // Paper end - elytra boost API + ++ // Paper start - sendOpLevel API ++ /** ++ * Send a packet to the player indicating its operator status level. ++ *

++ * Note: This will not persist across more than the current connection, and setting the player's operator ++ * status as a later point will override the effects of this. ++ * ++ * @param level The level to send to the player. Must be in {@code [0, 4]}. ++ * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}). ++ */ ++ void sendOpLevel(byte level); ++ // Paper end - sendOpLevel API ++ + // Spigot start + public class Spigot extends Entity.Spigot { + diff --git a/patches/api/0242-Add-RegistryAccess-for-managing-registries.patch b/patches/api/0242-Add-RegistryAccess-for-managing-registries.patch new file mode 100644 index 0000000000..17ce5cc911 --- /dev/null +++ b/patches/api/0242-Add-RegistryAccess-for-managing-registries.patch @@ -0,0 +1,394 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 2 Mar 2022 13:36:21 -0800 +Subject: [PATCH] Add RegistryAccess for managing registries + + +diff --git a/src/main/java/io/papermc/paper/registry/Reference.java b/src/main/java/io/papermc/paper/registry/Reference.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d8656772e0c983df7c40ddc367a73ce473348339 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/Reference.java +@@ -0,0 +1,47 @@ ++package io.papermc.paper.registry; ++ ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Represents a reference to a server-backed registry value that may ++ * change. ++ * ++ * @param type of the value ++ */ ++@Deprecated(forRemoval = true, since = "1.20.6") ++public interface Reference extends Keyed { ++ ++ /** ++ * Gets the value from the registry with the key. ++ * ++ * @return the value ++ * @throws java.util.NoSuchElementException if there is no value with this key ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.6") ++ @NotNull T value(); ++ ++ /** ++ * Gets the value from the registry with the key. ++ * ++ * @return the value or null if it doesn't exist ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.6") ++ @Nullable T valueOrNull(); ++ ++ /** ++ * Creates a reference to a registered value. ++ * ++ * @param registry the registry the value is located in ++ * @param key the key to the value ++ * @param the type of the value ++ * @return a reference ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.6") ++ static @NotNull Reference create(@NotNull Registry registry, @NotNull NamespacedKey key) { ++ return new ReferenceImpl<>(registry, key); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/registry/ReferenceImpl.java b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6083b5982 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.registry; ++ ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.NoSuchElementException; ++ ++record ReferenceImpl(@NotNull Registry registry, @NotNull NamespacedKey key) implements Reference { ++ ++ @Override ++ public @NotNull T value() { ++ final T value = this.registry.get(this.key); ++ if (value == null) { ++ throw new NoSuchElementException("No such value with key " + this.key); ++ } ++ return value; ++ } ++ ++ @Override ++ public @Nullable T valueOrNull() { ++ return this.registry.get(this.key); ++ } ++ ++ @Override ++ public @NotNull NamespacedKey getKey() { ++ return this.key; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/registry/RegistryAccess.java b/src/main/java/io/papermc/paper/registry/RegistryAccess.java +new file mode 100644 +index 0000000000000000000000000000000000000000..86ab67ff5023bf6adea80b02648b6f67476e30e5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/RegistryAccess.java +@@ -0,0 +1,49 @@ ++package io.papermc.paper.registry; ++ ++import org.bukkit.Keyed; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Used for accessing different {@link Registry} instances ++ * by a {@link RegistryKey}. Get the main instance of {@link RegistryAccess} ++ * with {@link RegistryAccess#registryAccess()}. ++ */ ++@ApiStatus.NonExtendable ++public interface RegistryAccess { ++ ++ /** ++ * Get the {@link RegistryAccess} instance for the server. ++ * ++ * @return the RegistryAccess instance ++ */ ++ static @NotNull RegistryAccess registryAccess() { ++ return RegistryAccessHolder.INSTANCE.orElseThrow(() -> new IllegalStateException("No RegistryAccess implementation found")); ++ } ++ ++ /** ++ * Gets the registry based on the type. ++ * ++ * @param type the type ++ * @return the registry or null if none found ++ * @param the type ++ * @deprecated use {@link #getRegistry(RegistryKey)} with keys from {@link RegistryKey} ++ */ ++ @Deprecated(since = "1.20.6", forRemoval = true) ++ @Nullable Registry getRegistry(@NotNull Class type); ++ ++ /** ++ * Gets the registry with the specified key. ++ * ++ * @param registryKey the key ++ * @return the registry ++ * @param the type ++ * @throws java.util.NoSuchElementException if no registry with the key is found ++ * @throws IllegalArgumentException if the registry is not available yet ++ */ ++ // Future note: We should have no trouble removing this generic qualifier when ++ // registry types no longer have to be "keyed" as it shouldn't break ABI or API. ++ @NotNull Registry getRegistry(@NotNull RegistryKey registryKey); ++} +diff --git a/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b89e19c070f97c9662f1e16309446494b30aa7c9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java +@@ -0,0 +1,12 @@ ++package io.papermc.paper.registry; ++ ++import java.util.Optional; ++import java.util.ServiceLoader; ++ ++final class RegistryAccessHolder { ++ ++ static final Optional INSTANCE = ServiceLoader.load(RegistryAccess.class).findFirst(); ++ ++ private RegistryAccessHolder() { ++ } ++} +diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java +index 791813220b2504214b1adecc69093cd600fb0f8c..47fe5b0d5d031110c27210a0a256c260b35d9ba1 100644 +--- a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java ++++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java +@@ -10,6 +10,17 @@ record RegistryKeyImpl(@NotNull Key key) implements RegistryKey { + + static final Set> REGISTRY_KEYS = Sets.newIdentityHashSet(); + ++ // override equals and hashCode to this can be used to simulate an "identity" hashmap ++ @Override ++ public boolean equals(final Object obj) { ++ return obj == this; ++ } ++ ++ @Override ++ public int hashCode() { ++ return System.identityHashCode(this); ++ } ++ + static RegistryKey create(@Subst("some_key") final String key) { + final RegistryKey registryKey = createInternal(key); + REGISTRY_KEYS.add(registryKey); +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 732ed3724e784ad659cb4411dbd73b42a8330a2c..7be6710d28dea19bd0f9054c1c2e32dacd355c45 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2398,8 +2398,11 @@ public final class Bukkit { + * @param tClass of the registry to get + * @param type of the registry + * @return the corresponding registry or null if not present ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} ++ * with keys from {@link io.papermc.paper.registry.RegistryKey} + */ + @Nullable ++ @Deprecated(since = "1.20.6") + public static Registry getRegistry(@NotNull Class tClass) { + return server.getRegistry(tClass); + } +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index a04d279561676e825905f5512c399d14a3d8f828..91117cad12eee0bdaac8e0398a0f7f288ba27a40 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -129,7 +129,7 @@ public interface Registry extends Iterable { + * + * @see Enchantment + */ +- Registry ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); ++ Registry ENCHANTMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENCHANTMENT); // Paper + /** + * Server entity types. + * +@@ -141,7 +141,7 @@ public interface Registry extends Iterable { + * + * @see MusicInstrument + */ +- Registry INSTRUMENT = Objects.requireNonNull(Bukkit.getRegistry(MusicInstrument.class), "No registry present for MusicInstrument. This is a bug."); ++ Registry INSTRUMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.INSTRUMENT); // Paper + /** + * Default server loot tables. + * +@@ -159,7 +159,7 @@ public interface Registry extends Iterable { + * + * @see PotionEffectType + */ +- Registry EFFECT = Objects.requireNonNull(Bukkit.getRegistry(PotionEffectType.class), "No registry present for PotionEffectType. This is a bug."); ++ Registry EFFECT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MOB_EFFECT); // Paper + /** + * Server particles. + * +@@ -182,14 +182,16 @@ public interface Registry extends Iterable { + * Server structures. + * + * @see Structure ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE} + */ +- Registry STRUCTURE = Bukkit.getRegistry(Structure.class); ++ @Deprecated(since = "1.20.6") // Paper ++ Registry STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper + /** + * Server structure types. + * + * @see StructureType + */ +- Registry STRUCTURE_TYPE = Bukkit.getRegistry(StructureType.class); ++ Registry STRUCTURE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE); // Paper + /** + * Sound keys. + * +@@ -200,21 +202,26 @@ public interface Registry extends Iterable { + * Trim materials. + * + * @see TrimMaterial ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL} + */ +- Registry TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class); ++ @Deprecated(since = "1.20.6") // Paper ++ Registry TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper + /** + * Trim patterns. + * + * @see TrimPattern ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN} + */ +- Registry TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class); ++ @Deprecated(since = "1.20.6") ++ Registry TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper + /** + * Damage types. + * + * @see DamageType ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#DAMAGE_TYPE} + */ +- @ApiStatus.Experimental +- Registry DAMAGE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); ++ @Deprecated(since = "1.20.6") ++ Registry DAMAGE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); // Paper + /** + * Villager profession. + * +@@ -268,8 +275,10 @@ public interface Registry extends Iterable { + * Wolf variants. + * + * @see Wolf.Variant ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#WOLF_VARIANT} + */ +- Registry WOLF_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Wolf.Variant.class), "No registry present for Wolf Variant. This is a bug."); ++ @Deprecated(since = "1.20.6") ++ Registry WOLF_VARIANT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Wolf.Variant.class), "No registry present for Wolf$Variant. This is a bug."); // Paper + /** + * Map cursor types. + * +@@ -282,7 +291,7 @@ public interface Registry extends Iterable { + * + * @see GameEvent + */ +- Registry GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug."); ++ Registry GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper + /** + * Get the object by its key. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 395f7910f535bfd33a5676b011ab62a53e30e140..5644af8154373923791e3ed5f8b01c3f5d357b9c 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2046,8 +2046,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + * @param tClass of the registry to get + * @param type of the registry + * @return the corresponding registry or null if not present ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} ++ * with keys from {@link io.papermc.paper.registry.RegistryKey} + */ + @Nullable ++ @Deprecated(since = "1.20.6") // Paper + Registry getRegistry(@NotNull Class tClass); + + /** +diff --git a/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f5ece852f97017f71bc129e194cb212979b2537b +--- /dev/null ++++ b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.registry; ++ ++import org.bukkit.Keyed; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public class TestRegistryAccess implements RegistryAccess { ++ ++ @Override ++ @Deprecated(since = "1.20.6", forRemoval = true) ++ public @Nullable Registry getRegistry(final @NotNull Class type) { ++ throw new UnsupportedOperationException("Not supported"); ++ } ++ ++ @Override ++ public @NotNull Registry getRegistry(final @NotNull RegistryKey registryKey) { ++ throw new UnsupportedOperationException("Not supported"); ++ } ++} +diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java +index b208150297a23c0b4acb79135416809718f5650e..f11c639f1dc3c5034678d80bde3127a2e81a4a93 100644 +--- a/src/test/java/org/bukkit/support/TestServer.java ++++ b/src/test/java/org/bukkit/support/TestServer.java +@@ -36,26 +36,11 @@ public final class TestServer { + + when(instance.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion()); + +- Map, Registry> registers = new HashMap<>(); +- when(instance.getRegistry(any())).then(invocationOnMock -> registers.computeIfAbsent(invocationOnMock.getArgument(0), aClass -> new Registry() { +- private final Map cache = new HashMap<>(); +- +- @Override +- public Keyed get(NamespacedKey key) { +- return cache.computeIfAbsent(key, key2 -> mock(aClass, withSettings().stubOnly())); +- } +- +- @NotNull +- @Override +- public Stream stream() { +- throw new UnsupportedOperationException("Not supported"); +- } +- +- @Override +- public Iterator iterator() { +- throw new UnsupportedOperationException("Not supported"); +- } +- })); ++ // Paper start - RegistryAccess ++ when(instance.getRegistry(any())).then(invocationOnMock -> { ++ return io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(((Class)invocationOnMock.getArgument(0))); ++ }); ++ // Paper end - RegistryAccess + + UnsafeValues unsafeValues = mock(withSettings().stubOnly()); + when(instance.getUnsafe()).thenReturn(unsafeValues); +diff --git a/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess +new file mode 100644 +index 0000000000000000000000000000000000000000..f0a5e6d6b99aeef349fe465080ef2ff7b58617a6 +--- /dev/null ++++ b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess +@@ -0,0 +1 @@ ++io.papermc.paper.registry.TestRegistryAccess diff --git a/patches/api/0242-Add-sendOpLevel-API.patch b/patches/api/0242-Add-sendOpLevel-API.patch deleted file mode 100644 index c6d0eae4c3..0000000000 --- a/patches/api/0242-Add-sendOpLevel-API.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Tue, 29 Dec 2020 15:02:57 +0100 -Subject: [PATCH] Add sendOpLevel API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 28a811be93b29f105dad1db91a8adccbdf9fcaf7..752b2bac47588c0f75a13a7e6ec2be3c2f5a149e 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3308,6 +3308,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - } - // Paper end - elytra boost API - -+ // Paper start - sendOpLevel API -+ /** -+ * Send a packet to the player indicating its operator status level. -+ *

-+ * Note: This will not persist across more than the current connection, and setting the player's operator -+ * status as a later point will override the effects of this. -+ * -+ * @param level The level to send to the player. Must be in {@code [0, 4]}. -+ * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}). -+ */ -+ void sendOpLevel(byte level); -+ // Paper end - sendOpLevel API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch b/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch deleted file mode 100644 index 17ce5cc911..0000000000 --- a/patches/api/0243-Add-RegistryAccess-for-managing-registries.patch +++ /dev/null @@ -1,394 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 2 Mar 2022 13:36:21 -0800 -Subject: [PATCH] Add RegistryAccess for managing registries - - -diff --git a/src/main/java/io/papermc/paper/registry/Reference.java b/src/main/java/io/papermc/paper/registry/Reference.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d8656772e0c983df7c40ddc367a73ce473348339 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/Reference.java -@@ -0,0 +1,47 @@ -+package io.papermc.paper.registry; -+ -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Registry; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Represents a reference to a server-backed registry value that may -+ * change. -+ * -+ * @param type of the value -+ */ -+@Deprecated(forRemoval = true, since = "1.20.6") -+public interface Reference extends Keyed { -+ -+ /** -+ * Gets the value from the registry with the key. -+ * -+ * @return the value -+ * @throws java.util.NoSuchElementException if there is no value with this key -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ @NotNull T value(); -+ -+ /** -+ * Gets the value from the registry with the key. -+ * -+ * @return the value or null if it doesn't exist -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ @Nullable T valueOrNull(); -+ -+ /** -+ * Creates a reference to a registered value. -+ * -+ * @param registry the registry the value is located in -+ * @param key the key to the value -+ * @param the type of the value -+ * @return a reference -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.6") -+ static @NotNull Reference create(@NotNull Registry registry, @NotNull NamespacedKey key) { -+ return new ReferenceImpl<>(registry, key); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/registry/ReferenceImpl.java b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6083b5982 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java -@@ -0,0 +1,31 @@ -+package io.papermc.paper.registry; -+ -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Registry; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.util.NoSuchElementException; -+ -+record ReferenceImpl(@NotNull Registry registry, @NotNull NamespacedKey key) implements Reference { -+ -+ @Override -+ public @NotNull T value() { -+ final T value = this.registry.get(this.key); -+ if (value == null) { -+ throw new NoSuchElementException("No such value with key " + this.key); -+ } -+ return value; -+ } -+ -+ @Override -+ public @Nullable T valueOrNull() { -+ return this.registry.get(this.key); -+ } -+ -+ @Override -+ public @NotNull NamespacedKey getKey() { -+ return this.key; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/registry/RegistryAccess.java b/src/main/java/io/papermc/paper/registry/RegistryAccess.java -new file mode 100644 -index 0000000000000000000000000000000000000000..86ab67ff5023bf6adea80b02648b6f67476e30e5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/RegistryAccess.java -@@ -0,0 +1,49 @@ -+package io.papermc.paper.registry; -+ -+import org.bukkit.Keyed; -+import org.bukkit.Registry; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Used for accessing different {@link Registry} instances -+ * by a {@link RegistryKey}. Get the main instance of {@link RegistryAccess} -+ * with {@link RegistryAccess#registryAccess()}. -+ */ -+@ApiStatus.NonExtendable -+public interface RegistryAccess { -+ -+ /** -+ * Get the {@link RegistryAccess} instance for the server. -+ * -+ * @return the RegistryAccess instance -+ */ -+ static @NotNull RegistryAccess registryAccess() { -+ return RegistryAccessHolder.INSTANCE.orElseThrow(() -> new IllegalStateException("No RegistryAccess implementation found")); -+ } -+ -+ /** -+ * Gets the registry based on the type. -+ * -+ * @param type the type -+ * @return the registry or null if none found -+ * @param the type -+ * @deprecated use {@link #getRegistry(RegistryKey)} with keys from {@link RegistryKey} -+ */ -+ @Deprecated(since = "1.20.6", forRemoval = true) -+ @Nullable Registry getRegistry(@NotNull Class type); -+ -+ /** -+ * Gets the registry with the specified key. -+ * -+ * @param registryKey the key -+ * @return the registry -+ * @param the type -+ * @throws java.util.NoSuchElementException if no registry with the key is found -+ * @throws IllegalArgumentException if the registry is not available yet -+ */ -+ // Future note: We should have no trouble removing this generic qualifier when -+ // registry types no longer have to be "keyed" as it shouldn't break ABI or API. -+ @NotNull Registry getRegistry(@NotNull RegistryKey registryKey); -+} -diff --git a/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..b89e19c070f97c9662f1e16309446494b30aa7c9 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/registry/RegistryAccessHolder.java -@@ -0,0 +1,12 @@ -+package io.papermc.paper.registry; -+ -+import java.util.Optional; -+import java.util.ServiceLoader; -+ -+final class RegistryAccessHolder { -+ -+ static final Optional INSTANCE = ServiceLoader.load(RegistryAccess.class).findFirst(); -+ -+ private RegistryAccessHolder() { -+ } -+} -diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java -index 791813220b2504214b1adecc69093cd600fb0f8c..47fe5b0d5d031110c27210a0a256c260b35d9ba1 100644 ---- a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java -+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java -@@ -10,6 +10,17 @@ record RegistryKeyImpl(@NotNull Key key) implements RegistryKey { - - static final Set> REGISTRY_KEYS = Sets.newIdentityHashSet(); - -+ // override equals and hashCode to this can be used to simulate an "identity" hashmap -+ @Override -+ public boolean equals(final Object obj) { -+ return obj == this; -+ } -+ -+ @Override -+ public int hashCode() { -+ return System.identityHashCode(this); -+ } -+ - static RegistryKey create(@Subst("some_key") final String key) { - final RegistryKey registryKey = createInternal(key); - REGISTRY_KEYS.add(registryKey); -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 732ed3724e784ad659cb4411dbd73b42a8330a2c..7be6710d28dea19bd0f9054c1c2e32dacd355c45 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2398,8 +2398,11 @@ public final class Bukkit { - * @param tClass of the registry to get - * @param type of the registry - * @return the corresponding registry or null if not present -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} -+ * with keys from {@link io.papermc.paper.registry.RegistryKey} - */ - @Nullable -+ @Deprecated(since = "1.20.6") - public static Registry getRegistry(@NotNull Class tClass) { - return server.getRegistry(tClass); - } -diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index a04d279561676e825905f5512c399d14a3d8f828..91117cad12eee0bdaac8e0398a0f7f288ba27a40 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -129,7 +129,7 @@ public interface Registry extends Iterable { - * - * @see Enchantment - */ -- Registry ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); -+ Registry ENCHANTMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENCHANTMENT); // Paper - /** - * Server entity types. - * -@@ -141,7 +141,7 @@ public interface Registry extends Iterable { - * - * @see MusicInstrument - */ -- Registry INSTRUMENT = Objects.requireNonNull(Bukkit.getRegistry(MusicInstrument.class), "No registry present for MusicInstrument. This is a bug."); -+ Registry INSTRUMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.INSTRUMENT); // Paper - /** - * Default server loot tables. - * -@@ -159,7 +159,7 @@ public interface Registry extends Iterable { - * - * @see PotionEffectType - */ -- Registry EFFECT = Objects.requireNonNull(Bukkit.getRegistry(PotionEffectType.class), "No registry present for PotionEffectType. This is a bug."); -+ Registry EFFECT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.MOB_EFFECT); // Paper - /** - * Server particles. - * -@@ -182,14 +182,16 @@ public interface Registry extends Iterable { - * Server structures. - * - * @see Structure -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE} - */ -- Registry STRUCTURE = Bukkit.getRegistry(Structure.class); -+ @Deprecated(since = "1.20.6") // Paper -+ Registry STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Structure.class), "No registry present for Structure. This is a bug."); // Paper - /** - * Server structure types. - * - * @see StructureType - */ -- Registry STRUCTURE_TYPE = Bukkit.getRegistry(StructureType.class); -+ Registry STRUCTURE_TYPE = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.STRUCTURE_TYPE); // Paper - /** - * Sound keys. - * -@@ -200,21 +202,26 @@ public interface Registry extends Iterable { - * Trim materials. - * - * @see TrimMaterial -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL} - */ -- Registry TRIM_MATERIAL = Bukkit.getRegistry(TrimMaterial.class); -+ @Deprecated(since = "1.20.6") // Paper -+ Registry TRIM_MATERIAL = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimMaterial.class), "No registry present for TrimMaterial. This is a bug."); // Paper - /** - * Trim patterns. - * - * @see TrimPattern -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN} - */ -- Registry TRIM_PATTERN = Bukkit.getRegistry(TrimPattern.class); -+ @Deprecated(since = "1.20.6") -+ Registry TRIM_PATTERN = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(TrimPattern.class), "No registry present for TrimPattern. This is a bug."); // Paper - /** - * Damage types. - * - * @see DamageType -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#DAMAGE_TYPE} - */ -- @ApiStatus.Experimental -- Registry DAMAGE_TYPE = Objects.requireNonNull(Bukkit.getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); -+ @Deprecated(since = "1.20.6") -+ Registry DAMAGE_TYPE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(DamageType.class), "No registry present for DamageType. This is a bug."); // Paper - /** - * Villager profession. - * -@@ -268,8 +275,10 @@ public interface Registry extends Iterable { - * Wolf variants. - * - * @see Wolf.Variant -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#WOLF_VARIANT} - */ -- Registry WOLF_VARIANT = Objects.requireNonNull(Bukkit.getRegistry(Wolf.Variant.class), "No registry present for Wolf Variant. This is a bug."); -+ @Deprecated(since = "1.20.6") -+ Registry WOLF_VARIANT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Wolf.Variant.class), "No registry present for Wolf$Variant. This is a bug."); // Paper - /** - * Map cursor types. - * -@@ -282,7 +291,7 @@ public interface Registry extends Iterable { - * - * @see GameEvent - */ -- Registry GAME_EVENT = Objects.requireNonNull(Bukkit.getRegistry(GameEvent.class), "No registry present for GameEvent. This is a bug."); -+ Registry GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper - /** - * Get the object by its key. - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 395f7910f535bfd33a5676b011ab62a53e30e140..5644af8154373923791e3ed5f8b01c3f5d357b9c 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2046,8 +2046,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - * @param tClass of the registry to get - * @param type of the registry - * @return the corresponding registry or null if not present -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} -+ * with keys from {@link io.papermc.paper.registry.RegistryKey} - */ - @Nullable -+ @Deprecated(since = "1.20.6") // Paper - Registry getRegistry(@NotNull Class tClass); - - /** -diff --git a/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f5ece852f97017f71bc129e194cb212979b2537b ---- /dev/null -+++ b/src/test/java/io/papermc/paper/registry/TestRegistryAccess.java -@@ -0,0 +1,20 @@ -+package io.papermc.paper.registry; -+ -+import org.bukkit.Keyed; -+import org.bukkit.Registry; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+public class TestRegistryAccess implements RegistryAccess { -+ -+ @Override -+ @Deprecated(since = "1.20.6", forRemoval = true) -+ public @Nullable Registry getRegistry(final @NotNull Class type) { -+ throw new UnsupportedOperationException("Not supported"); -+ } -+ -+ @Override -+ public @NotNull Registry getRegistry(final @NotNull RegistryKey registryKey) { -+ throw new UnsupportedOperationException("Not supported"); -+ } -+} -diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java -index b208150297a23c0b4acb79135416809718f5650e..f11c639f1dc3c5034678d80bde3127a2e81a4a93 100644 ---- a/src/test/java/org/bukkit/support/TestServer.java -+++ b/src/test/java/org/bukkit/support/TestServer.java -@@ -36,26 +36,11 @@ public final class TestServer { - - when(instance.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion()); - -- Map, Registry> registers = new HashMap<>(); -- when(instance.getRegistry(any())).then(invocationOnMock -> registers.computeIfAbsent(invocationOnMock.getArgument(0), aClass -> new Registry() { -- private final Map cache = new HashMap<>(); -- -- @Override -- public Keyed get(NamespacedKey key) { -- return cache.computeIfAbsent(key, key2 -> mock(aClass, withSettings().stubOnly())); -- } -- -- @NotNull -- @Override -- public Stream stream() { -- throw new UnsupportedOperationException("Not supported"); -- } -- -- @Override -- public Iterator iterator() { -- throw new UnsupportedOperationException("Not supported"); -- } -- })); -+ // Paper start - RegistryAccess -+ when(instance.getRegistry(any())).then(invocationOnMock -> { -+ return io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(((Class)invocationOnMock.getArgument(0))); -+ }); -+ // Paper end - RegistryAccess - - UnsafeValues unsafeValues = mock(withSettings().stubOnly()); - when(instance.getUnsafe()).thenReturn(unsafeValues); -diff --git a/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess -new file mode 100644 -index 0000000000000000000000000000000000000000..f0a5e6d6b99aeef349fe465080ef2ff7b58617a6 ---- /dev/null -+++ b/src/test/resources/META-INF/services/io.papermc.paper.registry.RegistryAccess -@@ -0,0 +1 @@ -+io.papermc.paper.registry.TestRegistryAccess diff --git a/patches/api/0243-Add-StructuresLocateEvent.patch b/patches/api/0243-Add-StructuresLocateEvent.patch new file mode 100644 index 0000000000..10ef586cce --- /dev/null +++ b/patches/api/0243-Add-StructuresLocateEvent.patch @@ -0,0 +1,534 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dfsek +Date: Tue, 15 Sep 2020 21:59:16 -0700 +Subject: [PATCH] Add StructuresLocateEvent + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1ac3369455972aeb1ade5dc023d1f818cd3535fa +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java +@@ -0,0 +1,163 @@ ++package io.papermc.paper.event.world; ++ ++import org.bukkit.Location; ++import org.bukkit.StructureType; ++import org.bukkit.World; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.WorldEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called before a structure/feature is located. ++ * This happens when: ++ *

    ++ *
  • The /locate command is used.
  • ++ *
  • An Eye of Ender is used.
  • ++ *
  • An Explorer/Treasure Map is activated.
  • ++ *
  • {@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.
  • ++ *
++ * ++ * @deprecated no longer used, see {@link StructuresLocateEvent} ++ */ ++@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++public class StructureLocateEvent extends WorldEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Location origin; ++ private Location result = null; ++ private StructureType type; ++ private int radius; ++ private boolean findUnexplored; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) { ++ super(world); ++ this.origin = origin; ++ this.type = structureType; ++ this.radius = radius; ++ this.findUnexplored = findUnexplored; ++ } ++ ++ /** ++ * Gets the location set as the structure location, if it was defined. ++ *

++ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}. ++ * Since this event fires before the search is done, the actual location is unknown at this point. ++ * ++ * @return The result location, if it has been set. {@code null} if it has not. ++ * @see World#locateNearestStructure(Location, StructureType, int, boolean) ++ */ ++ @Nullable ++ public Location getResult() { ++ return this.result; ++ } ++ ++ /** ++ * Sets the result {@link Location}. This causes the search to be skipped, and the location passed here to be used as the result. ++ * ++ * @param result the {@link Location} of the structure. ++ */ ++ public void setResult(@Nullable Location result) { ++ this.result = result; ++ } ++ ++ /** ++ * Gets the {@link StructureType} that is to be located. ++ * ++ * @return the structure type. ++ */ ++ @NotNull ++ public StructureType getType() { ++ return this.type; ++ } ++ ++ /** ++ * Sets the {@link StructureType} that is to be located. ++ * ++ * @param type the structure type. ++ */ ++ public void setType(@NotNull StructureType type) { ++ this.type = type; ++ } ++ ++ /** ++ * Gets the {@link Location} from which the search is to be conducted. ++ * ++ * @return {@link Location} where search begins ++ */ ++ @NotNull ++ public Location getOrigin() { ++ return this.origin; ++ } ++ ++ /** ++ * Gets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @return the search radius. ++ */ ++ public int getRadius() { ++ return this.radius; ++ } ++ ++ /** ++ * Sets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @param radius the search radius. ++ */ ++ public void setRadius(int radius) { ++ this.radius = radius; ++ } ++ ++ /** ++ * Gets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @return Whether to search for only unexplored structures. ++ */ ++ public boolean shouldFindUnexplored() { ++ return this.findUnexplored; ++ } ++ ++ /** ++ * Sets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @param findUnexplored Whether to search for only unexplored structures. ++ */ ++ public void setFindUnexplored(boolean findUnexplored) { ++ this.findUnexplored = findUnexplored; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..582af444b058708638683e7d6f9b79685c04c061 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java +@@ -0,0 +1,213 @@ ++package io.papermc.paper.event.world; ++ ++import io.papermc.paper.math.Position; ++import io.papermc.paper.util.TransformingRandomAccessList; ++import io.papermc.paper.world.structure.ConfiguredStructure; ++import java.util.Collections; ++import java.util.List; ++import java.util.Objects; ++import org.bukkit.Location; ++import org.bukkit.World; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.WorldEvent; ++import org.bukkit.generator.structure.Structure; ++import org.bukkit.generator.structure.StructureType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++import org.jetbrains.annotations.UnmodifiableView; ++ ++/** ++ * Called before a set of configured structures is located. ++ * This happens when: ++ *

    ++ *
  • The /locate command is used.
  • ++ *
  • An Eye of Ender is used.
  • ++ *
  • An Explorer/Treasure Map is activated.
  • ++ *
  • A dolphin swims to a treasure location.
  • ++ *
  • A trade is done with a villager for a map.
  • ++ *
  • {@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.
  • ++ *
  • {@link World#locateNearestStructure(Location, Structure, int, boolean)} is invoked.
  • ++ *
++ */ ++public class StructuresLocateEvent extends WorldEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Location origin; ++ private Result result; ++ private List structures; ++ private List legacy$structures; ++ private int radius; ++ private boolean findUnexplored; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public StructuresLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull List structures, int radius, boolean findUnexplored) { ++ super(world); ++ this.origin = origin; ++ this.setStructures(structures); ++ this.radius = radius; ++ this.findUnexplored = findUnexplored; ++ } ++ ++ /** ++ * Gets the {@link Location} from which the search is to be conducted. ++ * ++ * @return {@link Location} where search begins ++ */ ++ public @NotNull Location getOrigin() { ++ return this.origin.clone(); ++ } ++ ++ /** ++ * Gets the {@link Location} and {@link Structure} set as the result, if it was defined. ++ *

++ * Returns {@code null} if it has not been set by {@link StructuresLocateEvent#setResult(Result)}. ++ * Since this event fires before the search is done, the actual result is unknown at this point. ++ * ++ * @return The result location and structure, if it has been set. {@code null} if it has not. ++ * @see World#locateNearestStructure(Location, StructureType, int, boolean) ++ */ ++ public @Nullable Result getResult() { ++ return this.result; ++ } ++ ++ /** ++ * Sets the result {@link Location} and {@link Structure}. This causes the search to be ++ * skipped, and the result object passed here to be used as the result. ++ * ++ * @param result the {@link Location} and {@link Structure} of the search. ++ */ ++ public void setResult(@Nullable Result result) { ++ this.result = result; ++ } ++ ++ /** ++ * Gets a mutable list of ConfiguredStructures that are valid targets for the search. ++ * ++ * @return a mutable list of ConfiguredStructures ++ * @deprecated use {@link #getStructures()} ++ */ ++ @Deprecated(forRemoval = true) ++ public @NotNull List getConfiguredStructures() { ++ return this.legacy$structures; ++ } ++ ++ /** ++ * Sets the list of ConfiguredStructures that are valid targets for the search. ++ * ++ * @param configuredStructures a list of ConfiguredStructure targets ++ * @deprecated use {@link #setStructures(List)} ++ */ ++ @Deprecated(forRemoval = true) ++ public void setConfiguredStructures(@NotNull List configuredStructures) { ++ this.setStructures(configuredStructures.stream().map(ConfiguredStructure::toModern).toList()); ++ } ++ ++ /** ++ * Gets an unmodifiable list of Structures that are valid targets for the search. ++ * ++ * @return an unmodifiable list of Structures ++ */ ++ public @NotNull @UnmodifiableView List getStructures() { ++ return Collections.unmodifiableList(this.structures); ++ } ++ ++ /** ++ * Sets the list of Structures that are valid targets for the search. ++ * ++ * @param structures a list of Structures targets ++ */ ++ public void setStructures(final @NotNull List structures) { ++ this.structures = structures; ++ this.legacy$structures = new TransformingRandomAccessList<>(this.structures, ConfiguredStructure::fromModern, ConfiguredStructure::toModern); ++ } ++ ++ /** ++ * Gets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @return the search radius (in chunks) ++ */ ++ public int getRadius() { ++ return this.radius; ++ } ++ ++ /** ++ * Sets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @param radius the search radius (in chunks) ++ */ ++ public void setRadius(int radius) { ++ this.radius = radius; ++ } ++ ++ /** ++ * Gets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @return Whether to search for only unexplored structures. ++ */ ++ public boolean shouldFindUnexplored() { ++ return this.findUnexplored; ++ } ++ ++ /** ++ * Sets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @param findUnexplored Whether to search for only unexplored structures. ++ */ ++ public void setFindUnexplored(boolean findUnexplored) { ++ this.findUnexplored = findUnexplored; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ /** ++ * Result for {@link StructuresLocateEvent}. ++ */ ++ public record Result(@NotNull Position pos, @NotNull Structure structure) { ++ ++ @Deprecated(forRemoval = true) ++ public Result(final @NotNull Location position, @NotNull ConfiguredStructure configuredStructure) { ++ this(position, configuredStructure.toModern()); ++ } ++ ++ @Deprecated(forRemoval = true) ++ public @NotNull ConfiguredStructure configuredStructure() { ++ return Objects.requireNonNull(ConfiguredStructure.fromModern(this.structure), "Please use the newer Structure API"); ++ } ++ ++ @Deprecated(forRemoval = true) ++ public @NotNull Location position() { ++ //noinspection DataFlowIssue ++ return this.pos.toLocation(null); ++ } ++ } ++} +diff --git a/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f850496a0 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java +@@ -0,0 +1,113 @@ ++package io.papermc.paper.world.structure; ++ ++import io.papermc.paper.registry.Reference; ++import java.util.Objects; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.bukkit.StructureType; ++import org.bukkit.generator.structure.Structure; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Represents a configured structure each with a ++ * {@link StructureType}. Multiple ConfiguredStructures can have ++ * the same {@link StructureType}. ++ * @deprecated use {@link Structure} ++ */ ++@Deprecated(forRemoval = true) ++@ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++public final class ConfiguredStructure implements Keyed { ++ ++ public static final Reference PILLAGER_OUTPOST = create("pillager_outpost"); ++ public static final Reference MINESHAFT = create("mineshaft"); ++ public static final Reference MINESHAFT_MESA = create("mineshaft_mesa"); ++ public static final Reference WOODLAND_MANSION = create("mansion"); ++ public static final Reference JUNGLE_TEMPLE = create("jungle_pyramid"); ++ public static final Reference DESERT_PYRAMID = create("desert_pyramid"); ++ public static final Reference IGLOO = create("igloo"); ++ public static final Reference SHIPWRECK = create("shipwreck"); ++ public static final Reference SHIPWRECK_BEACHED = create("shipwreck_beached"); ++ public static final Reference SWAMP_HUT = create("swamp_hut"); ++ public static final Reference STRONGHOLD = create("stronghold"); ++ public static final Reference OCEAN_MONUMENT = create("monument"); ++ public static final Reference OCEAN_RUIN_COLD = create("ocean_ruin_cold"); ++ public static final Reference OCEAN_RUIN_WARM = create("ocean_ruin_warm"); ++ public static final Reference FORTRESS = create("fortress"); ++ public static final Reference NETHER_FOSSIL = create("nether_fossil"); ++ public static final Reference END_CITY = create("end_city"); ++ public static final Reference BURIED_TREASURE = create("buried_treasure"); ++ public static final Reference BASTION_REMNANT = create("bastion_remnant"); ++ public static final Reference VILLAGE_PLAINS = create("village_plains"); ++ public static final Reference VILLAGE_DESERT = create("village_desert"); ++ public static final Reference VILLAGE_SAVANNA = create("village_savanna"); ++ public static final Reference VILLAGE_SNOWY = create("village_snowy"); ++ public static final Reference VILLAGE_TAIGA = create("village_taiga"); ++ public static final Reference RUINED_PORTAL_STANDARD = create("ruined_portal"); ++ public static final Reference RUINED_PORTAL_DESERT = create("ruined_portal_desert"); ++ public static final Reference RUINED_PORTAL_JUNGLE = create("ruined_portal_jungle"); ++ public static final Reference RUINED_PORTAL_SWAMP = create("ruined_portal_swamp"); ++ public static final Reference RUINED_PORTAL_MOUNTAIN = create("ruined_portal_mountain"); ++ public static final Reference RUINED_PORTAL_OCEAN = create("ruined_portal_ocean"); ++ public static final Reference RUINED_PORTAL_NETHER = create("ruined_portal_nether"); ++ // public static final Reference ANCIENT_CITY = create("ancient_city"); // TODO remove when upstream adds "jigsaw" StructureType ++ ++ private final NamespacedKey key; ++ private final StructureType structureType; ++ ++ ConfiguredStructure(@NotNull NamespacedKey key, @NotNull StructureType structureType) { ++ this.key = key; ++ this.structureType = structureType; ++ } ++ ++ @Override ++ public @NotNull NamespacedKey getKey() { ++ return this.key; ++ } ++ ++ /** ++ * Gets the structure type for this configure structure. ++ * ++ * @return the structure type ++ */ ++ public @NotNull StructureType getStructureType() { ++ return this.structureType; ++ } ++ ++ @Override ++ public boolean equals(Object o) { ++ if (this == o) return true; ++ if (o == null || getClass() != o.getClass()) return false; ++ ConfiguredStructure structure = (ConfiguredStructure) o; ++ return this.key.equals(structure.key) && this.structureType.equals(structure.structureType); ++ } ++ ++ @Override ++ public int hashCode() { ++ return Objects.hash(this.key, this.structureType); ++ } ++ ++ @Override ++ public String toString() { ++ return "ConfiguredStructure{" + ++ "key=" + this.key + ++ ", structureType=" + this.structureType + ++ '}'; ++ } ++ ++ private static @NotNull Reference create(@NotNull String name) { ++ return Reference.create(Registry.CONFIGURED_STRUCTURE, NamespacedKey.minecraft(name)); ++ } ++ ++ @ApiStatus.Internal ++ public @NotNull Structure toModern() { ++ return Objects.requireNonNull(Registry.STRUCTURE.get(this.key)); ++ } ++ ++ @ApiStatus.Internal ++ public static @Nullable ConfiguredStructure fromModern(@NotNull Structure structure) { ++ return Registry.CONFIGURED_STRUCTURE.get(structure.getKey()); ++ } ++} +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index 91117cad12eee0bdaac8e0398a0f7f288ba27a40..43f410326d6d68242113e2fefe31af256889ed9c 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -292,6 +292,15 @@ public interface Registry extends Iterable { + * @see GameEvent + */ + Registry GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper ++ // Paper start ++ /** ++ * Configured structures. ++ * @see io.papermc.paper.world.structure.ConfiguredStructure ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE} ++ */ ++ @Deprecated(forRemoval = true) ++ Registry CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug."); ++ // Paper end + /** + * Get the object by its key. + * diff --git a/patches/api/0244-Add-BlockPreDispenseEvent.patch b/patches/api/0244-Add-BlockPreDispenseEvent.patch new file mode 100644 index 0000000000..6a8e491828 --- /dev/null +++ b/patches/api/0244-Add-BlockPreDispenseEvent.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Madeline Miller +Date: Sun, 17 Jan 2021 13:15:54 +1000 +Subject: [PATCH] Add BlockPreDispenseEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..62547d5853e7355a805fa1e7f1e5f56d06fca4ba +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java +@@ -0,0 +1,65 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++public class BlockPreDispenseEvent extends BlockEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final ItemStack itemStack; ++ private final int slot; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public BlockPreDispenseEvent(@NotNull Block block, @NotNull ItemStack itemStack, int slot) { ++ super(block); ++ this.itemStack = itemStack; ++ this.slot = slot; ++ } ++ ++ /** ++ * Gets the {@link ItemStack} to be dispensed. ++ * ++ * @return The item to be dispensed ++ */ ++ @NotNull ++ public ItemStack getItemStack() { ++ return this.itemStack; ++ } ++ ++ /** ++ * Gets the inventory slot of the dispenser to dispense from. ++ * ++ * @return The inventory slot ++ */ ++ public int getSlot() { ++ return this.slot; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0244-Add-StructuresLocateEvent.patch b/patches/api/0244-Add-StructuresLocateEvent.patch deleted file mode 100644 index 10ef586cce..0000000000 --- a/patches/api/0244-Add-StructuresLocateEvent.patch +++ /dev/null @@ -1,534 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dfsek -Date: Tue, 15 Sep 2020 21:59:16 -0700 -Subject: [PATCH] Add StructuresLocateEvent - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..1ac3369455972aeb1ade5dc023d1f818cd3535fa ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java -@@ -0,0 +1,163 @@ -+package io.papermc.paper.event.world; -+ -+import org.bukkit.Location; -+import org.bukkit.StructureType; -+import org.bukkit.World; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.WorldEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called before a structure/feature is located. -+ * This happens when: -+ *

    -+ *
  • The /locate command is used.
  • -+ *
  • An Eye of Ender is used.
  • -+ *
  • An Explorer/Treasure Map is activated.
  • -+ *
  • {@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.
  • -+ *
-+ * -+ * @deprecated no longer used, see {@link StructuresLocateEvent} -+ */ -+@Deprecated(forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+public class StructureLocateEvent extends WorldEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location origin; -+ private Location result = null; -+ private StructureType type; -+ private int radius; -+ private boolean findUnexplored; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) { -+ super(world); -+ this.origin = origin; -+ this.type = structureType; -+ this.radius = radius; -+ this.findUnexplored = findUnexplored; -+ } -+ -+ /** -+ * Gets the location set as the structure location, if it was defined. -+ *

-+ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}. -+ * Since this event fires before the search is done, the actual location is unknown at this point. -+ * -+ * @return The result location, if it has been set. {@code null} if it has not. -+ * @see World#locateNearestStructure(Location, StructureType, int, boolean) -+ */ -+ @Nullable -+ public Location getResult() { -+ return this.result; -+ } -+ -+ /** -+ * Sets the result {@link Location}. This causes the search to be skipped, and the location passed here to be used as the result. -+ * -+ * @param result the {@link Location} of the structure. -+ */ -+ public void setResult(@Nullable Location result) { -+ this.result = result; -+ } -+ -+ /** -+ * Gets the {@link StructureType} that is to be located. -+ * -+ * @return the structure type. -+ */ -+ @NotNull -+ public StructureType getType() { -+ return this.type; -+ } -+ -+ /** -+ * Sets the {@link StructureType} that is to be located. -+ * -+ * @param type the structure type. -+ */ -+ public void setType(@NotNull StructureType type) { -+ this.type = type; -+ } -+ -+ /** -+ * Gets the {@link Location} from which the search is to be conducted. -+ * -+ * @return {@link Location} where search begins -+ */ -+ @NotNull -+ public Location getOrigin() { -+ return this.origin; -+ } -+ -+ /** -+ * Gets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @return the search radius. -+ */ -+ public int getRadius() { -+ return this.radius; -+ } -+ -+ /** -+ * Sets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @param radius the search radius. -+ */ -+ public void setRadius(int radius) { -+ this.radius = radius; -+ } -+ -+ /** -+ * Gets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @return Whether to search for only unexplored structures. -+ */ -+ public boolean shouldFindUnexplored() { -+ return this.findUnexplored; -+ } -+ -+ /** -+ * Sets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @param findUnexplored Whether to search for only unexplored structures. -+ */ -+ public void setFindUnexplored(boolean findUnexplored) { -+ this.findUnexplored = findUnexplored; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..582af444b058708638683e7d6f9b79685c04c061 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java -@@ -0,0 +1,213 @@ -+package io.papermc.paper.event.world; -+ -+import io.papermc.paper.math.Position; -+import io.papermc.paper.util.TransformingRandomAccessList; -+import io.papermc.paper.world.structure.ConfiguredStructure; -+import java.util.Collections; -+import java.util.List; -+import java.util.Objects; -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.WorldEvent; -+import org.bukkit.generator.structure.Structure; -+import org.bukkit.generator.structure.StructureType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+import org.jetbrains.annotations.UnmodifiableView; -+ -+/** -+ * Called before a set of configured structures is located. -+ * This happens when: -+ *

    -+ *
  • The /locate command is used.
  • -+ *
  • An Eye of Ender is used.
  • -+ *
  • An Explorer/Treasure Map is activated.
  • -+ *
  • A dolphin swims to a treasure location.
  • -+ *
  • A trade is done with a villager for a map.
  • -+ *
  • {@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.
  • -+ *
  • {@link World#locateNearestStructure(Location, Structure, int, boolean)} is invoked.
  • -+ *
-+ */ -+public class StructuresLocateEvent extends WorldEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location origin; -+ private Result result; -+ private List structures; -+ private List legacy$structures; -+ private int radius; -+ private boolean findUnexplored; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public StructuresLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull List structures, int radius, boolean findUnexplored) { -+ super(world); -+ this.origin = origin; -+ this.setStructures(structures); -+ this.radius = radius; -+ this.findUnexplored = findUnexplored; -+ } -+ -+ /** -+ * Gets the {@link Location} from which the search is to be conducted. -+ * -+ * @return {@link Location} where search begins -+ */ -+ public @NotNull Location getOrigin() { -+ return this.origin.clone(); -+ } -+ -+ /** -+ * Gets the {@link Location} and {@link Structure} set as the result, if it was defined. -+ *

-+ * Returns {@code null} if it has not been set by {@link StructuresLocateEvent#setResult(Result)}. -+ * Since this event fires before the search is done, the actual result is unknown at this point. -+ * -+ * @return The result location and structure, if it has been set. {@code null} if it has not. -+ * @see World#locateNearestStructure(Location, StructureType, int, boolean) -+ */ -+ public @Nullable Result getResult() { -+ return this.result; -+ } -+ -+ /** -+ * Sets the result {@link Location} and {@link Structure}. This causes the search to be -+ * skipped, and the result object passed here to be used as the result. -+ * -+ * @param result the {@link Location} and {@link Structure} of the search. -+ */ -+ public void setResult(@Nullable Result result) { -+ this.result = result; -+ } -+ -+ /** -+ * Gets a mutable list of ConfiguredStructures that are valid targets for the search. -+ * -+ * @return a mutable list of ConfiguredStructures -+ * @deprecated use {@link #getStructures()} -+ */ -+ @Deprecated(forRemoval = true) -+ public @NotNull List getConfiguredStructures() { -+ return this.legacy$structures; -+ } -+ -+ /** -+ * Sets the list of ConfiguredStructures that are valid targets for the search. -+ * -+ * @param configuredStructures a list of ConfiguredStructure targets -+ * @deprecated use {@link #setStructures(List)} -+ */ -+ @Deprecated(forRemoval = true) -+ public void setConfiguredStructures(@NotNull List configuredStructures) { -+ this.setStructures(configuredStructures.stream().map(ConfiguredStructure::toModern).toList()); -+ } -+ -+ /** -+ * Gets an unmodifiable list of Structures that are valid targets for the search. -+ * -+ * @return an unmodifiable list of Structures -+ */ -+ public @NotNull @UnmodifiableView List getStructures() { -+ return Collections.unmodifiableList(this.structures); -+ } -+ -+ /** -+ * Sets the list of Structures that are valid targets for the search. -+ * -+ * @param structures a list of Structures targets -+ */ -+ public void setStructures(final @NotNull List structures) { -+ this.structures = structures; -+ this.legacy$structures = new TransformingRandomAccessList<>(this.structures, ConfiguredStructure::fromModern, ConfiguredStructure::toModern); -+ } -+ -+ /** -+ * Gets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @return the search radius (in chunks) -+ */ -+ public int getRadius() { -+ return this.radius; -+ } -+ -+ /** -+ * Sets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @param radius the search radius (in chunks) -+ */ -+ public void setRadius(int radius) { -+ this.radius = radius; -+ } -+ -+ /** -+ * Gets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @return Whether to search for only unexplored structures. -+ */ -+ public boolean shouldFindUnexplored() { -+ return this.findUnexplored; -+ } -+ -+ /** -+ * Sets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @param findUnexplored Whether to search for only unexplored structures. -+ */ -+ public void setFindUnexplored(boolean findUnexplored) { -+ this.findUnexplored = findUnexplored; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * Result for {@link StructuresLocateEvent}. -+ */ -+ public record Result(@NotNull Position pos, @NotNull Structure structure) { -+ -+ @Deprecated(forRemoval = true) -+ public Result(final @NotNull Location position, @NotNull ConfiguredStructure configuredStructure) { -+ this(position, configuredStructure.toModern()); -+ } -+ -+ @Deprecated(forRemoval = true) -+ public @NotNull ConfiguredStructure configuredStructure() { -+ return Objects.requireNonNull(ConfiguredStructure.fromModern(this.structure), "Please use the newer Structure API"); -+ } -+ -+ @Deprecated(forRemoval = true) -+ public @NotNull Location position() { -+ //noinspection DataFlowIssue -+ return this.pos.toLocation(null); -+ } -+ } -+} -diff --git a/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java -new file mode 100644 -index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f850496a0 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java -@@ -0,0 +1,113 @@ -+package io.papermc.paper.world.structure; -+ -+import io.papermc.paper.registry.Reference; -+import java.util.Objects; -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.Registry; -+import org.bukkit.StructureType; -+import org.bukkit.generator.structure.Structure; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Represents a configured structure each with a -+ * {@link StructureType}. Multiple ConfiguredStructures can have -+ * the same {@link StructureType}. -+ * @deprecated use {@link Structure} -+ */ -+@Deprecated(forRemoval = true) -+@ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+public final class ConfiguredStructure implements Keyed { -+ -+ public static final Reference PILLAGER_OUTPOST = create("pillager_outpost"); -+ public static final Reference MINESHAFT = create("mineshaft"); -+ public static final Reference MINESHAFT_MESA = create("mineshaft_mesa"); -+ public static final Reference WOODLAND_MANSION = create("mansion"); -+ public static final Reference JUNGLE_TEMPLE = create("jungle_pyramid"); -+ public static final Reference DESERT_PYRAMID = create("desert_pyramid"); -+ public static final Reference IGLOO = create("igloo"); -+ public static final Reference SHIPWRECK = create("shipwreck"); -+ public static final Reference SHIPWRECK_BEACHED = create("shipwreck_beached"); -+ public static final Reference SWAMP_HUT = create("swamp_hut"); -+ public static final Reference STRONGHOLD = create("stronghold"); -+ public static final Reference OCEAN_MONUMENT = create("monument"); -+ public static final Reference OCEAN_RUIN_COLD = create("ocean_ruin_cold"); -+ public static final Reference OCEAN_RUIN_WARM = create("ocean_ruin_warm"); -+ public static final Reference FORTRESS = create("fortress"); -+ public static final Reference NETHER_FOSSIL = create("nether_fossil"); -+ public static final Reference END_CITY = create("end_city"); -+ public static final Reference BURIED_TREASURE = create("buried_treasure"); -+ public static final Reference BASTION_REMNANT = create("bastion_remnant"); -+ public static final Reference VILLAGE_PLAINS = create("village_plains"); -+ public static final Reference VILLAGE_DESERT = create("village_desert"); -+ public static final Reference VILLAGE_SAVANNA = create("village_savanna"); -+ public static final Reference VILLAGE_SNOWY = create("village_snowy"); -+ public static final Reference VILLAGE_TAIGA = create("village_taiga"); -+ public static final Reference RUINED_PORTAL_STANDARD = create("ruined_portal"); -+ public static final Reference RUINED_PORTAL_DESERT = create("ruined_portal_desert"); -+ public static final Reference RUINED_PORTAL_JUNGLE = create("ruined_portal_jungle"); -+ public static final Reference RUINED_PORTAL_SWAMP = create("ruined_portal_swamp"); -+ public static final Reference RUINED_PORTAL_MOUNTAIN = create("ruined_portal_mountain"); -+ public static final Reference RUINED_PORTAL_OCEAN = create("ruined_portal_ocean"); -+ public static final Reference RUINED_PORTAL_NETHER = create("ruined_portal_nether"); -+ // public static final Reference ANCIENT_CITY = create("ancient_city"); // TODO remove when upstream adds "jigsaw" StructureType -+ -+ private final NamespacedKey key; -+ private final StructureType structureType; -+ -+ ConfiguredStructure(@NotNull NamespacedKey key, @NotNull StructureType structureType) { -+ this.key = key; -+ this.structureType = structureType; -+ } -+ -+ @Override -+ public @NotNull NamespacedKey getKey() { -+ return this.key; -+ } -+ -+ /** -+ * Gets the structure type for this configure structure. -+ * -+ * @return the structure type -+ */ -+ public @NotNull StructureType getStructureType() { -+ return this.structureType; -+ } -+ -+ @Override -+ public boolean equals(Object o) { -+ if (this == o) return true; -+ if (o == null || getClass() != o.getClass()) return false; -+ ConfiguredStructure structure = (ConfiguredStructure) o; -+ return this.key.equals(structure.key) && this.structureType.equals(structure.structureType); -+ } -+ -+ @Override -+ public int hashCode() { -+ return Objects.hash(this.key, this.structureType); -+ } -+ -+ @Override -+ public String toString() { -+ return "ConfiguredStructure{" + -+ "key=" + this.key + -+ ", structureType=" + this.structureType + -+ '}'; -+ } -+ -+ private static @NotNull Reference create(@NotNull String name) { -+ return Reference.create(Registry.CONFIGURED_STRUCTURE, NamespacedKey.minecraft(name)); -+ } -+ -+ @ApiStatus.Internal -+ public @NotNull Structure toModern() { -+ return Objects.requireNonNull(Registry.STRUCTURE.get(this.key)); -+ } -+ -+ @ApiStatus.Internal -+ public static @Nullable ConfiguredStructure fromModern(@NotNull Structure structure) { -+ return Registry.CONFIGURED_STRUCTURE.get(structure.getKey()); -+ } -+} -diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 91117cad12eee0bdaac8e0398a0f7f288ba27a40..43f410326d6d68242113e2fefe31af256889ed9c 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -292,6 +292,15 @@ public interface Registry extends Iterable { - * @see GameEvent - */ - Registry GAME_EVENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.GAME_EVENT); // Paper -+ // Paper start -+ /** -+ * Configured structures. -+ * @see io.papermc.paper.world.structure.ConfiguredStructure -+ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#STRUCTURE} -+ */ -+ @Deprecated(forRemoval = true) -+ Registry CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug."); -+ // Paper end - /** - * Get the object by its key. - * diff --git a/patches/api/0245-Add-BlockPreDispenseEvent.patch b/patches/api/0245-Add-BlockPreDispenseEvent.patch deleted file mode 100644 index 6a8e491828..0000000000 --- a/patches/api/0245-Add-BlockPreDispenseEvent.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Sun, 17 Jan 2021 13:15:54 +1000 -Subject: [PATCH] Add BlockPreDispenseEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..62547d5853e7355a805fa1e7f1e5f56d06fca4ba ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java -@@ -0,0 +1,65 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+public class BlockPreDispenseEvent extends BlockEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack itemStack; -+ private final int slot; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public BlockPreDispenseEvent(@NotNull Block block, @NotNull ItemStack itemStack, int slot) { -+ super(block); -+ this.itemStack = itemStack; -+ this.slot = slot; -+ } -+ -+ /** -+ * Gets the {@link ItemStack} to be dispensed. -+ * -+ * @return The item to be dispensed -+ */ -+ @NotNull -+ public ItemStack getItemStack() { -+ return this.itemStack; -+ } -+ -+ /** -+ * Gets the inventory slot of the dispenser to dispense from. -+ * -+ * @return The inventory slot -+ */ -+ public int getSlot() { -+ return this.slot; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0245-Added-PlayerChangeBeaconEffectEvent.patch b/patches/api/0245-Added-PlayerChangeBeaconEffectEvent.patch new file mode 100644 index 0000000000..4d84c9e1b1 --- /dev/null +++ b/patches/api/0245-Added-PlayerChangeBeaconEffectEvent.patch @@ -0,0 +1,149 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 24 Jun 2020 15:12:18 -0600 +Subject: [PATCH] Added PlayerChangeBeaconEffectEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6f4c2c4ff +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java +@@ -0,0 +1,137 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when a player sets the effect for a beacon ++ */ ++public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Block beacon; ++ private PotionEffectType primary; ++ private PotionEffectType secondary; ++ private boolean consumeItem = true; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @NotNull Block beacon) { ++ super(player); ++ this.primary = primary; ++ this.secondary = secondary; ++ this.beacon = beacon; ++ } ++ ++ /** ++ * @return the primary effect ++ */ ++ @Nullable public PotionEffectType getPrimary() { ++ return this.primary; ++ } ++ ++ /** ++ * Sets the primary effect ++ *

++ * NOTE: The primary effect still has to be one of the valid effects for a beacon. ++ * ++ * @param primary the primary effect ++ */ ++ public void setPrimary(@Nullable PotionEffectType primary) { ++ this.primary = primary; ++ } ++ ++ /** ++ * @return the secondary effect ++ */ ++ @Nullable public PotionEffectType getSecondary() { ++ return this.secondary; ++ } ++ ++ /** ++ * Sets the secondary effect ++ *

++ * This only has an effect when the beacon is able to accept a secondary effect. ++ * NOTE: The secondary effect still has to be a valid effect for a beacon. ++ * ++ * @param secondary the secondary effect ++ */ ++ public void setSecondary(@Nullable PotionEffectType secondary) { ++ this.secondary = secondary; ++ } ++ ++ /** ++ * @return the beacon block associated with this event ++ */ ++ @NotNull ++ public Block getBeacon() { ++ return this.beacon; ++ } ++ ++ /** ++ * Gets if the item used to change the beacon will be consumed. ++ *

++ * Independent of {@link #isCancelled()}. If the event is cancelled ++ * the item will NOT be consumed. ++ * ++ * @return {@code true} if item will be consumed ++ */ ++ public boolean willConsumeItem() { ++ return this.consumeItem; ++ } ++ ++ /** ++ * Sets if the item used to change the beacon should be consumed. ++ *

++ * Independent of {@link #isCancelled()}. If the event is cancelled ++ * the item will NOT be consumed. ++ * ++ * @param consumeItem {@code true} if item should be consumed ++ */ ++ public void setConsumeItem(boolean consumeItem) { ++ this.consumeItem = consumeItem; ++ } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will ++ * not take effect ++ */ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * If cancelled, the item will NOT be consumed regardless of what {@link #willConsumeItem()} says ++ *

++ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will not be applied ++ * or saved. ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0246-Added-PlayerChangeBeaconEffectEvent.patch b/patches/api/0246-Added-PlayerChangeBeaconEffectEvent.patch deleted file mode 100644 index 4d84c9e1b1..0000000000 --- a/patches/api/0246-Added-PlayerChangeBeaconEffectEvent.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 24 Jun 2020 15:12:18 -0600 -Subject: [PATCH] Added PlayerChangeBeaconEffectEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..1cc5dfb6d31f312f07acb1d5fb4719d6f4c2c4ff ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java -@@ -0,0 +1,137 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when a player sets the effect for a beacon -+ */ -+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block beacon; -+ private PotionEffectType primary; -+ private PotionEffectType secondary; -+ private boolean consumeItem = true; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @NotNull Block beacon) { -+ super(player); -+ this.primary = primary; -+ this.secondary = secondary; -+ this.beacon = beacon; -+ } -+ -+ /** -+ * @return the primary effect -+ */ -+ @Nullable public PotionEffectType getPrimary() { -+ return this.primary; -+ } -+ -+ /** -+ * Sets the primary effect -+ *

-+ * NOTE: The primary effect still has to be one of the valid effects for a beacon. -+ * -+ * @param primary the primary effect -+ */ -+ public void setPrimary(@Nullable PotionEffectType primary) { -+ this.primary = primary; -+ } -+ -+ /** -+ * @return the secondary effect -+ */ -+ @Nullable public PotionEffectType getSecondary() { -+ return this.secondary; -+ } -+ -+ /** -+ * Sets the secondary effect -+ *

-+ * This only has an effect when the beacon is able to accept a secondary effect. -+ * NOTE: The secondary effect still has to be a valid effect for a beacon. -+ * -+ * @param secondary the secondary effect -+ */ -+ public void setSecondary(@Nullable PotionEffectType secondary) { -+ this.secondary = secondary; -+ } -+ -+ /** -+ * @return the beacon block associated with this event -+ */ -+ @NotNull -+ public Block getBeacon() { -+ return this.beacon; -+ } -+ -+ /** -+ * Gets if the item used to change the beacon will be consumed. -+ *

-+ * Independent of {@link #isCancelled()}. If the event is cancelled -+ * the item will NOT be consumed. -+ * -+ * @return {@code true} if item will be consumed -+ */ -+ public boolean willConsumeItem() { -+ return this.consumeItem; -+ } -+ -+ /** -+ * Sets if the item used to change the beacon should be consumed. -+ *

-+ * Independent of {@link #isCancelled()}. If the event is cancelled -+ * the item will NOT be consumed. -+ * -+ * @param consumeItem {@code true} if item should be consumed -+ */ -+ public void setConsumeItem(boolean consumeItem) { -+ this.consumeItem = consumeItem; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will -+ * not take effect -+ */ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * If cancelled, the item will NOT be consumed regardless of what {@link #willConsumeItem()} says -+ *

-+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will not be applied -+ * or saved. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0246-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/api/0246-Added-PlayerStonecutterRecipeSelectEvent.patch new file mode 100644 index 0000000000..46377a6798 --- /dev/null +++ b/patches/api/0246-Added-PlayerStonecutterRecipeSelectEvent.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 27 Nov 2020 17:13:59 -0800 +Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8a7e1cb49ace104af3f9571fbc36b80687141736 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java +@@ -0,0 +1,60 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.StonecutterInventory; ++import org.bukkit.inventory.StonecuttingRecipe; ++import org.jetbrains.annotations.NotNull; ++ ++public class PlayerStonecutterRecipeSelectEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final StonecutterInventory stonecutterInventory; ++ private StonecuttingRecipe stonecuttingRecipe; ++ ++ private boolean cancelled; ++ ++ public PlayerStonecutterRecipeSelectEvent(@NotNull Player player, @NotNull StonecutterInventory stonecutterInventory, @NotNull StonecuttingRecipe stonecuttingRecipe) { ++ super(player); ++ this.stonecutterInventory = stonecutterInventory; ++ this.stonecuttingRecipe = stonecuttingRecipe; ++ } ++ ++ @NotNull ++ public StonecutterInventory getStonecutterInventory() { ++ return this.stonecutterInventory; ++ } ++ ++ @NotNull ++ public StonecuttingRecipe getStonecuttingRecipe() { ++ return this.stonecuttingRecipe; ++ } ++ ++ public void setStonecuttingRecipe(@NotNull StonecuttingRecipe stonecuttingRecipe) { ++ this.stonecuttingRecipe = stonecuttingRecipe; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch new file mode 100644 index 0000000000..f85f2a4f26 --- /dev/null +++ b/patches/api/0247-Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Fri, 29 Jan 2021 15:13:04 +0100 +Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java +index a33986a0c437a673435206fc337031a7eebdab3b..e0e068799a1868c8e561869015f41f553ef4fbdb 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java +@@ -10,10 +10,19 @@ import org.jetbrains.annotations.NotNull; + public class EntityUnleashEvent extends EntityEvent { + private static final HandlerList handlers = new HandlerList(); + private final UnleashReason reason; ++ private boolean dropLeash; // Paper + ++ // Paper start - drop leash variable ++ @Deprecated + public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) { ++ this(entity, reason, false); ++ } ++ ++ public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) { + super(entity); ++ // Paper end + this.reason = reason; ++ this.dropLeash = dropLeash; // Paper + } + + /** +@@ -26,6 +35,26 @@ public class EntityUnleashEvent extends EntityEvent { + return reason; + } + ++ // Paper start ++ /** ++ * Returns whether a leash item will be dropped. ++ * ++ * @return Whether the leash item will be dropped ++ */ ++ public boolean isDropLeash() { ++ return dropLeash; ++ } ++ ++ /** ++ * Sets whether a leash item should be dropped. ++ * ++ * @param dropLeash Whether the leash item should be dropped ++ */ ++ public void setDropLeash(boolean dropLeash) { ++ this.dropLeash = dropLeash; ++ } ++ // Paper end ++ + @NotNull + @Override + public HandlerList getHandlers() { +diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java +index 075af9c1c179bcc2f0e7cb4db4e0d54d6d58ce5c..d63bd62606763d0902ea800f0c35a1cfd07fc8ec 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java +@@ -17,8 +17,15 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc + private final Player player; + private final EquipmentSlot hand; + ++ // Paper start - drop leash variable ++ @Deprecated + public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand) { +- super(entity, UnleashReason.PLAYER_UNLEASH); ++ this(entity, player, hand, false); ++ } ++ ++ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand, boolean dropLeash) { ++ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash); ++ // Paper end + this.player = player; + this.hand = hand; + } diff --git a/patches/api/0247-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/api/0247-Added-PlayerStonecutterRecipeSelectEvent.patch deleted file mode 100644 index 46377a6798..0000000000 --- a/patches/api/0247-Added-PlayerStonecutterRecipeSelectEvent.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 27 Nov 2020 17:13:59 -0800 -Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..8a7e1cb49ace104af3f9571fbc36b80687141736 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java -@@ -0,0 +1,60 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.StonecutterInventory; -+import org.bukkit.inventory.StonecuttingRecipe; -+import org.jetbrains.annotations.NotNull; -+ -+public class PlayerStonecutterRecipeSelectEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final StonecutterInventory stonecutterInventory; -+ private StonecuttingRecipe stonecuttingRecipe; -+ -+ private boolean cancelled; -+ -+ public PlayerStonecutterRecipeSelectEvent(@NotNull Player player, @NotNull StonecutterInventory stonecutterInventory, @NotNull StonecuttingRecipe stonecuttingRecipe) { -+ super(player); -+ this.stonecutterInventory = stonecutterInventory; -+ this.stonecuttingRecipe = stonecuttingRecipe; -+ } -+ -+ @NotNull -+ public StonecutterInventory getStonecutterInventory() { -+ return this.stonecutterInventory; -+ } -+ -+ @NotNull -+ public StonecuttingRecipe getStonecuttingRecipe() { -+ return this.stonecuttingRecipe; -+ } -+ -+ public void setStonecuttingRecipe(@NotNull StonecuttingRecipe stonecuttingRecipe) { -+ this.stonecuttingRecipe = stonecuttingRecipe; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0248-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/0248-Add-dropLeash-variable-to-EntityUnleashEvent.patch deleted file mode 100644 index f85f2a4f26..0000000000 --- a/patches/api/0248-Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Fri, 29 Jan 2021 15:13:04 +0100 -Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -index a33986a0c437a673435206fc337031a7eebdab3b..e0e068799a1868c8e561869015f41f553ef4fbdb 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -@@ -10,10 +10,19 @@ import org.jetbrains.annotations.NotNull; - public class EntityUnleashEvent extends EntityEvent { - private static final HandlerList handlers = new HandlerList(); - private final UnleashReason reason; -+ private boolean dropLeash; // Paper - -+ // Paper start - drop leash variable -+ @Deprecated - public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) { -+ this(entity, reason, false); -+ } -+ -+ public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) { - super(entity); -+ // Paper end - this.reason = reason; -+ this.dropLeash = dropLeash; // Paper - } - - /** -@@ -26,6 +35,26 @@ public class EntityUnleashEvent extends EntityEvent { - return reason; - } - -+ // Paper start -+ /** -+ * Returns whether a leash item will be dropped. -+ * -+ * @return Whether the leash item will be dropped -+ */ -+ public boolean isDropLeash() { -+ return dropLeash; -+ } -+ -+ /** -+ * Sets whether a leash item should be dropped. -+ * -+ * @param dropLeash Whether the leash item should be dropped -+ */ -+ public void setDropLeash(boolean dropLeash) { -+ this.dropLeash = dropLeash; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { -diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java -index 075af9c1c179bcc2f0e7cb4db4e0d54d6d58ce5c..d63bd62606763d0902ea800f0c35a1cfd07fc8ec 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java -@@ -17,8 +17,15 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc - private final Player player; - private final EquipmentSlot hand; - -+ // Paper start - drop leash variable -+ @Deprecated - public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand) { -- super(entity, UnleashReason.PLAYER_UNLEASH); -+ this(entity, player, hand, false); -+ } -+ -+ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, @NotNull EquipmentSlot hand, boolean dropLeash) { -+ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash); -+ // Paper end - this.player = player; - this.hand = hand; - } diff --git a/patches/api/0248-add-DragonEggFormEvent.patch b/patches/api/0248-add-DragonEggFormEvent.patch new file mode 100644 index 0000000000..3b40a9f99d --- /dev/null +++ b/patches/api/0248-add-DragonEggFormEvent.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Mon, 25 Jan 2021 14:53:49 +0100 +Subject: [PATCH] add DragonEggFormEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..695c21a296c6d12e1204eba33b92c44e7c2d98b8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java +@@ -0,0 +1,55 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.Material; ++import org.bukkit.block.Block; ++import org.bukkit.block.BlockState; ++import org.bukkit.boss.DragonBattle; ++import org.bukkit.entity.EnderDragon; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockFormEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when the {@link EnderDragon} is defeated (killed) in a {@link DragonBattle}, ++ * causing a {@link Material#DRAGON_EGG} (more formally: {@link #getNewState()}) ++ * to possibly appear depending on {@link #isCancelled()}. ++ *

++ * This event might be cancelled by default depending on ++ * e.g. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration. ++ */ ++public class DragonEggFormEvent extends BlockFormEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final DragonBattle dragonBattle; ++ ++ @ApiStatus.Internal ++ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState, @NotNull DragonBattle dragonBattle) { ++ super(block, newState); ++ this.dragonBattle = dragonBattle; ++ } ++ ++ /** ++ * Gets the {@link DragonBattle} associated with this event. ++ * Keep in mind that the {@link EnderDragon} is already dead ++ * when this event is called. ++ * ++ * @return the dragon battle ++ */ ++ @NotNull ++ public DragonBattle getDragonBattle() { ++ return this.dragonBattle; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0249-EntityMoveEvent.patch b/patches/api/0249-EntityMoveEvent.patch new file mode 100644 index 0000000000..d9e828eb8c --- /dev/null +++ b/patches/api/0249-EntityMoveEvent.patch @@ -0,0 +1,162 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Tue, 11 Feb 2020 21:56:38 -0600 +Subject: [PATCH] EntityMoveEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..46990a220f70b04218b14aec1e9efbd46c2ad77c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java +@@ -0,0 +1,150 @@ ++package io.papermc.paper.event.entity; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.Location; ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.bukkit.event.player.PlayerMoveEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Holds information for living entity movement events ++ *

++ * Does not fire for players; use {@link PlayerMoveEvent} for player movement. ++ */ ++public class EntityMoveEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private Location from; ++ private Location to; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityMoveEvent(@NotNull LivingEntity entity, @NotNull Location from, @NotNull Location to) { ++ super(entity); ++ this.from = from; ++ this.to = to; ++ } ++ ++ @Override ++ @NotNull ++ public LivingEntity getEntity() { ++ return (LivingEntity) super.getEntity(); ++ } ++ ++ /** ++ * Gets the location this entity moved from ++ * ++ * @return Location the entity moved from ++ */ ++ @NotNull ++ public Location getFrom() { ++ return this.from; ++ } ++ ++ /** ++ * Sets the location to mark as where the entity moved from ++ * ++ * @param from New location to mark as the entity's previous location ++ */ ++ public void setFrom(@NotNull Location from) { ++ validateLocation(from); ++ this.from = from; ++ } ++ ++ /** ++ * Gets the location this entity moved to ++ * ++ * @return Location the entity moved to ++ */ ++ @NotNull ++ public Location getTo() { ++ return this.to; ++ } ++ ++ /** ++ * Sets the location that this entity will move to ++ * ++ * @param to New Location this entity will move to ++ */ ++ public void setTo(@NotNull Location to) { ++ validateLocation(to); ++ this.to = to; ++ } ++ ++ /** ++ * Check if the entity has changed position (even within the same block) in the event ++ * ++ * @return whether the entity has changed position or not ++ */ ++ public boolean hasChangedPosition() { ++ return hasExplicitlyChangedPosition() || !this.from.getWorld().equals(this.to.getWorld()); ++ } ++ ++ /** ++ * Check if the entity has changed position (even within the same block) in the event, disregarding a possible world change ++ * ++ * @return whether the entity has changed position or not ++ */ ++ public boolean hasExplicitlyChangedPosition() { ++ return this.from.getX() != this.to.getX() || this.from.getY() != this.to.getY() || this.from.getZ() != this.to.getZ(); ++ } ++ ++ /** ++ * Check if the entity has moved to a new block in the event ++ * ++ * @return whether the entity has moved to a new block or not ++ */ ++ public boolean hasChangedBlock() { ++ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld()); ++ } ++ ++ /** ++ * Check if the entity has moved to a new block in the event, disregarding a possible world change ++ * ++ * @return whether the entity has moved to a new block or not ++ */ ++ public boolean hasExplicitlyChangedBlock() { ++ return this.from.getBlockX() != this.to.getBlockX() || this.from.getBlockY() != this.to.getBlockY() || this.from.getBlockZ() != this.to.getBlockZ(); ++ } ++ ++ /** ++ * Check if the entity has changed orientation in the event ++ * ++ * @return whether the entity has changed orientation or not ++ */ ++ public boolean hasChangedOrientation() { ++ return this.from.getPitch() != this.to.getPitch() || this.from.getYaw() != this.to.getYaw(); ++ } ++ ++ private void validateLocation(@NotNull Location loc) { ++ Preconditions.checkArgument(loc != null, "Cannot use null location!"); ++ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!"); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0249-add-DragonEggFormEvent.patch b/patches/api/0249-add-DragonEggFormEvent.patch deleted file mode 100644 index 3b40a9f99d..0000000000 --- a/patches/api/0249-add-DragonEggFormEvent.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary -Date: Mon, 25 Jan 2021 14:53:49 +0100 -Subject: [PATCH] add DragonEggFormEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..695c21a296c6d12e1204eba33b92c44e7c2d98b8 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java -@@ -0,0 +1,55 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.Material; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockState; -+import org.bukkit.boss.DragonBattle; -+import org.bukkit.entity.EnderDragon; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockFormEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when the {@link EnderDragon} is defeated (killed) in a {@link DragonBattle}, -+ * causing a {@link Material#DRAGON_EGG} (more formally: {@link #getNewState()}) -+ * to possibly appear depending on {@link #isCancelled()}. -+ *

-+ * This event might be cancelled by default depending on -+ * e.g. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration. -+ */ -+public class DragonEggFormEvent extends BlockFormEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final DragonBattle dragonBattle; -+ -+ @ApiStatus.Internal -+ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState, @NotNull DragonBattle dragonBattle) { -+ super(block, newState); -+ this.dragonBattle = dragonBattle; -+ } -+ -+ /** -+ * Gets the {@link DragonBattle} associated with this event. -+ * Keep in mind that the {@link EnderDragon} is already dead -+ * when this event is called. -+ * -+ * @return the dragon battle -+ */ -+ @NotNull -+ public DragonBattle getDragonBattle() { -+ return this.dragonBattle; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0250-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/api/0250-Allow-adding-items-to-BlockDropItemEvent.patch new file mode 100644 index 0000000000..c6b7565fe4 --- /dev/null +++ b/patches/api/0250-Allow-adding-items-to-BlockDropItemEvent.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Wed, 20 Jan 2021 14:25:26 -0600 +Subject: [PATCH] Allow adding items to BlockDropItemEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java +index 7e21548cac8515c281ec86853e9272ab7695b24f..4c5ee91de162b202c2db8bf68259ad41a430125d 100644 +--- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java +@@ -68,7 +68,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable { + * Gets list of the Item drops caused by the block break. + * + * This list is mutable - removing an item from it will cause it to not +- * drop. It is not legal however to add new items to the list. ++ * drop. Adding to the list is allowed. + * + * @return The Item the block caused to drop + */ diff --git a/patches/api/0250-EntityMoveEvent.patch b/patches/api/0250-EntityMoveEvent.patch deleted file mode 100644 index d9e828eb8c..0000000000 --- a/patches/api/0250-EntityMoveEvent.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Tue, 11 Feb 2020 21:56:38 -0600 -Subject: [PATCH] EntityMoveEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..46990a220f70b04218b14aec1e9efbd46c2ad77c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java -@@ -0,0 +1,150 @@ -+package io.papermc.paper.event.entity; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.Location; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.event.player.PlayerMoveEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Holds information for living entity movement events -+ *

-+ * Does not fire for players; use {@link PlayerMoveEvent} for player movement. -+ */ -+public class EntityMoveEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private Location from; -+ private Location to; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityMoveEvent(@NotNull LivingEntity entity, @NotNull Location from, @NotNull Location to) { -+ super(entity); -+ this.from = from; -+ this.to = to; -+ } -+ -+ @Override -+ @NotNull -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ /** -+ * Gets the location this entity moved from -+ * -+ * @return Location the entity moved from -+ */ -+ @NotNull -+ public Location getFrom() { -+ return this.from; -+ } -+ -+ /** -+ * Sets the location to mark as where the entity moved from -+ * -+ * @param from New location to mark as the entity's previous location -+ */ -+ public void setFrom(@NotNull Location from) { -+ validateLocation(from); -+ this.from = from; -+ } -+ -+ /** -+ * Gets the location this entity moved to -+ * -+ * @return Location the entity moved to -+ */ -+ @NotNull -+ public Location getTo() { -+ return this.to; -+ } -+ -+ /** -+ * Sets the location that this entity will move to -+ * -+ * @param to New Location this entity will move to -+ */ -+ public void setTo(@NotNull Location to) { -+ validateLocation(to); -+ this.to = to; -+ } -+ -+ /** -+ * Check if the entity has changed position (even within the same block) in the event -+ * -+ * @return whether the entity has changed position or not -+ */ -+ public boolean hasChangedPosition() { -+ return hasExplicitlyChangedPosition() || !this.from.getWorld().equals(this.to.getWorld()); -+ } -+ -+ /** -+ * Check if the entity has changed position (even within the same block) in the event, disregarding a possible world change -+ * -+ * @return whether the entity has changed position or not -+ */ -+ public boolean hasExplicitlyChangedPosition() { -+ return this.from.getX() != this.to.getX() || this.from.getY() != this.to.getY() || this.from.getZ() != this.to.getZ(); -+ } -+ -+ /** -+ * Check if the entity has moved to a new block in the event -+ * -+ * @return whether the entity has moved to a new block or not -+ */ -+ public boolean hasChangedBlock() { -+ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld()); -+ } -+ -+ /** -+ * Check if the entity has moved to a new block in the event, disregarding a possible world change -+ * -+ * @return whether the entity has moved to a new block or not -+ */ -+ public boolean hasExplicitlyChangedBlock() { -+ return this.from.getBlockX() != this.to.getBlockX() || this.from.getBlockY() != this.to.getBlockY() || this.from.getBlockZ() != this.to.getBlockZ(); -+ } -+ -+ /** -+ * Check if the entity has changed orientation in the event -+ * -+ * @return whether the entity has changed orientation or not -+ */ -+ public boolean hasChangedOrientation() { -+ return this.from.getPitch() != this.to.getPitch() || this.from.getYaw() != this.to.getYaw(); -+ } -+ -+ private void validateLocation(@NotNull Location loc) { -+ Preconditions.checkArgument(loc != null, "Cannot use null location!"); -+ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!"); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0251-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/0251-Add-getMainThreadExecutor-to-BukkitScheduler.patch new file mode 100644 index 0000000000..7cc686da5a --- /dev/null +++ b/patches/api/0251-Add-getMainThreadExecutor-to-BukkitScheduler.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aleksander Jagiello +Date: Sun, 24 Jan 2021 22:17:29 +0100 +Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler + + +diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +index 0368e9125e6d73449cfa22ec7bdabf274457f4c1..487b5ca23159b531475c3d650894be707b49914e 100644 +--- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java ++++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +@@ -457,4 +457,15 @@ public interface BukkitScheduler { + @Deprecated + @NotNull + public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException; ++ ++ // Paper start - add getMainThreadExecutor ++ /** ++ * Returns an executor that will run tasks on the next server tick. ++ * ++ * @param plugin the reference to the plugin scheduling tasks ++ * @return an executor associated with the given plugin ++ */ ++ @NotNull ++ public java.util.concurrent.Executor getMainThreadExecutor(@NotNull Plugin plugin); ++ // Paper end + } diff --git a/patches/api/0251-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/api/0251-Allow-adding-items-to-BlockDropItemEvent.patch deleted file mode 100644 index c6b7565fe4..0000000000 --- a/patches/api/0251-Allow-adding-items-to-BlockDropItemEvent.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Wed, 20 Jan 2021 14:25:26 -0600 -Subject: [PATCH] Allow adding items to BlockDropItemEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java -index 7e21548cac8515c281ec86853e9272ab7695b24f..4c5ee91de162b202c2db8bf68259ad41a430125d 100644 ---- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java -@@ -68,7 +68,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable { - * Gets list of the Item drops caused by the block break. - * - * This list is mutable - removing an item from it will cause it to not -- * drop. It is not legal however to add new items to the list. -+ * drop. Adding to the list is allowed. - * - * @return The Item the block caused to drop - */ diff --git a/patches/api/0252-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/0252-Add-getMainThreadExecutor-to-BukkitScheduler.patch deleted file mode 100644 index 7cc686da5a..0000000000 --- a/patches/api/0252-Add-getMainThreadExecutor-to-BukkitScheduler.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aleksander Jagiello -Date: Sun, 24 Jan 2021 22:17:29 +0100 -Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler - - -diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java -index 0368e9125e6d73449cfa22ec7bdabf274457f4c1..487b5ca23159b531475c3d650894be707b49914e 100644 ---- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java -+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java -@@ -457,4 +457,15 @@ public interface BukkitScheduler { - @Deprecated - @NotNull - public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException; -+ -+ // Paper start - add getMainThreadExecutor -+ /** -+ * Returns an executor that will run tasks on the next server tick. -+ * -+ * @param plugin the reference to the plugin scheduling tasks -+ * @return an executor associated with the given plugin -+ */ -+ @NotNull -+ public java.util.concurrent.Executor getMainThreadExecutor(@NotNull Plugin plugin); -+ // Paper end - } diff --git a/patches/api/0252-living-entity-allow-attribute-registration.patch b/patches/api/0252-living-entity-allow-attribute-registration.patch new file mode 100644 index 0000000000..e7ded6dabb --- /dev/null +++ b/patches/api/0252-living-entity-allow-attribute-registration.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ysl3000 +Date: Sat, 24 Oct 2020 16:37:21 +0200 +Subject: [PATCH] living entity allow attribute registration + + +diff --git a/src/main/java/org/bukkit/attribute/Attributable.java b/src/main/java/org/bukkit/attribute/Attributable.java +index 0ed96b5af0e6e93590882e0ad8239221bcc3f688..474ed1df364a5ca18661d0fbc29901760e39cb07 100644 +--- a/src/main/java/org/bukkit/attribute/Attributable.java ++++ b/src/main/java/org/bukkit/attribute/Attributable.java +@@ -17,4 +17,14 @@ public interface Attributable { + */ + @Nullable + AttributeInstance getAttribute(@NotNull Attribute attribute); ++ ++ // Paper start ++ /** ++ * Registers a generic attribute to that attributable instance. ++ * Allows it to add attributes not registered by default to that entity. ++ * ++ * @param attribute the generic attribute to register ++ */ ++ void registerAttribute(@NotNull Attribute attribute); ++ // Paper end + } diff --git a/patches/api/0253-Add-missing-effects.patch b/patches/api/0253-Add-missing-effects.patch new file mode 100644 index 0000000000..52e92823ef --- /dev/null +++ b/patches/api/0253-Add-missing-effects.patch @@ -0,0 +1,320 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ivan Pekov +Date: Tue, 5 Jan 2021 10:19:11 +0200 +Subject: [PATCH] Add missing effects + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java +index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9277578f8 100644 +--- a/src/main/java/org/bukkit/Effect.java ++++ b/src/main/java/org/bukkit/Effect.java +@@ -131,9 +131,9 @@ public enum Effect { + /** + * Sound of a block breaking. Needs block ID as additional info. + */ +- STEP_SOUND(2001, Type.SOUND, Material.class), ++ STEP_SOUND(2001, Type.SOUND, org.bukkit.block.data.BlockData.class, Material.class), // Paper - block data is more correct, but the impl of the mtehods will still work with Material + /** +- * Visual effect of a splash potion breaking. Needs potion data value as ++ * Visual effect of a splash potion breaking. Needs color data value as + * additional info. + */ + POTION_BREAK(2002, Type.VISUAL, Color.class), +@@ -177,7 +177,9 @@ public enum Effect { + /** + * Particles displayed when a villager grows a plant, data + * is the number of particles ++ * @deprecated partially replaced by {@link #BEE_GROWTH} + */ ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper + VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class), + /** + * The sound/particles used by the enderdragon's breath +@@ -336,21 +338,197 @@ public enum Effect { + * block. + */ + OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL), ++ // Paper start - add missing effects ++ /** ++ * The sound of a wither spawning ++ */ ++ WITHER_SPAWNED(1023, Type.SOUND), ++ /** ++ * The sound of an ender dragon dying ++ */ ++ ENDER_DRAGON_DEATH(1028, Type.SOUND), ++ /** ++ * The sound of an ender portal being created in the overworld ++ */ ++ END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND), ++ /** ++ * The sound of phantom's bites ++ * ++ * @deprecated use {@link #PHANTOM_BITE} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ PHANTOM_BITES(1039, Type.SOUND), ++ /** ++ * The sound of zombie converting to drowned zombie ++ * ++ * @deprecated use {@link #ZOMBIE_CONVERTED_TO_DROWNED} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ ZOMBIE_CONVERTS_TO_DROWNED(1040, Type.SOUND), ++ /** ++ * The sound of a husk converting to zombie by drowning ++ * ++ * @deprecated use {@link #HUSK_CONVERTED_TO_ZOMBIE} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ HUSK_CONVERTS_TO_ZOMBIE(1041, Type.SOUND), ++ /** ++ * The sound of a grindstone being used ++ * ++ * @deprecated use {@link #GRINDSTONE_USE} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ GRINDSTONE_USED(1042, Type.SOUND), ++ /** ++ * The sound of a book page being turned ++ * ++ * @deprecated use {@link #BOOK_PAGE_TURN} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ BOOK_PAGE_TURNED(1043, Type.SOUND), ++ /** ++ * Particles displayed when a composter composts ++ * ++ * @deprecated use {@link #COMPOSTER_FILL_ATTEMPT} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ COMPOSTER_COMPOSTS(1500, Type.VISUAL), ++ /** ++ * Particles displayed when lava converts a block (either water to stone, or ++ * removing existing blocks such as torches) ++ * ++ * @deprecated use {@link #LAVA_INTERACT} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ LAVA_CONVERTS_BLOCK(1501, Type.VISUAL), ++ /** ++ * Particles displayd when a redstone torch burns out ++ * ++ * @deprecated use {@link #REDSTONE_TORCH_BURNOUT} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ REDSTONE_TORCH_BURNS_OUT(1502, Type.VISUAL), ++ /** ++ * Particles displayed when an ender eye is placed ++ * ++ * @deprecated use {@link #END_PORTAL_FRAME_FILL} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ ENDER_EYE_PLACED(1503, Type.VISUAL), ++ /** ++ * Particles displayed when an ender dragon destroys block ++ * ++ * @deprecated use {@link #ENDER_DRAGON_DESTROY_BLOCK} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ ENDER_DRAGON_DESTROYS_BLOCK(2008, Type.VISUAL), ++ /** ++ * Particles displayed when a wet sponge vaporizes in nether. ++ * ++ * @deprecated use {@link #SPONGE_DRY} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL), ++ ++ SOUND_STOP_JUKEBOX_SONG(1011, Type.SOUND), ++ ++ CRAFTER_CRAFT(1049, Type.SOUND), ++ ++ CRAFTER_FAIL(1050, Type.SOUND), ++ ++ /** ++ * {@link BlockFace} param is the direction to shoot ++ */ ++ SHOOT_WHITE_SMOKE(2010, Type.VISUAL, BlockFace.class), ++ ++ /** ++ * {@link Integer} param is the number of particles ++ */ ++ BEE_GROWTH(2011, Type.VISUAL, Integer.class), ++ ++ /** ++ * {@link Integer} param is the number of particles ++ */ ++ TURTLE_EGG_PLACEMENT(2012, Type.VISUAL, Integer.class), ++ ++ /** ++ * {@link Integer} param is relative to the number of particles ++ */ ++ SMASH_ATTACK(2013, Type.VISUAL, Integer.class), ++ ++ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class), ++ ++ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND), ++ ++ PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008, Type.VISUAL, org.bukkit.block.data.BlockData.class), ++ ++ PARTICLES_EGG_CRACK(3009, Type.VISUAL), ++ ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ GUST_DUST(3010, Type.VISUAL), ++ ++ /** ++ * {@link Boolean} param is true for "ominous" vaults ++ */ ++ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL, Boolean.class), ++ ++ /** ++ * {@link Boolean} param is true for "ominous" vaults ++ */ ++ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL, Boolean.class), ++ ++ /** ++ * {@link Integer} param is the number of players ++ */ ++ TRIAL_SPAWNER_DETECT_PLAYER(3013, Type.VISUAL, Integer.class), ++ ++ TRIAL_SPAWNER_EJECT_ITEM(3014, Type.VISUAL), ++ ++ /** ++ * {@link Boolean} param is true for "ominous" vaults ++ */ ++ VAULT_ACTIVATE(3015, Type.VISUAL, Boolean.class), ++ ++ /** ++ * {@link Boolean} param is true for "ominous" vaults ++ */ ++ VAULT_DEACTIVATE(3016, Type.VISUAL, Boolean.class), ++ ++ VAULT_EJECT_ITEM(3017, Type.VISUAL), ++ ++ SPAWN_COBWEB(3018, Type.VISUAL), ++ ++ /** ++ * {@link Integer} param is the number of players ++ */ ++ TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019, Type.VISUAL, Integer.class), ++ ++ /** ++ * {@link Boolean} param is true for changing to "ominous" ++ */ ++ TRIAL_SPAWNER_BECOME_OMINOUS(3020, Type.VISUAL, Boolean.class), ++ ++ /** ++ * {@link Boolean} param is true for "ominous" vaults ++ */ ++ TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class) + ; ++ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); ++ // Paper end + + private final int id; + private final Type type; +- private final Class data; ++ private final java.util.List> data; // Paper - support multiple data types + private static final Map BY_ID = Maps.newHashMap(); + + Effect(int id, /*@NotNull*/ Type type) { +- this(id, type, null); ++ this(id, type, (Class[]) null); // Paper - support multiple data types + } + +- Effect(int id, /*@NotNull*/ Type type, /*@Nullable*/ Class data) { ++ Effect(int id, /*@NotNull*/ Type type, /*@Nullable*/ Class...data) { // Paper - support multiple data types + this.id = id; + this.type = type; +- this.data = data; ++ this.data = data != null ? java.util.List.of(data) : null; // Paper - support multiple data types + } + + /** +@@ -366,8 +544,10 @@ public enum Effect { + + /** + * @return The type of the effect. ++ * @deprecated some effects can be both or neither + */ + @NotNull ++ @Deprecated // Paper - both + public Type getType() { + return this.type; + } +@@ -378,9 +558,16 @@ public enum Effect { + */ + @Nullable + public Class getData() { +- return this.data; ++ return this.data == null ? null : this.data.get(0); // Paper + } + ++ // Paper start - support deprecated data types ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public boolean isApplicable(Object obj) { ++ return this.data != null && com.google.common.collect.Iterables.any(this.data, aClass -> aClass.isAssignableFrom(obj.getClass())); ++ } ++ // Paper end - support deprecated data types ++ + /** + * Gets the Effect associated with the given ID. + * +@@ -396,12 +583,26 @@ public enum Effect { + + static { + for (Effect effect : values()) { ++ if (!isDeprecated(effect)) // Paper + BY_ID.put(effect.id, effect); + } + } + ++ // Paper start ++ private static boolean isDeprecated(Effect effect) { ++ try { ++ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); ++ } catch (NoSuchFieldException e) { ++ LOGGER.error("Error getting effect enum field {}", effect.name(), e); ++ return false; ++ } ++ } ++ // Paper end ++ + /** + * Represents the type of an effect. ++ * @deprecated not representative of what Effect does + */ ++ @Deprecated // Paper + public enum Type { SOUND, VISUAL } + } +diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java +index 4344512fa84a2f97a750e06761d8e160c0959f6a..615a4583ef8e70a7c86c28e648d0b57e8e6b9674 100644 +--- a/src/test/java/org/bukkit/EffectTest.java ++++ b/src/test/java/org/bukkit/EffectTest.java +@@ -5,10 +5,24 @@ import static org.hamcrest.CoreMatchers.*; + import org.junit.jupiter.api.Test; + + public class EffectTest { ++ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper ++ + @Test + public void getById() { + for (Effect effect : Effect.values()) { ++ if (!isDeprecated(effect)) // Paper + assertThat(Effect.getById(effect.getId()), is(effect)); + } + } ++ ++ // Paper start ++ private static boolean isDeprecated(Effect effect) { ++ try { ++ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); ++ } catch (NoSuchFieldException e) { ++ LOGGER.error("Error getting effect enum field {}", effect.name(), e); ++ return false; ++ } ++ } ++ // Paper end + } diff --git a/patches/api/0253-living-entity-allow-attribute-registration.patch b/patches/api/0253-living-entity-allow-attribute-registration.patch deleted file mode 100644 index e7ded6dabb..0000000000 --- a/patches/api/0253-living-entity-allow-attribute-registration.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ysl3000 -Date: Sat, 24 Oct 2020 16:37:21 +0200 -Subject: [PATCH] living entity allow attribute registration - - -diff --git a/src/main/java/org/bukkit/attribute/Attributable.java b/src/main/java/org/bukkit/attribute/Attributable.java -index 0ed96b5af0e6e93590882e0ad8239221bcc3f688..474ed1df364a5ca18661d0fbc29901760e39cb07 100644 ---- a/src/main/java/org/bukkit/attribute/Attributable.java -+++ b/src/main/java/org/bukkit/attribute/Attributable.java -@@ -17,4 +17,14 @@ public interface Attributable { - */ - @Nullable - AttributeInstance getAttribute(@NotNull Attribute attribute); -+ -+ // Paper start -+ /** -+ * Registers a generic attribute to that attributable instance. -+ * Allows it to add attributes not registered by default to that entity. -+ * -+ * @param attribute the generic attribute to register -+ */ -+ void registerAttribute(@NotNull Attribute attribute); -+ // Paper end - } diff --git a/patches/api/0254-Add-missing-effects.patch b/patches/api/0254-Add-missing-effects.patch deleted file mode 100644 index 52e92823ef..0000000000 --- a/patches/api/0254-Add-missing-effects.patch +++ /dev/null @@ -1,320 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ivan Pekov -Date: Tue, 5 Jan 2021 10:19:11 +0200 -Subject: [PATCH] Add missing effects - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java -index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9277578f8 100644 ---- a/src/main/java/org/bukkit/Effect.java -+++ b/src/main/java/org/bukkit/Effect.java -@@ -131,9 +131,9 @@ public enum Effect { - /** - * Sound of a block breaking. Needs block ID as additional info. - */ -- STEP_SOUND(2001, Type.SOUND, Material.class), -+ STEP_SOUND(2001, Type.SOUND, org.bukkit.block.data.BlockData.class, Material.class), // Paper - block data is more correct, but the impl of the mtehods will still work with Material - /** -- * Visual effect of a splash potion breaking. Needs potion data value as -+ * Visual effect of a splash potion breaking. Needs color data value as - * additional info. - */ - POTION_BREAK(2002, Type.VISUAL, Color.class), -@@ -177,7 +177,9 @@ public enum Effect { - /** - * Particles displayed when a villager grows a plant, data - * is the number of particles -+ * @deprecated partially replaced by {@link #BEE_GROWTH} - */ -+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper - VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class), - /** - * The sound/particles used by the enderdragon's breath -@@ -336,21 +338,197 @@ public enum Effect { - * block. - */ - OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL), -+ // Paper start - add missing effects -+ /** -+ * The sound of a wither spawning -+ */ -+ WITHER_SPAWNED(1023, Type.SOUND), -+ /** -+ * The sound of an ender dragon dying -+ */ -+ ENDER_DRAGON_DEATH(1028, Type.SOUND), -+ /** -+ * The sound of an ender portal being created in the overworld -+ */ -+ END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND), -+ /** -+ * The sound of phantom's bites -+ * -+ * @deprecated use {@link #PHANTOM_BITE} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ PHANTOM_BITES(1039, Type.SOUND), -+ /** -+ * The sound of zombie converting to drowned zombie -+ * -+ * @deprecated use {@link #ZOMBIE_CONVERTED_TO_DROWNED} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ ZOMBIE_CONVERTS_TO_DROWNED(1040, Type.SOUND), -+ /** -+ * The sound of a husk converting to zombie by drowning -+ * -+ * @deprecated use {@link #HUSK_CONVERTED_TO_ZOMBIE} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ HUSK_CONVERTS_TO_ZOMBIE(1041, Type.SOUND), -+ /** -+ * The sound of a grindstone being used -+ * -+ * @deprecated use {@link #GRINDSTONE_USE} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ GRINDSTONE_USED(1042, Type.SOUND), -+ /** -+ * The sound of a book page being turned -+ * -+ * @deprecated use {@link #BOOK_PAGE_TURN} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ BOOK_PAGE_TURNED(1043, Type.SOUND), -+ /** -+ * Particles displayed when a composter composts -+ * -+ * @deprecated use {@link #COMPOSTER_FILL_ATTEMPT} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ COMPOSTER_COMPOSTS(1500, Type.VISUAL), -+ /** -+ * Particles displayed when lava converts a block (either water to stone, or -+ * removing existing blocks such as torches) -+ * -+ * @deprecated use {@link #LAVA_INTERACT} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ LAVA_CONVERTS_BLOCK(1501, Type.VISUAL), -+ /** -+ * Particles displayd when a redstone torch burns out -+ * -+ * @deprecated use {@link #REDSTONE_TORCH_BURNOUT} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ REDSTONE_TORCH_BURNS_OUT(1502, Type.VISUAL), -+ /** -+ * Particles displayed when an ender eye is placed -+ * -+ * @deprecated use {@link #END_PORTAL_FRAME_FILL} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ ENDER_EYE_PLACED(1503, Type.VISUAL), -+ /** -+ * Particles displayed when an ender dragon destroys block -+ * -+ * @deprecated use {@link #ENDER_DRAGON_DESTROY_BLOCK} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ ENDER_DRAGON_DESTROYS_BLOCK(2008, Type.VISUAL), -+ /** -+ * Particles displayed when a wet sponge vaporizes in nether. -+ * -+ * @deprecated use {@link #SPONGE_DRY} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL), -+ -+ SOUND_STOP_JUKEBOX_SONG(1011, Type.SOUND), -+ -+ CRAFTER_CRAFT(1049, Type.SOUND), -+ -+ CRAFTER_FAIL(1050, Type.SOUND), -+ -+ /** -+ * {@link BlockFace} param is the direction to shoot -+ */ -+ SHOOT_WHITE_SMOKE(2010, Type.VISUAL, BlockFace.class), -+ -+ /** -+ * {@link Integer} param is the number of particles -+ */ -+ BEE_GROWTH(2011, Type.VISUAL, Integer.class), -+ -+ /** -+ * {@link Integer} param is the number of particles -+ */ -+ TURTLE_EGG_PLACEMENT(2012, Type.VISUAL, Integer.class), -+ -+ /** -+ * {@link Integer} param is relative to the number of particles -+ */ -+ SMASH_ATTACK(2013, Type.VISUAL, Integer.class), -+ -+ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class), -+ -+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND), -+ -+ PARTICLES_AND_SOUND_BRUSH_BLOCK_COMPLETE(3008, Type.VISUAL, org.bukkit.block.data.BlockData.class), -+ -+ PARTICLES_EGG_CRACK(3009, Type.VISUAL), -+ -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ GUST_DUST(3010, Type.VISUAL), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Integer} param is the number of players -+ */ -+ TRIAL_SPAWNER_DETECT_PLAYER(3013, Type.VISUAL, Integer.class), -+ -+ TRIAL_SPAWNER_EJECT_ITEM(3014, Type.VISUAL), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ VAULT_ACTIVATE(3015, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ VAULT_DEACTIVATE(3016, Type.VISUAL, Boolean.class), -+ -+ VAULT_EJECT_ITEM(3017, Type.VISUAL), -+ -+ SPAWN_COBWEB(3018, Type.VISUAL), -+ -+ /** -+ * {@link Integer} param is the number of players -+ */ -+ TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019, Type.VISUAL, Integer.class), -+ -+ /** -+ * {@link Boolean} param is true for changing to "ominous" -+ */ -+ TRIAL_SPAWNER_BECOME_OMINOUS(3020, Type.VISUAL, Boolean.class), -+ -+ /** -+ * {@link Boolean} param is true for "ominous" vaults -+ */ -+ TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class) - ; -+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); -+ // Paper end - - private final int id; - private final Type type; -- private final Class data; -+ private final java.util.List> data; // Paper - support multiple data types - private static final Map BY_ID = Maps.newHashMap(); - - Effect(int id, /*@NotNull*/ Type type) { -- this(id, type, null); -+ this(id, type, (Class[]) null); // Paper - support multiple data types - } - -- Effect(int id, /*@NotNull*/ Type type, /*@Nullable*/ Class data) { -+ Effect(int id, /*@NotNull*/ Type type, /*@Nullable*/ Class...data) { // Paper - support multiple data types - this.id = id; - this.type = type; -- this.data = data; -+ this.data = data != null ? java.util.List.of(data) : null; // Paper - support multiple data types - } - - /** -@@ -366,8 +544,10 @@ public enum Effect { - - /** - * @return The type of the effect. -+ * @deprecated some effects can be both or neither - */ - @NotNull -+ @Deprecated // Paper - both - public Type getType() { - return this.type; - } -@@ -378,9 +558,16 @@ public enum Effect { - */ - @Nullable - public Class getData() { -- return this.data; -+ return this.data == null ? null : this.data.get(0); // Paper - } - -+ // Paper start - support deprecated data types -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public boolean isApplicable(Object obj) { -+ return this.data != null && com.google.common.collect.Iterables.any(this.data, aClass -> aClass.isAssignableFrom(obj.getClass())); -+ } -+ // Paper end - support deprecated data types -+ - /** - * Gets the Effect associated with the given ID. - * -@@ -396,12 +583,26 @@ public enum Effect { - - static { - for (Effect effect : values()) { -+ if (!isDeprecated(effect)) // Paper - BY_ID.put(effect.id, effect); - } - } - -+ // Paper start -+ private static boolean isDeprecated(Effect effect) { -+ try { -+ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); -+ } catch (NoSuchFieldException e) { -+ LOGGER.error("Error getting effect enum field {}", effect.name(), e); -+ return false; -+ } -+ } -+ // Paper end -+ - /** - * Represents the type of an effect. -+ * @deprecated not representative of what Effect does - */ -+ @Deprecated // Paper - public enum Type { SOUND, VISUAL } - } -diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java -index 4344512fa84a2f97a750e06761d8e160c0959f6a..615a4583ef8e70a7c86c28e648d0b57e8e6b9674 100644 ---- a/src/test/java/org/bukkit/EffectTest.java -+++ b/src/test/java/org/bukkit/EffectTest.java -@@ -5,10 +5,24 @@ import static org.hamcrest.CoreMatchers.*; - import org.junit.jupiter.api.Test; - - public class EffectTest { -+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper -+ - @Test - public void getById() { - for (Effect effect : Effect.values()) { -+ if (!isDeprecated(effect)) // Paper - assertThat(Effect.getById(effect.getId()), is(effect)); - } - } -+ -+ // Paper start -+ private static boolean isDeprecated(Effect effect) { -+ try { -+ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); -+ } catch (NoSuchFieldException e) { -+ LOGGER.error("Error getting effect enum field {}", effect.name(), e); -+ return false; -+ } -+ } -+ // Paper end - } diff --git a/patches/api/0254-Expose-Tracked-Players.patch b/patches/api/0254-Expose-Tracked-Players.patch new file mode 100644 index 0000000000..368fb84d94 --- /dev/null +++ b/patches/api/0254-Expose-Tracked-Players.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tom +Date: Fri, 26 Feb 2021 16:24:25 -0600 +Subject: [PATCH] Expose Tracked Players + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index e9c3c5c4099f7bf7f83bde0b47fd193a3b401f0a..c7d6a328def83619dca9b6122aeb5870e4585e70 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -899,5 +899,14 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * Check if entity is inside a ticking chunk + */ + boolean isTicking(); ++ ++ /** ++ * Returns a set of {@link Player Players} within this entity's tracking range (players that can "see" this entity). ++ * ++ * @return players in tracking range ++ * @deprecated slightly misleading name, use {@link #getTrackedBy()} ++ */ ++ @Deprecated ++ @NotNull Set getTrackedPlayers(); + // Paper end + } diff --git a/patches/api/0255-Cache-the-result-of-Material-isBlock.patch b/patches/api/0255-Cache-the-result-of-Material-isBlock.patch new file mode 100644 index 0000000000..b2322c2c4a --- /dev/null +++ b/patches/api/0255-Cache-the-result-of-Material-isBlock.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Tue, 2 Mar 2021 15:24:58 -0800 +Subject: [PATCH] Cache the result of Material#isBlock + + +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 61e0739f002a949a204c7591dfa3074560d1459e..5aa595860c73e78cf3c9f2a8984c62744cfe5612 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -4684,6 +4684,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + public final Class data; + private final boolean legacy; + private final NamespacedKey key; ++ private boolean isBlock; // Paper + + private Material(final int id) { + this(id, 64); +@@ -4887,6 +4888,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * @return true if this material is a block + */ + public boolean isBlock() { ++ // Paper start - cache isBlock ++ return this.isBlock; ++ } ++ private boolean isBlock0() { ++ // Paper end + switch (this) { + // + case ACACIA_BUTTON: +@@ -6131,6 +6137,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + static { + for (Material material : values()) { + BY_NAME.put(material.name(), material); ++ material.isBlock = material.isBlock0(); // Paper + } + } + diff --git a/patches/api/0255-Expose-Tracked-Players.patch b/patches/api/0255-Expose-Tracked-Players.patch deleted file mode 100644 index 368fb84d94..0000000000 --- a/patches/api/0255-Expose-Tracked-Players.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tom -Date: Fri, 26 Feb 2021 16:24:25 -0600 -Subject: [PATCH] Expose Tracked Players - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index e9c3c5c4099f7bf7f83bde0b47fd193a3b401f0a..c7d6a328def83619dca9b6122aeb5870e4585e70 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -899,5 +899,14 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * Check if entity is inside a ticking chunk - */ - boolean isTicking(); -+ -+ /** -+ * Returns a set of {@link Player Players} within this entity's tracking range (players that can "see" this entity). -+ * -+ * @return players in tracking range -+ * @deprecated slightly misleading name, use {@link #getTrackedBy()} -+ */ -+ @Deprecated -+ @NotNull Set getTrackedPlayers(); - // Paper end - } diff --git a/patches/api/0256-Add-worldborder-events.patch b/patches/api/0256-Add-worldborder-events.patch new file mode 100644 index 0000000000..9f3ae70435 --- /dev/null +++ b/patches/api/0256-Add-worldborder-events.patch @@ -0,0 +1,316 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 4 Jan 2021 22:40:26 -0800 +Subject: [PATCH] Add worldborder events + + +diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..02ac479840c137ca5afcec149ef884e5a5d62928 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java +@@ -0,0 +1,117 @@ ++package io.papermc.paper.event.world.border; ++ ++import org.bukkit.World; ++import org.bukkit.WorldBorder; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a world border changes its bounds, either over time, or instantly. ++ */ ++public class WorldBorderBoundsChangeEvent extends WorldBorderEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private Type type; ++ private final double oldSize; ++ private double newSize; ++ private long duration; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public WorldBorderBoundsChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Type type, double oldSize, double newSize, long duration) { ++ super(world, worldBorder); ++ this.type = type; ++ this.oldSize = oldSize; ++ this.newSize = newSize; ++ this.duration = duration; ++ } ++ ++ /** ++ * Gets if this change is an instant change or over-time change. ++ * ++ * @return the change type ++ */ ++ @NotNull ++ public Type getType() { ++ return this.type; ++ } ++ ++ /** ++ * Gets the old size or the world border. ++ * ++ * @return the old size ++ */ ++ public double getOldSize() { ++ return this.oldSize; ++ } ++ ++ /** ++ * Gets the new size of the world border. ++ * ++ * @return the new size ++ */ ++ public double getNewSize() { ++ return this.newSize; ++ } ++ ++ /** ++ * Sets the new size of the world border. ++ * ++ * @param newSize the new size ++ */ ++ public void setNewSize(double newSize) { ++ this.newSize = Math.min(this.worldBorder.getMaxSize(), Math.max(1.0D, newSize)); ++ } ++ ++ /** ++ * Gets the time in milliseconds for the change. Will be 0 if instant. ++ * ++ * @return the time in milliseconds for the change ++ */ ++ public long getDuration() { ++ return this.duration; ++ } ++ ++ /** ++ * Sets the time in milliseconds for the change. Will change {@link #getType()} to return ++ * {@link Type#STARTED_MOVE}. ++ * ++ * @param duration the time in milliseconds for the change ++ */ ++ public void setDuration(long duration) { ++ // PAIL: TODO: Magic Values ++ this.duration = Math.min(9223372036854775L, Math.max(0L, duration)); ++ if (duration >= 0 && this.type == Type.INSTANT_MOVE) { ++ this.type = Type.STARTED_MOVE; ++ } ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ public enum Type { ++ STARTED_MOVE, ++ INSTANT_MOVE ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a44964593b7f78c5086dc4928e75ad892e624671 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.event.world.border; ++ ++import org.bukkit.World; ++import org.bukkit.WorldBorder; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a moving world border has finished its move. ++ */ ++public class WorldBorderBoundsChangeFinishEvent extends WorldBorderEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final double oldSize; ++ private final double newSize; ++ private final double duration; ++ ++ @ApiStatus.Internal ++ public WorldBorderBoundsChangeFinishEvent(@NotNull World world, @NotNull WorldBorder worldBorder, double oldSize, double newSize, double duration) { ++ super(world, worldBorder); ++ this.oldSize = oldSize; ++ this.newSize = newSize; ++ this.duration = duration; ++ } ++ ++ /** ++ * Gets the old size of the worldborder. ++ * ++ * @return the old size ++ */ ++ public double getOldSize() { ++ return this.oldSize; ++ } ++ ++ /** ++ * Gets the new size of the worldborder. ++ * ++ * @return the new size ++ */ ++ public double getNewSize() { ++ return this.newSize; ++ } ++ ++ /** ++ * Gets the duration this worldborder took to make the change. ++ *

++ * Can be 0 if handlers for {@link WorldBorderCenterChangeEvent} set the duration to 0. ++ * ++ * @return the duration of the transition ++ */ ++ public double getDuration() { ++ return this.duration; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dd96dcc0dd68d71bf27c758ed496153d434fb386 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java +@@ -0,0 +1,79 @@ ++package io.papermc.paper.event.world.border; ++ ++import org.bukkit.Location; ++import org.bukkit.World; ++import org.bukkit.WorldBorder; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a world border's center is changed. ++ */ ++public class WorldBorderCenterChangeEvent extends WorldBorderEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Location oldCenter; ++ private Location newCenter; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public WorldBorderCenterChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Location oldCenter, @NotNull Location newCenter) { ++ super(world, worldBorder); ++ this.oldCenter = oldCenter; ++ this.newCenter = newCenter; ++ } ++ ++ /** ++ * Gets the original center location of the world border. ++ * ++ * @return the old center ++ */ ++ @NotNull ++ public Location getOldCenter() { ++ return this.oldCenter.clone(); ++ } ++ ++ /** ++ * Gets the new center location for the world border. ++ * ++ * @return the new center ++ */ ++ @NotNull ++ public Location getNewCenter() { ++ return this.newCenter; ++ } ++ ++ /** ++ * Sets the new center location for the world border. Y coordinate is ignored. ++ * ++ * @param newCenter the new center ++ */ ++ public void setNewCenter(@NotNull Location newCenter) { ++ this.newCenter = newCenter; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..adb244f9be35c43ff99dbc3a771e1fdfb21da68c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java +@@ -0,0 +1,23 @@ ++package io.papermc.paper.event.world.border; ++ ++import org.bukkit.World; ++import org.bukkit.WorldBorder; ++import org.bukkit.event.world.WorldEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++public abstract class WorldBorderEvent extends WorldEvent { ++ ++ protected final WorldBorder worldBorder; ++ ++ @ApiStatus.Internal ++ protected WorldBorderEvent(@NotNull World world, @NotNull WorldBorder worldBorder) { ++ super(world); ++ this.worldBorder = worldBorder; ++ } ++ ++ @NotNull ++ public WorldBorder getWorldBorder() { ++ return this.worldBorder; ++ } ++} diff --git a/patches/api/0256-Cache-the-result-of-Material-isBlock.patch b/patches/api/0256-Cache-the-result-of-Material-isBlock.patch deleted file mode 100644 index b2322c2c4a..0000000000 --- a/patches/api/0256-Cache-the-result-of-Material-isBlock.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: Tue, 2 Mar 2021 15:24:58 -0800 -Subject: [PATCH] Cache the result of Material#isBlock - - -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 61e0739f002a949a204c7591dfa3074560d1459e..5aa595860c73e78cf3c9f2a8984c62744cfe5612 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -4684,6 +4684,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - public final Class data; - private final boolean legacy; - private final NamespacedKey key; -+ private boolean isBlock; // Paper - - private Material(final int id) { - this(id, 64); -@@ -4887,6 +4888,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * @return true if this material is a block - */ - public boolean isBlock() { -+ // Paper start - cache isBlock -+ return this.isBlock; -+ } -+ private boolean isBlock0() { -+ // Paper end - switch (this) { - // - case ACACIA_BUTTON: -@@ -6131,6 +6137,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - static { - for (Material material : values()) { - BY_NAME.put(material.name(), material); -+ material.isBlock = material.isBlock0(); // Paper - } - } - diff --git a/patches/api/0257-Add-worldborder-events.patch b/patches/api/0257-Add-worldborder-events.patch deleted file mode 100644 index 9f3ae70435..0000000000 --- a/patches/api/0257-Add-worldborder-events.patch +++ /dev/null @@ -1,316 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 4 Jan 2021 22:40:26 -0800 -Subject: [PATCH] Add worldborder events - - -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..02ac479840c137ca5afcec149ef884e5a5d62928 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java -@@ -0,0 +1,117 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a world border changes its bounds, either over time, or instantly. -+ */ -+public class WorldBorderBoundsChangeEvent extends WorldBorderEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private Type type; -+ private final double oldSize; -+ private double newSize; -+ private long duration; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WorldBorderBoundsChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Type type, double oldSize, double newSize, long duration) { -+ super(world, worldBorder); -+ this.type = type; -+ this.oldSize = oldSize; -+ this.newSize = newSize; -+ this.duration = duration; -+ } -+ -+ /** -+ * Gets if this change is an instant change or over-time change. -+ * -+ * @return the change type -+ */ -+ @NotNull -+ public Type getType() { -+ return this.type; -+ } -+ -+ /** -+ * Gets the old size or the world border. -+ * -+ * @return the old size -+ */ -+ public double getOldSize() { -+ return this.oldSize; -+ } -+ -+ /** -+ * Gets the new size of the world border. -+ * -+ * @return the new size -+ */ -+ public double getNewSize() { -+ return this.newSize; -+ } -+ -+ /** -+ * Sets the new size of the world border. -+ * -+ * @param newSize the new size -+ */ -+ public void setNewSize(double newSize) { -+ this.newSize = Math.min(this.worldBorder.getMaxSize(), Math.max(1.0D, newSize)); -+ } -+ -+ /** -+ * Gets the time in milliseconds for the change. Will be 0 if instant. -+ * -+ * @return the time in milliseconds for the change -+ */ -+ public long getDuration() { -+ return this.duration; -+ } -+ -+ /** -+ * Sets the time in milliseconds for the change. Will change {@link #getType()} to return -+ * {@link Type#STARTED_MOVE}. -+ * -+ * @param duration the time in milliseconds for the change -+ */ -+ public void setDuration(long duration) { -+ // PAIL: TODO: Magic Values -+ this.duration = Math.min(9223372036854775L, Math.max(0L, duration)); -+ if (duration >= 0 && this.type == Type.INSTANT_MOVE) { -+ this.type = Type.STARTED_MOVE; -+ } -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum Type { -+ STARTED_MOVE, -+ INSTANT_MOVE -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a44964593b7f78c5086dc4928e75ad892e624671 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java -@@ -0,0 +1,67 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a moving world border has finished its move. -+ */ -+public class WorldBorderBoundsChangeFinishEvent extends WorldBorderEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final double oldSize; -+ private final double newSize; -+ private final double duration; -+ -+ @ApiStatus.Internal -+ public WorldBorderBoundsChangeFinishEvent(@NotNull World world, @NotNull WorldBorder worldBorder, double oldSize, double newSize, double duration) { -+ super(world, worldBorder); -+ this.oldSize = oldSize; -+ this.newSize = newSize; -+ this.duration = duration; -+ } -+ -+ /** -+ * Gets the old size of the worldborder. -+ * -+ * @return the old size -+ */ -+ public double getOldSize() { -+ return this.oldSize; -+ } -+ -+ /** -+ * Gets the new size of the worldborder. -+ * -+ * @return the new size -+ */ -+ public double getNewSize() { -+ return this.newSize; -+ } -+ -+ /** -+ * Gets the duration this worldborder took to make the change. -+ *

-+ * Can be 0 if handlers for {@link WorldBorderCenterChangeEvent} set the duration to 0. -+ * -+ * @return the duration of the transition -+ */ -+ public double getDuration() { -+ return this.duration; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..dd96dcc0dd68d71bf27c758ed496153d434fb386 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java -@@ -0,0 +1,79 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a world border's center is changed. -+ */ -+public class WorldBorderCenterChangeEvent extends WorldBorderEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Location oldCenter; -+ private Location newCenter; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WorldBorderCenterChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Location oldCenter, @NotNull Location newCenter) { -+ super(world, worldBorder); -+ this.oldCenter = oldCenter; -+ this.newCenter = newCenter; -+ } -+ -+ /** -+ * Gets the original center location of the world border. -+ * -+ * @return the old center -+ */ -+ @NotNull -+ public Location getOldCenter() { -+ return this.oldCenter.clone(); -+ } -+ -+ /** -+ * Gets the new center location for the world border. -+ * -+ * @return the new center -+ */ -+ @NotNull -+ public Location getNewCenter() { -+ return this.newCenter; -+ } -+ -+ /** -+ * Sets the new center location for the world border. Y coordinate is ignored. -+ * -+ * @param newCenter the new center -+ */ -+ public void setNewCenter(@NotNull Location newCenter) { -+ this.newCenter = newCenter; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..adb244f9be35c43ff99dbc3a771e1fdfb21da68c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java -@@ -0,0 +1,23 @@ -+package io.papermc.paper.event.world.border; -+ -+import org.bukkit.World; -+import org.bukkit.WorldBorder; -+import org.bukkit.event.world.WorldEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+public abstract class WorldBorderEvent extends WorldEvent { -+ -+ protected final WorldBorder worldBorder; -+ -+ @ApiStatus.Internal -+ protected WorldBorderEvent(@NotNull World world, @NotNull WorldBorder worldBorder) { -+ super(world); -+ this.worldBorder = worldBorder; -+ } -+ -+ @NotNull -+ public WorldBorder getWorldBorder() { -+ return this.worldBorder; -+ } -+} diff --git a/patches/api/0257-added-PlayerNameEntityEvent.patch b/patches/api/0257-added-PlayerNameEntityEvent.patch new file mode 100644 index 0000000000..69bd20d13e --- /dev/null +++ b/patches/api/0257-added-PlayerNameEntityEvent.patch @@ -0,0 +1,122 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 5 Jul 2020 00:34:24 -0700 +Subject: [PATCH] added PlayerNameEntityEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java +new file mode 100755 +index 0000000000000000000000000000000000000000..84736d4a438e9023fbdeac1aea4d8b741cc39b61 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java +@@ -0,0 +1,110 @@ ++package io.papermc.paper.event.player; ++ ++import net.kyori.adventure.text.Component; ++import org.bukkit.entity.LivingEntity; ++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.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when the player is attempting to rename a mob ++ */ ++public class PlayerNameEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private LivingEntity entity; ++ private Component name; ++ private boolean persistent; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerNameEntityEvent(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Component name, boolean persistent) { ++ super(player); ++ this.entity = entity; ++ this.name = name; ++ this.persistent = persistent; ++ } ++ ++ /** ++ * Gets the name to be given to the entity. ++ * ++ * @return the name ++ */ ++ @Nullable ++ public Component getName() { ++ return this.name; ++ } ++ ++ /** ++ * Sets the name to be given to the entity. ++ * ++ * @param name the name ++ */ ++ public void setName(@Nullable Component name) { ++ this.name = name; ++ } ++ ++ /** ++ * Gets the entity involved in this event. ++ * ++ * @return the entity ++ */ ++ @NotNull ++ public LivingEntity getEntity() { ++ return this.entity; ++ } ++ ++ /** ++ * Sets the entity involved in this event. ++ * ++ * @param entity the entity ++ */ ++ public void setEntity(@NotNull LivingEntity entity) { ++ this.entity = entity; ++ } ++ ++ /** ++ * Gets whether this will set the mob to be persistent. ++ * ++ * @return persistent ++ */ ++ public boolean isPersistent() { ++ return this.persistent; ++ } ++ ++ /** ++ * Sets whether this will set the mob to be persistent. ++ * ++ * @param persistent persistent ++ */ ++ public void setPersistent(boolean persistent) { ++ this.persistent = persistent; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0258-Add-recipe-to-cook-events.patch b/patches/api/0258-Add-recipe-to-cook-events.patch new file mode 100644 index 0000000000..8c8712541e --- /dev/null +++ b/patches/api/0258-Add-recipe-to-cook-events.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> +Date: Wed, 6 Jan 2021 12:05:29 -0800 +Subject: [PATCH] Add recipe to cook events + + +diff --git a/src/main/java/org/bukkit/event/block/BlockCookEvent.java b/src/main/java/org/bukkit/event/block/BlockCookEvent.java +index be7af5440bf9923f0c9c84efa4d70a89337a2f96..a3f1c9cb36c9069ed622985a525bfc2a7a27ab91 100644 +--- a/src/main/java/org/bukkit/event/block/BlockCookEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockCookEvent.java +@@ -14,12 +14,21 @@ public class BlockCookEvent extends BlockEvent implements Cancellable { + private final ItemStack source; + private ItemStack result; + private boolean cancelled; ++ private final org.bukkit.inventory.CookingRecipe recipe; // Paper + ++ @Deprecated // Paper + public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result) { ++ // Paper start ++ this(block, source, result, null); ++ } ++ ++ public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe recipe) { ++ // Paper end + super(block); + this.source = source; + this.result = result; + this.cancelled = false; ++ this.recipe = recipe; // Paper + } + + /** +@@ -61,6 +70,18 @@ public class BlockCookEvent extends BlockEvent implements Cancellable { + this.cancelled = cancel; + } + ++ // Paper start ++ /** ++ * Gets the cooking recipe associated with this event. ++ * ++ * @return the recipe ++ */ ++ @org.jetbrains.annotations.Nullable ++ public org.bukkit.inventory.CookingRecipe getRecipe() { ++ return recipe; ++ } ++ // Paper end ++ + @NotNull + @Override + public HandlerList getHandlers() { +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java +index f8f9b08a0bd82a2667ae4e0c99dae9103f0db3f0..25478725bef34153bca204c815a167913b9cd389 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java +@@ -12,7 +12,13 @@ import org.jetbrains.annotations.NotNull; + */ + public class FurnaceSmeltEvent extends BlockCookEvent { + ++ @Deprecated // Paper + public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) { + super(furnace, source, result); + } ++ // Paper start ++ public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe recipe) { ++ super(furnace, source, result, recipe); ++ } ++ // Paper end + } diff --git a/patches/api/0258-added-PlayerNameEntityEvent.patch b/patches/api/0258-added-PlayerNameEntityEvent.patch deleted file mode 100644 index 69bd20d13e..0000000000 --- a/patches/api/0258-added-PlayerNameEntityEvent.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 5 Jul 2020 00:34:24 -0700 -Subject: [PATCH] added PlayerNameEntityEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java -new file mode 100755 -index 0000000000000000000000000000000000000000..84736d4a438e9023fbdeac1aea4d8b741cc39b61 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java -@@ -0,0 +1,110 @@ -+package io.papermc.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.LivingEntity; -+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.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when the player is attempting to rename a mob -+ */ -+public class PlayerNameEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private LivingEntity entity; -+ private Component name; -+ private boolean persistent; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerNameEntityEvent(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Component name, boolean persistent) { -+ super(player); -+ this.entity = entity; -+ this.name = name; -+ this.persistent = persistent; -+ } -+ -+ /** -+ * Gets the name to be given to the entity. -+ * -+ * @return the name -+ */ -+ @Nullable -+ public Component getName() { -+ return this.name; -+ } -+ -+ /** -+ * Sets the name to be given to the entity. -+ * -+ * @param name the name -+ */ -+ public void setName(@Nullable Component name) { -+ this.name = name; -+ } -+ -+ /** -+ * Gets the entity involved in this event. -+ * -+ * @return the entity -+ */ -+ @NotNull -+ public LivingEntity getEntity() { -+ return this.entity; -+ } -+ -+ /** -+ * Sets the entity involved in this event. -+ * -+ * @param entity the entity -+ */ -+ public void setEntity(@NotNull LivingEntity entity) { -+ this.entity = entity; -+ } -+ -+ /** -+ * Gets whether this will set the mob to be persistent. -+ * -+ * @return persistent -+ */ -+ public boolean isPersistent() { -+ return this.persistent; -+ } -+ -+ /** -+ * Sets whether this will set the mob to be persistent. -+ * -+ * @param persistent persistent -+ */ -+ public void setPersistent(boolean persistent) { -+ this.persistent = persistent; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0259-Add-Block-isValidTool.patch b/patches/api/0259-Add-Block-isValidTool.patch new file mode 100644 index 0000000000..835cf73b7a --- /dev/null +++ b/patches/api/0259-Add-Block-isValidTool.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 6 Jul 2020 12:44:23 -0700 +Subject: [PATCH] Add Block#isValidTool + + +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index c68ed7de2d50da4105dd38c0986f237e8c56b2d6..b5fe76a6353816a2d009dfa5921f8ada92984f34 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -230,6 +230,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr + public static int getBlockKeyZ(long packed) { + return (int) ((packed << 10) >> 37); + } ++ ++ /** ++ * Checks if the itemstack is a valid tool to ++ * break the block with ++ * ++ * @param itemStack The (tool) itemstack ++ * @return whether the block will drop items ++ */ ++ boolean isValidTool(@NotNull ItemStack itemStack); + // Paper end + + /** diff --git a/patches/api/0259-Add-recipe-to-cook-events.patch b/patches/api/0259-Add-recipe-to-cook-events.patch deleted file mode 100644 index 8c8712541e..0000000000 --- a/patches/api/0259-Add-recipe-to-cook-events.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> -Date: Wed, 6 Jan 2021 12:05:29 -0800 -Subject: [PATCH] Add recipe to cook events - - -diff --git a/src/main/java/org/bukkit/event/block/BlockCookEvent.java b/src/main/java/org/bukkit/event/block/BlockCookEvent.java -index be7af5440bf9923f0c9c84efa4d70a89337a2f96..a3f1c9cb36c9069ed622985a525bfc2a7a27ab91 100644 ---- a/src/main/java/org/bukkit/event/block/BlockCookEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockCookEvent.java -@@ -14,12 +14,21 @@ public class BlockCookEvent extends BlockEvent implements Cancellable { - private final ItemStack source; - private ItemStack result; - private boolean cancelled; -+ private final org.bukkit.inventory.CookingRecipe recipe; // Paper - -+ @Deprecated // Paper - public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result) { -+ // Paper start -+ this(block, source, result, null); -+ } -+ -+ public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe recipe) { -+ // Paper end - super(block); - this.source = source; - this.result = result; - this.cancelled = false; -+ this.recipe = recipe; // Paper - } - - /** -@@ -61,6 +70,18 @@ public class BlockCookEvent extends BlockEvent implements Cancellable { - this.cancelled = cancel; - } - -+ // Paper start -+ /** -+ * Gets the cooking recipe associated with this event. -+ * -+ * @return the recipe -+ */ -+ @org.jetbrains.annotations.Nullable -+ public org.bukkit.inventory.CookingRecipe getRecipe() { -+ return recipe; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { -diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java -index f8f9b08a0bd82a2667ae4e0c99dae9103f0db3f0..25478725bef34153bca204c815a167913b9cd389 100644 ---- a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java -@@ -12,7 +12,13 @@ import org.jetbrains.annotations.NotNull; - */ - public class FurnaceSmeltEvent extends BlockCookEvent { - -+ @Deprecated // Paper - public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) { - super(furnace, source, result); - } -+ // Paper start -+ public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe recipe) { -+ super(furnace, source, result, recipe); -+ } -+ // Paper end - } diff --git a/patches/api/0260-Add-Block-isValidTool.patch b/patches/api/0260-Add-Block-isValidTool.patch deleted file mode 100644 index 835cf73b7a..0000000000 --- a/patches/api/0260-Add-Block-isValidTool.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 6 Jul 2020 12:44:23 -0700 -Subject: [PATCH] Add Block#isValidTool - - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index c68ed7de2d50da4105dd38c0986f237e8c56b2d6..b5fe76a6353816a2d009dfa5921f8ada92984f34 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -230,6 +230,15 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - public static int getBlockKeyZ(long packed) { - return (int) ((packed << 10) >> 37); - } -+ -+ /** -+ * Checks if the itemstack is a valid tool to -+ * break the block with -+ * -+ * @param itemStack The (tool) itemstack -+ * @return whether the block will drop items -+ */ -+ boolean isValidTool(@NotNull ItemStack itemStack); - // Paper end - - /** diff --git a/patches/api/0260-Expand-world-key-API.patch b/patches/api/0260-Expand-world-key-API.patch new file mode 100644 index 0000000000..f419d2cbd1 --- /dev/null +++ b/patches/api/0260-Expand-world-key-API.patch @@ -0,0 +1,189 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 6 Jan 2021 00:34:10 -0800 +Subject: [PATCH] Expand world key API + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 7be6710d28dea19bd0f9054c1c2e32dacd355c45..8fd1de659777595d9d8198e7ee638ad5500a6317 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -864,6 +864,18 @@ public final class Bukkit { + public static World getWorld(@NotNull UUID uid) { + return server.getWorld(uid); + } ++ // Paper start ++ /** ++ * Gets the world from the given NamespacedKey ++ * ++ * @param worldKey the NamespacedKey of the world to retrieve ++ * @return a world with the given NamespacedKey, or null if none exists ++ */ ++ @Nullable ++ public static World getWorld(@NotNull NamespacedKey worldKey) { ++ return server.getWorld(worldKey); ++ } ++ // Paper end + + /** + * Create a new virtual {@link WorldBorder}. +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1d570ed88 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable; + * A RegionAccessor gives access to getting, modifying and spawning {@link Biome}, {@link BlockState} and {@link Entity}, + * as well as generating some basic structures. + */ +-public interface RegionAccessor { ++public interface RegionAccessor extends Keyed { // Paper + + /** + * Gets the {@link Biome} at the given {@link Location}. +@@ -452,5 +452,14 @@ public interface RegionAccessor { + */ + @NotNull + io.papermc.paper.world.MoonPhase getMoonPhase(); ++ ++ /** ++ * Get the world's key ++ * ++ * @return the world's key ++ */ ++ @NotNull ++ @Override ++ NamespacedKey getKey(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 5644af8154373923791e3ed5f8b01c3f5d357b9c..efd612c1df363bd9c8f1ae0ea70c884af532efc3 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -722,6 +722,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @Nullable + public World getWorld(@NotNull UUID uid); + ++ // Paper start ++ /** ++ * Gets the world from the given NamespacedKey ++ * ++ * @param worldKey the NamespacedKey of the world to retrieve ++ * @return a world with the given NamespacedKey, or null if none exists ++ */ ++ @Nullable ++ public World getWorld(@NotNull NamespacedKey worldKey); ++ // Paper end ++ + /** + * Create a new virtual {@link WorldBorder}. + *

+diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 5e817e3372edc381bc1d3b993686cbeaa5daac34..0bd07a92614e39385859d74a016184d78b8f58e3 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -165,5 +165,10 @@ public interface UnsafeValues { + * Use this when sending custom packets, so that there are no collisions on the client or server. + */ + public int nextEntityId(); ++ ++ /** ++ * Just don't use it. ++ */ ++ @org.jetbrains.annotations.NotNull String getMainLevelName(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java +index 27537aeabd3bd1b5383e6ecf775aa89e033aa2bc..afc0ce2eaa7cf48d1255fec7377103b1f7a99734 100644 +--- a/src/main/java/org/bukkit/WorldCreator.java ++++ b/src/main/java/org/bukkit/WorldCreator.java +@@ -13,6 +13,7 @@ import org.jetbrains.annotations.Nullable; + * Represents various types of options that may be used to create a world. + */ + public class WorldCreator { ++ private final NamespacedKey key; // Paper + private final String name; + private long seed; + private World.Environment environment = World.Environment.NORMAL; +@@ -30,11 +31,80 @@ public class WorldCreator { + * @param name Name of the world that will be created + */ + public WorldCreator(@NotNull String name) { +- Preconditions.checkArgument(name != null, "World name cannot be null"); ++ // Paper start ++ this(name, getWorldKey(name)); ++ } ++ ++ private static NamespacedKey getWorldKey(String name) { ++ final String mainLevelName = Bukkit.getUnsafe().getMainLevelName(); ++ if (name.equals(mainLevelName)) { ++ return NamespacedKey.minecraft("overworld"); ++ } else if (name.equals(mainLevelName + "_nether")) { ++ return NamespacedKey.minecraft("the_nether"); ++ } else if (name.equals(mainLevelName + "_the_end")) { ++ return NamespacedKey.minecraft("the_end"); ++ } else { ++ return NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_")); ++ } ++ } + +- this.name = name; ++ /** ++ * Creates an empty WorldCreator for the given world name and key ++ * ++ * @param levelName LevelName of the world that will be created ++ * @param worldKey NamespacedKey of the world that will be created ++ */ ++ public WorldCreator(@NotNull String levelName, @NotNull NamespacedKey worldKey) { ++ if (levelName == null || worldKey == null) { ++ throw new IllegalArgumentException("World name and key cannot be null"); ++ } ++ this.name = levelName; + this.seed = (new Random()).nextLong(); ++ this.key = worldKey; ++ } ++ ++ /** ++ * Creates an empty WorldCreator for the given key. ++ * LevelName will be the Key part of the NamespacedKey. ++ * ++ * @param worldKey NamespacedKey of the world that will be created ++ */ ++ public WorldCreator(@NotNull NamespacedKey worldKey) { ++ this(worldKey.getKey(), worldKey); ++ } ++ ++ /** ++ * Gets the key for this WorldCreator ++ * ++ * @return the key ++ */ ++ @NotNull ++ public NamespacedKey key() { ++ return key; ++ } ++ ++ /** ++ * Creates an empty WorldCreator for the given world name and key ++ * ++ * @param levelName LevelName of the world that will be created ++ * @param worldKey NamespacedKey of the world that will be created ++ */ ++ @NotNull ++ public static WorldCreator ofNameAndKey(@NotNull String levelName, @NotNull NamespacedKey worldKey) { ++ return new WorldCreator(levelName, worldKey); ++ } ++ ++ /** ++ * Creates an empty WorldCreator for the given key. ++ * LevelName will be the Key part of the NamespacedKey. ++ * ++ * @param worldKey NamespacedKey of the world that will be created ++ */ ++ @NotNull ++ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) { ++ return new WorldCreator(worldKey); + } ++ // Paper end + + /** + * Copies the options from the specified world diff --git a/patches/api/0261-Expand-world-key-API.patch b/patches/api/0261-Expand-world-key-API.patch deleted file mode 100644 index 0beb2158ec..0000000000 --- a/patches/api/0261-Expand-world-key-API.patch +++ /dev/null @@ -1,189 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 6 Jan 2021 00:34:10 -0800 -Subject: [PATCH] Expand world key API - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 732ed3724e784ad659cb4411dbd73b42a8330a2c..d078ea797cf4c6ab291aec3ad7fbd4740017286c 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -864,6 +864,18 @@ public final class Bukkit { - public static World getWorld(@NotNull UUID uid) { - return server.getWorld(uid); - } -+ // Paper start -+ /** -+ * Gets the world from the given NamespacedKey -+ * -+ * @param worldKey the NamespacedKey of the world to retrieve -+ * @return a world with the given NamespacedKey, or null if none exists -+ */ -+ @Nullable -+ public static World getWorld(@NotNull NamespacedKey worldKey) { -+ return server.getWorld(worldKey); -+ } -+ // Paper end - - /** - * Create a new virtual {@link WorldBorder}. -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1d570ed88 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable; - * A RegionAccessor gives access to getting, modifying and spawning {@link Biome}, {@link BlockState} and {@link Entity}, - * as well as generating some basic structures. - */ --public interface RegionAccessor { -+public interface RegionAccessor extends Keyed { // Paper - - /** - * Gets the {@link Biome} at the given {@link Location}. -@@ -452,5 +452,14 @@ public interface RegionAccessor { - */ - @NotNull - io.papermc.paper.world.MoonPhase getMoonPhase(); -+ -+ /** -+ * Get the world's key -+ * -+ * @return the world's key -+ */ -+ @NotNull -+ @Override -+ NamespacedKey getKey(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 395f7910f535bfd33a5676b011ab62a53e30e140..e6598c36cfc98282f30a57105986a295f1c94676 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -722,6 +722,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @Nullable - public World getWorld(@NotNull UUID uid); - -+ // Paper start -+ /** -+ * Gets the world from the given NamespacedKey -+ * -+ * @param worldKey the NamespacedKey of the world to retrieve -+ * @return a world with the given NamespacedKey, or null if none exists -+ */ -+ @Nullable -+ public World getWorld(@NotNull NamespacedKey worldKey); -+ // Paper end -+ - /** - * Create a new virtual {@link WorldBorder}. - *

-diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 241cb853476ea35dad73d0234b2d030e9af23476..5de86f8cd3cc7f7e8ebc4a22d3921273378704f2 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -164,5 +164,10 @@ public interface UnsafeValues { - * Use this when sending custom packets, so that there are no collisions on the client or server. - */ - public int nextEntityId(); -+ -+ /** -+ * Just don't use it. -+ */ -+ @org.jetbrains.annotations.NotNull String getMainLevelName(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java -index 27537aeabd3bd1b5383e6ecf775aa89e033aa2bc..afc0ce2eaa7cf48d1255fec7377103b1f7a99734 100644 ---- a/src/main/java/org/bukkit/WorldCreator.java -+++ b/src/main/java/org/bukkit/WorldCreator.java -@@ -13,6 +13,7 @@ import org.jetbrains.annotations.Nullable; - * Represents various types of options that may be used to create a world. - */ - public class WorldCreator { -+ private final NamespacedKey key; // Paper - private final String name; - private long seed; - private World.Environment environment = World.Environment.NORMAL; -@@ -30,11 +31,80 @@ public class WorldCreator { - * @param name Name of the world that will be created - */ - public WorldCreator(@NotNull String name) { -- Preconditions.checkArgument(name != null, "World name cannot be null"); -+ // Paper start -+ this(name, getWorldKey(name)); -+ } -+ -+ private static NamespacedKey getWorldKey(String name) { -+ final String mainLevelName = Bukkit.getUnsafe().getMainLevelName(); -+ if (name.equals(mainLevelName)) { -+ return NamespacedKey.minecraft("overworld"); -+ } else if (name.equals(mainLevelName + "_nether")) { -+ return NamespacedKey.minecraft("the_nether"); -+ } else if (name.equals(mainLevelName + "_the_end")) { -+ return NamespacedKey.minecraft("the_end"); -+ } else { -+ return NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_")); -+ } -+ } - -- this.name = name; -+ /** -+ * Creates an empty WorldCreator for the given world name and key -+ * -+ * @param levelName LevelName of the world that will be created -+ * @param worldKey NamespacedKey of the world that will be created -+ */ -+ public WorldCreator(@NotNull String levelName, @NotNull NamespacedKey worldKey) { -+ if (levelName == null || worldKey == null) { -+ throw new IllegalArgumentException("World name and key cannot be null"); -+ } -+ this.name = levelName; - this.seed = (new Random()).nextLong(); -+ this.key = worldKey; -+ } -+ -+ /** -+ * Creates an empty WorldCreator for the given key. -+ * LevelName will be the Key part of the NamespacedKey. -+ * -+ * @param worldKey NamespacedKey of the world that will be created -+ */ -+ public WorldCreator(@NotNull NamespacedKey worldKey) { -+ this(worldKey.getKey(), worldKey); -+ } -+ -+ /** -+ * Gets the key for this WorldCreator -+ * -+ * @return the key -+ */ -+ @NotNull -+ public NamespacedKey key() { -+ return key; -+ } -+ -+ /** -+ * Creates an empty WorldCreator for the given world name and key -+ * -+ * @param levelName LevelName of the world that will be created -+ * @param worldKey NamespacedKey of the world that will be created -+ */ -+ @NotNull -+ public static WorldCreator ofNameAndKey(@NotNull String levelName, @NotNull NamespacedKey worldKey) { -+ return new WorldCreator(levelName, worldKey); -+ } -+ -+ /** -+ * Creates an empty WorldCreator for the given key. -+ * LevelName will be the Key part of the NamespacedKey. -+ * -+ * @param worldKey NamespacedKey of the world that will be created -+ */ -+ @NotNull -+ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) { -+ return new WorldCreator(worldKey); - } -+ // Paper end - - /** - * Copies the options from the specified world diff --git a/patches/api/0261-Improve-Item-Rarity-API.patch b/patches/api/0261-Improve-Item-Rarity-API.patch new file mode 100644 index 0000000000..6080352888 --- /dev/null +++ b/patches/api/0261-Improve-Item-Rarity-API.patch @@ -0,0 +1,131 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 12 Mar 2021 17:09:40 -0800 +Subject: [PATCH] Improve Item Rarity API + + +diff --git a/src/main/java/io/papermc/paper/inventory/ItemRarity.java b/src/main/java/io/papermc/paper/inventory/ItemRarity.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f1cd5a4f37eee8975ac3d0421b524afcf644fafd +--- /dev/null ++++ b/src/main/java/io/papermc/paper/inventory/ItemRarity.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.inventory; ++ ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.format.TextColor; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * @deprecated use {@link org.bukkit.inventory.ItemRarity} with {@link org.bukkit.inventory.meta.ItemMeta#getRarity()} ++ */ ++@Deprecated(forRemoval = true, since = "1.20.5") ++public enum ItemRarity { ++ ++ COMMON(NamedTextColor.WHITE), ++ UNCOMMON(NamedTextColor.YELLOW), ++ RARE(NamedTextColor.AQUA), ++ EPIC(NamedTextColor.LIGHT_PURPLE); ++ ++ TextColor color; ++ ++ ItemRarity(TextColor color) { ++ this.color = color; ++ } ++ ++ /** ++ * Gets the color formatting associated with the rarity. ++ * @return ++ */ ++ @NotNull ++ public TextColor getColor() { ++ return color; ++ } ++} +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 5aa595860c73e78cf3c9f2a8984c62744cfe5612..1e4ebe9bdc6aadf18029377e7ce70ca0d88bd1a1 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -4750,6 +4750,19 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + return Bukkit.getUnsafe().getBlockTranslationKey(this); + } + } ++ ++ /** ++ * Returns the item rarity for the item. The Material MUST be an Item not a block. ++ * Use {@link #isItem()} before this. ++ * ++ * @return the item rarity ++ * @deprecated use {@link org.bukkit.inventory.meta.ItemMeta#hasRarity()} and {@link org.bukkit.inventory.meta.ItemMeta#getRarity()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ public io.papermc.paper.inventory.ItemRarity getItemRarity() { ++ return new org.bukkit.inventory.ItemStack(this).getRarity(); ++ } + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/inventory/ItemRarity.java b/src/main/java/org/bukkit/inventory/ItemRarity.java +index e7931f73f10fe35ebd5fe4a04b036d53bb117ebd..cbce835ed6d44e5b8c9aaae4e36a77f8e5bed45f 100644 +--- a/src/main/java/org/bukkit/inventory/ItemRarity.java ++++ b/src/main/java/org/bukkit/inventory/ItemRarity.java +@@ -9,17 +9,32 @@ public enum ItemRarity { + /** + * White item name. + */ +- COMMON, ++ COMMON(net.kyori.adventure.text.format.NamedTextColor.WHITE), // Paper + /** + * Yellow item name. + */ +- UNCOMMON, ++ UNCOMMON(net.kyori.adventure.text.format.NamedTextColor.YELLOW), // Paper + /** + * Aqua item name. + */ +- RARE, ++ RARE(net.kyori.adventure.text.format.NamedTextColor.AQUA), // Paper + /** + * Light purple item name. + */ +- EPIC; ++ EPIC(net.kyori.adventure.text.format.NamedTextColor.LIGHT_PURPLE); // Paper ++ // Paper start - improve ItemRarity ++ private final net.kyori.adventure.text.format.NamedTextColor color; ++ ItemRarity(final net.kyori.adventure.text.format.NamedTextColor color) { ++ this.color = color; ++ } ++ ++ /** ++ * Gets the color formatting associated with this rarity. ++ * ++ * @return the color ++ */ ++ public net.kyori.adventure.text.format.@org.jetbrains.annotations.NotNull TextColor color() { ++ return this.color; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 645cff10eef90826bb44bbe937b141289f182cde..a92421bbf0ee40ecbe4f272459c6a918dc45344c 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -891,5 +891,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + public @NotNull String translationKey() { + return Bukkit.getUnsafe().getTranslationKey(this); + } ++ ++ /** ++ * Gets the item rarity of the itemstack. The rarity can change based on enchantments. ++ * ++ * @return the itemstack rarity ++ * @deprecated Use {@link ItemMeta#hasRarity()} and {@link ItemMeta#getRarity()} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ public io.papermc.paper.inventory.ItemRarity getRarity() { ++ return io.papermc.paper.inventory.ItemRarity.valueOf(this.getItemMeta().getRarity().name()); ++ } + // Paper end + } diff --git a/patches/api/0262-Expose-protocol-version.patch b/patches/api/0262-Expose-protocol-version.patch new file mode 100644 index 0000000000..3c5153dc6b --- /dev/null +++ b/patches/api/0262-Expose-protocol-version.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Fri, 26 Mar 2021 11:23:27 +0100 +Subject: [PATCH] Expose protocol version + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 0bd07a92614e39385859d74a016184d78b8f58e3..5f2d521a54d03a2270a1812146f954dc16c9d728 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -170,5 +170,12 @@ public interface UnsafeValues { + * Just don't use it. + */ + @org.jetbrains.annotations.NotNull String getMainLevelName(); ++ ++ /** ++ * Returns the server's protocol version. ++ * ++ * @return the server's protocol version ++ */ ++ int getProtocolVersion(); + // Paper end + } diff --git a/patches/api/0262-Improve-Item-Rarity-API.patch b/patches/api/0262-Improve-Item-Rarity-API.patch deleted file mode 100644 index 6080352888..0000000000 --- a/patches/api/0262-Improve-Item-Rarity-API.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 12 Mar 2021 17:09:40 -0800 -Subject: [PATCH] Improve Item Rarity API - - -diff --git a/src/main/java/io/papermc/paper/inventory/ItemRarity.java b/src/main/java/io/papermc/paper/inventory/ItemRarity.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f1cd5a4f37eee8975ac3d0421b524afcf644fafd ---- /dev/null -+++ b/src/main/java/io/papermc/paper/inventory/ItemRarity.java -@@ -0,0 +1,32 @@ -+package io.papermc.paper.inventory; -+ -+import net.kyori.adventure.text.format.NamedTextColor; -+import net.kyori.adventure.text.format.TextColor; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * @deprecated use {@link org.bukkit.inventory.ItemRarity} with {@link org.bukkit.inventory.meta.ItemMeta#getRarity()} -+ */ -+@Deprecated(forRemoval = true, since = "1.20.5") -+public enum ItemRarity { -+ -+ COMMON(NamedTextColor.WHITE), -+ UNCOMMON(NamedTextColor.YELLOW), -+ RARE(NamedTextColor.AQUA), -+ EPIC(NamedTextColor.LIGHT_PURPLE); -+ -+ TextColor color; -+ -+ ItemRarity(TextColor color) { -+ this.color = color; -+ } -+ -+ /** -+ * Gets the color formatting associated with the rarity. -+ * @return -+ */ -+ @NotNull -+ public TextColor getColor() { -+ return color; -+ } -+} -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 5aa595860c73e78cf3c9f2a8984c62744cfe5612..1e4ebe9bdc6aadf18029377e7ce70ca0d88bd1a1 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -4750,6 +4750,19 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - return Bukkit.getUnsafe().getBlockTranslationKey(this); - } - } -+ -+ /** -+ * Returns the item rarity for the item. The Material MUST be an Item not a block. -+ * Use {@link #isItem()} before this. -+ * -+ * @return the item rarity -+ * @deprecated use {@link org.bukkit.inventory.meta.ItemMeta#hasRarity()} and {@link org.bukkit.inventory.meta.ItemMeta#getRarity()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ public io.papermc.paper.inventory.ItemRarity getItemRarity() { -+ return new org.bukkit.inventory.ItemStack(this).getRarity(); -+ } - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/inventory/ItemRarity.java b/src/main/java/org/bukkit/inventory/ItemRarity.java -index e7931f73f10fe35ebd5fe4a04b036d53bb117ebd..cbce835ed6d44e5b8c9aaae4e36a77f8e5bed45f 100644 ---- a/src/main/java/org/bukkit/inventory/ItemRarity.java -+++ b/src/main/java/org/bukkit/inventory/ItemRarity.java -@@ -9,17 +9,32 @@ public enum ItemRarity { - /** - * White item name. - */ -- COMMON, -+ COMMON(net.kyori.adventure.text.format.NamedTextColor.WHITE), // Paper - /** - * Yellow item name. - */ -- UNCOMMON, -+ UNCOMMON(net.kyori.adventure.text.format.NamedTextColor.YELLOW), // Paper - /** - * Aqua item name. - */ -- RARE, -+ RARE(net.kyori.adventure.text.format.NamedTextColor.AQUA), // Paper - /** - * Light purple item name. - */ -- EPIC; -+ EPIC(net.kyori.adventure.text.format.NamedTextColor.LIGHT_PURPLE); // Paper -+ // Paper start - improve ItemRarity -+ private final net.kyori.adventure.text.format.NamedTextColor color; -+ ItemRarity(final net.kyori.adventure.text.format.NamedTextColor color) { -+ this.color = color; -+ } -+ -+ /** -+ * Gets the color formatting associated with this rarity. -+ * -+ * @return the color -+ */ -+ public net.kyori.adventure.text.format.@org.jetbrains.annotations.NotNull TextColor color() { -+ return this.color; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 645cff10eef90826bb44bbe937b141289f182cde..a92421bbf0ee40ecbe4f272459c6a918dc45344c 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -891,5 +891,17 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - public @NotNull String translationKey() { - return Bukkit.getUnsafe().getTranslationKey(this); - } -+ -+ /** -+ * Gets the item rarity of the itemstack. The rarity can change based on enchantments. -+ * -+ * @return the itemstack rarity -+ * @deprecated Use {@link ItemMeta#hasRarity()} and {@link ItemMeta#getRarity()} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ public io.papermc.paper.inventory.ItemRarity getRarity() { -+ return io.papermc.paper.inventory.ItemRarity.valueOf(this.getItemMeta().getRarity().name()); -+ } - // Paper end - } diff --git a/patches/api/0263-Expose-protocol-version.patch b/patches/api/0263-Expose-protocol-version.patch deleted file mode 100644 index 0450fa0966..0000000000 --- a/patches/api/0263-Expose-protocol-version.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Fri, 26 Mar 2021 11:23:27 +0100 -Subject: [PATCH] Expose protocol version - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 5de86f8cd3cc7f7e8ebc4a22d3921273378704f2..a874faec93468c83fc475b60629fc36f933bd11c 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -169,5 +169,12 @@ public interface UnsafeValues { - * Just don't use it. - */ - @org.jetbrains.annotations.NotNull String getMainLevelName(); -+ -+ /** -+ * Returns the server's protocol version. -+ * -+ * @return the server's protocol version -+ */ -+ int getProtocolVersion(); - // Paper end - } diff --git a/patches/api/0263-add-isDeeplySleeping-to-HumanEntity.patch b/patches/api/0263-add-isDeeplySleeping-to-HumanEntity.patch new file mode 100644 index 0000000000..45207a6064 --- /dev/null +++ b/patches/api/0263-add-isDeeplySleeping-to-HumanEntity.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 8 Apr 2021 17:36:15 -0700 +Subject: [PATCH] add isDeeplySleeping to HumanEntity + + +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index 083d5798ccc7f37c6df5e234c7ef233202102b8f..a47ea595c2a23b361a56f13877b67892ecfed826 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -358,6 +358,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + void setHurtDirection(float hurtDirection); + // Paper end + ++ // Paper start ++ /** ++ * If the player has slept enough to count towards passing the night. ++ * ++ * @return true if the player has slept enough ++ */ ++ public boolean isDeeplySleeping(); ++ // Paper end ++ + /** + * Get the sleep ticks of the player. This value may be capped. + * diff --git a/patches/api/0264-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/api/0264-add-consumeFuel-to-FurnaceBurnEvent.patch new file mode 100644 index 0000000000..07036efb43 --- /dev/null +++ b/patches/api/0264-add-consumeFuel-to-FurnaceBurnEvent.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 22 Apr 2021 16:45:15 -0700 +Subject: [PATCH] add consumeFuel to FurnaceBurnEvent + + +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java +index 24077da8e6a7937f66eafc6779206055cf82e8d2..ba4dc8aed85169e55cac276bdd51116919305019 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java +@@ -18,6 +18,7 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable { + private int burnTime; + private boolean cancelled; + private boolean burning; ++ private boolean consumeFuel = true; // Paper + + public FurnaceBurnEvent(@NotNull final Block furnace, @NotNull final ItemStack fuel, final int burnTime) { + super(furnace); +@@ -72,6 +73,25 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable { + public void setBurning(boolean burning) { + this.burning = burning; + } ++ // Paper start ++ /** ++ * Gets whether the furnace's fuel will be consumed or not. ++ * ++ * @return whether the furnace's fuel will be consumed ++ */ ++ public boolean willConsumeFuel() { ++ return consumeFuel; ++ } ++ ++ /** ++ * Sets whether the furnace's fuel will be consumed or not. ++ * ++ * @param consumeFuel true to consume the fuel ++ */ ++ public void setConsumeFuel(boolean consumeFuel) { ++ this.consumeFuel = consumeFuel; ++ } ++ // Paper end + + @Override + public boolean isCancelled() { diff --git a/patches/api/0264-add-isDeeplySleeping-to-HumanEntity.patch b/patches/api/0264-add-isDeeplySleeping-to-HumanEntity.patch deleted file mode 100644 index 45207a6064..0000000000 --- a/patches/api/0264-add-isDeeplySleeping-to-HumanEntity.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 8 Apr 2021 17:36:15 -0700 -Subject: [PATCH] add isDeeplySleeping to HumanEntity - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 083d5798ccc7f37c6df5e234c7ef233202102b8f..a47ea595c2a23b361a56f13877b67892ecfed826 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -358,6 +358,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - void setHurtDirection(float hurtDirection); - // Paper end - -+ // Paper start -+ /** -+ * If the player has slept enough to count towards passing the night. -+ * -+ * @return true if the player has slept enough -+ */ -+ public boolean isDeeplySleeping(); -+ // Paper end -+ - /** - * Get the sleep ticks of the player. This value may be capped. - * diff --git a/patches/api/0265-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/api/0265-add-consumeFuel-to-FurnaceBurnEvent.patch deleted file mode 100644 index 07036efb43..0000000000 --- a/patches/api/0265-add-consumeFuel-to-FurnaceBurnEvent.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 22 Apr 2021 16:45:15 -0700 -Subject: [PATCH] add consumeFuel to FurnaceBurnEvent - - -diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java -index 24077da8e6a7937f66eafc6779206055cf82e8d2..ba4dc8aed85169e55cac276bdd51116919305019 100644 ---- a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java -@@ -18,6 +18,7 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable { - private int burnTime; - private boolean cancelled; - private boolean burning; -+ private boolean consumeFuel = true; // Paper - - public FurnaceBurnEvent(@NotNull final Block furnace, @NotNull final ItemStack fuel, final int burnTime) { - super(furnace); -@@ -72,6 +73,25 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable { - public void setBurning(boolean burning) { - this.burning = burning; - } -+ // Paper start -+ /** -+ * Gets whether the furnace's fuel will be consumed or not. -+ * -+ * @return whether the furnace's fuel will be consumed -+ */ -+ public boolean willConsumeFuel() { -+ return consumeFuel; -+ } -+ -+ /** -+ * Sets whether the furnace's fuel will be consumed or not. -+ * -+ * @param consumeFuel true to consume the fuel -+ */ -+ public void setConsumeFuel(boolean consumeFuel) { -+ this.consumeFuel = consumeFuel; -+ } -+ // Paper end - - @Override - public boolean isCancelled() { diff --git a/patches/api/0265-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/api/0265-add-get-set-drop-chance-to-EntityEquipment.patch new file mode 100644 index 0000000000..d75f180c94 --- /dev/null +++ b/patches/api/0265-add-get-set-drop-chance-to-EntityEquipment.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 22 Apr 2021 00:28:20 -0700 +Subject: [PATCH] add get-set drop chance to EntityEquipment + + +diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java +index 127302aa7c22f59438de66fffa0b03ae84a2a8ad..1b34286fb6cbedb3841c84c499eb626f61885126 100644 +--- a/src/main/java/org/bukkit/inventory/EntityEquipment.java ++++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java +@@ -527,4 +527,34 @@ public interface EntityEquipment { + */ + @NotNull // Paper + Entity getHolder(); ++ // Paper start ++ /** ++ * Gets the drop chance of specified slot. ++ * ++ *

    ++ *
  • A drop chance of 0.0F will never drop ++ *
  • A drop chance of 1.0F will always drop if killed by a player ++ *
  • A drop chance of greater than 1.0F will always drop if killed by anything ++ *
++ * ++ * @param slot the slot to get the drop chance of ++ * @return the drop chance for the slot ++ */ ++ float getDropChance(@NotNull EquipmentSlot slot); ++ ++ /** ++ * Sets the drop chance of the specified slot. ++ * ++ *
    ++ *
  • A drop chance of 0.0F will never drop ++ *
  • A drop chance of 1.0F will always drop if killed by a player ++ *
  • A drop chance of greater than 1.0F will always drop if killed by anything ++ *
++ * ++ * @param slot the slot to set the drop chance of ++ * @param chance the drop chance for the slot ++ * @throws UnsupportedOperationException when called on non-{@link Mob} entities ++ */ ++ void setDropChance(@NotNull EquipmentSlot slot, float chance); ++ // Paper end + } diff --git a/patches/api/0266-Added-PlayerDeepSleepEvent.patch b/patches/api/0266-Added-PlayerDeepSleepEvent.patch new file mode 100644 index 0000000000..b333894788 --- /dev/null +++ b/patches/api/0266-Added-PlayerDeepSleepEvent.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 21 Apr 2021 15:58:25 -0700 +Subject: [PATCH] Added PlayerDeepSleepEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..54cf2ec5e025fac9a0c8f151ff4f8c83a62b8405 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java +@@ -0,0 +1,48 @@ ++package io.papermc.paper.event.player; ++ ++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.NotNull; ++ ++/** ++ * Called when a player has slept long enough ++ * to count as passing the night/storm. ++ *

++ * Cancelling this event will prevent the player from being counted as deeply sleeping ++ * unless they exit and re-enter the bed. ++ */ ++public class PlayerDeepSleepEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerDeepSleepEvent(@NotNull Player player) { ++ super(player); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0266-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/api/0266-add-get-set-drop-chance-to-EntityEquipment.patch deleted file mode 100644 index d75f180c94..0000000000 --- a/patches/api/0266-add-get-set-drop-chance-to-EntityEquipment.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 22 Apr 2021 00:28:20 -0700 -Subject: [PATCH] add get-set drop chance to EntityEquipment - - -diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java -index 127302aa7c22f59438de66fffa0b03ae84a2a8ad..1b34286fb6cbedb3841c84c499eb626f61885126 100644 ---- a/src/main/java/org/bukkit/inventory/EntityEquipment.java -+++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java -@@ -527,4 +527,34 @@ public interface EntityEquipment { - */ - @NotNull // Paper - Entity getHolder(); -+ // Paper start -+ /** -+ * Gets the drop chance of specified slot. -+ * -+ *

    -+ *
  • A drop chance of 0.0F will never drop -+ *
  • A drop chance of 1.0F will always drop if killed by a player -+ *
  • A drop chance of greater than 1.0F will always drop if killed by anything -+ *
-+ * -+ * @param slot the slot to get the drop chance of -+ * @return the drop chance for the slot -+ */ -+ float getDropChance(@NotNull EquipmentSlot slot); -+ -+ /** -+ * Sets the drop chance of the specified slot. -+ * -+ *
    -+ *
  • A drop chance of 0.0F will never drop -+ *
  • A drop chance of 1.0F will always drop if killed by a player -+ *
  • A drop chance of greater than 1.0F will always drop if killed by anything -+ *
-+ * -+ * @param slot the slot to set the drop chance of -+ * @param chance the drop chance for the slot -+ * @throws UnsupportedOperationException when called on non-{@link Mob} entities -+ */ -+ void setDropChance(@NotNull EquipmentSlot slot, float chance); -+ // Paper end - } diff --git a/patches/api/0267-Added-PlayerDeepSleepEvent.patch b/patches/api/0267-Added-PlayerDeepSleepEvent.patch deleted file mode 100644 index b333894788..0000000000 --- a/patches/api/0267-Added-PlayerDeepSleepEvent.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 21 Apr 2021 15:58:25 -0700 -Subject: [PATCH] Added PlayerDeepSleepEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..54cf2ec5e025fac9a0c8f151ff4f8c83a62b8405 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java -@@ -0,0 +1,48 @@ -+package io.papermc.paper.event.player; -+ -+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.NotNull; -+ -+/** -+ * Called when a player has slept long enough -+ * to count as passing the night/storm. -+ *

-+ * Cancelling this event will prevent the player from being counted as deeply sleeping -+ * unless they exit and re-enter the bed. -+ */ -+public class PlayerDeepSleepEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerDeepSleepEvent(@NotNull Player player) { -+ super(player); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0267-More-World-API.patch b/patches/api/0267-More-World-API.patch new file mode 100644 index 0000000000..7340819de5 --- /dev/null +++ b/patches/api/0267-More-World-API.patch @@ -0,0 +1,133 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 7 Jul 2020 10:53:22 -0700 +Subject: [PATCH] More World API + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 77314fdbd99a5cc34e7a1df4692ba8a1685ef002..f4d31d9d0f4cbd2621adf97a20b65ae83e5fd064 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -3849,6 +3849,122 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @Nullable + StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); + ++ // Paper start ++ /** ++ * Locates the nearest biome based on an origin, biome type, and radius to search. ++ * Step defaults to {@code 8}. ++ * ++ * @param origin Origin location ++ * @param biome Biome to find ++ * @param radius radius to search ++ * @return Location of biome or null if not found in specified radius ++ * @deprecated use {@link #locateNearestBiome(Location, int, Biome...)} ++ */ ++ @Deprecated ++ @Nullable ++ default Location locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius) { ++ return java.util.Optional.ofNullable(this.locateNearestBiome(origin, radius, 8, 8, biome)).map(BiomeSearchResult::getLocation).orElse(null); ++ } ++ ++ /** ++ * Locates the nearest biome based on an origin, biome type, and radius to search ++ * and step ++ * ++ * @param origin Origin location ++ * @param biome Biome to find ++ * @param radius radius to search ++ * @param step Search step 1 would mean checking every block, 8 would be every 8th block ++ * @return Location of biome or null if not found in specified radius ++ * @deprecated use {@link #locateNearestBiome(Location, int, int, int, Biome...)} ++ */ ++ @Deprecated ++ @Nullable ++ default Location locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius, int step) { ++ return java.util.Optional.ofNullable(this.locateNearestBiome(origin, radius, step, step, biome)).map(BiomeSearchResult::getLocation).orElse(null); ++ } ++ ++ /** ++ * Checks if the world: ++ *

    ++ *
  • evaporates water
  • ++ *
  • dries sponges
  • ++ *
  • has lava spread faster and further
  • ++ *
++ * ++ * @return true if ultrawarm, false if not ++ * @deprecated use {@link #isUltraWarm()} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ boolean isUltrawarm(); ++ ++ /** ++ * Gets the coordinate scaling of this world. ++ * ++ * @return the coordinate scale ++ */ ++ double getCoordinateScale(); ++ ++ /** ++ * Checks if the world has skylight access ++ * ++ * @return whether there is skylight ++ * @deprecated use {@link #hasSkyLight()} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ boolean hasSkylight(); ++ ++ /** ++ * Checks if the world has a bedrock ceiling ++ * ++ * @return whether the world has a bedrock ceiling ++ * @deprecated use {@link #hasCeiling()} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ boolean hasBedrockCeiling(); ++ ++ /** ++ * Checks if beds work ++ * ++ * @return whether beds work ++ * @deprecated use {@link #isBedWorks()} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ boolean doesBedWork(); ++ ++ /** ++ * Checks if respawn anchors work ++ * ++ * @return whether respawn anchors work ++ * @deprecated use {@link #isRespawnAnchorWorks()} ++ */ ++ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") ++ boolean doesRespawnAnchorWork(); ++ ++ /** ++ * Checks if this world has a fixed time ++ * ++ * @return whether this world has fixed time ++ */ ++ boolean isFixedTime(); ++ ++ /** ++ * Gets the collection of materials that burn infinitely in this world. ++ * ++ * @return the materials that will forever stay lit by fire ++ */ ++ @NotNull ++ Collection getInfiniburn(); ++ ++ /** ++ * Posts a specified game event at a location ++ * ++ * @param sourceEntity optional source entity ++ * @param gameEvent the game event to post ++ * @param position the position in the world where to post the event to listeners ++ */ ++ void sendGameEvent(@Nullable Entity sourceEntity, @NotNull GameEvent gameEvent, @NotNull Vector position); ++ // Paper end ++ + // Spigot start + @Deprecated(forRemoval = true) // Paper + public class Spigot { diff --git a/patches/api/0268-Added-PlayerBedFailEnterEvent.patch b/patches/api/0268-Added-PlayerBedFailEnterEvent.patch new file mode 100644 index 0000000000..6f9decf5fc --- /dev/null +++ b/patches/api/0268-Added-PlayerBedFailEnterEvent.patch @@ -0,0 +1,131 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 24 Dec 2020 12:27:49 -0800 +Subject: [PATCH] Added PlayerBedFailEnterEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6cd803e108dc2e6c0b8afda123123450403ef729 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java +@@ -0,0 +1,119 @@ ++package io.papermc.paper.event.player; ++ ++import net.kyori.adventure.text.Component; ++import org.bukkit.block.Block; ++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.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public class PlayerBedFailEnterEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final FailReason failReason; ++ private final Block bed; ++ private boolean willExplode; ++ private Component message; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerBedFailEnterEvent(@NotNull Player player, @NotNull FailReason failReason, @NotNull Block bed, boolean willExplode, @Nullable Component message) { ++ super(player); ++ this.failReason = failReason; ++ this.bed = bed; ++ this.willExplode = willExplode; ++ this.message = message; ++ } ++ ++ @NotNull ++ public FailReason getFailReason() { ++ return this.failReason; ++ } ++ ++ @NotNull ++ public Block getBed() { ++ return this.bed; ++ } ++ ++ public boolean getWillExplode() { ++ return this.willExplode; ++ } ++ ++ public void setWillExplode(boolean willExplode) { ++ this.willExplode = willExplode; ++ } ++ ++ @Nullable ++ public Component getMessage() { ++ return this.message; ++ } ++ ++ public void setMessage(@Nullable Component message) { ++ this.message = message; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * NOTE: This does not cancel the player getting in the bed, but any messages/explosions ++ * that may occur because of the interaction. ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ public enum FailReason { ++ /** ++ * The world doesn't allow sleeping (ex. Nether or The End). Entering ++ * the bed is prevented and the bed explodes. ++ */ ++ NOT_POSSIBLE_HERE, ++ /** ++ * Entering the bed is prevented due to it not being night nor ++ * thundering currently. ++ *

++ * If the event is forcefully allowed during daytime, the player will ++ * enter the bed (and set its bed location), but might get immediately ++ * thrown out again. ++ */ ++ NOT_POSSIBLE_NOW, ++ /** ++ * Entering the bed is prevented due to the player being too far away. ++ */ ++ TOO_FAR_AWAY, ++ /** ++ * Bed is obstructed. ++ */ ++ OBSTRUCTED, ++ /** ++ * Entering the bed is prevented due to there being some other problem. ++ */ ++ OTHER_PROBLEM, ++ /** ++ * Entering the bed is prevented due to there being monsters nearby. ++ */ ++ NOT_SAFE ++ } ++} diff --git a/patches/api/0268-More-World-API.patch b/patches/api/0268-More-World-API.patch deleted file mode 100644 index 7340819de5..0000000000 --- a/patches/api/0268-More-World-API.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 7 Jul 2020 10:53:22 -0700 -Subject: [PATCH] More World API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 77314fdbd99a5cc34e7a1df4692ba8a1685ef002..f4d31d9d0f4cbd2621adf97a20b65ae83e5fd064 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -3849,6 +3849,122 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @Nullable - StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); - -+ // Paper start -+ /** -+ * Locates the nearest biome based on an origin, biome type, and radius to search. -+ * Step defaults to {@code 8}. -+ * -+ * @param origin Origin location -+ * @param biome Biome to find -+ * @param radius radius to search -+ * @return Location of biome or null if not found in specified radius -+ * @deprecated use {@link #locateNearestBiome(Location, int, Biome...)} -+ */ -+ @Deprecated -+ @Nullable -+ default Location locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius) { -+ return java.util.Optional.ofNullable(this.locateNearestBiome(origin, radius, 8, 8, biome)).map(BiomeSearchResult::getLocation).orElse(null); -+ } -+ -+ /** -+ * Locates the nearest biome based on an origin, biome type, and radius to search -+ * and step -+ * -+ * @param origin Origin location -+ * @param biome Biome to find -+ * @param radius radius to search -+ * @param step Search step 1 would mean checking every block, 8 would be every 8th block -+ * @return Location of biome or null if not found in specified radius -+ * @deprecated use {@link #locateNearestBiome(Location, int, int, int, Biome...)} -+ */ -+ @Deprecated -+ @Nullable -+ default Location locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius, int step) { -+ return java.util.Optional.ofNullable(this.locateNearestBiome(origin, radius, step, step, biome)).map(BiomeSearchResult::getLocation).orElse(null); -+ } -+ -+ /** -+ * Checks if the world: -+ *

    -+ *
  • evaporates water
  • -+ *
  • dries sponges
  • -+ *
  • has lava spread faster and further
  • -+ *
-+ * -+ * @return true if ultrawarm, false if not -+ * @deprecated use {@link #isUltraWarm()} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ boolean isUltrawarm(); -+ -+ /** -+ * Gets the coordinate scaling of this world. -+ * -+ * @return the coordinate scale -+ */ -+ double getCoordinateScale(); -+ -+ /** -+ * Checks if the world has skylight access -+ * -+ * @return whether there is skylight -+ * @deprecated use {@link #hasSkyLight()} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ boolean hasSkylight(); -+ -+ /** -+ * Checks if the world has a bedrock ceiling -+ * -+ * @return whether the world has a bedrock ceiling -+ * @deprecated use {@link #hasCeiling()} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ boolean hasBedrockCeiling(); -+ -+ /** -+ * Checks if beds work -+ * -+ * @return whether beds work -+ * @deprecated use {@link #isBedWorks()} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ boolean doesBedWork(); -+ -+ /** -+ * Checks if respawn anchors work -+ * -+ * @return whether respawn anchors work -+ * @deprecated use {@link #isRespawnAnchorWorks()} -+ */ -+ @Deprecated(forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.21") -+ boolean doesRespawnAnchorWork(); -+ -+ /** -+ * Checks if this world has a fixed time -+ * -+ * @return whether this world has fixed time -+ */ -+ boolean isFixedTime(); -+ -+ /** -+ * Gets the collection of materials that burn infinitely in this world. -+ * -+ * @return the materials that will forever stay lit by fire -+ */ -+ @NotNull -+ Collection getInfiniburn(); -+ -+ /** -+ * Posts a specified game event at a location -+ * -+ * @param sourceEntity optional source entity -+ * @param gameEvent the game event to post -+ * @param position the position in the world where to post the event to listeners -+ */ -+ void sendGameEvent(@Nullable Entity sourceEntity, @NotNull GameEvent gameEvent, @NotNull Vector position); -+ // Paper end -+ - // Spigot start - @Deprecated(forRemoval = true) // Paper - public class Spigot { diff --git a/patches/api/0269-Added-PlayerBedFailEnterEvent.patch b/patches/api/0269-Added-PlayerBedFailEnterEvent.patch deleted file mode 100644 index 6f9decf5fc..0000000000 --- a/patches/api/0269-Added-PlayerBedFailEnterEvent.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 24 Dec 2020 12:27:49 -0800 -Subject: [PATCH] Added PlayerBedFailEnterEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6cd803e108dc2e6c0b8afda123123450403ef729 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java -@@ -0,0 +1,119 @@ -+package io.papermc.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.block.Block; -+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.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+public class PlayerBedFailEnterEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final FailReason failReason; -+ private final Block bed; -+ private boolean willExplode; -+ private Component message; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerBedFailEnterEvent(@NotNull Player player, @NotNull FailReason failReason, @NotNull Block bed, boolean willExplode, @Nullable Component message) { -+ super(player); -+ this.failReason = failReason; -+ this.bed = bed; -+ this.willExplode = willExplode; -+ this.message = message; -+ } -+ -+ @NotNull -+ public FailReason getFailReason() { -+ return this.failReason; -+ } -+ -+ @NotNull -+ public Block getBed() { -+ return this.bed; -+ } -+ -+ public boolean getWillExplode() { -+ return this.willExplode; -+ } -+ -+ public void setWillExplode(boolean willExplode) { -+ this.willExplode = willExplode; -+ } -+ -+ @Nullable -+ public Component getMessage() { -+ return this.message; -+ } -+ -+ public void setMessage(@Nullable Component message) { -+ this.message = message; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * NOTE: This does not cancel the player getting in the bed, but any messages/explosions -+ * that may occur because of the interaction. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum FailReason { -+ /** -+ * The world doesn't allow sleeping (ex. Nether or The End). Entering -+ * the bed is prevented and the bed explodes. -+ */ -+ NOT_POSSIBLE_HERE, -+ /** -+ * Entering the bed is prevented due to it not being night nor -+ * thundering currently. -+ *

-+ * If the event is forcefully allowed during daytime, the player will -+ * enter the bed (and set its bed location), but might get immediately -+ * thrown out again. -+ */ -+ NOT_POSSIBLE_NOW, -+ /** -+ * Entering the bed is prevented due to the player being too far away. -+ */ -+ TOO_FAR_AWAY, -+ /** -+ * Bed is obstructed. -+ */ -+ OBSTRUCTED, -+ /** -+ * Entering the bed is prevented due to there being some other problem. -+ */ -+ OTHER_PROBLEM, -+ /** -+ * Entering the bed is prevented due to there being monsters nearby. -+ */ -+ NOT_SAFE -+ } -+} diff --git a/patches/api/0269-Introduce-beacon-activation-deactivation-events.patch b/patches/api/0269-Introduce-beacon-activation-deactivation-events.patch new file mode 100644 index 0000000000..4e173b3d6c --- /dev/null +++ b/patches/api/0269-Introduce-beacon-activation-deactivation-events.patch @@ -0,0 +1,107 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spyridon Pagkalos +Date: Thu, 25 Mar 2021 20:25:47 +0200 +Subject: [PATCH] Introduce beacon activation/deactivation events + + +diff --git a/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..05609ec9df637c9aa53528218cbc8cda30f0aea1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Beacon; ++import org.bukkit.block.Block; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a beacon is activated. ++ * Activation occurs when the beacon beam becomes visible. ++ */ ++public class BeaconActivatedEvent extends BlockEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @ApiStatus.Internal ++ public BeaconActivatedEvent(@NotNull Block block) { ++ super(block); ++ } ++ ++ /** ++ * Returns the beacon that was activated. ++ * ++ * @return the beacon that was activated. ++ */ ++ @NotNull ++ public Beacon getBeacon() { ++ return (Beacon) this.block.getState(); ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dc106d6bfbd9d0ab84b17597d71381a5c0b07d64 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java +@@ -0,0 +1,46 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.Material; ++import org.bukkit.block.Beacon; ++import org.bukkit.block.Block; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when a beacon is deactivated, either because its base block(s) or itself were destroyed. ++ */ ++public class BeaconDeactivatedEvent extends BlockEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @ApiStatus.Internal ++ public BeaconDeactivatedEvent(@NotNull Block block) { ++ super(block); ++ } ++ ++ /** ++ * Returns the beacon that was deactivated. ++ * This will return {@code null} if the beacon does not exist. ++ * (which can occur after the deactivation of a now broken beacon) ++ * ++ * @return The beacon that got deactivated, or {@code null} if it does not exist. ++ */ ++ @Nullable ++ public Beacon getBeacon() { ++ return this.block.getType() == Material.BEACON ? (Beacon) this.block.getState() : null; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0270-Introduce-beacon-activation-deactivation-events.patch b/patches/api/0270-Introduce-beacon-activation-deactivation-events.patch deleted file mode 100644 index 4e173b3d6c..0000000000 --- a/patches/api/0270-Introduce-beacon-activation-deactivation-events.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spyridon Pagkalos -Date: Thu, 25 Mar 2021 20:25:47 +0200 -Subject: [PATCH] Introduce beacon activation/deactivation events - - -diff --git a/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..05609ec9df637c9aa53528218cbc8cda30f0aea1 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java -@@ -0,0 +1,43 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Beacon; -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a beacon is activated. -+ * Activation occurs when the beacon beam becomes visible. -+ */ -+public class BeaconActivatedEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @ApiStatus.Internal -+ public BeaconActivatedEvent(@NotNull Block block) { -+ super(block); -+ } -+ -+ /** -+ * Returns the beacon that was activated. -+ * -+ * @return the beacon that was activated. -+ */ -+ @NotNull -+ public Beacon getBeacon() { -+ return (Beacon) this.block.getState(); -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..dc106d6bfbd9d0ab84b17597d71381a5c0b07d64 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java -@@ -0,0 +1,46 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.Material; -+import org.bukkit.block.Beacon; -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when a beacon is deactivated, either because its base block(s) or itself were destroyed. -+ */ -+public class BeaconDeactivatedEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @ApiStatus.Internal -+ public BeaconDeactivatedEvent(@NotNull Block block) { -+ super(block); -+ } -+ -+ /** -+ * Returns the beacon that was deactivated. -+ * This will return {@code null} if the beacon does not exist. -+ * (which can occur after the deactivation of a now broken beacon) -+ * -+ * @return The beacon that got deactivated, or {@code null} if it does not exist. -+ */ -+ @Nullable -+ public Beacon getBeacon() { -+ return this.block.getType() == Material.BEACON ? (Beacon) this.block.getState() : null; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0270-PlayerMoveEvent-Improvements.patch b/patches/api/0270-PlayerMoveEvent-Improvements.patch new file mode 100644 index 0000000000..33cf16e54b --- /dev/null +++ b/patches/api/0270-PlayerMoveEvent-Improvements.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: HexedHero <6012891+HexedHero@users.noreply.github.com> +Date: Thu, 29 Apr 2021 10:31:44 +0100 +Subject: [PATCH] PlayerMoveEvent Improvements + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java +index 1a58734d919fae247eeb85dd785fd59990856505..b484abf3b06b1fb3577b43d50d64498dcd7652c9 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java +@@ -93,6 +93,53 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable { + this.to = to; + } + ++ // Paper start - PlayerMoveEvent improvements ++ /** ++ * Check if the player has changed position (even within the same block) in the event ++ * ++ * @return whether the player has changed position or not ++ */ ++ public boolean hasChangedPosition() { ++ return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld()); ++ } ++ ++ /** ++ * Check if the player has changed position (even within the same block) in the event, disregarding a possible world change ++ * ++ * @return whether the player has changed position or not ++ */ ++ public boolean hasExplicitlyChangedPosition() { ++ return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ(); ++ } ++ ++ /** ++ * Check if the player has moved to a new block in the event ++ * ++ * @return whether the player has moved to a new block or not ++ */ ++ public boolean hasChangedBlock() { ++ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld()); ++ } ++ ++ /** ++ * Check if the player has moved to a new block in the event, disregarding a possible world change ++ * ++ * @return whether the player has moved to a new block or not ++ */ ++ public boolean hasExplicitlyChangedBlock() { ++ return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ(); ++ } ++ ++ /** ++ * Check if the player has changed orientation in the event ++ * ++ * @return whether the player has changed orientation or not ++ */ ++ public boolean hasChangedOrientation() { ++ return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw(); ++ } ++ // Paper end ++ + private void validateLocation(@NotNull Location loc) { + Preconditions.checkArgument(loc != null, "Cannot use null location!"); + Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!"); diff --git a/patches/api/0271-PlayerMoveEvent-Improvements.patch b/patches/api/0271-PlayerMoveEvent-Improvements.patch deleted file mode 100644 index 33cf16e54b..0000000000 --- a/patches/api/0271-PlayerMoveEvent-Improvements.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Thu, 29 Apr 2021 10:31:44 +0100 -Subject: [PATCH] PlayerMoveEvent Improvements - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java -index 1a58734d919fae247eeb85dd785fd59990856505..b484abf3b06b1fb3577b43d50d64498dcd7652c9 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java -@@ -93,6 +93,53 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable { - this.to = to; - } - -+ // Paper start - PlayerMoveEvent improvements -+ /** -+ * Check if the player has changed position (even within the same block) in the event -+ * -+ * @return whether the player has changed position or not -+ */ -+ public boolean hasChangedPosition() { -+ return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld()); -+ } -+ -+ /** -+ * Check if the player has changed position (even within the same block) in the event, disregarding a possible world change -+ * -+ * @return whether the player has changed position or not -+ */ -+ public boolean hasExplicitlyChangedPosition() { -+ return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ(); -+ } -+ -+ /** -+ * Check if the player has moved to a new block in the event -+ * -+ * @return whether the player has moved to a new block or not -+ */ -+ public boolean hasChangedBlock() { -+ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld()); -+ } -+ -+ /** -+ * Check if the player has moved to a new block in the event, disregarding a possible world change -+ * -+ * @return whether the player has moved to a new block or not -+ */ -+ public boolean hasExplicitlyChangedBlock() { -+ return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ(); -+ } -+ -+ /** -+ * Check if the player has changed orientation in the event -+ * -+ * @return whether the player has changed orientation or not -+ */ -+ public boolean hasChangedOrientation() { -+ return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw(); -+ } -+ // Paper end -+ - private void validateLocation(@NotNull Location loc) { - Preconditions.checkArgument(loc != null, "Cannot use null location!"); - Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!"); diff --git a/patches/api/0271-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/api/0271-add-RespawnFlags-to-PlayerRespawnEvent.patch new file mode 100644 index 0000000000..c596be8b98 --- /dev/null +++ b/patches/api/0271-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 22 Apr 2021 17:17:54 -0700 +Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +index 03225d2b4c91caa58c2995d9cf0e7fb4663749ab..b45f265ec7819b06a9a8361e8c1e43fd88b3138b 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +@@ -18,6 +18,7 @@ public class PlayerRespawnEvent extends PlayerEvent { + private final boolean isBedSpawn; + private final boolean isAnchorSpawn; + private final RespawnReason respawnReason; ++ private final java.util.Set respawnFlags; // Paper + + @Deprecated + public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) { +@@ -29,12 +30,24 @@ public class PlayerRespawnEvent extends PlayerEvent { + this(respawnPlayer, respawnLocation, isBedSpawn, false, RespawnReason.PLUGIN); + } + ++ @Deprecated // Paper + public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason) { ++ // Paper start ++ this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, respawnReason, com.google.common.collect.ImmutableSet.builder()); ++ } ++ ++ public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason, @NotNull final com.google.common.collect.ImmutableSet.Builder respawnFlags) { ++ // Paper end + super(respawnPlayer); + this.respawnLocation = respawnLocation; + this.isBedSpawn = isBedSpawn; + this.isAnchorSpawn = isAnchorSpawn; + this.respawnReason = respawnReason; ++ // Paper start ++ if (this.isBedSpawn) { respawnFlags.add(RespawnFlag.BED_SPAWN); } ++ if (this.isAnchorSpawn) { respawnFlags.add(RespawnFlag.ANCHOR_SPAWN); } ++ this.respawnFlags = respawnFlags.build(); ++ // Paper end + } + + /** +@@ -116,4 +129,31 @@ public class PlayerRespawnEvent extends PlayerEvent { + */ + PLUGIN; + } ++ ++ // Paper start ++ /** ++ * Get the set of flags that apply to this respawn. ++ * ++ * @return an immutable set of the flags that apply to this respawn ++ */ ++ @NotNull ++ public java.util.Set getRespawnFlags() { ++ return respawnFlags; ++ } ++ ++ public enum RespawnFlag { ++ /** ++ * Will use the bed spawn location ++ */ ++ BED_SPAWN, ++ /** ++ * Will use the respawn anchor location ++ */ ++ ANCHOR_SPAWN, ++ /** ++ * Is caused by going to the end portal in the end. ++ */ ++ END_PORTAL, ++ } ++ // Paper end + } diff --git a/patches/api/0272-Add-more-WanderingTrader-API.patch b/patches/api/0272-Add-more-WanderingTrader-API.patch new file mode 100644 index 0000000000..99045d4949 --- /dev/null +++ b/patches/api/0272-Add-more-WanderingTrader-API.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: HexedHero <6012891+HexedHero@users.noreply.github.com> +Date: Thu, 6 May 2021 14:56:26 +0100 +Subject: [PATCH] Add more WanderingTrader API + + +diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java +index 55394ed5c68cb0bf4333fc918e3b4c8c4e3db0c6..da76e1ed5406322073dd8c7a89ca55aa68620ac4 100644 +--- a/src/main/java/org/bukkit/entity/WanderingTrader.java ++++ b/src/main/java/org/bukkit/entity/WanderingTrader.java +@@ -28,4 +28,30 @@ public interface WanderingTrader extends AbstractVillager { + * {@link WanderingTrader} is forcibly despawned + */ + public void setDespawnDelay(int despawnDelay); ++ ++ // Paper start - Add more WanderingTrader API ++ /** ++ * Set if the Wandering Trader can and will drink an invisibility potion. ++ * @param bool whether the mob will drink ++ */ ++ public void setCanDrinkPotion(boolean bool); ++ ++ /** ++ * Get if the Wandering Trader can and will drink an invisibility potion. ++ * @return whether the mob will drink ++ */ ++ public boolean canDrinkPotion(); ++ ++ /** ++ * Set if the Wandering Trader can and will drink milk. ++ * @param bool whether the mob will drink ++ */ ++ public void setCanDrinkMilk(boolean bool); ++ ++ /** ++ * Get if the Wandering Trader can and will drink milk. ++ * @return whether the mob will drink ++ */ ++ public boolean canDrinkMilk(); ++ // Paper end + } diff --git a/patches/api/0272-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/api/0272-add-RespawnFlags-to-PlayerRespawnEvent.patch deleted file mode 100644 index c596be8b98..0000000000 --- a/patches/api/0272-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 22 Apr 2021 17:17:54 -0700 -Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -index 03225d2b4c91caa58c2995d9cf0e7fb4663749ab..b45f265ec7819b06a9a8361e8c1e43fd88b3138b 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java -@@ -18,6 +18,7 @@ public class PlayerRespawnEvent extends PlayerEvent { - private final boolean isBedSpawn; - private final boolean isAnchorSpawn; - private final RespawnReason respawnReason; -+ private final java.util.Set respawnFlags; // Paper - - @Deprecated - public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) { -@@ -29,12 +30,24 @@ public class PlayerRespawnEvent extends PlayerEvent { - this(respawnPlayer, respawnLocation, isBedSpawn, false, RespawnReason.PLUGIN); - } - -+ @Deprecated // Paper - public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason) { -+ // Paper start -+ this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, respawnReason, com.google.common.collect.ImmutableSet.builder()); -+ } -+ -+ public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final RespawnReason respawnReason, @NotNull final com.google.common.collect.ImmutableSet.Builder respawnFlags) { -+ // Paper end - super(respawnPlayer); - this.respawnLocation = respawnLocation; - this.isBedSpawn = isBedSpawn; - this.isAnchorSpawn = isAnchorSpawn; - this.respawnReason = respawnReason; -+ // Paper start -+ if (this.isBedSpawn) { respawnFlags.add(RespawnFlag.BED_SPAWN); } -+ if (this.isAnchorSpawn) { respawnFlags.add(RespawnFlag.ANCHOR_SPAWN); } -+ this.respawnFlags = respawnFlags.build(); -+ // Paper end - } - - /** -@@ -116,4 +129,31 @@ public class PlayerRespawnEvent extends PlayerEvent { - */ - PLUGIN; - } -+ -+ // Paper start -+ /** -+ * Get the set of flags that apply to this respawn. -+ * -+ * @return an immutable set of the flags that apply to this respawn -+ */ -+ @NotNull -+ public java.util.Set getRespawnFlags() { -+ return respawnFlags; -+ } -+ -+ public enum RespawnFlag { -+ /** -+ * Will use the bed spawn location -+ */ -+ BED_SPAWN, -+ /** -+ * Will use the respawn anchor location -+ */ -+ ANCHOR_SPAWN, -+ /** -+ * Is caused by going to the end portal in the end. -+ */ -+ END_PORTAL, -+ } -+ // Paper end - } diff --git a/patches/api/0273-Add-EntityBlockStorage-clearEntities.patch b/patches/api/0273-Add-EntityBlockStorage-clearEntities.patch new file mode 100644 index 0000000000..7032ba6155 --- /dev/null +++ b/patches/api/0273-Add-EntityBlockStorage-clearEntities.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Mon, 5 Apr 2021 18:12:06 -0400 +Subject: [PATCH] Add EntityBlockStorage#clearEntities() + + +diff --git a/src/main/java/org/bukkit/block/EntityBlockStorage.java b/src/main/java/org/bukkit/block/EntityBlockStorage.java +index f3f8d765d5d487aa14edf0b88c32608fb804c331..739911cda33b373f99df627a3a378b37d7d461aa 100644 +--- a/src/main/java/org/bukkit/block/EntityBlockStorage.java ++++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java +@@ -53,4 +53,11 @@ public interface EntityBlockStorage extends TileState { + * @param entity Entity to add to the block + */ + void addEntity(@NotNull T entity); ++ ++ // Paper start - Add EntityBlockStorage clearEntities ++ /** ++ * Clear all currently stored entities in the block. ++ */ ++ void clearEntities(); ++ // Paper end + } diff --git a/patches/api/0273-Add-more-WanderingTrader-API.patch b/patches/api/0273-Add-more-WanderingTrader-API.patch deleted file mode 100644 index 99045d4949..0000000000 --- a/patches/api/0273-Add-more-WanderingTrader-API.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Thu, 6 May 2021 14:56:26 +0100 -Subject: [PATCH] Add more WanderingTrader API - - -diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java -index 55394ed5c68cb0bf4333fc918e3b4c8c4e3db0c6..da76e1ed5406322073dd8c7a89ca55aa68620ac4 100644 ---- a/src/main/java/org/bukkit/entity/WanderingTrader.java -+++ b/src/main/java/org/bukkit/entity/WanderingTrader.java -@@ -28,4 +28,30 @@ public interface WanderingTrader extends AbstractVillager { - * {@link WanderingTrader} is forcibly despawned - */ - public void setDespawnDelay(int despawnDelay); -+ -+ // Paper start - Add more WanderingTrader API -+ /** -+ * Set if the Wandering Trader can and will drink an invisibility potion. -+ * @param bool whether the mob will drink -+ */ -+ public void setCanDrinkPotion(boolean bool); -+ -+ /** -+ * Get if the Wandering Trader can and will drink an invisibility potion. -+ * @return whether the mob will drink -+ */ -+ public boolean canDrinkPotion(); -+ -+ /** -+ * Set if the Wandering Trader can and will drink milk. -+ * @param bool whether the mob will drink -+ */ -+ public void setCanDrinkMilk(boolean bool); -+ -+ /** -+ * Get if the Wandering Trader can and will drink milk. -+ * @return whether the mob will drink -+ */ -+ public boolean canDrinkMilk(); -+ // Paper end - } diff --git a/patches/api/0274-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/api/0274-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch new file mode 100644 index 0000000000..16af3a7728 --- /dev/null +++ b/patches/api/0274-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> +Date: Fri, 8 Jan 2021 20:29:58 +0100 +Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java +index 21ff095afb434d15babcdbe85fa0b94cbb7e75a7..6f618bb140a901c5c1cd08210978a6a651677ba4 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java +@@ -4,6 +4,10 @@ import org.bukkit.advancement.Advancement; + import org.bukkit.entity.Player; + import org.bukkit.event.HandlerList; + import org.jetbrains.annotations.NotNull; ++// Paper start ++import org.jetbrains.annotations.Nullable; ++import net.kyori.adventure.text.Component; ++// Paper end + + /** + * Called when a player has completed all criteria in an advancement. +@@ -13,10 +17,17 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent { + private static final HandlerList handlers = new HandlerList(); + // + private final Advancement advancement; ++ private Component message; // Paper - Add Adventure message + + public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement) { ++ // Paper start - Add Adventure message ++ this(who, advancement, null); ++ } ++ public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement, @Nullable Component message) { ++ // Paper end + super(who); + this.advancement = advancement; ++ this.message = message; // Paper - Add Adventure message + } + + /** +@@ -29,6 +40,31 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent { + return advancement; + } + ++ // Paper start - Add Adventure message ++ /** ++ * Gets the message to send to all online players. ++ *

++ * Will be null if the advancement does not announce to chat, for example if ++ * it is a recipe unlock or a root advancement. ++ * ++ * @return The announcement message, or null ++ */ ++ @Nullable ++ public Component message() { ++ return this.message; ++ } ++ ++ /** ++ * Sets the message to send to all online players. ++ *

++ * If set to null the message will not be sent. ++ * ++ * @param message The new message ++ */ ++ public void message(@Nullable Component message) { ++ this.message = message; ++ } ++ // Paper end + @NotNull + @Override + public HandlerList getHandlers() { diff --git a/patches/api/0274-Add-EntityBlockStorage-clearEntities.patch b/patches/api/0274-Add-EntityBlockStorage-clearEntities.patch deleted file mode 100644 index 7032ba6155..0000000000 --- a/patches/api/0274-Add-EntityBlockStorage-clearEntities.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Mon, 5 Apr 2021 18:12:06 -0400 -Subject: [PATCH] Add EntityBlockStorage#clearEntities() - - -diff --git a/src/main/java/org/bukkit/block/EntityBlockStorage.java b/src/main/java/org/bukkit/block/EntityBlockStorage.java -index f3f8d765d5d487aa14edf0b88c32608fb804c331..739911cda33b373f99df627a3a378b37d7d461aa 100644 ---- a/src/main/java/org/bukkit/block/EntityBlockStorage.java -+++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java -@@ -53,4 +53,11 @@ public interface EntityBlockStorage extends TileState { - * @param entity Entity to add to the block - */ - void addEntity(@NotNull T entity); -+ -+ // Paper start - Add EntityBlockStorage clearEntities -+ /** -+ * Clear all currently stored entities in the block. -+ */ -+ void clearEntities(); -+ // Paper end - } diff --git a/patches/api/0275-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/api/0275-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch deleted file mode 100644 index 16af3a7728..0000000000 --- a/patches/api/0275-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> -Date: Fri, 8 Jan 2021 20:29:58 +0100 -Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java -index 21ff095afb434d15babcdbe85fa0b94cbb7e75a7..6f618bb140a901c5c1cd08210978a6a651677ba4 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java -@@ -4,6 +4,10 @@ import org.bukkit.advancement.Advancement; - import org.bukkit.entity.Player; - import org.bukkit.event.HandlerList; - import org.jetbrains.annotations.NotNull; -+// Paper start -+import org.jetbrains.annotations.Nullable; -+import net.kyori.adventure.text.Component; -+// Paper end - - /** - * Called when a player has completed all criteria in an advancement. -@@ -13,10 +17,17 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent { - private static final HandlerList handlers = new HandlerList(); - // - private final Advancement advancement; -+ private Component message; // Paper - Add Adventure message - - public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement) { -+ // Paper start - Add Adventure message -+ this(who, advancement, null); -+ } -+ public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement, @Nullable Component message) { -+ // Paper end - super(who); - this.advancement = advancement; -+ this.message = message; // Paper - Add Adventure message - } - - /** -@@ -29,6 +40,31 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent { - return advancement; - } - -+ // Paper start - Add Adventure message -+ /** -+ * Gets the message to send to all online players. -+ *

-+ * Will be null if the advancement does not announce to chat, for example if -+ * it is a recipe unlock or a root advancement. -+ * -+ * @return The announcement message, or null -+ */ -+ @Nullable -+ public Component message() { -+ return this.message; -+ } -+ -+ /** -+ * Sets the message to send to all online players. -+ *

-+ * If set to null the message will not be sent. -+ * -+ * @param message The new message -+ */ -+ public void message(@Nullable Component message) { -+ this.message = message; -+ } -+ // Paper end - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/0275-Inventory-close.patch b/patches/api/0275-Inventory-close.patch new file mode 100644 index 0000000000..87dfa1a083 --- /dev/null +++ b/patches/api/0275-Inventory-close.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 11 May 2021 14:54:20 -0700 +Subject: [PATCH] Inventory#close + + +diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java +index 129b5ab5062beeb9bb52465a788bc3a3aee9c49e..0d519813c12d98b28d62e6d01d7ec6e8c2dba3c3 100644 +--- a/src/main/java/org/bukkit/inventory/Inventory.java ++++ b/src/main/java/org/bukkit/inventory/Inventory.java +@@ -355,6 +355,15 @@ public interface Inventory extends Iterable { + */ + public void clear(); + ++ // Paper start ++ /** ++ * Closes the inventory for all viewers. ++ * ++ * @return the number of viewers the inventory was closed for ++ */ ++ public int close(); ++ // Paper end ++ + /** + * Gets a list of players viewing the inventory. Note that a player is + * considered to be viewing their own inventory and internal crafting diff --git a/patches/api/0276-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/0276-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch new file mode 100644 index 0000000000..3103f1ce2c --- /dev/null +++ b/patches/api/0276-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MeFisto94 +Date: Tue, 11 May 2021 00:48:51 +0200 +Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and + Skeletons + + +diff --git a/src/main/java/org/bukkit/entity/AbstractSkeleton.java b/src/main/java/org/bukkit/entity/AbstractSkeleton.java +index 4f4f1e48cdaee0d845f60666569e48731be3fbb9..504fd761e5863c09fe785300a5c3e68e00baf2b0 100644 +--- a/src/main/java/org/bukkit/entity/AbstractSkeleton.java ++++ b/src/main/java/org/bukkit/entity/AbstractSkeleton.java +@@ -32,4 +32,24 @@ public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entit + @Deprecated + @Contract("_ -> fail") + public void setSkeletonType(Skeleton.SkeletonType type); ++ ++ // Paper start ++ /** ++ * Check if this skeleton will burn in the sunlight. This ++ * does not take into account an entity's natural fire ++ * immunity. ++ * ++ * @return True if skeleton will burn in sunlight ++ */ ++ boolean shouldBurnInDay(); ++ ++ /** ++ * Set if this skeleton should burn in the sunlight. This ++ * will not override an entity's natural fire ++ * immunity. ++ * ++ * @param shouldBurnInDay True to burn in sunlight ++ */ ++ void setShouldBurnInDay(boolean shouldBurnInDay); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java +index 082601f349ae2cebbffd1012c19c521241696a09..3dafdf14ced991ae1179ef1ca455da62f8c3243e 100644 +--- a/src/main/java/org/bukkit/entity/Phantom.java ++++ b/src/main/java/org/bukkit/entity/Phantom.java +@@ -26,5 +26,19 @@ public interface Phantom extends Flying, Enemy { + */ + @Nullable + public java.util.UUID getSpawningEntity(); ++ ++ /** ++ * Check if this phantom will burn in the sunlight ++ * ++ * @return True if phantom will burn in sunlight ++ */ ++ public boolean shouldBurnInDay(); ++ ++ /** ++ * Set if this phantom should burn in the sunlight ++ * ++ * @param shouldBurnInDay True to burn in sunlight ++ */ ++ public void setShouldBurnInDay(boolean shouldBurnInDay); + // Paper end + } diff --git a/patches/api/0276-Inventory-close.patch b/patches/api/0276-Inventory-close.patch deleted file mode 100644 index 87dfa1a083..0000000000 --- a/patches/api/0276-Inventory-close.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 11 May 2021 14:54:20 -0700 -Subject: [PATCH] Inventory#close - - -diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java -index 129b5ab5062beeb9bb52465a788bc3a3aee9c49e..0d519813c12d98b28d62e6d01d7ec6e8c2dba3c3 100644 ---- a/src/main/java/org/bukkit/inventory/Inventory.java -+++ b/src/main/java/org/bukkit/inventory/Inventory.java -@@ -355,6 +355,15 @@ public interface Inventory extends Iterable { - */ - public void clear(); - -+ // Paper start -+ /** -+ * Closes the inventory for all viewers. -+ * -+ * @return the number of viewers the inventory was closed for -+ */ -+ public int close(); -+ // Paper end -+ - /** - * Gets a list of players viewing the inventory. Note that a player is - * considered to be viewing their own inventory and internal crafting diff --git a/patches/api/0277-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/0277-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch deleted file mode 100644 index 3103f1ce2c..0000000000 --- a/patches/api/0277-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MeFisto94 -Date: Tue, 11 May 2021 00:48:51 +0200 -Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and - Skeletons - - -diff --git a/src/main/java/org/bukkit/entity/AbstractSkeleton.java b/src/main/java/org/bukkit/entity/AbstractSkeleton.java -index 4f4f1e48cdaee0d845f60666569e48731be3fbb9..504fd761e5863c09fe785300a5c3e68e00baf2b0 100644 ---- a/src/main/java/org/bukkit/entity/AbstractSkeleton.java -+++ b/src/main/java/org/bukkit/entity/AbstractSkeleton.java -@@ -32,4 +32,24 @@ public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entit - @Deprecated - @Contract("_ -> fail") - public void setSkeletonType(Skeleton.SkeletonType type); -+ -+ // Paper start -+ /** -+ * Check if this skeleton will burn in the sunlight. This -+ * does not take into account an entity's natural fire -+ * immunity. -+ * -+ * @return True if skeleton will burn in sunlight -+ */ -+ boolean shouldBurnInDay(); -+ -+ /** -+ * Set if this skeleton should burn in the sunlight. This -+ * will not override an entity's natural fire -+ * immunity. -+ * -+ * @param shouldBurnInDay True to burn in sunlight -+ */ -+ void setShouldBurnInDay(boolean shouldBurnInDay); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java -index 082601f349ae2cebbffd1012c19c521241696a09..3dafdf14ced991ae1179ef1ca455da62f8c3243e 100644 ---- a/src/main/java/org/bukkit/entity/Phantom.java -+++ b/src/main/java/org/bukkit/entity/Phantom.java -@@ -26,5 +26,19 @@ public interface Phantom extends Flying, Enemy { - */ - @Nullable - public java.util.UUID getSpawningEntity(); -+ -+ /** -+ * Check if this phantom will burn in the sunlight -+ * -+ * @return True if phantom will burn in sunlight -+ */ -+ public boolean shouldBurnInDay(); -+ -+ /** -+ * Set if this phantom should burn in the sunlight -+ * -+ * @param shouldBurnInDay True to burn in sunlight -+ */ -+ public void setShouldBurnInDay(boolean shouldBurnInDay); - // Paper end - } diff --git a/patches/api/0277-Add-basic-Datapack-API.patch b/patches/api/0277-Add-basic-Datapack-API.patch new file mode 100644 index 0000000000..951643df7d --- /dev/null +++ b/patches/api/0277-Add-basic-Datapack-API.patch @@ -0,0 +1,160 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Connor Linfoot +Date: Sun, 16 May 2021 15:07:34 +0100 +Subject: [PATCH] Add basic Datapack API + + +diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7b2ab0be10a21e0496ad1d485ff8cb2c0b92a2cb +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datapack/Datapack.java +@@ -0,0 +1,32 @@ ++package io.papermc.paper.datapack; ++ ++import org.checkerframework.checker.nullness.qual.NonNull; ++ ++public interface Datapack { ++ ++ /** ++ * @return the name of the pack ++ */ ++ @NonNull ++ String getName(); ++ ++ /** ++ * @return the compatibility of the pack ++ */ ++ @NonNull ++ Compatibility getCompatibility(); ++ ++ /** ++ * @return whether or not the pack is currently enabled ++ */ ++ boolean isEnabled(); ++ ++ void setEnabled(boolean enabled); ++ ++ enum Compatibility { ++ TOO_OLD, ++ TOO_NEW, ++ COMPATIBLE, ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f70d08b2a2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java +@@ -0,0 +1,21 @@ ++package io.papermc.paper.datapack; ++ ++import org.checkerframework.checker.nullness.qual.NonNull; ++ ++import java.util.Collection; ++ ++public interface DatapackManager { ++ ++ /** ++ * @return all the packs known to the server ++ */ ++ @NonNull ++ Collection getPacks(); ++ ++ /** ++ * @return all the packs which are currently enabled ++ */ ++ @NonNull ++ Collection getEnabledPacks(); ++ ++} +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 8fd1de659777595d9d8198e7ee638ad5500a6317..e62d46629305a268906cd2cd5d5977d063c2f484 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -330,9 +330,11 @@ public final class Bukkit { + /** + * Get the DataPack Manager. + * ++ * @deprecated use {@link #getDatapackManager()} + * @return the manager + */ + @NotNull ++ @Deprecated(forRemoval = true) + public static DataPackManager getDataPackManager() { + return server.getDataPackManager(); + } +@@ -2588,6 +2590,14 @@ public final class Bukkit { + public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { + return server.getMobGoals(); + } ++ ++ /** ++ * @return the datapack manager ++ */ ++ @NotNull ++ public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { ++ return server.getDatapackManager(); ++ } + // Paper end + + @NotNull +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index efd612c1df363bd9c8f1ae0ea70c884af532efc3..7b6342a3d6ae0716876c958ef6029d5a6dc233bb 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -266,9 +266,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + /** + * Get the DataPack Manager. + * ++ * @deprecated use {@link #getDatapackManager()} + * @return the manager + */ + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public DataPackManager getDataPackManager(); + + /** +@@ -2254,5 +2256,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + @NotNull + com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); ++ ++ /** ++ * @return the datapack manager ++ */ ++ @NotNull ++ io.papermc.paper.datapack.DatapackManager getDatapackManager(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/packs/DataPack.java b/src/main/java/org/bukkit/packs/DataPack.java +index 3d5af25a399589f1bdf95b77f584ae0ae5c26f02..ab512c7ee9d2442055b719d02d0d0ecc7ea8d992 100644 +--- a/src/main/java/org/bukkit/packs/DataPack.java ++++ b/src/main/java/org/bukkit/packs/DataPack.java +@@ -10,8 +10,10 @@ import org.jetbrains.annotations.NotNull; + * Represents a data pack. + * + * @see Minecraft wiki ++ * @deprecated use {@link io.papermc.paper.datapack.Datapack} + */ + @ApiStatus.Experimental ++@Deprecated(forRemoval = true) // Paper + public interface DataPack extends Keyed { + + /** +diff --git a/src/main/java/org/bukkit/packs/DataPackManager.java b/src/main/java/org/bukkit/packs/DataPackManager.java +index d7fb6310e6b1050c496d748388310bc6f8d78e23..2cd505046277febe010e9476539b064321d8b2ec 100644 +--- a/src/main/java/org/bukkit/packs/DataPackManager.java ++++ b/src/main/java/org/bukkit/packs/DataPackManager.java +@@ -11,8 +11,10 @@ import org.jetbrains.annotations.Nullable; + + /** + * Manager of data packs. ++ * @deprecated use {@link io.papermc.paper.datapack.DatapackManager} + */ + @ApiStatus.Experimental ++@Deprecated(forRemoval = true) // Paper + public interface DataPackManager { + + /** diff --git a/patches/api/0278-Add-basic-Datapack-API.patch b/patches/api/0278-Add-basic-Datapack-API.patch deleted file mode 100644 index eef13380f6..0000000000 --- a/patches/api/0278-Add-basic-Datapack-API.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Connor Linfoot -Date: Sun, 16 May 2021 15:07:34 +0100 -Subject: [PATCH] Add basic Datapack API - - -diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7b2ab0be10a21e0496ad1d485ff8cb2c0b92a2cb ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java -@@ -0,0 +1,32 @@ -+package io.papermc.paper.datapack; -+ -+import org.checkerframework.checker.nullness.qual.NonNull; -+ -+public interface Datapack { -+ -+ /** -+ * @return the name of the pack -+ */ -+ @NonNull -+ String getName(); -+ -+ /** -+ * @return the compatibility of the pack -+ */ -+ @NonNull -+ Compatibility getCompatibility(); -+ -+ /** -+ * @return whether or not the pack is currently enabled -+ */ -+ boolean isEnabled(); -+ -+ void setEnabled(boolean enabled); -+ -+ enum Compatibility { -+ TOO_OLD, -+ TOO_NEW, -+ COMPATIBLE, -+ } -+ -+} -diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f70d08b2a2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java -@@ -0,0 +1,21 @@ -+package io.papermc.paper.datapack; -+ -+import org.checkerframework.checker.nullness.qual.NonNull; -+ -+import java.util.Collection; -+ -+public interface DatapackManager { -+ -+ /** -+ * @return all the packs known to the server -+ */ -+ @NonNull -+ Collection getPacks(); -+ -+ /** -+ * @return all the packs which are currently enabled -+ */ -+ @NonNull -+ Collection getEnabledPacks(); -+ -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 652932fa3ae5360802335803b4108b65019b6922..237bdd97203dbc80c010ae57735bc45e36c78fc5 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -330,9 +330,11 @@ public final class Bukkit { - /** - * Get the DataPack Manager. - * -+ * @deprecated use {@link #getDatapackManager()} - * @return the manager - */ - @NotNull -+ @Deprecated(forRemoval = true) - public static DataPackManager getDataPackManager() { - return server.getDataPackManager(); - } -@@ -2588,6 +2590,14 @@ public final class Bukkit { - public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { - return server.getMobGoals(); - } -+ -+ /** -+ * @return the datapack manager -+ */ -+ @NotNull -+ public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { -+ return server.getDatapackManager(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index d28b3ad2e9979127051e8062122572bc3d2cb0b5..d3631288ec03c5ca04221c20ecee745f7e9fa71a 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -266,9 +266,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - /** - * Get the DataPack Manager. - * -+ * @deprecated use {@link #getDatapackManager()} - * @return the manager - */ - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public DataPackManager getDataPackManager(); - - /** -@@ -2254,5 +2256,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull - com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); -+ -+ /** -+ * @return the datapack manager -+ */ -+ @NotNull -+ io.papermc.paper.datapack.DatapackManager getDatapackManager(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/packs/DataPack.java b/src/main/java/org/bukkit/packs/DataPack.java -index 3d5af25a399589f1bdf95b77f584ae0ae5c26f02..ab512c7ee9d2442055b719d02d0d0ecc7ea8d992 100644 ---- a/src/main/java/org/bukkit/packs/DataPack.java -+++ b/src/main/java/org/bukkit/packs/DataPack.java -@@ -10,8 +10,10 @@ import org.jetbrains.annotations.NotNull; - * Represents a data pack. - * - * @see Minecraft wiki -+ * @deprecated use {@link io.papermc.paper.datapack.Datapack} - */ - @ApiStatus.Experimental -+@Deprecated(forRemoval = true) // Paper - public interface DataPack extends Keyed { - - /** -diff --git a/src/main/java/org/bukkit/packs/DataPackManager.java b/src/main/java/org/bukkit/packs/DataPackManager.java -index d7fb6310e6b1050c496d748388310bc6f8d78e23..2cd505046277febe010e9476539b064321d8b2ec 100644 ---- a/src/main/java/org/bukkit/packs/DataPackManager.java -+++ b/src/main/java/org/bukkit/packs/DataPackManager.java -@@ -11,8 +11,10 @@ import org.jetbrains.annotations.Nullable; - - /** - * Manager of data packs. -+ * @deprecated use {@link io.papermc.paper.datapack.DatapackManager} - */ - @ApiStatus.Experimental -+@Deprecated(forRemoval = true) // Paper - public interface DataPackManager { - - /** diff --git a/patches/api/0278-additions-to-PlayerGameModeChangeEvent.patch b/patches/api/0278-additions-to-PlayerGameModeChangeEvent.patch new file mode 100644 index 0000000000..b2e65ae490 --- /dev/null +++ b/patches/api/0278-additions-to-PlayerGameModeChangeEvent.patch @@ -0,0 +1,121 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 15 May 2021 10:04:50 -0700 +Subject: [PATCH] additions to PlayerGameModeChangeEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java +index 4b96e0573c7ce32ad8c41124ee9ecab8359318a5..aee4a8b52c0d4abb655a4778575f0122acf19049 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java +@@ -8,15 +8,32 @@ import org.jetbrains.annotations.NotNull; + + /** + * Called when the GameMode of the player is changed. ++ *

++ * NOTE: When {@link #getCause()} is {@link Cause#DEFAULT_GAMEMODE}, ++ * the Player from {@link #getPlayer()} might not be fully online at ++ * the time this event is fired. Plugins should use {@link Player#isOnline()} ++ * to check before changing player state. + */ + public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; + private final GameMode newGameMode; ++ // Paper start ++ private final Cause cause; ++ private net.kyori.adventure.text.Component cancelMessage; + ++ @Deprecated // Paper end + public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode) { ++ // Paper start ++ this(player, newGameMode, Cause.UNKNOWN, null); ++ } ++ ++ public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode, @NotNull Cause cause, @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component cancelMessage) { ++ // Paper end + super(player); + this.newGameMode = newGameMode; ++ this.cause = cause; // Paper ++ this.cancelMessage = cancelMessage; // Paper + } + + @Override +@@ -49,4 +66,77 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl + public static HandlerList getHandlerList() { + return handlers; + } ++ // Paper start ++ /** ++ * Gets the cause of this gamemode change. ++ * ++ * @return the cause ++ */ ++ @NotNull ++ public Cause getCause() { ++ return cause; ++ } ++ ++ /** ++ * Only valid if the cause of the gamemode change was directly due to a command.. ++ * Gets the message shown to the command user if the event is cancelled ++ * as a notification that a player's gamemode was not changed. ++ *

++ * This returns {@code null} if the gamemode change was due to a plugin, or a ++ * player joining the game with a gamemode not equal to the server default gamemode ++ * and {@code force-gamemode} is set to true. ++ * ++ * @return the error message shown to the command user, null if not directly caused by a command ++ */ ++ @org.jetbrains.annotations.Nullable ++ public net.kyori.adventure.text.Component cancelMessage() { ++ return cancelMessage; ++ } ++ ++ /** ++ * Sets the message shown to the command user if the event was cancelled. ++ * The message is only shown to cancelled events that are directly called by a command ++ * not by a plugin or a player joining with the wrong gamemode. ++ * ++ * @param message the error message shown to the command user, null to show no message. ++ */ ++ public void cancelMessage(@org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component message) { ++ this.cancelMessage = message; ++ } ++ ++ public enum Cause { ++ ++ /** ++ * A plugin changed the player's gamemode with ++ * {@link Player#setGameMode(GameMode)}. ++ */ ++ PLUGIN, ++ ++ /** ++ * The {@code /gamemode} command was used. ++ */ ++ COMMAND, ++ ++ /** ++ * A player had their gamemode changed as a result of ++ * the {@code /defaultgamemode} command, or they joined ++ * with a gamemode that was not the default gamemode and ++ * {@code force-gamemode} in {@code server.properties} is set to true. ++ */ ++ DEFAULT_GAMEMODE, ++ ++ /** ++ * When the player dies in a hardcore world and has their gamemode ++ * changed to {@link GameMode#SPECTATOR}. ++ */ ++ HARDCORE_DEATH, ++ ++ /** ++ * This cause is only used if a plugin fired their own ++ * {@link PlayerGameModeChangeEvent} and did not include a ++ * cause. Can usually be ignored. ++ */ ++ UNKNOWN, ++ } ++ // Paper end + } diff --git a/patches/api/0279-ItemStack-repair-check-API.patch b/patches/api/0279-ItemStack-repair-check-API.patch new file mode 100644 index 0000000000..5949d4de6b --- /dev/null +++ b/patches/api/0279-ItemStack-repair-check-API.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 15 May 2021 22:10:50 -0700 +Subject: [PATCH] ItemStack repair check API + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 5f2d521a54d03a2270a1812146f954dc16c9d728..0a8a9e6fbead467737530ce6c84560dcbb803282 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -177,5 +177,15 @@ public interface UnsafeValues { + * @return the server's protocol version + */ + int getProtocolVersion(); ++ ++ /** ++ * Checks if an itemstack can be repaired with another itemstack. ++ * Returns false if either argument's type is not an item ({@link Material#isItem()}). ++ * ++ * @param itemToBeRepaired the itemstack to be repaired ++ * @param repairMaterial the repair material ++ * @return true if valid repair, false if not ++ */ ++ public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial); + // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index a92421bbf0ee40ecbe4f272459c6a918dc45344c..04ff6579282708c48edee419381c698707fe0a3b 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -903,5 +903,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + public io.papermc.paper.inventory.ItemRarity getRarity() { + return io.papermc.paper.inventory.ItemRarity.valueOf(this.getItemMeta().getRarity().name()); + } ++ ++ /** ++ * Checks if an itemstack can repair this itemstack. ++ * Returns false if {@code this} or {@code repairMaterial}'s type is not an item ({@link Material#isItem()}). ++ * ++ * @param repairMaterial the repair material ++ * @return true if it is repairable by, false if not ++ */ ++ public boolean isRepairableBy(@NotNull ItemStack repairMaterial) { ++ return Bukkit.getUnsafe().isValidRepairItemStack(this, repairMaterial); ++ } ++ ++ /** ++ * Checks if this itemstack can repair another. ++ * Returns false if {@code this} or {@code toBeRepaired}'s type is not an item ({@link Material#isItem()}). ++ * ++ * @param toBeRepaired the itemstack to be repaired ++ * @return true if it can repair, false if not ++ */ ++ public boolean canRepair(@NotNull ItemStack toBeRepaired) { ++ return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); ++ } + // Paper end + } diff --git a/patches/api/0279-additions-to-PlayerGameModeChangeEvent.patch b/patches/api/0279-additions-to-PlayerGameModeChangeEvent.patch deleted file mode 100644 index b2e65ae490..0000000000 --- a/patches/api/0279-additions-to-PlayerGameModeChangeEvent.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 15 May 2021 10:04:50 -0700 -Subject: [PATCH] additions to PlayerGameModeChangeEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java -index 4b96e0573c7ce32ad8c41124ee9ecab8359318a5..aee4a8b52c0d4abb655a4778575f0122acf19049 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java -@@ -8,15 +8,32 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called when the GameMode of the player is changed. -+ *

-+ * NOTE: When {@link #getCause()} is {@link Cause#DEFAULT_GAMEMODE}, -+ * the Player from {@link #getPlayer()} might not be fully online at -+ * the time this event is fired. Plugins should use {@link Player#isOnline()} -+ * to check before changing player state. - */ - public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - private final GameMode newGameMode; -+ // Paper start -+ private final Cause cause; -+ private net.kyori.adventure.text.Component cancelMessage; - -+ @Deprecated // Paper end - public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode) { -+ // Paper start -+ this(player, newGameMode, Cause.UNKNOWN, null); -+ } -+ -+ public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode, @NotNull Cause cause, @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component cancelMessage) { -+ // Paper end - super(player); - this.newGameMode = newGameMode; -+ this.cause = cause; // Paper -+ this.cancelMessage = cancelMessage; // Paper - } - - @Override -@@ -49,4 +66,77 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of this gamemode change. -+ * -+ * @return the cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return cause; -+ } -+ -+ /** -+ * Only valid if the cause of the gamemode change was directly due to a command.. -+ * Gets the message shown to the command user if the event is cancelled -+ * as a notification that a player's gamemode was not changed. -+ *

-+ * This returns {@code null} if the gamemode change was due to a plugin, or a -+ * player joining the game with a gamemode not equal to the server default gamemode -+ * and {@code force-gamemode} is set to true. -+ * -+ * @return the error message shown to the command user, null if not directly caused by a command -+ */ -+ @org.jetbrains.annotations.Nullable -+ public net.kyori.adventure.text.Component cancelMessage() { -+ return cancelMessage; -+ } -+ -+ /** -+ * Sets the message shown to the command user if the event was cancelled. -+ * The message is only shown to cancelled events that are directly called by a command -+ * not by a plugin or a player joining with the wrong gamemode. -+ * -+ * @param message the error message shown to the command user, null to show no message. -+ */ -+ public void cancelMessage(@org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component message) { -+ this.cancelMessage = message; -+ } -+ -+ public enum Cause { -+ -+ /** -+ * A plugin changed the player's gamemode with -+ * {@link Player#setGameMode(GameMode)}. -+ */ -+ PLUGIN, -+ -+ /** -+ * The {@code /gamemode} command was used. -+ */ -+ COMMAND, -+ -+ /** -+ * A player had their gamemode changed as a result of -+ * the {@code /defaultgamemode} command, or they joined -+ * with a gamemode that was not the default gamemode and -+ * {@code force-gamemode} in {@code server.properties} is set to true. -+ */ -+ DEFAULT_GAMEMODE, -+ -+ /** -+ * When the player dies in a hardcore world and has their gamemode -+ * changed to {@link GameMode#SPECTATOR}. -+ */ -+ HARDCORE_DEATH, -+ -+ /** -+ * This cause is only used if a plugin fired their own -+ * {@link PlayerGameModeChangeEvent} and did not include a -+ * cause. Can usually be ignored. -+ */ -+ UNKNOWN, -+ } -+ // Paper end - } diff --git a/patches/api/0280-ItemStack-repair-check-API.patch b/patches/api/0280-ItemStack-repair-check-API.patch deleted file mode 100644 index eff25d7f58..0000000000 --- a/patches/api/0280-ItemStack-repair-check-API.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 15 May 2021 22:10:50 -0700 -Subject: [PATCH] ItemStack repair check API - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index a874faec93468c83fc475b60629fc36f933bd11c..4130481843c9e0b847bd656622b0c1107ac1297b 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -176,5 +176,15 @@ public interface UnsafeValues { - * @return the server's protocol version - */ - int getProtocolVersion(); -+ -+ /** -+ * Checks if an itemstack can be repaired with another itemstack. -+ * Returns false if either argument's type is not an item ({@link Material#isItem()}). -+ * -+ * @param itemToBeRepaired the itemstack to be repaired -+ * @param repairMaterial the repair material -+ * @return true if valid repair, false if not -+ */ -+ public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial); - // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index a92421bbf0ee40ecbe4f272459c6a918dc45344c..04ff6579282708c48edee419381c698707fe0a3b 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -903,5 +903,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - public io.papermc.paper.inventory.ItemRarity getRarity() { - return io.papermc.paper.inventory.ItemRarity.valueOf(this.getItemMeta().getRarity().name()); - } -+ -+ /** -+ * Checks if an itemstack can repair this itemstack. -+ * Returns false if {@code this} or {@code repairMaterial}'s type is not an item ({@link Material#isItem()}). -+ * -+ * @param repairMaterial the repair material -+ * @return true if it is repairable by, false if not -+ */ -+ public boolean isRepairableBy(@NotNull ItemStack repairMaterial) { -+ return Bukkit.getUnsafe().isValidRepairItemStack(this, repairMaterial); -+ } -+ -+ /** -+ * Checks if this itemstack can repair another. -+ * Returns false if {@code this} or {@code toBeRepaired}'s type is not an item ({@link Material#isItem()}). -+ * -+ * @param toBeRepaired the itemstack to be repaired -+ * @return true if it can repair, false if not -+ */ -+ public boolean canRepair(@NotNull ItemStack toBeRepaired) { -+ return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); -+ } - // Paper end - } diff --git a/patches/api/0280-More-Enchantment-API.patch b/patches/api/0280-More-Enchantment-API.patch new file mode 100644 index 0000000000..a58f9ad820 --- /dev/null +++ b/patches/api/0280-More-Enchantment-API.patch @@ -0,0 +1,189 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 6 May 2021 19:58:03 -0700 +Subject: [PATCH] More Enchantment API + +Co-authored-by: Luis + +diff --git a/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java b/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java +new file mode 100644 +index 0000000000000000000000000000000000000000..50c49739cc25679c9d241466e3069c9c232a22c4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java +@@ -0,0 +1,25 @@ ++package io.papermc.paper.enchantments; ++ ++@Deprecated(forRemoval = true, since = "As of 1.20.5 enchantments do not have a rarity.") ++public enum EnchantmentRarity { ++ ++ COMMON(10), ++ UNCOMMON(5), ++ RARE(2), ++ VERY_RARE(1); ++ ++ private final int weight; ++ ++ EnchantmentRarity(int weight) { ++ this.weight = weight; ++ } ++ ++ /** ++ * Gets the weight for the rarity. ++ * ++ * @return the weight ++ */ ++ public int getWeight() { ++ return weight; ++ } ++} +diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java +index 4e41980dfbb256356231bc9565f6a90ea66aab76..de616cecaeb45018d96685c916532188e369bdd4 100644 +--- a/src/main/java/org/bukkit/enchantments/Enchantment.java ++++ b/src/main/java/org/bukkit/enchantments/Enchantment.java +@@ -292,11 +292,7 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve + * Cursed enchantments are found the same way treasure enchantments are + * + * @return true if the enchantment is cursed +- * @deprecated cursed enchantments are no longer special. Will return true +- * only for {@link Enchantment#BINDING_CURSE} and +- * {@link Enchantment#VANISHING_CURSE}. + */ +- @Deprecated + public abstract boolean isCursed(); + + /** +@@ -330,6 +326,87 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve + * @return the name of the enchantment with {@code level} applied + */ + public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); ++ ++ /** ++ * Checks if this enchantment can be found in villager trades. ++ * ++ * @return true if the enchantment can be found in trades ++ */ ++ public abstract boolean isTradeable(); ++ ++ /** ++ * Checks if this enchantment can be found in an enchanting table ++ * or use to enchant items generated by loot tables. ++ * ++ * @return true if the enchantment can be found in a table or by loot tables ++ */ ++ public abstract boolean isDiscoverable(); ++ ++ /** ++ * Gets the minimum modified cost of this enchantment at a specific level. ++ *

++ * Note this is not the number of experience levels needed, and does not directly translate to the levels shown in an enchanting table. ++ * This value is used in combination with factors such as tool enchantability to determine a final cost. ++ * See https://minecraft.wiki/w/Enchanting/Levels for more information. ++ *

++ * @param level The level of the enchantment ++ * @return The modified cost of this enchantment ++ */ ++ public abstract int getMinModifiedCost(int level); ++ ++ /** ++ * Gets the maximum modified cost of this enchantment at a specific level. ++ *

++ * Note this is not the number of experience levels needed, and does not directly translate to the levels shown in an enchanting table. ++ * This value is used in combination with factors such as tool enchantability to determine a final cost. ++ * See https://minecraft.wiki/w/Enchanting/Levels for more information. ++ *

++ * @param level The level of the enchantment ++ * @return The modified cost of this enchantment ++ */ ++ public abstract int getMaxModifiedCost(int level); ++ ++ /** ++ * Gets the rarity of this enchantment. ++ * ++ * @return the rarity ++ * @deprecated As of 1.20.5 enchantments do not have a rarity. ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ @Contract("-> fail") ++ public abstract io.papermc.paper.enchantments.EnchantmentRarity getRarity(); ++ ++ /** ++ * Gets the damage increase as a result of the level and entity category specified ++ * ++ * @param level the level of enchantment ++ * @param entityCategory the category of entity ++ * @return the damage increase ++ * @deprecated Use {@link #getDamageIncrease(int, org.bukkit.entity.EntityType)} instead. ++ * Enchantment damage increase is no longer handled via {@link org.bukkit.entity.EntityCategory}s, but ++ * is instead controlled by tags, e.g. {@link org.bukkit.Tag#ENTITY_TYPES_SENSITIVE_TO_BANE_OF_ARTHROPODS}. ++ * As such, a category cannot properly represent all entities defined by the tags. ++ */ ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory); ++ ++ /** ++ * Gets the damage increase as a result of the level and entity type specified ++ * ++ * @param level the level of enchantment ++ * @param entityType the type of entity. ++ * @return the damage increase ++ */ ++ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType); ++ ++ /** ++ * Gets the equipment slots where this enchantment is considered "active". ++ * ++ * @return the equipment slots ++ */ ++ @NotNull ++ public abstract java.util.Set getActiveSlots(); + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +index ac0371285370594d4de1554871b19bbcd2311730..da5d153a3e55a38b767359564001ad8663f9730b 100644 +--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java ++++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java +@@ -31,5 +31,42 @@ public abstract class EnchantmentWrapper extends Enchantment { + public @NotNull String translationKey() { + return getEnchantment().translationKey(); + } ++ ++ @Override ++ public boolean isTradeable() { ++ return getEnchantment().isTradeable(); ++ } ++ ++ @Override ++ public boolean isDiscoverable() { ++ return getEnchantment().isDiscoverable(); ++ } ++ ++ @Override ++ public int getMinModifiedCost(int level) { ++ return getEnchantment().getMinModifiedCost(level); ++ } ++ ++ @Override ++ public int getMaxModifiedCost(int level) { ++ return getEnchantment().getMaxModifiedCost(level); ++ } ++ ++ @NotNull ++ @Override ++ public io.papermc.paper.enchantments.EnchantmentRarity getRarity() { ++ return getEnchantment().getRarity(); ++ } ++ ++ @Override ++ public float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory) { ++ return getEnchantment().getDamageIncrease(level, entityCategory); ++ } ++ ++ @NotNull ++ @Override ++ public java.util.Set getActiveSlots() { ++ return getEnchantment().getActiveSlots(); ++ } + // Paper end + } diff --git a/patches/api/0281-Add-Mob-lookAt-API.patch b/patches/api/0281-Add-Mob-lookAt-API.patch new file mode 100644 index 0000000000..0dd5126905 --- /dev/null +++ b/patches/api/0281-Add-Mob-lookAt-API.patch @@ -0,0 +1,99 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 14 May 2021 13:42:06 -0500 +Subject: [PATCH] Add Mob#lookAt API + + +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 7eee2e561346ac1d672f9652edb78e76c910fc9d..11b6d1aba7d1f6ae1f3c822193486f5a1478e105 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -27,6 +27,88 @@ public interface Mob extends LivingEntity, Lootable { + * @return True if mob is exposed to daylight + */ + boolean isInDaylight(); ++ ++ /** ++ * Instruct this Mob to look at a specific Location ++ *

++ * Useful when implementing custom mob goals ++ * ++ * @param location location to look at ++ */ ++ void lookAt(@NotNull org.bukkit.Location location); ++ ++ /** ++ * Instruct this Mob to look at a specific Location ++ *

++ * Useful when implementing custom mob goals ++ * ++ * @param location location to look at ++ * @param headRotationSpeed head rotation speed ++ * @param maxHeadPitch max head pitch rotation ++ */ ++ void lookAt(@NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch); ++ ++ /** ++ * Instruct this Mob to look at a specific Entity ++ *

++ * If a LivingEntity, look at eye location ++ *

++ * Useful when implementing custom mob goals ++ * ++ * @param entity entity to look at ++ */ ++ void lookAt(@NotNull Entity entity); ++ ++ /** ++ * Instruct this Mob to look at a specific Entity ++ *

++ * If a LivingEntity, look at eye location ++ *

++ * Useful when implementing custom mob goals ++ * ++ * @param entity entity to look at ++ * @param headRotationSpeed head rotation speed ++ * @param maxHeadPitch max head pitch rotation ++ */ ++ void lookAt(@NotNull Entity entity, float headRotationSpeed, float maxHeadPitch); ++ ++ /** ++ * Instruct this Mob to look at a specific position ++ *

++ * Useful when implementing custom mob goals ++ * ++ * @param x x coordinate ++ * @param y y coordinate ++ * @param z z coordinate ++ */ ++ void lookAt(double x, double y, double z); ++ ++ /** ++ * Instruct this Mob to look at a specific position ++ *

++ * Useful when implementing custom mob goals ++ * ++ * @param x x coordinate ++ * @param y y coordinate ++ * @param z z coordinate ++ * @param headRotationSpeed head rotation speed ++ * @param maxHeadPitch max head pitch rotation ++ */ ++ void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch); ++ ++ /** ++ * Gets the head rotation speed ++ * ++ * @return the head rotation speed ++ */ ++ int getHeadRotationSpeed(); ++ ++ /** ++ * Gets the max head pitch rotation ++ * ++ * @return the max head pitch rotation ++ */ ++ int getMaxHeadPitch(); + // Paper end + /** + * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/0281-More-Enchantment-API.patch b/patches/api/0281-More-Enchantment-API.patch deleted file mode 100644 index a58f9ad820..0000000000 --- a/patches/api/0281-More-Enchantment-API.patch +++ /dev/null @@ -1,189 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 6 May 2021 19:58:03 -0700 -Subject: [PATCH] More Enchantment API - -Co-authored-by: Luis - -diff --git a/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java b/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java -new file mode 100644 -index 0000000000000000000000000000000000000000..50c49739cc25679c9d241466e3069c9c232a22c4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java -@@ -0,0 +1,25 @@ -+package io.papermc.paper.enchantments; -+ -+@Deprecated(forRemoval = true, since = "As of 1.20.5 enchantments do not have a rarity.") -+public enum EnchantmentRarity { -+ -+ COMMON(10), -+ UNCOMMON(5), -+ RARE(2), -+ VERY_RARE(1); -+ -+ private final int weight; -+ -+ EnchantmentRarity(int weight) { -+ this.weight = weight; -+ } -+ -+ /** -+ * Gets the weight for the rarity. -+ * -+ * @return the weight -+ */ -+ public int getWeight() { -+ return weight; -+ } -+} -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index 4e41980dfbb256356231bc9565f6a90ea66aab76..de616cecaeb45018d96685c916532188e369bdd4 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -292,11 +292,7 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve - * Cursed enchantments are found the same way treasure enchantments are - * - * @return true if the enchantment is cursed -- * @deprecated cursed enchantments are no longer special. Will return true -- * only for {@link Enchantment#BINDING_CURSE} and -- * {@link Enchantment#VANISHING_CURSE}. - */ -- @Deprecated - public abstract boolean isCursed(); - - /** -@@ -330,6 +326,87 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve - * @return the name of the enchantment with {@code level} applied - */ - public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); -+ -+ /** -+ * Checks if this enchantment can be found in villager trades. -+ * -+ * @return true if the enchantment can be found in trades -+ */ -+ public abstract boolean isTradeable(); -+ -+ /** -+ * Checks if this enchantment can be found in an enchanting table -+ * or use to enchant items generated by loot tables. -+ * -+ * @return true if the enchantment can be found in a table or by loot tables -+ */ -+ public abstract boolean isDiscoverable(); -+ -+ /** -+ * Gets the minimum modified cost of this enchantment at a specific level. -+ *

-+ * Note this is not the number of experience levels needed, and does not directly translate to the levels shown in an enchanting table. -+ * This value is used in combination with factors such as tool enchantability to determine a final cost. -+ * See https://minecraft.wiki/w/Enchanting/Levels for more information. -+ *

-+ * @param level The level of the enchantment -+ * @return The modified cost of this enchantment -+ */ -+ public abstract int getMinModifiedCost(int level); -+ -+ /** -+ * Gets the maximum modified cost of this enchantment at a specific level. -+ *

-+ * Note this is not the number of experience levels needed, and does not directly translate to the levels shown in an enchanting table. -+ * This value is used in combination with factors such as tool enchantability to determine a final cost. -+ * See https://minecraft.wiki/w/Enchanting/Levels for more information. -+ *

-+ * @param level The level of the enchantment -+ * @return The modified cost of this enchantment -+ */ -+ public abstract int getMaxModifiedCost(int level); -+ -+ /** -+ * Gets the rarity of this enchantment. -+ * -+ * @return the rarity -+ * @deprecated As of 1.20.5 enchantments do not have a rarity. -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ @Contract("-> fail") -+ public abstract io.papermc.paper.enchantments.EnchantmentRarity getRarity(); -+ -+ /** -+ * Gets the damage increase as a result of the level and entity category specified -+ * -+ * @param level the level of enchantment -+ * @param entityCategory the category of entity -+ * @return the damage increase -+ * @deprecated Use {@link #getDamageIncrease(int, org.bukkit.entity.EntityType)} instead. -+ * Enchantment damage increase is no longer handled via {@link org.bukkit.entity.EntityCategory}s, but -+ * is instead controlled by tags, e.g. {@link org.bukkit.Tag#ENTITY_TYPES_SENSITIVE_TO_BANE_OF_ARTHROPODS}. -+ * As such, a category cannot properly represent all entities defined by the tags. -+ */ -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory); -+ -+ /** -+ * Gets the damage increase as a result of the level and entity type specified -+ * -+ * @param level the level of enchantment -+ * @param entityType the type of entity. -+ * @return the damage increase -+ */ -+ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType); -+ -+ /** -+ * Gets the equipment slots where this enchantment is considered "active". -+ * -+ * @return the equipment slots -+ */ -+ @NotNull -+ public abstract java.util.Set getActiveSlots(); - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -index ac0371285370594d4de1554871b19bbcd2311730..da5d153a3e55a38b767359564001ad8663f9730b 100644 ---- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java -@@ -31,5 +31,42 @@ public abstract class EnchantmentWrapper extends Enchantment { - public @NotNull String translationKey() { - return getEnchantment().translationKey(); - } -+ -+ @Override -+ public boolean isTradeable() { -+ return getEnchantment().isTradeable(); -+ } -+ -+ @Override -+ public boolean isDiscoverable() { -+ return getEnchantment().isDiscoverable(); -+ } -+ -+ @Override -+ public int getMinModifiedCost(int level) { -+ return getEnchantment().getMinModifiedCost(level); -+ } -+ -+ @Override -+ public int getMaxModifiedCost(int level) { -+ return getEnchantment().getMaxModifiedCost(level); -+ } -+ -+ @NotNull -+ @Override -+ public io.papermc.paper.enchantments.EnchantmentRarity getRarity() { -+ return getEnchantment().getRarity(); -+ } -+ -+ @Override -+ public float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory) { -+ return getEnchantment().getDamageIncrease(level, entityCategory); -+ } -+ -+ @NotNull -+ @Override -+ public java.util.Set getActiveSlots() { -+ return getEnchantment().getActiveSlots(); -+ } - // Paper end - } diff --git a/patches/api/0282-Add-Mob-lookAt-API.patch b/patches/api/0282-Add-Mob-lookAt-API.patch deleted file mode 100644 index 0dd5126905..0000000000 --- a/patches/api/0282-Add-Mob-lookAt-API.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 14 May 2021 13:42:06 -0500 -Subject: [PATCH] Add Mob#lookAt API - - -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 7eee2e561346ac1d672f9652edb78e76c910fc9d..11b6d1aba7d1f6ae1f3c822193486f5a1478e105 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -27,6 +27,88 @@ public interface Mob extends LivingEntity, Lootable { - * @return True if mob is exposed to daylight - */ - boolean isInDaylight(); -+ -+ /** -+ * Instruct this Mob to look at a specific Location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param location location to look at -+ */ -+ void lookAt(@NotNull org.bukkit.Location location); -+ -+ /** -+ * Instruct this Mob to look at a specific Location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param location location to look at -+ * @param headRotationSpeed head rotation speed -+ * @param maxHeadPitch max head pitch rotation -+ */ -+ void lookAt(@NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch); -+ -+ /** -+ * Instruct this Mob to look at a specific Entity -+ *

-+ * If a LivingEntity, look at eye location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param entity entity to look at -+ */ -+ void lookAt(@NotNull Entity entity); -+ -+ /** -+ * Instruct this Mob to look at a specific Entity -+ *

-+ * If a LivingEntity, look at eye location -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param entity entity to look at -+ * @param headRotationSpeed head rotation speed -+ * @param maxHeadPitch max head pitch rotation -+ */ -+ void lookAt(@NotNull Entity entity, float headRotationSpeed, float maxHeadPitch); -+ -+ /** -+ * Instruct this Mob to look at a specific position -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param x x coordinate -+ * @param y y coordinate -+ * @param z z coordinate -+ */ -+ void lookAt(double x, double y, double z); -+ -+ /** -+ * Instruct this Mob to look at a specific position -+ *

-+ * Useful when implementing custom mob goals -+ * -+ * @param x x coordinate -+ * @param y y coordinate -+ * @param z z coordinate -+ * @param headRotationSpeed head rotation speed -+ * @param maxHeadPitch max head pitch rotation -+ */ -+ void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch); -+ -+ /** -+ * Gets the head rotation speed -+ * -+ * @return the head rotation speed -+ */ -+ int getHeadRotationSpeed(); -+ -+ /** -+ * Gets the max head pitch rotation -+ * -+ * @return the max head pitch rotation -+ */ -+ int getMaxHeadPitch(); - // Paper end - /** - * Instructs this Mob to set the specified LivingEntity as its target. diff --git a/patches/api/0282-ItemStack-editMeta.patch b/patches/api/0282-ItemStack-editMeta.patch new file mode 100644 index 0000000000..d2c36b432c --- /dev/null +++ b/patches/api/0282-ItemStack-editMeta.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Riley Park +Date: Sun, 23 May 2021 05:04:28 -0700 +Subject: [PATCH] ItemStack#editMeta + + +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 04ff6579282708c48edee419381c698707fe0a3b..351f5c0feec38377fccf09bfc1cef2df88fc2dcd 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -561,6 +561,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + return result.ensureServerConversions(); // Paper + } + ++ // Paper start ++ /** ++ * Edits the {@link ItemMeta} of this stack. ++ *

++ * The {@link java.util.function.Consumer} must only interact ++ * with this stack's {@link ItemMeta} through the provided {@link ItemMeta} instance. ++ * Calling this method or any other meta-related method of the {@link ItemStack} class ++ * (such as {@link #getItemMeta()}, {@link #addItemFlags(ItemFlag...)}, {@link #lore()}, etc.) ++ * from inside the consumer is disallowed and will produce undefined results or exceptions. ++ *

++ * ++ * @param consumer the meta consumer ++ * @return {@code true} if the edit was successful, {@code false} otherwise ++ */ ++ public boolean editMeta(final @NotNull java.util.function.Consumer consumer) { ++ return editMeta(ItemMeta.class, consumer); ++ } ++ ++ /** ++ * Edits the {@link ItemMeta} of this stack if the meta is of the specified type. ++ *

++ * The {@link java.util.function.Consumer} must only interact ++ * with this stack's {@link ItemMeta} through the provided {@link ItemMeta} instance. ++ * Calling this method or any other meta-related method of the {@link ItemStack} class ++ * (such as {@link #getItemMeta()}, {@link #addItemFlags(ItemFlag...)}, {@link #lore()}, etc.) ++ * from inside the consumer is disallowed and will produce undefined results or exceptions. ++ *

++ * ++ * @param metaClass the type of meta to edit ++ * @param consumer the meta consumer ++ * @param the meta type ++ * @return {@code true} if the edit was successful, {@code false} otherwise ++ */ ++ public boolean editMeta(final @NotNull Class metaClass, final @NotNull java.util.function.Consumer<@NotNull ? super M> consumer) { ++ final @Nullable ItemMeta meta = this.getItemMeta(); ++ if (metaClass.isInstance(meta)) { ++ consumer.accept((M) meta); ++ this.setItemMeta(meta); ++ return true; ++ } ++ return false; ++ } ++ // Paper end ++ + /** + * Get a copy of this ItemStack's {@link ItemMeta}. + * diff --git a/patches/api/0283-Add-EntityInsideBlockEvent.patch b/patches/api/0283-Add-EntityInsideBlockEvent.patch new file mode 100644 index 0000000000..2805c40dcc --- /dev/null +++ b/patches/api/0283-Add-EntityInsideBlockEvent.patch @@ -0,0 +1,98 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 8 May 2021 18:02:06 -0700 +Subject: [PATCH] Add EntityInsideBlockEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3e98db83060e614c606de41dcd4b4ac4f242edc9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java +@@ -0,0 +1,86 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when an entity enters the hitbox of a block. ++ * Only called for blocks that react when an entity is inside. ++ * If cancelled, any action that would have resulted from that entity ++ * being in the block will not happen (such as extinguishing an entity in a cauldron). ++ *

++ * Blocks this is currently called for: ++ *

    ++ *
  • Big dripleaf
  • ++ *
  • Bubble column
  • ++ *
  • Buttons
  • ++ *
  • Cactus
  • ++ *
  • Campfire
  • ++ *
  • Cauldron
  • ++ *
  • Crops
  • ++ *
  • Ender Portal
  • ++ *
  • Fires
  • ++ *
  • Frogspawn
  • ++ *
  • Honey
  • ++ *
  • Hopper
  • ++ *
  • Detector rails
  • ++ *
  • Nether portals
  • ++ *
  • Pitcher crop
  • ++ *
  • Powdered snow
  • ++ *
  • Pressure plates
  • ++ *
  • Sweet berry bush
  • ++ *
  • Tripwire
  • ++ *
  • Waterlily
  • ++ *
  • Web
  • ++ *
  • Wither rose
  • ++ *
++ */ ++public class EntityInsideBlockEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Block block; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityInsideBlockEvent(@NotNull Entity entity, @NotNull Block block) { ++ super(entity); ++ this.block = block; ++ } ++ ++ /** ++ * Gets the block. ++ * ++ * @return the block ++ */ ++ @NotNull ++ public Block getBlock() { ++ return this.block; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0283-ItemStack-editMeta.patch b/patches/api/0283-ItemStack-editMeta.patch deleted file mode 100644 index d2c36b432c..0000000000 --- a/patches/api/0283-ItemStack-editMeta.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Riley Park -Date: Sun, 23 May 2021 05:04:28 -0700 -Subject: [PATCH] ItemStack#editMeta - - -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 04ff6579282708c48edee419381c698707fe0a3b..351f5c0feec38377fccf09bfc1cef2df88fc2dcd 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -561,6 +561,50 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - return result.ensureServerConversions(); // Paper - } - -+ // Paper start -+ /** -+ * Edits the {@link ItemMeta} of this stack. -+ *

-+ * The {@link java.util.function.Consumer} must only interact -+ * with this stack's {@link ItemMeta} through the provided {@link ItemMeta} instance. -+ * Calling this method or any other meta-related method of the {@link ItemStack} class -+ * (such as {@link #getItemMeta()}, {@link #addItemFlags(ItemFlag...)}, {@link #lore()}, etc.) -+ * from inside the consumer is disallowed and will produce undefined results or exceptions. -+ *

-+ * -+ * @param consumer the meta consumer -+ * @return {@code true} if the edit was successful, {@code false} otherwise -+ */ -+ public boolean editMeta(final @NotNull java.util.function.Consumer consumer) { -+ return editMeta(ItemMeta.class, consumer); -+ } -+ -+ /** -+ * Edits the {@link ItemMeta} of this stack if the meta is of the specified type. -+ *

-+ * The {@link java.util.function.Consumer} must only interact -+ * with this stack's {@link ItemMeta} through the provided {@link ItemMeta} instance. -+ * Calling this method or any other meta-related method of the {@link ItemStack} class -+ * (such as {@link #getItemMeta()}, {@link #addItemFlags(ItemFlag...)}, {@link #lore()}, etc.) -+ * from inside the consumer is disallowed and will produce undefined results or exceptions. -+ *

-+ * -+ * @param metaClass the type of meta to edit -+ * @param consumer the meta consumer -+ * @param the meta type -+ * @return {@code true} if the edit was successful, {@code false} otherwise -+ */ -+ public boolean editMeta(final @NotNull Class metaClass, final @NotNull java.util.function.Consumer<@NotNull ? super M> consumer) { -+ final @Nullable ItemMeta meta = this.getItemMeta(); -+ if (metaClass.isInstance(meta)) { -+ consumer.accept((M) meta); -+ this.setItemMeta(meta); -+ return true; -+ } -+ return false; -+ } -+ // Paper end -+ - /** - * Get a copy of this ItemStack's {@link ItemMeta}. - * diff --git a/patches/api/0284-Add-EntityInsideBlockEvent.patch b/patches/api/0284-Add-EntityInsideBlockEvent.patch deleted file mode 100644 index 2805c40dcc..0000000000 --- a/patches/api/0284-Add-EntityInsideBlockEvent.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 8 May 2021 18:02:06 -0700 -Subject: [PATCH] Add EntityInsideBlockEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3e98db83060e614c606de41dcd4b4ac4f242edc9 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java -@@ -0,0 +1,86 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when an entity enters the hitbox of a block. -+ * Only called for blocks that react when an entity is inside. -+ * If cancelled, any action that would have resulted from that entity -+ * being in the block will not happen (such as extinguishing an entity in a cauldron). -+ *

-+ * Blocks this is currently called for: -+ *

    -+ *
  • Big dripleaf
  • -+ *
  • Bubble column
  • -+ *
  • Buttons
  • -+ *
  • Cactus
  • -+ *
  • Campfire
  • -+ *
  • Cauldron
  • -+ *
  • Crops
  • -+ *
  • Ender Portal
  • -+ *
  • Fires
  • -+ *
  • Frogspawn
  • -+ *
  • Honey
  • -+ *
  • Hopper
  • -+ *
  • Detector rails
  • -+ *
  • Nether portals
  • -+ *
  • Pitcher crop
  • -+ *
  • Powdered snow
  • -+ *
  • Pressure plates
  • -+ *
  • Sweet berry bush
  • -+ *
  • Tripwire
  • -+ *
  • Waterlily
  • -+ *
  • Web
  • -+ *
  • Wither rose
  • -+ *
-+ */ -+public class EntityInsideBlockEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block block; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityInsideBlockEvent(@NotNull Entity entity, @NotNull Block block) { -+ super(entity); -+ this.block = block; -+ } -+ -+ /** -+ * Gets the block. -+ * -+ * @return the block -+ */ -+ @NotNull -+ public Block getBlock() { -+ return this.block; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0284-Attributes-API-for-item-defaults.patch b/patches/api/0284-Attributes-API-for-item-defaults.patch new file mode 100644 index 0000000000..db30aff62c --- /dev/null +++ b/patches/api/0284-Attributes-API-for-item-defaults.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 8 May 2021 15:02:00 -0700 +Subject: [PATCH] Attributes API for item defaults + +(Now replaced by upstream's API) + +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 1e4ebe9bdc6aadf18029377e7ce70ca0d88bd1a1..3cb658023d738617a310099fa3759af253a9f4c2 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -4763,6 +4763,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + public io.papermc.paper.inventory.ItemRarity getItemRarity() { + return new org.bukkit.inventory.ItemStack(this).getRarity(); + } ++ ++ /** ++ * Returns an immutable multimap of attributes for the slot. ++ * {@link #isItem()} must be true for this material. ++ * ++ * @param equipmentSlot the slot to get the attributes for ++ * @throws IllegalArgumentException if {@link #isItem()} is false ++ * @return an immutable multimap of attributes ++ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)} ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true, since = "1.20.5") ++ public Multimap getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { ++ return this.getDefaultAttributeModifiers(equipmentSlot); ++ } + // Paper end + + /** diff --git a/patches/api/0285-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/api/0285-Add-cause-to-Weather-ThunderChangeEvents.patch new file mode 100644 index 0000000000..8e5d45d87b --- /dev/null +++ b/patches/api/0285-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -0,0 +1,104 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 2 Dec 2020 18:25:31 -0800 +Subject: [PATCH] Add cause to Weather/ThunderChangeEvents + + +diff --git a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java +index 6cdf83476b4e366bed79960e3706bea5ebe56788..032395c7114b6d757acf1918ce2b014870e85fcd 100644 +--- a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java ++++ b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java +@@ -12,10 +12,20 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean canceled; + private final boolean to; ++ // Paper start ++ private final Cause cause; + ++ public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) { ++ super(world); ++ this.to = to; ++ this.cause = cause; ++ } ++ ++ @Deprecated // Paper end + public ThunderChangeEvent(@NotNull final World world, final boolean to) { + super(world); + this.to = to; ++ this.cause = Cause.UNKNOWN; // Paper + } + + @Override +@@ -47,4 +57,23 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { + public static HandlerList getHandlerList() { + return handlers; + } ++ // Paper start ++ /** ++ * Gets the cause of the weather change. ++ * ++ * @return the weather change cause ++ */ ++ @NotNull ++ public Cause getCause() { ++ return this.cause; ++ } ++ ++ public enum Cause { ++ COMMAND, ++ NATURAL, ++ SLEEP, ++ PLUGIN, ++ UNKNOWN ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java +index d562d87e7418641e52f4dae44f573eaa31add44a..dabd390b84354c14c269c03cbed2006014d004b2 100644 +--- a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java ++++ b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java +@@ -12,10 +12,20 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean canceled; + private final boolean to; ++ // Paper start ++ private final Cause cause; + ++ public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) { ++ super(world); ++ this.to = to; ++ this.cause = cause; ++ } ++ ++ @Deprecated // Paper end + public WeatherChangeEvent(@NotNull final World world, final boolean to) { + super(world); + this.to = to; ++ this.cause = Cause.UNKNOWN; // Paper + } + + @Override +@@ -47,4 +57,23 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { + public static HandlerList getHandlerList() { + return handlers; + } ++ // Paper start ++ /** ++ * Gets the cause of the weather change. ++ * ++ * @return the weather change cause ++ */ ++ @NotNull ++ public Cause getCause() { ++ return cause; ++ } ++ ++ public enum Cause { ++ COMMAND, ++ NATURAL, ++ SLEEP, ++ PLUGIN, ++ UNKNOWN ++ } ++ // Paper end + } diff --git a/patches/api/0285-Attributes-API-for-item-defaults.patch b/patches/api/0285-Attributes-API-for-item-defaults.patch deleted file mode 100644 index db30aff62c..0000000000 --- a/patches/api/0285-Attributes-API-for-item-defaults.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 8 May 2021 15:02:00 -0700 -Subject: [PATCH] Attributes API for item defaults - -(Now replaced by upstream's API) - -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 1e4ebe9bdc6aadf18029377e7ce70ca0d88bd1a1..3cb658023d738617a310099fa3759af253a9f4c2 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -4763,6 +4763,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - public io.papermc.paper.inventory.ItemRarity getItemRarity() { - return new org.bukkit.inventory.ItemStack(this).getRarity(); - } -+ -+ /** -+ * Returns an immutable multimap of attributes for the slot. -+ * {@link #isItem()} must be true for this material. -+ * -+ * @param equipmentSlot the slot to get the attributes for -+ * @throws IllegalArgumentException if {@link #isItem()} is false -+ * @return an immutable multimap of attributes -+ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)} -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true, since = "1.20.5") -+ public Multimap getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { -+ return this.getDefaultAttributeModifiers(equipmentSlot); -+ } - // Paper end - - /** diff --git a/patches/api/0286-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/api/0286-Add-cause-to-Weather-ThunderChangeEvents.patch deleted file mode 100644 index 8e5d45d87b..0000000000 --- a/patches/api/0286-Add-cause-to-Weather-ThunderChangeEvents.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 2 Dec 2020 18:25:31 -0800 -Subject: [PATCH] Add cause to Weather/ThunderChangeEvents - - -diff --git a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java -index 6cdf83476b4e366bed79960e3706bea5ebe56788..032395c7114b6d757acf1918ce2b014870e85fcd 100644 ---- a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java -+++ b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java -@@ -12,10 +12,20 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean canceled; - private final boolean to; -+ // Paper start -+ private final Cause cause; - -+ public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) { -+ super(world); -+ this.to = to; -+ this.cause = cause; -+ } -+ -+ @Deprecated // Paper end - public ThunderChangeEvent(@NotNull final World world, final boolean to) { - super(world); - this.to = to; -+ this.cause = Cause.UNKNOWN; // Paper - } - - @Override -@@ -47,4 +57,23 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of the weather change. -+ * -+ * @return the weather change cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ public enum Cause { -+ COMMAND, -+ NATURAL, -+ SLEEP, -+ PLUGIN, -+ UNKNOWN -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java -index d562d87e7418641e52f4dae44f573eaa31add44a..dabd390b84354c14c269c03cbed2006014d004b2 100644 ---- a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java -+++ b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java -@@ -12,10 +12,20 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean canceled; - private final boolean to; -+ // Paper start -+ private final Cause cause; - -+ public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) { -+ super(world); -+ this.to = to; -+ this.cause = cause; -+ } -+ -+ @Deprecated // Paper end - public WeatherChangeEvent(@NotNull final World world, final boolean to) { - super(world); - this.to = to; -+ this.cause = Cause.UNKNOWN; // Paper - } - - @Override -@@ -47,4 +57,23 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of the weather change. -+ * -+ * @return the weather change cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return cause; -+ } -+ -+ public enum Cause { -+ COMMAND, -+ NATURAL, -+ SLEEP, -+ PLUGIN, -+ UNKNOWN -+ } -+ // Paper end - } diff --git a/patches/api/0286-More-Lidded-Block-API.patch b/patches/api/0286-More-Lidded-Block-API.patch new file mode 100644 index 0000000000..a89f206f9a --- /dev/null +++ b/patches/api/0286-More-Lidded-Block-API.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: LemonCaramel +Date: Sun, 23 May 2021 17:49:31 +0900 +Subject: [PATCH] More Lidded Block API + + +diff --git a/src/main/java/org/bukkit/block/Lidded.java b/src/main/java/org/bukkit/block/Lidded.java +index 9da2566e02e63be1a0188deaa27b841fa61688ea..30c7df0021df44a411e50636d906d4a1d30fd927 100644 +--- a/src/main/java/org/bukkit/block/Lidded.java ++++ b/src/main/java/org/bukkit/block/Lidded.java +@@ -13,4 +13,13 @@ public interface Lidded { + * viewing this block. + */ + void close(); ++ ++ // Paper start - More Lidded Block API ++ /** ++ * Checks if the block's animation state. ++ * ++ * @return true if the block's animation state is set to open. ++ */ ++ boolean isOpen(); ++ // Paper end - More Lidded Block API + } diff --git a/patches/api/0287-Add-PlayerKickEvent-causes.patch b/patches/api/0287-Add-PlayerKickEvent-causes.patch new file mode 100644 index 0000000000..5bded2058c --- /dev/null +++ b/patches/api/0287-Add-PlayerKickEvent-causes.patch @@ -0,0 +1,144 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 15 May 2021 20:30:34 -0700 +Subject: [PATCH] Add PlayerKickEvent causes + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 752b2bac47588c0f75a13a7e6ec2be3c2f5a149e..b177daa7a974125dc4ccf1bc6d119ad42dba3514 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -321,6 +321,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * @param message kick message + */ + void kick(final net.kyori.adventure.text.@Nullable Component message); ++ ++ /** ++ * Kicks player with custom kick message and cause. ++ * ++ * @param message kick message ++ * @param cause kick cause ++ */ ++ void kick(final net.kyori.adventure.text.@Nullable Component message, org.bukkit.event.player.PlayerKickEvent.@NotNull Cause cause); + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +index 997b06c19a5277656521e0e298f2958c209f1da1..b8bf61bea73086c61dce6230686e627dc324ebe0 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +@@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private net.kyori.adventure.text.Component leaveMessage; // Paper + private net.kyori.adventure.text.Component kickReason; // Paper ++ private final Cause cause; // Paper + private boolean cancel; + + @Deprecated // Paper +@@ -19,14 +20,26 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { + super(playerKicked); + this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper + this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper ++ this.cause = Cause.UNKNOWN; // Paper + this.cancel = false; + } + // Paper start ++ @Deprecated + public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage) { + super(playerKicked); + this.kickReason = kickReason; + this.leaveMessage = leaveMessage; + this.cancel = false; ++ this.cause = Cause.UNKNOWN; ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage, @NotNull final Cause cause) { ++ super(playerKicked); ++ this.kickReason = kickReason; ++ this.leaveMessage = leaveMessage; ++ this.cancel = false; ++ this.cause = cause; + } + + /** +@@ -132,4 +145,79 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { + public static HandlerList getHandlerList() { + return handlers; + } ++ // Paper start ++ /** ++ * Gets the cause of this kick ++ * ++ * @return ++ */ ++ @NotNull ++ public org.bukkit.event.player.PlayerKickEvent.Cause getCause() { ++ return cause; ++ } ++ ++ public enum Cause { ++ ++ PLUGIN, ++ ++ WHITELIST, ++ ++ BANNED, ++ ++ IP_BANNED, ++ ++ KICK_COMMAND, ++ ++ FLYING_PLAYER, ++ ++ FLYING_VEHICLE, ++ ++ TIMEOUT, ++ ++ IDLING, ++ ++ INVALID_VEHICLE_MOVEMENT, ++ ++ INVALID_PLAYER_MOVEMENT, ++ ++ INVALID_ENTITY_ATTACKED, ++ ++ INVALID_PAYLOAD, ++ ++ INVALID_COOKIE, ++ ++ SPAM, ++ ++ ILLEGAL_ACTION, ++ ++ ILLEGAL_CHARACTERS, ++ ++ OUT_OF_ORDER_CHAT, ++ ++ UNSIGNED_CHAT, ++ ++ CHAT_VALIDATION_FAILED, ++ ++ EXPIRED_PROFILE_PUBLIC_KEY, ++ ++ INVALID_PUBLIC_KEY_SIGNATURE, ++ ++ TOO_MANY_PENDING_CHATS, ++ ++ SELF_INTERACTION, ++ ++ DUPLICATE_LOGIN, ++ ++ RESOURCE_PACK_REJECTION, ++ ++ /** ++ * Spigot's restart command ++ */ ++ RESTART_COMMAND, ++ /** ++ * Fallback cause ++ */ ++ UNKNOWN, ++ } ++ // Paper end + } diff --git a/patches/api/0287-More-Lidded-Block-API.patch b/patches/api/0287-More-Lidded-Block-API.patch deleted file mode 100644 index a89f206f9a..0000000000 --- a/patches/api/0287-More-Lidded-Block-API.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: LemonCaramel -Date: Sun, 23 May 2021 17:49:31 +0900 -Subject: [PATCH] More Lidded Block API - - -diff --git a/src/main/java/org/bukkit/block/Lidded.java b/src/main/java/org/bukkit/block/Lidded.java -index 9da2566e02e63be1a0188deaa27b841fa61688ea..30c7df0021df44a411e50636d906d4a1d30fd927 100644 ---- a/src/main/java/org/bukkit/block/Lidded.java -+++ b/src/main/java/org/bukkit/block/Lidded.java -@@ -13,4 +13,13 @@ public interface Lidded { - * viewing this block. - */ - void close(); -+ -+ // Paper start - More Lidded Block API -+ /** -+ * Checks if the block's animation state. -+ * -+ * @return true if the block's animation state is set to open. -+ */ -+ boolean isOpen(); -+ // Paper end - More Lidded Block API - } diff --git a/patches/api/0288-Add-PlayerKickEvent-causes.patch b/patches/api/0288-Add-PlayerKickEvent-causes.patch deleted file mode 100644 index 5bded2058c..0000000000 --- a/patches/api/0288-Add-PlayerKickEvent-causes.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 15 May 2021 20:30:34 -0700 -Subject: [PATCH] Add PlayerKickEvent causes - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 752b2bac47588c0f75a13a7e6ec2be3c2f5a149e..b177daa7a974125dc4ccf1bc6d119ad42dba3514 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -321,6 +321,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param message kick message - */ - void kick(final net.kyori.adventure.text.@Nullable Component message); -+ -+ /** -+ * Kicks player with custom kick message and cause. -+ * -+ * @param message kick message -+ * @param cause kick cause -+ */ -+ void kick(final net.kyori.adventure.text.@Nullable Component message, org.bukkit.event.player.PlayerKickEvent.@NotNull Cause cause); - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -index 997b06c19a5277656521e0e298f2958c209f1da1..b8bf61bea73086c61dce6230686e627dc324ebe0 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -@@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private net.kyori.adventure.text.Component leaveMessage; // Paper - private net.kyori.adventure.text.Component kickReason; // Paper -+ private final Cause cause; // Paper - private boolean cancel; - - @Deprecated // Paper -@@ -19,14 +20,26 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { - super(playerKicked); - this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper - this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper -+ this.cause = Cause.UNKNOWN; // Paper - this.cancel = false; - } - // Paper start -+ @Deprecated - public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage) { - super(playerKicked); - this.kickReason = kickReason; - this.leaveMessage = leaveMessage; - this.cancel = false; -+ this.cause = Cause.UNKNOWN; -+ } -+ -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage, @NotNull final Cause cause) { -+ super(playerKicked); -+ this.kickReason = kickReason; -+ this.leaveMessage = leaveMessage; -+ this.cancel = false; -+ this.cause = cause; - } - - /** -@@ -132,4 +145,79 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { - public static HandlerList getHandlerList() { - return handlers; - } -+ // Paper start -+ /** -+ * Gets the cause of this kick -+ * -+ * @return -+ */ -+ @NotNull -+ public org.bukkit.event.player.PlayerKickEvent.Cause getCause() { -+ return cause; -+ } -+ -+ public enum Cause { -+ -+ PLUGIN, -+ -+ WHITELIST, -+ -+ BANNED, -+ -+ IP_BANNED, -+ -+ KICK_COMMAND, -+ -+ FLYING_PLAYER, -+ -+ FLYING_VEHICLE, -+ -+ TIMEOUT, -+ -+ IDLING, -+ -+ INVALID_VEHICLE_MOVEMENT, -+ -+ INVALID_PLAYER_MOVEMENT, -+ -+ INVALID_ENTITY_ATTACKED, -+ -+ INVALID_PAYLOAD, -+ -+ INVALID_COOKIE, -+ -+ SPAM, -+ -+ ILLEGAL_ACTION, -+ -+ ILLEGAL_CHARACTERS, -+ -+ OUT_OF_ORDER_CHAT, -+ -+ UNSIGNED_CHAT, -+ -+ CHAT_VALIDATION_FAILED, -+ -+ EXPIRED_PROFILE_PUBLIC_KEY, -+ -+ INVALID_PUBLIC_KEY_SIGNATURE, -+ -+ TOO_MANY_PENDING_CHATS, -+ -+ SELF_INTERACTION, -+ -+ DUPLICATE_LOGIN, -+ -+ RESOURCE_PACK_REJECTION, -+ -+ /** -+ * Spigot's restart command -+ */ -+ RESTART_COMMAND, -+ /** -+ * Fallback cause -+ */ -+ UNKNOWN, -+ } -+ // Paper end - } diff --git a/patches/api/0288-Add-PufferFishStateChangeEvent.patch b/patches/api/0288-Add-PufferFishStateChangeEvent.patch new file mode 100644 index 0000000000..7a719777e3 --- /dev/null +++ b/patches/api/0288-Add-PufferFishStateChangeEvent.patch @@ -0,0 +1,99 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: HexedHero <6012891+HexedHero@users.noreply.github.com> +Date: Mon, 10 May 2021 16:58:38 +0100 +Subject: [PATCH] Add PufferFishStateChangeEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4e04b49c1e2bc2a965c9be2388539d9ed5a58f89 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java +@@ -0,0 +1,87 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.PufferFish; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called just before a {@link PufferFish} inflates or deflates. ++ */ ++public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final int newPuffState; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PufferFishStateChangeEvent(@NotNull PufferFish entity, int newPuffState) { ++ super(entity); ++ this.newPuffState = newPuffState; ++ } ++ ++ @NotNull ++ @Override ++ public PufferFish getEntity() { ++ return (PufferFish) super.getEntity(); ++ } ++ ++ /** ++ * Get the new puff state of the {@link PufferFish}. ++ *

++ * This is what the {@link PufferFish}'s new puff state will be after this event if it isn't cancelled.
++ * Refer to {@link PufferFish#getPuffState()} to get the current puff state. ++ * ++ * @return The new puff state, 0 being not inflated, 1 being slightly inflated and 2 being fully inflated ++ */ ++ public int getNewPuffState() { ++ return this.newPuffState; ++ } ++ ++ /** ++ * Get if the {@link PufferFish} is going to inflate. ++ * ++ * @return If it's going to inflate ++ */ ++ public boolean isInflating() { ++ return this.newPuffState > this.getEntity().getPuffState(); ++ } ++ ++ /** ++ * Get if the {@link PufferFish} is going to deflate. ++ * ++ * @return If it's going to deflate ++ */ ++ public boolean isDeflating() { ++ return this.newPuffState < this.getEntity().getPuffState(); ++ } ++ ++ /** ++ * Set whether to cancel the {@link PufferFish} (in/de)flating. ++ * ++ * @param cancel {@code true} if you wish to cancel the (in/de)flation ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0289-Add-BellRevealRaiderEvent.patch b/patches/api/0289-Add-BellRevealRaiderEvent.patch new file mode 100644 index 0000000000..c45f89fd4b --- /dev/null +++ b/patches/api/0289-Add-BellRevealRaiderEvent.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 26 May 2021 17:08:57 -0400 +Subject: [PATCH] Add BellRevealRaiderEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e41599405514cd7eea93d842243f6c5c938b93f1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java +@@ -0,0 +1,63 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Raider; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a {@link Raider} is revealed by a bell. ++ * ++ * @deprecated use {@link org.bukkit.event.block.BellResonateEvent} ++ */ ++@Deprecated ++public class BellRevealRaiderEvent extends BlockEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Raider raider; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Raider raider) { ++ super(theBlock); ++ this.raider = raider; ++ } ++ ++ /** ++ * Gets the raider that the bell revealed. ++ * ++ * @return The raider ++ */ ++ @NotNull ++ public Raider getEntity() { ++ return this.raider; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * {@inheritDoc} ++ *

++ * This does not cancel the particle effects shown on the bell, only the entity. ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0289-Add-PufferFishStateChangeEvent.patch b/patches/api/0289-Add-PufferFishStateChangeEvent.patch deleted file mode 100644 index 7a719777e3..0000000000 --- a/patches/api/0289-Add-PufferFishStateChangeEvent.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Mon, 10 May 2021 16:58:38 +0100 -Subject: [PATCH] Add PufferFishStateChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..4e04b49c1e2bc2a965c9be2388539d9ed5a58f89 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java -@@ -0,0 +1,87 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.PufferFish; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called just before a {@link PufferFish} inflates or deflates. -+ */ -+public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int newPuffState; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PufferFishStateChangeEvent(@NotNull PufferFish entity, int newPuffState) { -+ super(entity); -+ this.newPuffState = newPuffState; -+ } -+ -+ @NotNull -+ @Override -+ public PufferFish getEntity() { -+ return (PufferFish) super.getEntity(); -+ } -+ -+ /** -+ * Get the new puff state of the {@link PufferFish}. -+ *

-+ * This is what the {@link PufferFish}'s new puff state will be after this event if it isn't cancelled.
-+ * Refer to {@link PufferFish#getPuffState()} to get the current puff state. -+ * -+ * @return The new puff state, 0 being not inflated, 1 being slightly inflated and 2 being fully inflated -+ */ -+ public int getNewPuffState() { -+ return this.newPuffState; -+ } -+ -+ /** -+ * Get if the {@link PufferFish} is going to inflate. -+ * -+ * @return If it's going to inflate -+ */ -+ public boolean isInflating() { -+ return this.newPuffState > this.getEntity().getPuffState(); -+ } -+ -+ /** -+ * Get if the {@link PufferFish} is going to deflate. -+ * -+ * @return If it's going to deflate -+ */ -+ public boolean isDeflating() { -+ return this.newPuffState < this.getEntity().getPuffState(); -+ } -+ -+ /** -+ * Set whether to cancel the {@link PufferFish} (in/de)flating. -+ * -+ * @param cancel {@code true} if you wish to cancel the (in/de)flation -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0290-Add-BellRevealRaiderEvent.patch b/patches/api/0290-Add-BellRevealRaiderEvent.patch deleted file mode 100644 index c45f89fd4b..0000000000 --- a/patches/api/0290-Add-BellRevealRaiderEvent.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 26 May 2021 17:08:57 -0400 -Subject: [PATCH] Add BellRevealRaiderEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..e41599405514cd7eea93d842243f6c5c938b93f1 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java -@@ -0,0 +1,63 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.entity.Raider; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a {@link Raider} is revealed by a bell. -+ * -+ * @deprecated use {@link org.bukkit.event.block.BellResonateEvent} -+ */ -+@Deprecated -+public class BellRevealRaiderEvent extends BlockEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Raider raider; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Raider raider) { -+ super(theBlock); -+ this.raider = raider; -+ } -+ -+ /** -+ * Gets the raider that the bell revealed. -+ * -+ * @return The raider -+ */ -+ @NotNull -+ public Raider getEntity() { -+ return this.raider; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * {@inheritDoc} -+ *

-+ * This does not cancel the particle effects shown on the bell, only the entity. -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0290-Add-ElderGuardianAppearanceEvent.patch b/patches/api/0290-Add-ElderGuardianAppearanceEvent.patch new file mode 100644 index 0000000000..23897b7390 --- /dev/null +++ b/patches/api/0290-Add-ElderGuardianAppearanceEvent.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Fri, 19 Mar 2021 23:39:21 -0400 +Subject: [PATCH] Add ElderGuardianAppearanceEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..47eabdc8b1a3a3207f197eeca00f3ca5c9940b89 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.ElderGuardian; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Is called when an {@link ElderGuardian} appears in front of a {@link Player}. ++ */ ++public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Player affectedPlayer; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public ElderGuardianAppearanceEvent(@NotNull ElderGuardian guardian, @NotNull Player affectedPlayer) { ++ super(guardian); ++ this.affectedPlayer = affectedPlayer; ++ } ++ ++ /** ++ * Get the player affected by the guardian appearance. ++ * ++ * @return Player affected by the appearance ++ */ ++ @NotNull ++ public Player getAffectedPlayer() { ++ return this.affectedPlayer; ++ } ++ ++ /** ++ * The elder guardian playing the effect. ++ * ++ * @return The elder guardian ++ */ ++ @NotNull ++ public ElderGuardian getEntity() { ++ return (ElderGuardian) super.getEntity(); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0291-Add-ElderGuardianAppearanceEvent.patch b/patches/api/0291-Add-ElderGuardianAppearanceEvent.patch deleted file mode 100644 index 23897b7390..0000000000 --- a/patches/api/0291-Add-ElderGuardianAppearanceEvent.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Fri, 19 Mar 2021 23:39:21 -0400 -Subject: [PATCH] Add ElderGuardianAppearanceEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..47eabdc8b1a3a3207f197eeca00f3ca5c9940b89 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java -@@ -0,0 +1,67 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.ElderGuardian; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Is called when an {@link ElderGuardian} appears in front of a {@link Player}. -+ */ -+public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player affectedPlayer; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public ElderGuardianAppearanceEvent(@NotNull ElderGuardian guardian, @NotNull Player affectedPlayer) { -+ super(guardian); -+ this.affectedPlayer = affectedPlayer; -+ } -+ -+ /** -+ * Get the player affected by the guardian appearance. -+ * -+ * @return Player affected by the appearance -+ */ -+ @NotNull -+ public Player getAffectedPlayer() { -+ return this.affectedPlayer; -+ } -+ -+ /** -+ * The elder guardian playing the effect. -+ * -+ * @return The elder guardian -+ */ -+ @NotNull -+ public ElderGuardian getEntity() { -+ return (ElderGuardian) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0291-Add-more-line-of-sight-methods.patch b/patches/api/0291-Add-more-line-of-sight-methods.patch new file mode 100644 index 0000000000..dc87546ce9 --- /dev/null +++ b/patches/api/0291-Add-more-line-of-sight-methods.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com> +Date: Sat, 29 May 2021 14:33:18 -0500 +Subject: [PATCH] Add more line of sight methods + + +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index d8b1fa79dc24138dc71e32c14bda71c1d570ed88..b68367f123f029c3ff47eab6bfabd7a894a99da4 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -461,5 +461,13 @@ public interface RegionAccessor extends Keyed { // Paper + @NotNull + @Override + NamespacedKey getKey(); ++ ++ /** ++ * Tell whether a line of sight exists between the given locations ++ * @param from Location to start at ++ * @param to target Location ++ * @return whether a line of sight exists between {@code from} and {@code to} ++ */ ++ public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index b75b79512a8fd7054f0c0c08e34f6900309e522c..62a301f2f87b053bcfbf16c9870c3f740eb70022 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -622,6 +622,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + public boolean hasLineOfSight(@NotNull Entity other); + ++ // Paper start ++ /** ++ * Checks whether the living entity has block line of sight to the given block. ++ *

++ * This uses the same algorithm that hostile mobs use to find the closest ++ * player. ++ * ++ * @param location the location to determine line of sight to ++ * @return true if there is a line of sight, false if not ++ */ ++ public boolean hasLineOfSight(@NotNull Location location); ++ // Paper end ++ + /** + * Returns if the living entity despawns when away from players or not. + *

diff --git a/patches/api/0292-Add-WaterBottleSplashEvent.patch b/patches/api/0292-Add-WaterBottleSplashEvent.patch new file mode 100644 index 0000000000..f5525245fa --- /dev/null +++ b/patches/api/0292-Add-WaterBottleSplashEvent.patch @@ -0,0 +1,162 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Thu, 8 Dec 2022 10:12:23 -0700 +Subject: [PATCH] Add WaterBottleSplashEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..362afc28190dd6f0ed0407273f2be1aab73bb8f5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java +@@ -0,0 +1,137 @@ ++package io.papermc.paper.event.entity; ++ ++import java.util.Collection; ++import java.util.Map; ++import java.util.Set; ++import java.util.stream.Collectors; ++import org.bukkit.block.Block; ++import org.bukkit.block.BlockFace; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.entity.ThrownPotion; ++import org.bukkit.event.entity.PotionSplashEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++import org.jetbrains.annotations.Unmodifiable; ++ ++/** ++ * Called when a splash water potion "splashes" and affects ++ * different entities in different ways. ++ */ ++public class WaterBottleSplashEvent extends PotionSplashEvent { ++ ++ private final @NotNull Set rehydrate; ++ private final @NotNull Set extinguish; ++ ++ @ApiStatus.Internal ++ public WaterBottleSplashEvent( ++ final @NotNull ThrownPotion potion, ++ final @Nullable Entity hitEntity, ++ final @Nullable Block hitBlock, ++ final @Nullable BlockFace hitFace, ++ final @NotNull Map affectedEntities, ++ final @NotNull Set rehydrate, ++ final @NotNull Set extinguish ++ ) { ++ super(potion, hitEntity, hitBlock, hitFace, affectedEntities); ++ this.rehydrate = rehydrate; ++ this.extinguish = extinguish; ++ } ++ ++ /** ++ * Gets an immutable collection of entities that ++ * will take damage as a result of this event. Use ++ * other methods on this class to modify which entities ++ * take damage. ++ * ++ * @return an immutable collection of entities ++ * @see #doNotDamageAsWaterSensitive(LivingEntity) ++ * @see #damageAsWaterSensitive(LivingEntity) ++ */ ++ @NotNull ++ public @Unmodifiable Collection getToDamage() { ++ return this.affectedEntities.entrySet().stream().filter(entry -> entry.getValue() > 0).map(Map.Entry::getKey).collect(Collectors.toUnmodifiableSet()); ++ } ++ ++ /** ++ * Removes this entity from the group that ++ * will be damaged. ++ * ++ * @param entity entity to remove ++ */ ++ public void doNotDamageAsWaterSensitive(final @NotNull LivingEntity entity) { ++ this.affectedEntities.remove(entity); ++ } ++ ++ /** ++ * Adds this entity to the group that ++ * will be damaged ++ * ++ * @param entity entity to add ++ */ ++ public void damageAsWaterSensitive(final @NotNull LivingEntity entity) { ++ this.affectedEntities.put(entity, 1.0); ++ } ++ ++ /** ++ * Get a mutable collection of entities ++ * that will be rehydrated by this. ++ *

++ * As of 1.19.3 this only will contain Axolotls as they ++ * are the only entity type that can be rehydrated, but ++ * it may change in the future. ++ * ++ * @return the entities ++ */ ++ @NotNull ++ public Collection getToRehydrate() { ++ return this.rehydrate; ++ } ++ ++ /** ++ * Get a mutable collection of entities that will ++ * be extinguished as a result of this event. ++ * ++ * @return entities to be extinguished ++ */ ++ @NotNull ++ public Collection getToExtinguish() { ++ return this.extinguish; ++ } ++ ++ /** ++ * @return a confusing collection, don't use it ++ * @deprecated Use {@link #getToDamage()} ++ */ ++ @Deprecated ++ @Override ++ public @NotNull Collection getAffectedEntities() { ++ return super.getAffectedEntities(); ++ } ++ ++ /** ++ * Doesn't make sense for this event as intensity doesn't vary. ++ * ++ * @return a confusing value ++ * @deprecated check if {@link #getToDamage()} contains an entity ++ */ ++ @Deprecated ++ @Override ++ public double getIntensity(final @NotNull LivingEntity entity) { ++ return super.getIntensity(entity); ++ } ++ ++ /** ++ * Doesn't make sense for this event as intensity doesn't vary. ++ * ++ * @deprecated use {@link #damageAsWaterSensitive(LivingEntity)} ++ * or {@link #doNotDamageAsWaterSensitive(LivingEntity)} to change which entities are ++ * damaged ++ */ ++ @Deprecated ++ @Override ++ public void setIntensity(final @NotNull LivingEntity entity, final double intensity) { ++ super.setIntensity(entity, intensity); ++ } ++} +diff --git a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java +index bc6ba6c4c07cacfc6ab7a2a72b12dfba110ba911..2e58b716fdb21026d2ee838e81559601344c8a00 100644 +--- a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java +@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; + public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; +- private final Map affectedEntities; ++ protected final Map affectedEntities; // Paper + + @Deprecated + public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map affectedEntities) { diff --git a/patches/api/0292-Add-more-line-of-sight-methods.patch b/patches/api/0292-Add-more-line-of-sight-methods.patch deleted file mode 100644 index dc87546ce9..0000000000 --- a/patches/api/0292-Add-more-line-of-sight-methods.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com> -Date: Sat, 29 May 2021 14:33:18 -0500 -Subject: [PATCH] Add more line of sight methods - - -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index d8b1fa79dc24138dc71e32c14bda71c1d570ed88..b68367f123f029c3ff47eab6bfabd7a894a99da4 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -461,5 +461,13 @@ public interface RegionAccessor extends Keyed { // Paper - @NotNull - @Override - NamespacedKey getKey(); -+ -+ /** -+ * Tell whether a line of sight exists between the given locations -+ * @param from Location to start at -+ * @param to target Location -+ * @return whether a line of sight exists between {@code from} and {@code to} -+ */ -+ public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index b75b79512a8fd7054f0c0c08e34f6900309e522c..62a301f2f87b053bcfbf16c9870c3f740eb70022 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -622,6 +622,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - public boolean hasLineOfSight(@NotNull Entity other); - -+ // Paper start -+ /** -+ * Checks whether the living entity has block line of sight to the given block. -+ *

-+ * This uses the same algorithm that hostile mobs use to find the closest -+ * player. -+ * -+ * @param location the location to determine line of sight to -+ * @return true if there is a line of sight, false if not -+ */ -+ public boolean hasLineOfSight(@NotNull Location location); -+ // Paper end -+ - /** - * Returns if the living entity despawns when away from players or not. - *

diff --git a/patches/api/0293-Add-WaterBottleSplashEvent.patch b/patches/api/0293-Add-WaterBottleSplashEvent.patch deleted file mode 100644 index f5525245fa..0000000000 --- a/patches/api/0293-Add-WaterBottleSplashEvent.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Thu, 8 Dec 2022 10:12:23 -0700 -Subject: [PATCH] Add WaterBottleSplashEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..362afc28190dd6f0ed0407273f2be1aab73bb8f5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/WaterBottleSplashEvent.java -@@ -0,0 +1,137 @@ -+package io.papermc.paper.event.entity; -+ -+import java.util.Collection; -+import java.util.Map; -+import java.util.Set; -+import java.util.stream.Collectors; -+import org.bukkit.block.Block; -+import org.bukkit.block.BlockFace; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.ThrownPotion; -+import org.bukkit.event.entity.PotionSplashEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+import org.jetbrains.annotations.Unmodifiable; -+ -+/** -+ * Called when a splash water potion "splashes" and affects -+ * different entities in different ways. -+ */ -+public class WaterBottleSplashEvent extends PotionSplashEvent { -+ -+ private final @NotNull Set rehydrate; -+ private final @NotNull Set extinguish; -+ -+ @ApiStatus.Internal -+ public WaterBottleSplashEvent( -+ final @NotNull ThrownPotion potion, -+ final @Nullable Entity hitEntity, -+ final @Nullable Block hitBlock, -+ final @Nullable BlockFace hitFace, -+ final @NotNull Map affectedEntities, -+ final @NotNull Set rehydrate, -+ final @NotNull Set extinguish -+ ) { -+ super(potion, hitEntity, hitBlock, hitFace, affectedEntities); -+ this.rehydrate = rehydrate; -+ this.extinguish = extinguish; -+ } -+ -+ /** -+ * Gets an immutable collection of entities that -+ * will take damage as a result of this event. Use -+ * other methods on this class to modify which entities -+ * take damage. -+ * -+ * @return an immutable collection of entities -+ * @see #doNotDamageAsWaterSensitive(LivingEntity) -+ * @see #damageAsWaterSensitive(LivingEntity) -+ */ -+ @NotNull -+ public @Unmodifiable Collection getToDamage() { -+ return this.affectedEntities.entrySet().stream().filter(entry -> entry.getValue() > 0).map(Map.Entry::getKey).collect(Collectors.toUnmodifiableSet()); -+ } -+ -+ /** -+ * Removes this entity from the group that -+ * will be damaged. -+ * -+ * @param entity entity to remove -+ */ -+ public void doNotDamageAsWaterSensitive(final @NotNull LivingEntity entity) { -+ this.affectedEntities.remove(entity); -+ } -+ -+ /** -+ * Adds this entity to the group that -+ * will be damaged -+ * -+ * @param entity entity to add -+ */ -+ public void damageAsWaterSensitive(final @NotNull LivingEntity entity) { -+ this.affectedEntities.put(entity, 1.0); -+ } -+ -+ /** -+ * Get a mutable collection of entities -+ * that will be rehydrated by this. -+ *

-+ * As of 1.19.3 this only will contain Axolotls as they -+ * are the only entity type that can be rehydrated, but -+ * it may change in the future. -+ * -+ * @return the entities -+ */ -+ @NotNull -+ public Collection getToRehydrate() { -+ return this.rehydrate; -+ } -+ -+ /** -+ * Get a mutable collection of entities that will -+ * be extinguished as a result of this event. -+ * -+ * @return entities to be extinguished -+ */ -+ @NotNull -+ public Collection getToExtinguish() { -+ return this.extinguish; -+ } -+ -+ /** -+ * @return a confusing collection, don't use it -+ * @deprecated Use {@link #getToDamage()} -+ */ -+ @Deprecated -+ @Override -+ public @NotNull Collection getAffectedEntities() { -+ return super.getAffectedEntities(); -+ } -+ -+ /** -+ * Doesn't make sense for this event as intensity doesn't vary. -+ * -+ * @return a confusing value -+ * @deprecated check if {@link #getToDamage()} contains an entity -+ */ -+ @Deprecated -+ @Override -+ public double getIntensity(final @NotNull LivingEntity entity) { -+ return super.getIntensity(entity); -+ } -+ -+ /** -+ * Doesn't make sense for this event as intensity doesn't vary. -+ * -+ * @deprecated use {@link #damageAsWaterSensitive(LivingEntity)} -+ * or {@link #doNotDamageAsWaterSensitive(LivingEntity)} to change which entities are -+ * damaged -+ */ -+ @Deprecated -+ @Override -+ public void setIntensity(final @NotNull LivingEntity entity, final double intensity) { -+ super.setIntensity(entity, intensity); -+ } -+} -diff --git a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java -index bc6ba6c4c07cacfc6ab7a2a72b12dfba110ba911..2e58b716fdb21026d2ee838e81559601344c8a00 100644 ---- a/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java -+++ b/src/main/java/org/bukkit/event/entity/PotionSplashEvent.java -@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; - public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; -- private final Map affectedEntities; -+ protected final Map affectedEntities; // Paper - - @Deprecated - public PotionSplashEvent(@NotNull final ThrownPotion potion, @NotNull final Map affectedEntities) { diff --git a/patches/api/0293-Add-more-LimitedRegion-API.patch b/patches/api/0293-Add-more-LimitedRegion-API.patch new file mode 100644 index 0000000000..292f95c890 --- /dev/null +++ b/patches/api/0293-Add-more-LimitedRegion-API.patch @@ -0,0 +1,161 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dfsek +Date: Sat, 19 Jun 2021 20:15:29 -0700 +Subject: [PATCH] Add more LimitedRegion API + + +diff --git a/src/main/java/org/bukkit/generator/LimitedRegion.java b/src/main/java/org/bukkit/generator/LimitedRegion.java +index 85faeeeef908243aa5f172284784e7e67995ebfb..e0b249d328f7671894cea94bc00d54ab54aacd36 100644 +--- a/src/main/java/org/bukkit/generator/LimitedRegion.java ++++ b/src/main/java/org/bukkit/generator/LimitedRegion.java +@@ -4,6 +4,12 @@ import java.util.List; + import org.bukkit.Location; + import org.bukkit.RegionAccessor; + import org.bukkit.block.BlockState; ++// Paper start ++import org.bukkit.World; ++import org.bukkit.block.BlockState; ++import org.bukkit.block.data.BlockData; ++import org.bukkit.util.Vector; ++// Paper end + import org.jetbrains.annotations.NotNull; + + /** +@@ -53,4 +59,137 @@ public interface LimitedRegion extends RegionAccessor { + */ + @NotNull + List getTileEntities(); ++ ++ ++ // Paper start ++ /** ++ * Sets the block at a vector location to the provided {@link BlockData}. ++ * ++ * @param vector {@link Vector} representing the position of the block to set. ++ * @param data {@link BlockData} to set the block at the provided coordinates to. ++ */ ++ default void setBlockData(@NotNull Vector vector, @NotNull BlockData data) { ++ setBlockData(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), data); ++ } ++ ++ /** ++ * Sets the {@link BlockState} at a location. ++ * ++ * @param x X coordinate. ++ * @param y Y coordinate. ++ * @param z Z coordinate. ++ * @param state The block state. ++ */ ++ void setBlockState(int x, int y, int z, @NotNull BlockState state); ++ ++ /** ++ * Sets the {@link BlockState} at a location. ++ * ++ * @param location Location to set block state. ++ * @param state The block state. ++ */ ++ default void setBlockState(@NotNull Vector location, @NotNull BlockState state) { ++ setBlockState(location.getBlockX(), location.getBlockY(), location.getBlockZ(), state); ++ } ++ ++ /** ++ * Gets the {@link BlockState} at a location. ++ * ++ * @param location Location to get block state from. ++ * @return The block state. ++ */ ++ @NotNull ++ default BlockState getBlockState(@NotNull Vector location) { ++ return getBlockState(location.getBlockX(), location.getBlockY(), location.getBlockZ()); ++ } ++ ++ /** ++ * Schedules a block update at (x, y, z). ++ * ++ * @param x X coordinate ++ * @param y Y coordinate ++ * @param z Z coordinate ++ */ ++ void scheduleBlockUpdate(int x, int y, int z); ++ ++ /** ++ * Schedules a block update at a vector location. ++ * ++ * @param location {@link Vector} representing the position of the block to update. ++ */ ++ default void scheduleBlockUpdate(@NotNull Vector location) { ++ scheduleBlockUpdate(location.getBlockX(), location.getBlockY(), location.getBlockZ()); ++ } ++ ++ /** ++ * Schedules a fluid update at (x, y, z). ++ * ++ * @param x X coordinate ++ * @param y Y coordinate ++ * @param z Z coordinate ++ */ ++ void scheduleFluidUpdate(int x, int y, int z); ++ ++ /** ++ * Schedules a fluid update at a vector location. ++ * ++ * @param location {@link Vector} representing the position of the block to update. ++ */ ++ default void scheduleFluidUpdate(@NotNull Vector location) { ++ scheduleFluidUpdate(location.getBlockX(), location.getBlockY(), location.getBlockZ()); ++ } ++ ++ /** ++ * Gets the {@link World} object this region represents. ++ *

++ * Do not attempt to read from/write to this world! Doing so during generation will cause a deadlock! ++ * ++ * @return The {@link World} object that this region represents. ++ */ ++ @NotNull ++ World getWorld(); ++ ++ /** ++ * Gets the {@link BlockData} of the block at the provided coordinates. ++ * ++ * @param vector {@link Vector} representing the position of the block to get. ++ * @return {@link BlockData} at the coordinates ++ */ ++ @NotNull ++ default BlockData getBlockData(@NotNull Vector vector) { ++ return getBlockData(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); ++ } ++ ++ /** ++ * Gets the X-coordinate of the chunk in the center of the region. ++ * ++ * @return The center chunk's X coordinate. ++ */ ++ int getCenterChunkX(); ++ ++ /** ++ * Gets the X-coordinate of the block in the center of the region. ++ * ++ * @return The center chunk's X coordinate. ++ */ ++ default int getCenterBlockX() { ++ return getCenterChunkX() << 4; ++ } ++ ++ /** ++ * Gets the Z-coordinate of the chunk in the center of the region. ++ * ++ * @return The center chunk's Z coordinate. ++ */ ++ int getCenterChunkZ(); ++ ++ /** ++ * Gets the Z-coordinate of the block in the center of the region. ++ * ++ * @return The center chunk's Z coordinate. ++ */ ++ default int getCenterBlockZ() { ++ return getCenterChunkZ() << 4; ++ } ++ // Paper end + } diff --git a/patches/api/0294-Add-more-LimitedRegion-API.patch b/patches/api/0294-Add-more-LimitedRegion-API.patch deleted file mode 100644 index 292f95c890..0000000000 --- a/patches/api/0294-Add-more-LimitedRegion-API.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dfsek -Date: Sat, 19 Jun 2021 20:15:29 -0700 -Subject: [PATCH] Add more LimitedRegion API - - -diff --git a/src/main/java/org/bukkit/generator/LimitedRegion.java b/src/main/java/org/bukkit/generator/LimitedRegion.java -index 85faeeeef908243aa5f172284784e7e67995ebfb..e0b249d328f7671894cea94bc00d54ab54aacd36 100644 ---- a/src/main/java/org/bukkit/generator/LimitedRegion.java -+++ b/src/main/java/org/bukkit/generator/LimitedRegion.java -@@ -4,6 +4,12 @@ import java.util.List; - import org.bukkit.Location; - import org.bukkit.RegionAccessor; - import org.bukkit.block.BlockState; -+// Paper start -+import org.bukkit.World; -+import org.bukkit.block.BlockState; -+import org.bukkit.block.data.BlockData; -+import org.bukkit.util.Vector; -+// Paper end - import org.jetbrains.annotations.NotNull; - - /** -@@ -53,4 +59,137 @@ public interface LimitedRegion extends RegionAccessor { - */ - @NotNull - List getTileEntities(); -+ -+ -+ // Paper start -+ /** -+ * Sets the block at a vector location to the provided {@link BlockData}. -+ * -+ * @param vector {@link Vector} representing the position of the block to set. -+ * @param data {@link BlockData} to set the block at the provided coordinates to. -+ */ -+ default void setBlockData(@NotNull Vector vector, @NotNull BlockData data) { -+ setBlockData(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ(), data); -+ } -+ -+ /** -+ * Sets the {@link BlockState} at a location. -+ * -+ * @param x X coordinate. -+ * @param y Y coordinate. -+ * @param z Z coordinate. -+ * @param state The block state. -+ */ -+ void setBlockState(int x, int y, int z, @NotNull BlockState state); -+ -+ /** -+ * Sets the {@link BlockState} at a location. -+ * -+ * @param location Location to set block state. -+ * @param state The block state. -+ */ -+ default void setBlockState(@NotNull Vector location, @NotNull BlockState state) { -+ setBlockState(location.getBlockX(), location.getBlockY(), location.getBlockZ(), state); -+ } -+ -+ /** -+ * Gets the {@link BlockState} at a location. -+ * -+ * @param location Location to get block state from. -+ * @return The block state. -+ */ -+ @NotNull -+ default BlockState getBlockState(@NotNull Vector location) { -+ return getBlockState(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Schedules a block update at (x, y, z). -+ * -+ * @param x X coordinate -+ * @param y Y coordinate -+ * @param z Z coordinate -+ */ -+ void scheduleBlockUpdate(int x, int y, int z); -+ -+ /** -+ * Schedules a block update at a vector location. -+ * -+ * @param location {@link Vector} representing the position of the block to update. -+ */ -+ default void scheduleBlockUpdate(@NotNull Vector location) { -+ scheduleBlockUpdate(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Schedules a fluid update at (x, y, z). -+ * -+ * @param x X coordinate -+ * @param y Y coordinate -+ * @param z Z coordinate -+ */ -+ void scheduleFluidUpdate(int x, int y, int z); -+ -+ /** -+ * Schedules a fluid update at a vector location. -+ * -+ * @param location {@link Vector} representing the position of the block to update. -+ */ -+ default void scheduleFluidUpdate(@NotNull Vector location) { -+ scheduleFluidUpdate(location.getBlockX(), location.getBlockY(), location.getBlockZ()); -+ } -+ -+ /** -+ * Gets the {@link World} object this region represents. -+ *

-+ * Do not attempt to read from/write to this world! Doing so during generation will cause a deadlock! -+ * -+ * @return The {@link World} object that this region represents. -+ */ -+ @NotNull -+ World getWorld(); -+ -+ /** -+ * Gets the {@link BlockData} of the block at the provided coordinates. -+ * -+ * @param vector {@link Vector} representing the position of the block to get. -+ * @return {@link BlockData} at the coordinates -+ */ -+ @NotNull -+ default BlockData getBlockData(@NotNull Vector vector) { -+ return getBlockData(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); -+ } -+ -+ /** -+ * Gets the X-coordinate of the chunk in the center of the region. -+ * -+ * @return The center chunk's X coordinate. -+ */ -+ int getCenterChunkX(); -+ -+ /** -+ * Gets the X-coordinate of the block in the center of the region. -+ * -+ * @return The center chunk's X coordinate. -+ */ -+ default int getCenterBlockX() { -+ return getCenterChunkX() << 4; -+ } -+ -+ /** -+ * Gets the Z-coordinate of the chunk in the center of the region. -+ * -+ * @return The center chunk's Z coordinate. -+ */ -+ int getCenterChunkZ(); -+ -+ /** -+ * Gets the Z-coordinate of the block in the center of the region. -+ * -+ * @return The center chunk's Z coordinate. -+ */ -+ default int getCenterBlockZ() { -+ return getCenterChunkZ() << 4; -+ } -+ // Paper end - } diff --git a/patches/api/0294-Missing-Entity-API.patch b/patches/api/0294-Missing-Entity-API.patch new file mode 100644 index 0000000000..582dafaea4 --- /dev/null +++ b/patches/api/0294-Missing-Entity-API.patch @@ -0,0 +1,1448 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Fri, 28 May 2021 21:06:59 -0400 +Subject: [PATCH] Missing Entity API + +Co-authored-by: Nassim Jahnke +Co-authored-by: Jake Potrebic +Co-authored-by: William Blake Galbreath +Co-authored-by: SoSeDiK +Co-authored-by: booky10 +Co-authored-by: Amin +Co-authored-by: TrollyLoki +Co-authored-by: FireInstall +Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com> + +diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java +new file mode 100644 +index 0000000000000000000000000000000000000000..39ad7d283609d7e427a2ab35b6fad839e032fe92 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/SchoolableFish.java +@@ -0,0 +1,47 @@ ++package io.papermc.paper.entity; ++ ++import org.bukkit.entity.Fish; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Represents a fish that can school with other fish. ++ */ ++public interface SchoolableFish extends Fish { ++ ++ /** ++ * Forces this fish to follow the given fish. ++ * ++ * @param leader fish to follow ++ */ ++ void startFollowing(@NotNull SchoolableFish leader); ++ ++ /** ++ * Causes the fish to stop following their current ++ * leader. ++ */ ++ void stopFollowing(); ++ ++ /** ++ * Gets the amount of fish currently following this fish. ++ * ++ * @return school size ++ */ ++ int getSchoolSize(); ++ ++ /** ++ * Gets the maximum number of fish that will naturally follow this fish. ++ * ++ * @return max school size ++ */ ++ int getMaxSchoolSize(); ++ ++ /** ++ * Gets the fish that this entity is currently following. ++ * ++ * @return following fish ++ */ ++ @Nullable ++ SchoolableFish getSchoolLeader(); ++ ++} +diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java +index 0d88dce9978243a1f995c5fb448c5d71b01136eb..8b1048c94dffd058eb9fd9144f7f59fc9bd219ad 100644 +--- a/src/main/java/org/bukkit/entity/AbstractHorse.java ++++ b/src/main/java/org/bukkit/entity/AbstractHorse.java +@@ -106,17 +106,71 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable { + * Gets whether the horse is currently grazing hay. + * + * @return true if eating hay ++ * @deprecated use {@link #isEatingGrass()}, this name is incorrect + */ ++ @Deprecated // Paper - Horse API + boolean isEatingHaystack(); + + /** + * Sets whether the horse is grazing hay. + * + * @param eatingHaystack new hay grazing status ++ * @deprecated use {@link #setEatingGrass(boolean)}, this name is incorrect + */ ++ @Deprecated // Paper - Horse API + void setEatingHaystack(boolean eatingHaystack); + + @NotNull + @Override + public AbstractHorseInventory getInventory(); ++ ++ // Paper start - Horse API ++ /** ++ * Gets if a horse is in their eating grass animation. ++ * ++ * @return eating grass animation is active ++ */ ++ public boolean isEatingGrass(); ++ ++ /** ++ * Sets if a horse is in their eating grass animation. ++ * ++ *

When true, the horse will lower its neck.

++ * ++ * @param eating eating grass animation is active ++ */ ++ public void setEatingGrass(boolean eating); ++ ++ /** ++ * Gets if a horse is in their rearing animation. ++ * ++ * @return rearing animation is active ++ */ ++ public boolean isRearing(); ++ ++ /** ++ * Sets if a horse is in their rearing animation. ++ * ++ *

When true, the horse will stand on its hind legs.

++ * ++ * @param rearing rearing animation is active ++ */ ++ public void setRearing(boolean rearing); ++ ++ /** ++ * Gets if a horse is in their eating animation. ++ * ++ * @return eating animation is active ++ */ ++ public boolean isEating(); ++ ++ /** ++ * Sets if a horse is in their eating animation. ++ * ++ *

When true, the horse will bob its head.

++ * ++ * @param eating eating animation is active ++ */ ++ public void setEating(boolean eating); ++ // Paper end - Horse API + } +diff --git a/src/main/java/org/bukkit/entity/AreaEffectCloud.java b/src/main/java/org/bukkit/entity/AreaEffectCloud.java +index 3c65da551aca046986fc0302de3ccc149ee9526c..7f989f2025d16b368829c45f08b8cc8537c99e13 100644 +--- a/src/main/java/org/bukkit/entity/AreaEffectCloud.java ++++ b/src/main/java/org/bukkit/entity/AreaEffectCloud.java +@@ -239,4 +239,20 @@ public interface AreaEffectCloud extends Entity { + * @param source the {@link ProjectileSource} that threw the LingeringPotion + */ + public void setSource(@Nullable ProjectileSource source); ++ ++ // Paper start - owner API ++ /** ++ * Get the entity UUID for the owner of this area effect cloud. ++ * ++ * @return the entity owner uuid or null ++ */ ++ @Nullable java.util.UUID getOwnerUniqueId(); ++ ++ /** ++ * Sets the entity UUID for the owner of this area effect cloud. ++ * ++ * @param ownerUuid the entity owner uuid or null to clear ++ */ ++ void setOwnerUniqueId(@Nullable java.util.UUID ownerUuid); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Bat.java b/src/main/java/org/bukkit/entity/Bat.java +index bd73f22ef7e79e1ade69e860e7ae1d3dcd6fc858..b9f8b14d90a758672642222675d2f5664d4f67b4 100644 +--- a/src/main/java/org/bukkit/entity/Bat.java ++++ b/src/main/java/org/bukkit/entity/Bat.java +@@ -24,4 +24,23 @@ public interface Bat extends Ambient { + * @param state the new state + */ + void setAwake(boolean state); ++ ++ // Paper start ++ /** ++ * Gets the location that this bat is currently trying to move towards. ++ * ++ * @return target location, or null if it's going to find a new location ++ */ ++ @org.jetbrains.annotations.Nullable ++ org.bukkit.Location getTargetLocation(); ++ ++ /** ++ * Sets the location that this bat is currently trying to move towards. ++ *

++ * This can be set to null to cause the bat to recalculate its target location ++ * ++ * @param location location to move towards (world is ignored, will always use the entity's world) ++ */ ++ void setTargetLocation(@org.jetbrains.annotations.Nullable org.bukkit.Location location); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Bee.java b/src/main/java/org/bukkit/entity/Bee.java +index adb20a9abba33c32d553f620fa82b27dff64ab5f..1f6702b0de00b87dbed7f6d93e911655e8667b0b 100644 +--- a/src/main/java/org/bukkit/entity/Bee.java ++++ b/src/main/java/org/bukkit/entity/Bee.java +@@ -93,4 +93,56 @@ public interface Bee extends Animals { + * @param ticks Ticks the bee cannot enter a hive for + */ + void setCannotEnterHiveTicks(int ticks); ++ ++ // Paper start ++ /** ++ * Sets the override for if the bee is currently rolling. ++ * ++ * @param rolling is rolling, or unset for vanilla behavior ++ */ ++ void setRollingOverride(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState rolling); ++ ++ /** ++ * Gets the plugin set override for if the bee is currently rolling. ++ * ++ * @return plugin set rolling override ++ */ ++ @org.jetbrains.annotations.NotNull ++ net.kyori.adventure.util.TriState getRollingOverride(); ++ ++ /** ++ * Gets if the bee is currently rolling. ++ * ++ * @return is rolling ++ */ ++ boolean isRolling(); ++ ++ /** ++ * Sets how many crops this bee has grown since it last ++ * pollinated. ++ * @param crops number of crops ++ */ ++ void setCropsGrownSincePollination(int crops); ++ ++ /** ++ * Gets how many crops this bee has grown since it last ++ * pollinated. ++ * @return number of crops ++ */ ++ int getCropsGrownSincePollination(); ++ ++ /** ++ * Sets how many ticks this bee has gone without pollinating. ++ * ++ * @param ticks number of ticks ++ */ ++ void setTicksSincePollination(int ticks); ++ ++ /** ++ * Gets how many ticks this bee has gone without pollinating ++ * ++ * @return number of ticks ++ */ ++ int getTicksSincePollination(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java +index d1327761a4b95eba97877f1991fc19b298b48eaf..0534fbc228f64cf3b361ab097d9b88212bdb0f36 100644 +--- a/src/main/java/org/bukkit/entity/Cat.java ++++ b/src/main/java/org/bukkit/entity/Cat.java +@@ -68,4 +68,36 @@ public interface Cat extends Tameable, Sittable { + return key; + } + } ++ ++ // Paper start - More cat api ++ /** ++ * Sets if the cat is lying down. ++ * This is visual and does not affect the behaviour of the cat. ++ * ++ * @param lyingDown whether the cat should lie down ++ */ ++ public void setLyingDown(boolean lyingDown); ++ ++ /** ++ * Gets if the cat is lying down. ++ * ++ * @return whether the cat is lying down ++ */ ++ public boolean isLyingDown(); ++ ++ /** ++ * Sets if the cat has its head up. ++ * This is visual and does not affect the behaviour of the cat. ++ * ++ * @param headUp head is up ++ */ ++ public void setHeadUp(boolean headUp); ++ ++ /** ++ * Gets if the cat has its head up. ++ * ++ * @return head is up ++ */ ++ public boolean isHeadUp(); ++ // Paper end - More cat api + } +diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java +index cb3ec6ef6c38c2071cb6ad91da094fca2de8d5c6..b4c1a262602d4ca5ffc9fcc21d6aa79af8c040a7 100644 +--- a/src/main/java/org/bukkit/entity/Chicken.java ++++ b/src/main/java/org/bukkit/entity/Chicken.java +@@ -3,4 +3,35 @@ package org.bukkit.entity; + /** + * Represents a Chicken. + */ +-public interface Chicken extends Animals {} ++// Paper start ++public interface Chicken extends Animals { ++ ++ /** ++ * Gets if this chicken was spawned as a chicken jockey. ++ * ++ * @return is chicken jockey ++ */ ++ boolean isChickenJockey(); ++ ++ /** ++ * Sets if this chicken was spawned as a chicken jockey. ++ * ++ * @param isChickenJockey is chicken jockey ++ */ ++ void setIsChickenJockey(boolean isChickenJockey); ++ ++ /** ++ * Gets the number of ticks till this chicken lays an egg. ++ * ++ * @return ticks till the chicken lays an egg ++ */ ++ int getEggLayTime(); ++ ++ /** ++ * Sets the number of ticks till this chicken lays an egg. ++ * ++ * @param eggLayTime ticks till the chicken lays an egg ++ */ ++ void setEggLayTime(int eggLayTime); ++} ++// Paper end +diff --git a/src/main/java/org/bukkit/entity/Cod.java b/src/main/java/org/bukkit/entity/Cod.java +index 191ce6c0e32ab3d05b1376e0fa56d1292c2d442c..8de09075e14a08a6c68f9c24e8960cc04a018036 100644 +--- a/src/main/java/org/bukkit/entity/Cod.java ++++ b/src/main/java/org/bukkit/entity/Cod.java +@@ -4,4 +4,4 @@ package org.bukkit.entity; + /** + * Represents a cod fish. + */ +-public interface Cod extends Fish { } ++public interface Cod extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API +diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java +index 58191017244f3949f6174fb108e3a245738a53c4..61672c6faf94aa497145aadd634bb10103c7b05a 100644 +--- a/src/main/java/org/bukkit/entity/Enderman.java ++++ b/src/main/java/org/bukkit/entity/Enderman.java +@@ -86,4 +86,36 @@ public interface Enderman extends Monster { + * @return true if the teleport succeeded. + */ + public boolean teleportTowards(@NotNull Entity entity); ++ ++ // Paper start ++ /** ++ * Returns whether the enderman is screaming/angry. ++ * ++ * @return whether the enderman is screaming ++ */ ++ boolean isScreaming(); ++ ++ /** ++ * Sets whether the enderman is screaming/angry. ++ * ++ * @param screaming whether the enderman is screaming ++ */ ++ void setScreaming(boolean screaming); ++ ++ /** ++ * Returns whether the enderman has been stared at. ++ * If set to true, players will hear an ambient sound. ++ * ++ * @return whether the enderman has been stared at ++ */ ++ boolean hasBeenStaredAt(); ++ ++ /** ++ * Sets whether the enderman has been stared at. ++ * If set to true, players will hear an ambient sound. ++ * ++ * @param hasBeenStaredAt whether the enderman has been stared at ++ */ ++ void setHasBeenStaredAt(boolean hasBeenStaredAt); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java +index 9e7f42caab1204036f4203354c115fd40c6def92..138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2 100644 +--- a/src/main/java/org/bukkit/entity/Endermite.java ++++ b/src/main/java/org/bukkit/entity/Endermite.java +@@ -23,4 +23,22 @@ public interface Endermite extends Monster { + */ + @Deprecated + void setPlayerSpawned(boolean playerSpawned); ++ // Paper start ++ /** ++ * Sets how many ticks this endermite has been living for. ++ * If this value is greater than 2400, this endermite will despawn. ++ * ++ * @param ticks lifetime ticks ++ */ ++ void setLifetimeTicks(int ticks); ++ ++ /** ++ * Gets how long this endermite has been living for. ++ * This value will tick up while {@link LivingEntity#getRemoveWhenFarAway()} is false. ++ * If this value is greater than 2400, this endermite will despawn. ++ * ++ * @return lifetime ticks ++ */ ++ int getLifetimeTicks(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index c7d6a328def83619dca9b6122aeb5870e4585e70..795e799fec7cfd65a0e08bb3f941148d85ff4c3b 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -289,6 +289,40 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + boolean isFrozen(); + ++ // Paper start - missing entity api ++ /** ++ * Sets whether the entity is invisible or not. ++ *

++ * This setting is undefined for non-living entities like boats or paintings. ++ * Non-living entities that are marked as invisible through this method may e.g. only hide their shadow. ++ * To hide such entities from players completely, see {@link Player#hideEntity(org.bukkit.plugin.Plugin, Entity)}. ++ * ++ * @param invisible If the entity is invisible ++ */ ++ void setInvisible(boolean invisible); // Paper - moved up from LivingEntity ++ ++ /** ++ * Gets whether the entity is invisible or not. ++ * ++ * @return Whether the entity is invisible ++ */ ++ boolean isInvisible(); // Paper - moved up from LivingEntity ++ ++ /** ++ * Sets this entities no physics status. ++ * ++ * @param noPhysics boolean indicating if the entity should not have physics. ++ */ ++ void setNoPhysics(boolean noPhysics); ++ ++ /** ++ * Gets if this entity has no physics. ++ * ++ * @return true if the entity does not have physics. ++ */ ++ boolean hasNoPhysics(); ++ // Paper end - missing entity api ++ + /** + * Mark the entity's removal. + * +diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/bukkit/entity/Fireball.java +index 7a44707f2307dc4dbfea4de3f4baf3cc0490dc93..d0e82102425e54274be9c4769634d754319d6196 100644 +--- a/src/main/java/org/bukkit/entity/Fireball.java ++++ b/src/main/java/org/bukkit/entity/Fireball.java +@@ -23,4 +23,32 @@ public interface Fireball extends Projectile, Explosive { + @NotNull + public Vector getDirection(); + ++ // Paper start - Expose power on fireball projectiles ++ /** ++ * {@inheritDoc} ++ *

++ * Note: For fireball entities, their movement is also controlled by their power. ++ * ++ * @param velocity New velocity to travel with ++ * @see #setPower(Vector) ++ */ ++ @Override ++ public void setVelocity(@NotNull Vector velocity); ++ ++ /** ++ * Sets the power of a fireball. The power determines the direction and magnitude of its acceleration. ++ * ++ * @param power the power ++ */ ++ public void setPower(@NotNull Vector power); ++ ++ /** ++ * Gets the power of a fireball. The power determines the direction and magnitude of its acceleration. ++ * ++ * @return the power ++ */ ++ @NotNull ++ public Vector getPower(); ++ // Paper end - Expose power on fireball projectiles ++ + } +diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java +index c61a473453f33f9d10c330fc46cfa9d52251fe49..473a7e36ad64f866d1d2e09e2ecb2e9881668faf 100644 +--- a/src/main/java/org/bukkit/entity/Fox.java ++++ b/src/main/java/org/bukkit/entity/Fox.java +@@ -92,4 +92,55 @@ public interface Fox extends Animals, Sittable { + RED, + SNOW; + } ++ ++ // Paper start - Add more fox behavior API ++ /** ++ * Sets if the fox is interested. ++ * ++ * @param interested is interested ++ */ ++ public void setInterested(boolean interested); ++ ++ /** ++ * Gets if the fox is interested. ++ * ++ * @return fox is interested ++ */ ++ public boolean isInterested(); ++ ++ /** ++ * Sets if the fox is leaping. ++ * ++ * @param leaping is leaping ++ */ ++ public void setLeaping(boolean leaping); ++ ++ /** ++ * Gets if the fox is leaping. ++ * ++ * @return fox is leaping ++ */ ++ public boolean isLeaping(); ++ ++ /** ++ * Sets if the fox is defending. ++ * ++ * @param defending is defending ++ */ ++ public void setDefending(boolean defending); ++ ++ /** ++ * Gets if the fox is defending. ++ * ++ * @return fox is defending ++ */ ++ public boolean isDefending(); ++ ++ /** ++ * Sets if the fox face planted. ++ * ++ * @param faceplanted face planted ++ */ ++ public void setFaceplanted(boolean faceplanted); ++ // Paper end - Add more fox behavior API + } +diff --git a/src/main/java/org/bukkit/entity/Ghast.java b/src/main/java/org/bukkit/entity/Ghast.java +index 6b3c9bef9a8a34ddc6ff42cf358541a2665bf5e3..9c618a27d590f186f29c5d9094fc565efd40ca49 100644 +--- a/src/main/java/org/bukkit/entity/Ghast.java ++++ b/src/main/java/org/bukkit/entity/Ghast.java +@@ -18,4 +18,21 @@ public interface Ghast extends Flying, Enemy { + * @param flag Whether the Ghast is charging + */ + void setCharging(boolean flag); ++ ++ // Paper start ++ /** ++ * Returns the explosion power of shot fireballs. ++ * ++ * @return explosion power of shot fireballs ++ */ ++ int getExplosionPower(); ++ ++ /** ++ * Sets the explosion power of shot fireballs. ++ * ++ * @param explosionPower explosion power of shot fireballs ++ * @throws IllegalArgumentException if the explosion power is less than 0 or greater than 127 ++ */ ++ void setExplosionPower(int explosionPower); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 62a301f2f87b053bcfbf16c9870c3f740eb70022..ce5cf587ce44f2410c1d0bcf459b6309ec70bfee 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -994,6 +994,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * + * @param invisible If the entity is invisible + */ ++ @Override // Paper - move invisibility up to Entity + public void setInvisible(boolean invisible); + + /** +@@ -1001,6 +1002,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + * + * @return Whether the entity is invisible + */ ++ @Override // Paper - move invisibility up to Entity + public boolean isInvisible(); + + // Paper start +@@ -1037,6 +1039,57 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + void setShieldBlockingDelay(int delay); + // Paper end + ++ // Paper start - missing entity API ++ /** ++ * Retrieves the sideways movement direction of the entity. ++ *

++ * The returned value ranges from -1 to 1, where: ++ * - Positive 1 represents movement to the left. ++ * - Negative 1 represents movement to the right. ++ *

++ * Please note that for entities of type {@link Player}, this value is updated only when riding another entity. ++ *

++ * This method specifically provides information about the entity's sideways movement, whereas {@link #getVelocity()} returns ++ * a vector representing the entity's overall current momentum. ++ * ++ * @return Sideways movement direction, ranging from -1 (right) to 1 (left). ++ */ ++ float getSidewaysMovement(); ++ ++ /** ++ * Retrieves the upwards movement direction of the entity. ++ *

++ * The returned value ranges from -1 to 1, where: ++ * - Positive 1 represents upward movement. ++ * - Negative 1 represents downward movement. ++ *

++ * Please note that for entities of type {@link Player}, this value is never updated. ++ *

++ * This method specifically provides information about the entity's vertical movement, ++ * whereas {@link #getVelocity()} returns a vector representing the entity's overall ++ * current momentum. ++ * ++ * @return Upwards movement direction, ranging from -1 (downward) to 1 (upward). ++ */ ++ float getUpwardsMovement(); ++ ++ /** ++ * Retrieves the forwards movement direction of the entity. ++ *

++ * The returned value ranges from -1 to 1, where: ++ * - Positive 1 represents movement forwards. ++ * - Negative 1 represents movement backwards. ++ *

++ * Please note that for entities of type {@link Player}, this value is updated only when riding another entity. ++ *

++ * This method specifically provides information about the entity's forward and backward movement, ++ * whereas {@link #getVelocity()} returns a vector representing the entity's overall current momentum. ++ * ++ * @return Forwards movement direction, ranging from -1 (backward) to 1 (forward). ++ */ ++ float getForwardsMovement(); ++ // Paper end - missing entity API ++ + // Paper start - active item API + /** + * Starts using the item in the specified hand, making it the +diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java +index d23226ccb0f6c25028f000ce31346cd0a8898e6a..bc84b892cae5fe7019a3ad481e9da79956efa1fe 100644 +--- a/src/main/java/org/bukkit/entity/Llama.java ++++ b/src/main/java/org/bukkit/entity/Llama.java +@@ -67,4 +67,56 @@ public interface Llama extends ChestedHorse, RangedEntity { // Paper + @NotNull + @Override + LlamaInventory getInventory(); ++ ++ // Paper start ++ /** ++ * Checks if this llama is in a caravan. ++ * This means that this llama is currently following ++ * another llama. ++ * ++ * @return is in caravan ++ */ ++ boolean inCaravan(); ++ ++ /** ++ * Joins a caravan, with the provided llama being the leader ++ * of the caravan. ++ * This llama will then follow the provided llama. ++ * ++ * @param llama head of caravan to join ++ */ ++ void joinCaravan(@NotNull Llama llama); ++ ++ /** ++ * Leaves the current caravan that they are in. ++ */ ++ void leaveCaravan(); ++ ++ /** ++ * Get the llama that this llama is following. ++ *

++ * Does not necessarily mean the leader of the entire caravan. ++ * ++ * @return the llama currently being followed ++ */ ++ @org.jetbrains.annotations.Nullable ++ Llama getCaravanHead(); ++ ++ /** ++ * Checks if another llama is currently following behind ++ * this llama. ++ * ++ * @return true if being followed in the caravan ++ */ ++ boolean hasCaravanTail(); ++ ++ /** ++ * Gets the llama that is currently following behind ++ * this llama. ++ * ++ * @return the llama following this llama, or null if none is following them ++ */ ++ @org.jetbrains.annotations.Nullable ++ Llama getCaravanTail(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 11b6d1aba7d1f6ae1f3c822193486f5a1478e105..709c8fc3dde786f45ff13d6ee6c405ffdc765282 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -162,4 +162,38 @@ public interface Mob extends LivingEntity, Lootable { + */ + @Nullable + public Sound getAmbientSound(); ++ ++ // Paper start ++ /** ++ * Some mobs will raise their arm(s) when aggressive: ++ *

    ++ *
  • {@link Drowned}
  • ++ *
  • {@link Piglin}
  • ++ *
  • {@link Skeleton}
  • ++ *
  • {@link Zombie}
  • ++ *
  • {@link ZombieVillager}
  • ++ *
  • {@link Illusioner}
  • ++ *
  • {@link Vindicator}
  • ++ *
  • {@link Panda}
  • ++ *
  • {@link Pillager}
  • ++ *
  • {@link PiglinBrute}
  • ++ *
++ *

++ * Note: This doesn't always show the actual aggressive state as ++ * set by {@link #setAggressive(boolean)}. {@link Panda}'s are always ++ * aggressive if their combined {@link Panda.Gene} is {@link Panda.Gene#AGGRESSIVE}. ++ * ++ * @return wether the mob is aggressive or not ++ */ ++ boolean isAggressive(); ++ ++ /** ++ * Some mobs will raise their arm(s) when aggressive, ++ * see {@link #isAggressive()} for full list. ++ * ++ * @param aggressive wether the mob should be aggressive or not ++ * @see #isAggressive() ++ */ ++ void setAggressive(boolean aggressive); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java +index 1f027927a1194f4f8e86c1375a2772e6e261c151..aa5686df134185334a74429576ff0709a604dbfd 100644 +--- a/src/main/java/org/bukkit/entity/Panda.java ++++ b/src/main/java/org/bukkit/entity/Panda.java +@@ -107,6 +107,98 @@ public interface Panda extends Animals, Sittable { + */ + int getUnhappyTicks(); + ++ // Paper start - Panda API ++ /** ++ * Sets the sneeze progress in this animation. ++ * This value counts up only if {@link Panda#isSneezing()} is true ++ * ++ * @param ticks sneeze progress ++ */ ++ void setSneezeTicks(int ticks); ++ ++ /** ++ * Gets the current sneeze progress, or how many ticks this panda will sneeze for. ++ * ++ * @return sneeze progress ++ */ ++ int getSneezeTicks(); ++ ++ /** ++ * Sets the eating ticks for this panda. ++ *

++ * ++ * This starts counting up as long as it is greater than 0. ++ * ++ * @param ticks eating ticks ++ */ ++ void setEatingTicks(int ticks); ++ ++ /** ++ * Gets the current eating progress, or how many ticks this panda has been eating for. ++ * ++ * @return eating progress ++ */ ++ int getEatingTicks(); ++ ++ /** ++ * Sets the number of ticks this panda will be unhappy for. ++ *

++ * This value counts down. ++ * ++ * @param ticks unhappy ticks ++ */ ++ void setUnhappyTicks(int ticks); ++ ++ /** ++ * Sets if this panda is currently on its back. ++ * ++ * @param onBack is on its back ++ * @deprecated use {@link #setOnBack(boolean)} ++ */ ++ @Deprecated(forRemoval = true) ++ default void setIsOnBack(boolean onBack) { ++ this.setOnBack(onBack); ++ } ++ ++ /** ++ * Sets if this panda is currently sitting. ++ * ++ * @param sitting is currently sitting ++ * @deprecated use {@link #setSitting(boolean)} ++ */ ++ @Deprecated(forRemoval = true) ++ default void setIsSitting(boolean sitting) { ++ this.setSitting(sitting); ++ } ++ ++ /** ++ * Sets if this panda is currently sitting. ++ * ++ * @param sitting is currently sitting ++ */ ++ @Override ++ void setSitting(boolean sitting); ++ ++ /** ++ * Gets if this panda is sitting. ++ * ++ * @return is sitting ++ */ ++ @Override ++ boolean isSitting(); ++ ++ /** ++ * Gets this Panda's combined gene. ++ *

++ * The combined gene can be modified using ++ * {@link #setMainGene(Gene)} or {@link #setHiddenGene(Gene)}. ++ * ++ * @return combined gene ++ */ ++ @NotNull ++ Gene getCombinedGene(); ++ // Paper end - Panda API ++ + public enum Gene { + + NORMAL(false), +diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java +index 3dafdf14ced991ae1179ef1ca455da62f8c3243e..2fe8e8868f12bd9e846baf8858cd2c333c00a0d8 100644 +--- a/src/main/java/org/bukkit/entity/Phantom.java ++++ b/src/main/java/org/bukkit/entity/Phantom.java +@@ -40,5 +40,21 @@ public interface Phantom extends Flying, Enemy { + * @param shouldBurnInDay True to burn in sunlight + */ + public void setShouldBurnInDay(boolean shouldBurnInDay); ++ ++ /** ++ * Gets the location that this phantom circles around when not attacking a player ++ * This will be changed after attacking a player. ++ * ++ * @return circling location ++ */ ++ @org.jetbrains.annotations.NotNull ++ org.bukkit.Location getAnchorLocation(); ++ ++ /** ++ * Sets the location that this phantom circles around when not attacking a player ++ * ++ * @param location circling location (world is ignored, will always use the entity's world) ++ */ ++ void setAnchorLocation(@org.jetbrains.annotations.NotNull org.bukkit.Location location); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Piglin.java b/src/main/java/org/bukkit/entity/Piglin.java +index 6fdc0e0bb62189dbf3cf9ce7a87b7fbb995956a3..eb0b7c18c1266748ff1e8e18e49b6c4f6e078b83 100644 +--- a/src/main/java/org/bukkit/entity/Piglin.java ++++ b/src/main/java/org/bukkit/entity/Piglin.java +@@ -90,4 +90,47 @@ public interface Piglin extends PiglinAbstract, InventoryHolder, com.destroystok + */ + @NotNull + public Set getBarterList(); ++ ++ // Paper start ++ /** ++ * Causes the piglin to appear as if they are charging ++ * a crossbow. ++ *

++ * This works with any item currently held in the piglin's hand. ++ * ++ * @param chargingCrossbow is charging ++ */ ++ void setChargingCrossbow(boolean chargingCrossbow); ++ ++ /** ++ * Gets if the piglin is currently charging the ++ * item in their hand. ++ * ++ * @return is charging ++ */ ++ boolean isChargingCrossbow(); ++ ++ /** ++ * Sets whether the Piglin is dancing or not ++ * ++ * @param dancing is dancing ++ */ ++ void setDancing(boolean dancing); ++ ++ /** ++ * Causes the piglin to dance for a ++ * specified amount of time ++ * ++ * @param duration duration of the dance in ticks ++ */ ++ void setDancing(long duration); ++ ++ /** ++ * Gets if the piglin is currently dancing ++ * ++ * @return is dancing ++ */ ++ boolean isDancing(); ++ // Paper end ++ + } +diff --git a/src/main/java/org/bukkit/entity/PolarBear.java b/src/main/java/org/bukkit/entity/PolarBear.java +index 479f7a7c54c85cb685f56e60906650d1989c03ff..4e526ba6aa462a484984fb9f0512b8db113086fe 100644 +--- a/src/main/java/org/bukkit/entity/PolarBear.java ++++ b/src/main/java/org/bukkit/entity/PolarBear.java +@@ -3,4 +3,22 @@ package org.bukkit.entity; + /** + * Represents a polar bear. + */ +-public interface PolarBear extends Animals {} ++// Paper start ++public interface PolarBear extends Animals { ++ ++ /** ++ * Returns whether the polar bear is standing. ++ * ++ * @return whether the polar bear is standing ++ */ ++ boolean isStanding(); ++ ++ /** ++ * Sets whether the polar bear is standing. ++ * ++ * @param standing whether the polar bear should be standing ++ */ ++ void setStanding(boolean standing); ++ ++} ++// Paper end +diff --git a/src/main/java/org/bukkit/entity/Rabbit.java b/src/main/java/org/bukkit/entity/Rabbit.java +index e88154283a8ef594e160d25005870053de15568a..979062aa476e3bd75166458d8831894fba8778cd 100644 +--- a/src/main/java/org/bukkit/entity/Rabbit.java ++++ b/src/main/java/org/bukkit/entity/Rabbit.java +@@ -14,6 +14,23 @@ public interface Rabbit extends Animals { + * @param type Sets the type of rabbit for this entity. + */ + public void setRabbitType(@NotNull Type type); ++ // Paper start ++ /** ++ * Sets how many ticks this rabbit will wait ++ * until trying to find more carrots. ++ * ++ * @param ticks ticks ++ */ ++ void setMoreCarrotTicks(int ticks); ++ ++ /** ++ * Returns how many ticks this rabbit ++ * will wait until trying to find more carrots. ++ * ++ * @return ticks ++ */ ++ int getMoreCarrotTicks(); ++ // Paper end + + /** + * Represents the various types a Rabbit might be. +diff --git a/src/main/java/org/bukkit/entity/Ravager.java b/src/main/java/org/bukkit/entity/Ravager.java +index 4374d5206d4d15a4d8d228c137ed9a96821a1f02..0eb7214472f3a43641a3526000af6beeefb7b36f 100644 +--- a/src/main/java/org/bukkit/entity/Ravager.java ++++ b/src/main/java/org/bukkit/entity/Ravager.java +@@ -3,4 +3,61 @@ package org.bukkit.entity; + /** + * Illager beast. + */ +-public interface Ravager extends Raider { } ++// Paper start - Missing Entity Behavior ++public interface Ravager extends Raider { ++ ++ /** ++ * Gets how many ticks this ravager is attacking for. ++ * When attacking, the ravager cannot move. ++ * ++ * @return ticks attacking or -1 if they are currently not attacking ++ */ ++ int getAttackTicks(); ++ ++ /** ++ * Sets how many ticks this ravager is attacking for. ++ * When attacking, the ravager cannot move. ++ * This will tick down till it gets to -1, where this ravager will no longer be attacking. ++ * ++ * @param ticks ticks attacking or -1 if they should no longer be attacking ++ */ ++ void setAttackTicks(int ticks); ++ ++ /** ++ * Gets how many ticks the ravager is stunned for. ++ * The ravager cannot move or attack while stunned. ++ * At 0, this will cause the ravager to roar. ++ * ++ * @return ticks stunned or -1 if they are currently not stunned ++ */ ++ int getStunnedTicks(); ++ ++ /** ++ * Sets how many ticks the ravager is stunned for. ++ * The ravager cannot move or attack while stunned. ++ * At 0, this will cause the ravager to roar. ++ * ++ * @param ticks ticks stunned or -1 if they should no longer be stunned ++ */ ++ void setStunnedTicks(int ticks); ++ ++ /** ++ * Gets how many ticks the ravager is roaring for. ++ * While roaring, the ravager cannot move ++ * ++ * @return ticks roaring or -1 if they are currently not roaring ++ */ ++ int getRoarTicks(); ++ ++ /** ++ * Sets how many ticks the ravager is roaring for. ++ * While roaring, the ravager cannot move ++ * This will tick down till it gets to -1, where it is no longer active. ++ * If set to 11, this will play a sound and hurt nearby players. ++ * ++ * @param ticks ticks roaring or -1 if they should no longer be roaring ++ */ ++ void setRoarTicks(int ticks); ++ ++} ++// Paper end +diff --git a/src/main/java/org/bukkit/entity/Salmon.java b/src/main/java/org/bukkit/entity/Salmon.java +index a52a7af219633d575dcbe8ac4b219834bfd4d4d2..1e839b247182af6873a4d74b236d6412817c18bf 100644 +--- a/src/main/java/org/bukkit/entity/Salmon.java ++++ b/src/main/java/org/bukkit/entity/Salmon.java +@@ -4,4 +4,4 @@ package org.bukkit.entity; + /** + * Represents a salmon fish. + */ +-public interface Salmon extends Fish { } ++public interface Salmon extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API +diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java +index 0813bd913c8fdb2001963ce3e82c07c2af105418..87e717c9ea61b0cbf536bc62fa829ddcfae5ad8c 100644 +--- a/src/main/java/org/bukkit/entity/TNTPrimed.java ++++ b/src/main/java/org/bukkit/entity/TNTPrimed.java +@@ -64,4 +64,26 @@ public interface TNTPrimed extends Explosive { + default org.bukkit.Location getSourceLoc() { + return this.getOrigin(); + } ++ ++ // Paper start ++ /** ++ * Sets the visual block data of this ++ * primed tnt. ++ *
++ * The explosion of the tnt stays the ++ * same and is not affected by this change. ++ * ++ * @param data the visual block data ++ */ ++ void setBlockData(@org.jetbrains.annotations.NotNull org.bukkit.block.data.BlockData data); ++ ++ /** ++ * Gets the visual block data of this ++ * primed tnt. ++ * ++ * @return the visual block data ++ */ ++ @org.jetbrains.annotations.NotNull ++ org.bukkit.block.data.BlockData getBlockData(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Tadpole.java b/src/main/java/org/bukkit/entity/Tadpole.java +index d64979ebdd018f0f63b6115809b48374ba454249..8e097ad55d208a6980c320e2a849efdcc504cff1 100644 +--- a/src/main/java/org/bukkit/entity/Tadpole.java ++++ b/src/main/java/org/bukkit/entity/Tadpole.java +@@ -18,4 +18,21 @@ public interface Tadpole extends Fish { + * @param age New age + */ + public void setAge(int age); ++ ++ // Paper start - Tadpole age lock api ++ /** ++ * Lock the age of the animal, setting this will prevent the animal from ++ * maturing. ++ * ++ * @param lock new lock ++ */ ++ void setAgeLock(boolean lock); ++ ++ /** ++ * Gets the current agelock. ++ * ++ * @return the current agelock ++ */ ++ boolean getAgeLock(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java +index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7 100644 +--- a/src/main/java/org/bukkit/entity/Trident.java ++++ b/src/main/java/org/bukkit/entity/Trident.java +@@ -3,4 +3,40 @@ package org.bukkit.entity; + /** + * Represents a thrown trident. + */ +-public interface Trident extends AbstractArrow, ThrowableProjectile { } ++// Paper start ++public interface Trident extends AbstractArrow, ThrowableProjectile { ++ ++ /** ++ * Returns whether the trident has an enchanted glow. ++ * This can be separate from the underlying item having any enchantments. ++ * ++ * @return whether the trident has an enchanted glow ++ */ ++ boolean hasGlint(); ++ ++ /** ++ * Sets whether the trident has an enchanted glow. ++ * This is separate from the underlying item having any enchantments. ++ * ++ * @param glint whether the trident should have an enchanted glow ++ */ ++ void setGlint(boolean glint); ++ ++ /** ++ * Returns the loyalty level of the trident. ++ * This can be separate from the underlying item's enchantments. ++ * ++ * @return loyalty level of the trident ++ */ ++ int getLoyaltyLevel(); ++ ++ /** ++ * Sets the loyalty level of the trident. ++ * This is separate from the underlying item's enchantments. ++ * ++ * @param loyaltyLevel loyalty level ++ * @throws IllegalArgumentException if the loyalty level is lower than 0 or greater than 127 ++ */ ++ void setLoyaltyLevel(int loyaltyLevel); ++} ++// Paper end +diff --git a/src/main/java/org/bukkit/entity/TropicalFish.java b/src/main/java/org/bukkit/entity/TropicalFish.java +index ab31289bb0f9c8e581537a88e1db22bcdbd3d484..84bba32e80d755f094975b667f1bf2a132087f4f 100644 +--- a/src/main/java/org/bukkit/entity/TropicalFish.java ++++ b/src/main/java/org/bukkit/entity/TropicalFish.java +@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Tropical fish. + */ +-public interface TropicalFish extends Fish { ++public interface TropicalFish extends io.papermc.paper.entity.SchoolableFish { // Paper - Schooling Fish API + + /** + * Gets the color of the fish's pattern. +diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java +index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f400d6be6f 100644 +--- a/src/main/java/org/bukkit/entity/Vex.java ++++ b/src/main/java/org/bukkit/entity/Vex.java +@@ -57,21 +57,30 @@ public interface Vex extends Monster { + * Gets the remaining lifespan of this entity. + * + * @return life in ticks ++ * @deprecated This API duplicates existing API which uses the more ++ * preferable name due to mirroring internals better + */ ++ @Deprecated + int getLifeTicks(); + + /** + * Sets the remaining lifespan of this entity. + * + * @param lifeTicks life in ticks, or negative for unlimited lifepan ++ * @deprecated This API duplicates existing API which uses the more ++ * preferable name due to mirroring internals better + */ ++ @Deprecated + void setLifeTicks(int lifeTicks); + + /** + * Gets if the entity has a limited life. + * + * @return true if the entity has limited life ++ * @deprecated This API duplicates existing API which uses the more ++ * preferable name due to mirroring internals better + */ ++ @Deprecated + boolean hasLimitedLife(); + // Paper start + +@@ -89,5 +98,37 @@ public interface Vex extends Monster { + * @param summoner New summoner + */ + void setSummoner(@Nullable Mob summoner); ++ ++ /** ++ * Gets if this vex should start to take damage ++ * once {@link Vex#getLimitedLifetimeTicks()} is less than or equal to 0. ++ * ++ * @return will take damage ++ */ ++ boolean hasLimitedLifetime(); ++ ++ /** ++ * Sets if this vex should start to take damage ++ * once {@link Vex#getLimitedLifetimeTicks()} is less than or equal to 0. ++ * ++ * @param hasLimitedLifetime should take damage ++ */ ++ void setLimitedLifetime(boolean hasLimitedLifetime); ++ ++ /** ++ * Gets the number of ticks remaining until the vex will start ++ * to take damage. ++ * ++ * @return ticks until the vex will start to take damage ++ */ ++ int getLimitedLifetimeTicks(); ++ ++ /** ++ * Sets the number of ticks remaining until the vex takes damage. ++ * This number is ticked down only if {@link Vex#hasLimitedLifetime()} is true. ++ * ++ * @param ticks ticks remaining ++ */ ++ void setLimitedLifetimeTicks(int ticks); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java +index da76e1ed5406322073dd8c7a89ca55aa68620ac4..9f25774659b29d8fcca3eb9d9487edff42dbad13 100644 +--- a/src/main/java/org/bukkit/entity/WanderingTrader.java ++++ b/src/main/java/org/bukkit/entity/WanderingTrader.java +@@ -53,5 +53,26 @@ public interface WanderingTrader extends AbstractVillager { + * @return whether the mob will drink + */ + public boolean canDrinkMilk(); ++ ++ /** ++ * Gets the location that this wandering trader is currently ++ * wandering towards. ++ *

++ * This will return null if the wandering trader has finished ++ * wandering towards the given location. ++ * ++ * @return the location currently wandering towards, or null if not wandering ++ */ ++ @org.jetbrains.annotations.Nullable ++ org.bukkit.Location getWanderingTowards(); ++ ++ /** ++ * Sets the location that this wandering trader is currently wandering towards. ++ *

++ * This can be set to null to prevent the wandering trader from wandering further. ++ * ++ * @param location location to wander towards (world is ignored, will always use the entity's world) ++ */ ++ void setWanderingTowards(@org.jetbrains.annotations.Nullable org.bukkit.Location location); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java +index 3794db8867b53f3b3735ad82fdd8765a26df2bfb..efaa45f41bc1dc8df6665c55b4e5ade343d60d4c 100644 +--- a/src/main/java/org/bukkit/entity/Warden.java ++++ b/src/main/java/org/bukkit/entity/Warden.java +@@ -30,6 +30,18 @@ public interface Warden extends Monster { + */ + int getAnger(@NotNull Entity entity); + ++ // Paper start ++ /** ++ * Gets the highest anger level of this warden. ++ *

++ * Anger is an integer from 0 to 150. Once a Warden reaches 80 anger at a ++ * target it will actively pursue it. ++ * ++ * @return highest anger level ++ */ ++ int getHighestAnger(); ++ // Paper end ++ + /** + * Increases the anger level of this warden. + * +diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java +index 87a814f63c3f35be35bfa210c9248ad211c0dd8f..14543c2238b45c526dd9aebea2aa5c22f5df54dc 100644 +--- a/src/main/java/org/bukkit/entity/Wither.java ++++ b/src/main/java/org/bukkit/entity/Wither.java +@@ -43,7 +43,9 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra + * Returns the wither's current invulnerability ticks. + * + * @return amount of invulnerability ticks ++ * @deprecated Duplicate api, use {@link #getInvulnerableTicks()} + */ ++ @Deprecated(forRemoval = true) // Paper + int getInvulnerabilityTicks(); + + /** +@@ -52,7 +54,9 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra + * When invulnerability ticks reach 0, the wither will trigger an explosion. + * + * @param ticks amount of invulnerability ticks ++ * @deprecated Duplicate api, use {@link #setInvulnerableTicks(int)} + */ ++ @Deprecated(forRemoval = true) // Paper + void setInvulnerabilityTicks(int ticks); + + /** +@@ -64,4 +68,43 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra + LEFT, + RIGHT + } ++ ++ // Paper start ++ /** ++ * @return whether the wither is charged ++ */ ++ boolean isCharged(); ++ ++ /** ++ * @return ticks the wither is invulnerable for ++ */ ++ int getInvulnerableTicks(); ++ ++ /** ++ * Sets for how long in the future, the wither should be invulnerable. ++ * ++ * @param ticks ticks the wither is invulnerable for ++ */ ++ void setInvulnerableTicks(int ticks); ++ ++ /** ++ * @return whether the wither can travel through portals ++ */ ++ boolean canTravelThroughPortals(); ++ ++ /** ++ * Sets whether the wither can travel through portals. ++ * ++ * @param value whether the wither can travel through portals ++ */ ++ void setCanTravelThroughPortals(boolean value); ++ ++ /** ++ * Makes the wither invulnerable for 11 seconds and ++ * sets the health to one third of the max health. ++ *
++ * This is called in vanilla directly after spawning the wither. ++ */ ++ void enterInvulnerabilityPhase(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java +index 7cc1d9a966454af70b7c25735fe474fe3eb97eb4..ac6fd8ca95771c185c145f4589ddd5b2a6e8c2da 100644 +--- a/src/main/java/org/bukkit/entity/ZombieVillager.java ++++ b/src/main/java/org/bukkit/entity/ZombieVillager.java +@@ -90,4 +90,22 @@ public interface ZombieVillager extends Zombie { + * @param conversionPlayer the player + */ + void setConversionPlayer(@Nullable OfflinePlayer conversionPlayer); ++ ++ // Paper start - missing entity behaviour api - converting without entity event ++ /** ++ * Sets the amount of ticks until this entity will be converted to a ++ * Villager as a result of being cured. ++ *

++ * When this reaches 0, the entity will be converted. A value of less than 0 ++ * will stop the current conversion process without converting the current ++ * entity. ++ * ++ * @param time new conversion time ++ * @param broadcastEntityEvent whether this conversion time mutation should broadcast the ++ * org.bukkit.{@link org.bukkit.EntityEffect#ZOMBIE_TRANSFORM} entity event to the ++ * world. If false, no entity event is published, preventing for example the ++ * org.bukkit.{@link org.bukkit.Sound#ENTITY_ZOMBIE_VILLAGER_CURE} from playing. ++ */ ++ void setConversionTime(int time, boolean broadcastEntityEvent); ++ // Paper end - missing entity behaviour api - converting without entity event + } +diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java +index db69687a7ad4b18d17ab1677cae5d8dd4dcd3678..304b05aeaea5febf493fc40d433a23acb384b4f0 100644 +--- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java ++++ b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java +@@ -24,4 +24,23 @@ public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntit + * @param enabled new enabled state + */ + void setEnabled(boolean enabled); ++ // Paper start ++ /** ++ * Gets the number of ticks that this hopper minecart cannot pickup items up for. ++ * ++ * @return ticks left on cooldown ++ * @deprecated Hopper minecarts don't have cooldowns anymore ++ */ ++ @Deprecated(forRemoval = true) ++ int getPickupCooldown(); ++ ++ /** ++ * Sets the number of ticks that this hopper minecart cannot pickup items for. ++ * ++ * @param cooldown cooldown length in ticks ++ * @deprecated Hopper minecarts don't have cooldowns anymore ++ */ ++ @Deprecated(forRemoval = true) ++ void setPickupCooldown(int cooldown); ++ // Paper end + } diff --git a/patches/api/0295-Adds-PlayerArmSwingEvent.patch b/patches/api/0295-Adds-PlayerArmSwingEvent.patch new file mode 100644 index 0000000000..48e43517eb --- /dev/null +++ b/patches/api/0295-Adds-PlayerArmSwingEvent.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 12 Mar 2021 19:20:03 -0800 +Subject: [PATCH] Adds PlayerArmSwingEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3e8cbd13eb16e0926130bb8b07e2101602b19565 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java +@@ -0,0 +1,29 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.player.PlayerAnimationEvent; ++import org.bukkit.event.player.PlayerAnimationType; ++import org.bukkit.inventory.EquipmentSlot; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++public class PlayerArmSwingEvent extends PlayerAnimationEvent { ++ ++ private final EquipmentSlot equipmentSlot; ++ ++ @ApiStatus.Internal ++ public PlayerArmSwingEvent(@NotNull Player player, @NotNull EquipmentSlot equipmentSlot) { ++ super(player, equipmentSlot == EquipmentSlot.HAND ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); ++ this.equipmentSlot = equipmentSlot; ++ } ++ ++ /** ++ * Returns the hand of the arm swing. ++ * ++ * @return the hand ++ */ ++ @NotNull ++ public EquipmentSlot getHand() { ++ return this.equipmentSlot; ++ } ++} +diff --git a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java +index eb722a1e3b987b86fae2fa8346606fa15fada26f..11c27b1a4a749e129ed4b2d906c315d97a4b66e7 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java +@@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull; + + /** + * Represents a player animation event ++ *
Use {@link io.papermc.paper.event.player.PlayerArmSwingEvent} for determining which arm was swung. + */ + public class PlayerAnimationEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0295-Missing-Entity-API.patch b/patches/api/0295-Missing-Entity-API.patch deleted file mode 100644 index 582dafaea4..0000000000 --- a/patches/api/0295-Missing-Entity-API.patch +++ /dev/null @@ -1,1448 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Fri, 28 May 2021 21:06:59 -0400 -Subject: [PATCH] Missing Entity API - -Co-authored-by: Nassim Jahnke -Co-authored-by: Jake Potrebic -Co-authored-by: William Blake Galbreath -Co-authored-by: SoSeDiK -Co-authored-by: booky10 -Co-authored-by: Amin -Co-authored-by: TrollyLoki -Co-authored-by: FireInstall -Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com> - -diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java -new file mode 100644 -index 0000000000000000000000000000000000000000..39ad7d283609d7e427a2ab35b6fad839e032fe92 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/SchoolableFish.java -@@ -0,0 +1,47 @@ -+package io.papermc.paper.entity; -+ -+import org.bukkit.entity.Fish; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Represents a fish that can school with other fish. -+ */ -+public interface SchoolableFish extends Fish { -+ -+ /** -+ * Forces this fish to follow the given fish. -+ * -+ * @param leader fish to follow -+ */ -+ void startFollowing(@NotNull SchoolableFish leader); -+ -+ /** -+ * Causes the fish to stop following their current -+ * leader. -+ */ -+ void stopFollowing(); -+ -+ /** -+ * Gets the amount of fish currently following this fish. -+ * -+ * @return school size -+ */ -+ int getSchoolSize(); -+ -+ /** -+ * Gets the maximum number of fish that will naturally follow this fish. -+ * -+ * @return max school size -+ */ -+ int getMaxSchoolSize(); -+ -+ /** -+ * Gets the fish that this entity is currently following. -+ * -+ * @return following fish -+ */ -+ @Nullable -+ SchoolableFish getSchoolLeader(); -+ -+} -diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java -index 0d88dce9978243a1f995c5fb448c5d71b01136eb..8b1048c94dffd058eb9fd9144f7f59fc9bd219ad 100644 ---- a/src/main/java/org/bukkit/entity/AbstractHorse.java -+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java -@@ -106,17 +106,71 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable { - * Gets whether the horse is currently grazing hay. - * - * @return true if eating hay -+ * @deprecated use {@link #isEatingGrass()}, this name is incorrect - */ -+ @Deprecated // Paper - Horse API - boolean isEatingHaystack(); - - /** - * Sets whether the horse is grazing hay. - * - * @param eatingHaystack new hay grazing status -+ * @deprecated use {@link #setEatingGrass(boolean)}, this name is incorrect - */ -+ @Deprecated // Paper - Horse API - void setEatingHaystack(boolean eatingHaystack); - - @NotNull - @Override - public AbstractHorseInventory getInventory(); -+ -+ // Paper start - Horse API -+ /** -+ * Gets if a horse is in their eating grass animation. -+ * -+ * @return eating grass animation is active -+ */ -+ public boolean isEatingGrass(); -+ -+ /** -+ * Sets if a horse is in their eating grass animation. -+ * -+ *

When true, the horse will lower its neck.

-+ * -+ * @param eating eating grass animation is active -+ */ -+ public void setEatingGrass(boolean eating); -+ -+ /** -+ * Gets if a horse is in their rearing animation. -+ * -+ * @return rearing animation is active -+ */ -+ public boolean isRearing(); -+ -+ /** -+ * Sets if a horse is in their rearing animation. -+ * -+ *

When true, the horse will stand on its hind legs.

-+ * -+ * @param rearing rearing animation is active -+ */ -+ public void setRearing(boolean rearing); -+ -+ /** -+ * Gets if a horse is in their eating animation. -+ * -+ * @return eating animation is active -+ */ -+ public boolean isEating(); -+ -+ /** -+ * Sets if a horse is in their eating animation. -+ * -+ *

When true, the horse will bob its head.

-+ * -+ * @param eating eating animation is active -+ */ -+ public void setEating(boolean eating); -+ // Paper end - Horse API - } -diff --git a/src/main/java/org/bukkit/entity/AreaEffectCloud.java b/src/main/java/org/bukkit/entity/AreaEffectCloud.java -index 3c65da551aca046986fc0302de3ccc149ee9526c..7f989f2025d16b368829c45f08b8cc8537c99e13 100644 ---- a/src/main/java/org/bukkit/entity/AreaEffectCloud.java -+++ b/src/main/java/org/bukkit/entity/AreaEffectCloud.java -@@ -239,4 +239,20 @@ public interface AreaEffectCloud extends Entity { - * @param source the {@link ProjectileSource} that threw the LingeringPotion - */ - public void setSource(@Nullable ProjectileSource source); -+ -+ // Paper start - owner API -+ /** -+ * Get the entity UUID for the owner of this area effect cloud. -+ * -+ * @return the entity owner uuid or null -+ */ -+ @Nullable java.util.UUID getOwnerUniqueId(); -+ -+ /** -+ * Sets the entity UUID for the owner of this area effect cloud. -+ * -+ * @param ownerUuid the entity owner uuid or null to clear -+ */ -+ void setOwnerUniqueId(@Nullable java.util.UUID ownerUuid); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Bat.java b/src/main/java/org/bukkit/entity/Bat.java -index bd73f22ef7e79e1ade69e860e7ae1d3dcd6fc858..b9f8b14d90a758672642222675d2f5664d4f67b4 100644 ---- a/src/main/java/org/bukkit/entity/Bat.java -+++ b/src/main/java/org/bukkit/entity/Bat.java -@@ -24,4 +24,23 @@ public interface Bat extends Ambient { - * @param state the new state - */ - void setAwake(boolean state); -+ -+ // Paper start -+ /** -+ * Gets the location that this bat is currently trying to move towards. -+ * -+ * @return target location, or null if it's going to find a new location -+ */ -+ @org.jetbrains.annotations.Nullable -+ org.bukkit.Location getTargetLocation(); -+ -+ /** -+ * Sets the location that this bat is currently trying to move towards. -+ *

-+ * This can be set to null to cause the bat to recalculate its target location -+ * -+ * @param location location to move towards (world is ignored, will always use the entity's world) -+ */ -+ void setTargetLocation(@org.jetbrains.annotations.Nullable org.bukkit.Location location); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Bee.java b/src/main/java/org/bukkit/entity/Bee.java -index adb20a9abba33c32d553f620fa82b27dff64ab5f..1f6702b0de00b87dbed7f6d93e911655e8667b0b 100644 ---- a/src/main/java/org/bukkit/entity/Bee.java -+++ b/src/main/java/org/bukkit/entity/Bee.java -@@ -93,4 +93,56 @@ public interface Bee extends Animals { - * @param ticks Ticks the bee cannot enter a hive for - */ - void setCannotEnterHiveTicks(int ticks); -+ -+ // Paper start -+ /** -+ * Sets the override for if the bee is currently rolling. -+ * -+ * @param rolling is rolling, or unset for vanilla behavior -+ */ -+ void setRollingOverride(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState rolling); -+ -+ /** -+ * Gets the plugin set override for if the bee is currently rolling. -+ * -+ * @return plugin set rolling override -+ */ -+ @org.jetbrains.annotations.NotNull -+ net.kyori.adventure.util.TriState getRollingOverride(); -+ -+ /** -+ * Gets if the bee is currently rolling. -+ * -+ * @return is rolling -+ */ -+ boolean isRolling(); -+ -+ /** -+ * Sets how many crops this bee has grown since it last -+ * pollinated. -+ * @param crops number of crops -+ */ -+ void setCropsGrownSincePollination(int crops); -+ -+ /** -+ * Gets how many crops this bee has grown since it last -+ * pollinated. -+ * @return number of crops -+ */ -+ int getCropsGrownSincePollination(); -+ -+ /** -+ * Sets how many ticks this bee has gone without pollinating. -+ * -+ * @param ticks number of ticks -+ */ -+ void setTicksSincePollination(int ticks); -+ -+ /** -+ * Gets how many ticks this bee has gone without pollinating -+ * -+ * @return number of ticks -+ */ -+ int getTicksSincePollination(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java -index d1327761a4b95eba97877f1991fc19b298b48eaf..0534fbc228f64cf3b361ab097d9b88212bdb0f36 100644 ---- a/src/main/java/org/bukkit/entity/Cat.java -+++ b/src/main/java/org/bukkit/entity/Cat.java -@@ -68,4 +68,36 @@ public interface Cat extends Tameable, Sittable { - return key; - } - } -+ -+ // Paper start - More cat api -+ /** -+ * Sets if the cat is lying down. -+ * This is visual and does not affect the behaviour of the cat. -+ * -+ * @param lyingDown whether the cat should lie down -+ */ -+ public void setLyingDown(boolean lyingDown); -+ -+ /** -+ * Gets if the cat is lying down. -+ * -+ * @return whether the cat is lying down -+ */ -+ public boolean isLyingDown(); -+ -+ /** -+ * Sets if the cat has its head up. -+ * This is visual and does not affect the behaviour of the cat. -+ * -+ * @param headUp head is up -+ */ -+ public void setHeadUp(boolean headUp); -+ -+ /** -+ * Gets if the cat has its head up. -+ * -+ * @return head is up -+ */ -+ public boolean isHeadUp(); -+ // Paper end - More cat api - } -diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java -index cb3ec6ef6c38c2071cb6ad91da094fca2de8d5c6..b4c1a262602d4ca5ffc9fcc21d6aa79af8c040a7 100644 ---- a/src/main/java/org/bukkit/entity/Chicken.java -+++ b/src/main/java/org/bukkit/entity/Chicken.java -@@ -3,4 +3,35 @@ package org.bukkit.entity; - /** - * Represents a Chicken. - */ --public interface Chicken extends Animals {} -+// Paper start -+public interface Chicken extends Animals { -+ -+ /** -+ * Gets if this chicken was spawned as a chicken jockey. -+ * -+ * @return is chicken jockey -+ */ -+ boolean isChickenJockey(); -+ -+ /** -+ * Sets if this chicken was spawned as a chicken jockey. -+ * -+ * @param isChickenJockey is chicken jockey -+ */ -+ void setIsChickenJockey(boolean isChickenJockey); -+ -+ /** -+ * Gets the number of ticks till this chicken lays an egg. -+ * -+ * @return ticks till the chicken lays an egg -+ */ -+ int getEggLayTime(); -+ -+ /** -+ * Sets the number of ticks till this chicken lays an egg. -+ * -+ * @param eggLayTime ticks till the chicken lays an egg -+ */ -+ void setEggLayTime(int eggLayTime); -+} -+// Paper end -diff --git a/src/main/java/org/bukkit/entity/Cod.java b/src/main/java/org/bukkit/entity/Cod.java -index 191ce6c0e32ab3d05b1376e0fa56d1292c2d442c..8de09075e14a08a6c68f9c24e8960cc04a018036 100644 ---- a/src/main/java/org/bukkit/entity/Cod.java -+++ b/src/main/java/org/bukkit/entity/Cod.java -@@ -4,4 +4,4 @@ package org.bukkit.entity; - /** - * Represents a cod fish. - */ --public interface Cod extends Fish { } -+public interface Cod extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API -diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java -index 58191017244f3949f6174fb108e3a245738a53c4..61672c6faf94aa497145aadd634bb10103c7b05a 100644 ---- a/src/main/java/org/bukkit/entity/Enderman.java -+++ b/src/main/java/org/bukkit/entity/Enderman.java -@@ -86,4 +86,36 @@ public interface Enderman extends Monster { - * @return true if the teleport succeeded. - */ - public boolean teleportTowards(@NotNull Entity entity); -+ -+ // Paper start -+ /** -+ * Returns whether the enderman is screaming/angry. -+ * -+ * @return whether the enderman is screaming -+ */ -+ boolean isScreaming(); -+ -+ /** -+ * Sets whether the enderman is screaming/angry. -+ * -+ * @param screaming whether the enderman is screaming -+ */ -+ void setScreaming(boolean screaming); -+ -+ /** -+ * Returns whether the enderman has been stared at. -+ * If set to true, players will hear an ambient sound. -+ * -+ * @return whether the enderman has been stared at -+ */ -+ boolean hasBeenStaredAt(); -+ -+ /** -+ * Sets whether the enderman has been stared at. -+ * If set to true, players will hear an ambient sound. -+ * -+ * @param hasBeenStaredAt whether the enderman has been stared at -+ */ -+ void setHasBeenStaredAt(boolean hasBeenStaredAt); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java -index 9e7f42caab1204036f4203354c115fd40c6def92..138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2 100644 ---- a/src/main/java/org/bukkit/entity/Endermite.java -+++ b/src/main/java/org/bukkit/entity/Endermite.java -@@ -23,4 +23,22 @@ public interface Endermite extends Monster { - */ - @Deprecated - void setPlayerSpawned(boolean playerSpawned); -+ // Paper start -+ /** -+ * Sets how many ticks this endermite has been living for. -+ * If this value is greater than 2400, this endermite will despawn. -+ * -+ * @param ticks lifetime ticks -+ */ -+ void setLifetimeTicks(int ticks); -+ -+ /** -+ * Gets how long this endermite has been living for. -+ * This value will tick up while {@link LivingEntity#getRemoveWhenFarAway()} is false. -+ * If this value is greater than 2400, this endermite will despawn. -+ * -+ * @return lifetime ticks -+ */ -+ int getLifetimeTicks(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index c7d6a328def83619dca9b6122aeb5870e4585e70..795e799fec7cfd65a0e08bb3f941148d85ff4c3b 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -289,6 +289,40 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - boolean isFrozen(); - -+ // Paper start - missing entity api -+ /** -+ * Sets whether the entity is invisible or not. -+ *

-+ * This setting is undefined for non-living entities like boats or paintings. -+ * Non-living entities that are marked as invisible through this method may e.g. only hide their shadow. -+ * To hide such entities from players completely, see {@link Player#hideEntity(org.bukkit.plugin.Plugin, Entity)}. -+ * -+ * @param invisible If the entity is invisible -+ */ -+ void setInvisible(boolean invisible); // Paper - moved up from LivingEntity -+ -+ /** -+ * Gets whether the entity is invisible or not. -+ * -+ * @return Whether the entity is invisible -+ */ -+ boolean isInvisible(); // Paper - moved up from LivingEntity -+ -+ /** -+ * Sets this entities no physics status. -+ * -+ * @param noPhysics boolean indicating if the entity should not have physics. -+ */ -+ void setNoPhysics(boolean noPhysics); -+ -+ /** -+ * Gets if this entity has no physics. -+ * -+ * @return true if the entity does not have physics. -+ */ -+ boolean hasNoPhysics(); -+ // Paper end - missing entity api -+ - /** - * Mark the entity's removal. - * -diff --git a/src/main/java/org/bukkit/entity/Fireball.java b/src/main/java/org/bukkit/entity/Fireball.java -index 7a44707f2307dc4dbfea4de3f4baf3cc0490dc93..d0e82102425e54274be9c4769634d754319d6196 100644 ---- a/src/main/java/org/bukkit/entity/Fireball.java -+++ b/src/main/java/org/bukkit/entity/Fireball.java -@@ -23,4 +23,32 @@ public interface Fireball extends Projectile, Explosive { - @NotNull - public Vector getDirection(); - -+ // Paper start - Expose power on fireball projectiles -+ /** -+ * {@inheritDoc} -+ *

-+ * Note: For fireball entities, their movement is also controlled by their power. -+ * -+ * @param velocity New velocity to travel with -+ * @see #setPower(Vector) -+ */ -+ @Override -+ public void setVelocity(@NotNull Vector velocity); -+ -+ /** -+ * Sets the power of a fireball. The power determines the direction and magnitude of its acceleration. -+ * -+ * @param power the power -+ */ -+ public void setPower(@NotNull Vector power); -+ -+ /** -+ * Gets the power of a fireball. The power determines the direction and magnitude of its acceleration. -+ * -+ * @return the power -+ */ -+ @NotNull -+ public Vector getPower(); -+ // Paper end - Expose power on fireball projectiles -+ - } -diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java -index c61a473453f33f9d10c330fc46cfa9d52251fe49..473a7e36ad64f866d1d2e09e2ecb2e9881668faf 100644 ---- a/src/main/java/org/bukkit/entity/Fox.java -+++ b/src/main/java/org/bukkit/entity/Fox.java -@@ -92,4 +92,55 @@ public interface Fox extends Animals, Sittable { - RED, - SNOW; - } -+ -+ // Paper start - Add more fox behavior API -+ /** -+ * Sets if the fox is interested. -+ * -+ * @param interested is interested -+ */ -+ public void setInterested(boolean interested); -+ -+ /** -+ * Gets if the fox is interested. -+ * -+ * @return fox is interested -+ */ -+ public boolean isInterested(); -+ -+ /** -+ * Sets if the fox is leaping. -+ * -+ * @param leaping is leaping -+ */ -+ public void setLeaping(boolean leaping); -+ -+ /** -+ * Gets if the fox is leaping. -+ * -+ * @return fox is leaping -+ */ -+ public boolean isLeaping(); -+ -+ /** -+ * Sets if the fox is defending. -+ * -+ * @param defending is defending -+ */ -+ public void setDefending(boolean defending); -+ -+ /** -+ * Gets if the fox is defending. -+ * -+ * @return fox is defending -+ */ -+ public boolean isDefending(); -+ -+ /** -+ * Sets if the fox face planted. -+ * -+ * @param faceplanted face planted -+ */ -+ public void setFaceplanted(boolean faceplanted); -+ // Paper end - Add more fox behavior API - } -diff --git a/src/main/java/org/bukkit/entity/Ghast.java b/src/main/java/org/bukkit/entity/Ghast.java -index 6b3c9bef9a8a34ddc6ff42cf358541a2665bf5e3..9c618a27d590f186f29c5d9094fc565efd40ca49 100644 ---- a/src/main/java/org/bukkit/entity/Ghast.java -+++ b/src/main/java/org/bukkit/entity/Ghast.java -@@ -18,4 +18,21 @@ public interface Ghast extends Flying, Enemy { - * @param flag Whether the Ghast is charging - */ - void setCharging(boolean flag); -+ -+ // Paper start -+ /** -+ * Returns the explosion power of shot fireballs. -+ * -+ * @return explosion power of shot fireballs -+ */ -+ int getExplosionPower(); -+ -+ /** -+ * Sets the explosion power of shot fireballs. -+ * -+ * @param explosionPower explosion power of shot fireballs -+ * @throws IllegalArgumentException if the explosion power is less than 0 or greater than 127 -+ */ -+ void setExplosionPower(int explosionPower); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 62a301f2f87b053bcfbf16c9870c3f740eb70022..ce5cf587ce44f2410c1d0bcf459b6309ec70bfee 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -994,6 +994,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * - * @param invisible If the entity is invisible - */ -+ @Override // Paper - move invisibility up to Entity - public void setInvisible(boolean invisible); - - /** -@@ -1001,6 +1002,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * - * @return Whether the entity is invisible - */ -+ @Override // Paper - move invisibility up to Entity - public boolean isInvisible(); - - // Paper start -@@ -1037,6 +1039,57 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - void setShieldBlockingDelay(int delay); - // Paper end - -+ // Paper start - missing entity API -+ /** -+ * Retrieves the sideways movement direction of the entity. -+ *

-+ * The returned value ranges from -1 to 1, where: -+ * - Positive 1 represents movement to the left. -+ * - Negative 1 represents movement to the right. -+ *

-+ * Please note that for entities of type {@link Player}, this value is updated only when riding another entity. -+ *

-+ * This method specifically provides information about the entity's sideways movement, whereas {@link #getVelocity()} returns -+ * a vector representing the entity's overall current momentum. -+ * -+ * @return Sideways movement direction, ranging from -1 (right) to 1 (left). -+ */ -+ float getSidewaysMovement(); -+ -+ /** -+ * Retrieves the upwards movement direction of the entity. -+ *

-+ * The returned value ranges from -1 to 1, where: -+ * - Positive 1 represents upward movement. -+ * - Negative 1 represents downward movement. -+ *

-+ * Please note that for entities of type {@link Player}, this value is never updated. -+ *

-+ * This method specifically provides information about the entity's vertical movement, -+ * whereas {@link #getVelocity()} returns a vector representing the entity's overall -+ * current momentum. -+ * -+ * @return Upwards movement direction, ranging from -1 (downward) to 1 (upward). -+ */ -+ float getUpwardsMovement(); -+ -+ /** -+ * Retrieves the forwards movement direction of the entity. -+ *

-+ * The returned value ranges from -1 to 1, where: -+ * - Positive 1 represents movement forwards. -+ * - Negative 1 represents movement backwards. -+ *

-+ * Please note that for entities of type {@link Player}, this value is updated only when riding another entity. -+ *

-+ * This method specifically provides information about the entity's forward and backward movement, -+ * whereas {@link #getVelocity()} returns a vector representing the entity's overall current momentum. -+ * -+ * @return Forwards movement direction, ranging from -1 (backward) to 1 (forward). -+ */ -+ float getForwardsMovement(); -+ // Paper end - missing entity API -+ - // Paper start - active item API - /** - * Starts using the item in the specified hand, making it the -diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java -index d23226ccb0f6c25028f000ce31346cd0a8898e6a..bc84b892cae5fe7019a3ad481e9da79956efa1fe 100644 ---- a/src/main/java/org/bukkit/entity/Llama.java -+++ b/src/main/java/org/bukkit/entity/Llama.java -@@ -67,4 +67,56 @@ public interface Llama extends ChestedHorse, RangedEntity { // Paper - @NotNull - @Override - LlamaInventory getInventory(); -+ -+ // Paper start -+ /** -+ * Checks if this llama is in a caravan. -+ * This means that this llama is currently following -+ * another llama. -+ * -+ * @return is in caravan -+ */ -+ boolean inCaravan(); -+ -+ /** -+ * Joins a caravan, with the provided llama being the leader -+ * of the caravan. -+ * This llama will then follow the provided llama. -+ * -+ * @param llama head of caravan to join -+ */ -+ void joinCaravan(@NotNull Llama llama); -+ -+ /** -+ * Leaves the current caravan that they are in. -+ */ -+ void leaveCaravan(); -+ -+ /** -+ * Get the llama that this llama is following. -+ *

-+ * Does not necessarily mean the leader of the entire caravan. -+ * -+ * @return the llama currently being followed -+ */ -+ @org.jetbrains.annotations.Nullable -+ Llama getCaravanHead(); -+ -+ /** -+ * Checks if another llama is currently following behind -+ * this llama. -+ * -+ * @return true if being followed in the caravan -+ */ -+ boolean hasCaravanTail(); -+ -+ /** -+ * Gets the llama that is currently following behind -+ * this llama. -+ * -+ * @return the llama following this llama, or null if none is following them -+ */ -+ @org.jetbrains.annotations.Nullable -+ Llama getCaravanTail(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 11b6d1aba7d1f6ae1f3c822193486f5a1478e105..709c8fc3dde786f45ff13d6ee6c405ffdc765282 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -162,4 +162,38 @@ public interface Mob extends LivingEntity, Lootable { - */ - @Nullable - public Sound getAmbientSound(); -+ -+ // Paper start -+ /** -+ * Some mobs will raise their arm(s) when aggressive: -+ *

    -+ *
  • {@link Drowned}
  • -+ *
  • {@link Piglin}
  • -+ *
  • {@link Skeleton}
  • -+ *
  • {@link Zombie}
  • -+ *
  • {@link ZombieVillager}
  • -+ *
  • {@link Illusioner}
  • -+ *
  • {@link Vindicator}
  • -+ *
  • {@link Panda}
  • -+ *
  • {@link Pillager}
  • -+ *
  • {@link PiglinBrute}
  • -+ *
-+ *

-+ * Note: This doesn't always show the actual aggressive state as -+ * set by {@link #setAggressive(boolean)}. {@link Panda}'s are always -+ * aggressive if their combined {@link Panda.Gene} is {@link Panda.Gene#AGGRESSIVE}. -+ * -+ * @return wether the mob is aggressive or not -+ */ -+ boolean isAggressive(); -+ -+ /** -+ * Some mobs will raise their arm(s) when aggressive, -+ * see {@link #isAggressive()} for full list. -+ * -+ * @param aggressive wether the mob should be aggressive or not -+ * @see #isAggressive() -+ */ -+ void setAggressive(boolean aggressive); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java -index 1f027927a1194f4f8e86c1375a2772e6e261c151..aa5686df134185334a74429576ff0709a604dbfd 100644 ---- a/src/main/java/org/bukkit/entity/Panda.java -+++ b/src/main/java/org/bukkit/entity/Panda.java -@@ -107,6 +107,98 @@ public interface Panda extends Animals, Sittable { - */ - int getUnhappyTicks(); - -+ // Paper start - Panda API -+ /** -+ * Sets the sneeze progress in this animation. -+ * This value counts up only if {@link Panda#isSneezing()} is true -+ * -+ * @param ticks sneeze progress -+ */ -+ void setSneezeTicks(int ticks); -+ -+ /** -+ * Gets the current sneeze progress, or how many ticks this panda will sneeze for. -+ * -+ * @return sneeze progress -+ */ -+ int getSneezeTicks(); -+ -+ /** -+ * Sets the eating ticks for this panda. -+ *

-+ * -+ * This starts counting up as long as it is greater than 0. -+ * -+ * @param ticks eating ticks -+ */ -+ void setEatingTicks(int ticks); -+ -+ /** -+ * Gets the current eating progress, or how many ticks this panda has been eating for. -+ * -+ * @return eating progress -+ */ -+ int getEatingTicks(); -+ -+ /** -+ * Sets the number of ticks this panda will be unhappy for. -+ *

-+ * This value counts down. -+ * -+ * @param ticks unhappy ticks -+ */ -+ void setUnhappyTicks(int ticks); -+ -+ /** -+ * Sets if this panda is currently on its back. -+ * -+ * @param onBack is on its back -+ * @deprecated use {@link #setOnBack(boolean)} -+ */ -+ @Deprecated(forRemoval = true) -+ default void setIsOnBack(boolean onBack) { -+ this.setOnBack(onBack); -+ } -+ -+ /** -+ * Sets if this panda is currently sitting. -+ * -+ * @param sitting is currently sitting -+ * @deprecated use {@link #setSitting(boolean)} -+ */ -+ @Deprecated(forRemoval = true) -+ default void setIsSitting(boolean sitting) { -+ this.setSitting(sitting); -+ } -+ -+ /** -+ * Sets if this panda is currently sitting. -+ * -+ * @param sitting is currently sitting -+ */ -+ @Override -+ void setSitting(boolean sitting); -+ -+ /** -+ * Gets if this panda is sitting. -+ * -+ * @return is sitting -+ */ -+ @Override -+ boolean isSitting(); -+ -+ /** -+ * Gets this Panda's combined gene. -+ *

-+ * The combined gene can be modified using -+ * {@link #setMainGene(Gene)} or {@link #setHiddenGene(Gene)}. -+ * -+ * @return combined gene -+ */ -+ @NotNull -+ Gene getCombinedGene(); -+ // Paper end - Panda API -+ - public enum Gene { - - NORMAL(false), -diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java -index 3dafdf14ced991ae1179ef1ca455da62f8c3243e..2fe8e8868f12bd9e846baf8858cd2c333c00a0d8 100644 ---- a/src/main/java/org/bukkit/entity/Phantom.java -+++ b/src/main/java/org/bukkit/entity/Phantom.java -@@ -40,5 +40,21 @@ public interface Phantom extends Flying, Enemy { - * @param shouldBurnInDay True to burn in sunlight - */ - public void setShouldBurnInDay(boolean shouldBurnInDay); -+ -+ /** -+ * Gets the location that this phantom circles around when not attacking a player -+ * This will be changed after attacking a player. -+ * -+ * @return circling location -+ */ -+ @org.jetbrains.annotations.NotNull -+ org.bukkit.Location getAnchorLocation(); -+ -+ /** -+ * Sets the location that this phantom circles around when not attacking a player -+ * -+ * @param location circling location (world is ignored, will always use the entity's world) -+ */ -+ void setAnchorLocation(@org.jetbrains.annotations.NotNull org.bukkit.Location location); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Piglin.java b/src/main/java/org/bukkit/entity/Piglin.java -index 6fdc0e0bb62189dbf3cf9ce7a87b7fbb995956a3..eb0b7c18c1266748ff1e8e18e49b6c4f6e078b83 100644 ---- a/src/main/java/org/bukkit/entity/Piglin.java -+++ b/src/main/java/org/bukkit/entity/Piglin.java -@@ -90,4 +90,47 @@ public interface Piglin extends PiglinAbstract, InventoryHolder, com.destroystok - */ - @NotNull - public Set getBarterList(); -+ -+ // Paper start -+ /** -+ * Causes the piglin to appear as if they are charging -+ * a crossbow. -+ *

-+ * This works with any item currently held in the piglin's hand. -+ * -+ * @param chargingCrossbow is charging -+ */ -+ void setChargingCrossbow(boolean chargingCrossbow); -+ -+ /** -+ * Gets if the piglin is currently charging the -+ * item in their hand. -+ * -+ * @return is charging -+ */ -+ boolean isChargingCrossbow(); -+ -+ /** -+ * Sets whether the Piglin is dancing or not -+ * -+ * @param dancing is dancing -+ */ -+ void setDancing(boolean dancing); -+ -+ /** -+ * Causes the piglin to dance for a -+ * specified amount of time -+ * -+ * @param duration duration of the dance in ticks -+ */ -+ void setDancing(long duration); -+ -+ /** -+ * Gets if the piglin is currently dancing -+ * -+ * @return is dancing -+ */ -+ boolean isDancing(); -+ // Paper end -+ - } -diff --git a/src/main/java/org/bukkit/entity/PolarBear.java b/src/main/java/org/bukkit/entity/PolarBear.java -index 479f7a7c54c85cb685f56e60906650d1989c03ff..4e526ba6aa462a484984fb9f0512b8db113086fe 100644 ---- a/src/main/java/org/bukkit/entity/PolarBear.java -+++ b/src/main/java/org/bukkit/entity/PolarBear.java -@@ -3,4 +3,22 @@ package org.bukkit.entity; - /** - * Represents a polar bear. - */ --public interface PolarBear extends Animals {} -+// Paper start -+public interface PolarBear extends Animals { -+ -+ /** -+ * Returns whether the polar bear is standing. -+ * -+ * @return whether the polar bear is standing -+ */ -+ boolean isStanding(); -+ -+ /** -+ * Sets whether the polar bear is standing. -+ * -+ * @param standing whether the polar bear should be standing -+ */ -+ void setStanding(boolean standing); -+ -+} -+// Paper end -diff --git a/src/main/java/org/bukkit/entity/Rabbit.java b/src/main/java/org/bukkit/entity/Rabbit.java -index e88154283a8ef594e160d25005870053de15568a..979062aa476e3bd75166458d8831894fba8778cd 100644 ---- a/src/main/java/org/bukkit/entity/Rabbit.java -+++ b/src/main/java/org/bukkit/entity/Rabbit.java -@@ -14,6 +14,23 @@ public interface Rabbit extends Animals { - * @param type Sets the type of rabbit for this entity. - */ - public void setRabbitType(@NotNull Type type); -+ // Paper start -+ /** -+ * Sets how many ticks this rabbit will wait -+ * until trying to find more carrots. -+ * -+ * @param ticks ticks -+ */ -+ void setMoreCarrotTicks(int ticks); -+ -+ /** -+ * Returns how many ticks this rabbit -+ * will wait until trying to find more carrots. -+ * -+ * @return ticks -+ */ -+ int getMoreCarrotTicks(); -+ // Paper end - - /** - * Represents the various types a Rabbit might be. -diff --git a/src/main/java/org/bukkit/entity/Ravager.java b/src/main/java/org/bukkit/entity/Ravager.java -index 4374d5206d4d15a4d8d228c137ed9a96821a1f02..0eb7214472f3a43641a3526000af6beeefb7b36f 100644 ---- a/src/main/java/org/bukkit/entity/Ravager.java -+++ b/src/main/java/org/bukkit/entity/Ravager.java -@@ -3,4 +3,61 @@ package org.bukkit.entity; - /** - * Illager beast. - */ --public interface Ravager extends Raider { } -+// Paper start - Missing Entity Behavior -+public interface Ravager extends Raider { -+ -+ /** -+ * Gets how many ticks this ravager is attacking for. -+ * When attacking, the ravager cannot move. -+ * -+ * @return ticks attacking or -1 if they are currently not attacking -+ */ -+ int getAttackTicks(); -+ -+ /** -+ * Sets how many ticks this ravager is attacking for. -+ * When attacking, the ravager cannot move. -+ * This will tick down till it gets to -1, where this ravager will no longer be attacking. -+ * -+ * @param ticks ticks attacking or -1 if they should no longer be attacking -+ */ -+ void setAttackTicks(int ticks); -+ -+ /** -+ * Gets how many ticks the ravager is stunned for. -+ * The ravager cannot move or attack while stunned. -+ * At 0, this will cause the ravager to roar. -+ * -+ * @return ticks stunned or -1 if they are currently not stunned -+ */ -+ int getStunnedTicks(); -+ -+ /** -+ * Sets how many ticks the ravager is stunned for. -+ * The ravager cannot move or attack while stunned. -+ * At 0, this will cause the ravager to roar. -+ * -+ * @param ticks ticks stunned or -1 if they should no longer be stunned -+ */ -+ void setStunnedTicks(int ticks); -+ -+ /** -+ * Gets how many ticks the ravager is roaring for. -+ * While roaring, the ravager cannot move -+ * -+ * @return ticks roaring or -1 if they are currently not roaring -+ */ -+ int getRoarTicks(); -+ -+ /** -+ * Sets how many ticks the ravager is roaring for. -+ * While roaring, the ravager cannot move -+ * This will tick down till it gets to -1, where it is no longer active. -+ * If set to 11, this will play a sound and hurt nearby players. -+ * -+ * @param ticks ticks roaring or -1 if they should no longer be roaring -+ */ -+ void setRoarTicks(int ticks); -+ -+} -+// Paper end -diff --git a/src/main/java/org/bukkit/entity/Salmon.java b/src/main/java/org/bukkit/entity/Salmon.java -index a52a7af219633d575dcbe8ac4b219834bfd4d4d2..1e839b247182af6873a4d74b236d6412817c18bf 100644 ---- a/src/main/java/org/bukkit/entity/Salmon.java -+++ b/src/main/java/org/bukkit/entity/Salmon.java -@@ -4,4 +4,4 @@ package org.bukkit.entity; - /** - * Represents a salmon fish. - */ --public interface Salmon extends Fish { } -+public interface Salmon extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API -diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java -index 0813bd913c8fdb2001963ce3e82c07c2af105418..87e717c9ea61b0cbf536bc62fa829ddcfae5ad8c 100644 ---- a/src/main/java/org/bukkit/entity/TNTPrimed.java -+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java -@@ -64,4 +64,26 @@ public interface TNTPrimed extends Explosive { - default org.bukkit.Location getSourceLoc() { - return this.getOrigin(); - } -+ -+ // Paper start -+ /** -+ * Sets the visual block data of this -+ * primed tnt. -+ *
-+ * The explosion of the tnt stays the -+ * same and is not affected by this change. -+ * -+ * @param data the visual block data -+ */ -+ void setBlockData(@org.jetbrains.annotations.NotNull org.bukkit.block.data.BlockData data); -+ -+ /** -+ * Gets the visual block data of this -+ * primed tnt. -+ * -+ * @return the visual block data -+ */ -+ @org.jetbrains.annotations.NotNull -+ org.bukkit.block.data.BlockData getBlockData(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Tadpole.java b/src/main/java/org/bukkit/entity/Tadpole.java -index d64979ebdd018f0f63b6115809b48374ba454249..8e097ad55d208a6980c320e2a849efdcc504cff1 100644 ---- a/src/main/java/org/bukkit/entity/Tadpole.java -+++ b/src/main/java/org/bukkit/entity/Tadpole.java -@@ -18,4 +18,21 @@ public interface Tadpole extends Fish { - * @param age New age - */ - public void setAge(int age); -+ -+ // Paper start - Tadpole age lock api -+ /** -+ * Lock the age of the animal, setting this will prevent the animal from -+ * maturing. -+ * -+ * @param lock new lock -+ */ -+ void setAgeLock(boolean lock); -+ -+ /** -+ * Gets the current agelock. -+ * -+ * @return the current agelock -+ */ -+ boolean getAgeLock(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java -index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7 100644 ---- a/src/main/java/org/bukkit/entity/Trident.java -+++ b/src/main/java/org/bukkit/entity/Trident.java -@@ -3,4 +3,40 @@ package org.bukkit.entity; - /** - * Represents a thrown trident. - */ --public interface Trident extends AbstractArrow, ThrowableProjectile { } -+// Paper start -+public interface Trident extends AbstractArrow, ThrowableProjectile { -+ -+ /** -+ * Returns whether the trident has an enchanted glow. -+ * This can be separate from the underlying item having any enchantments. -+ * -+ * @return whether the trident has an enchanted glow -+ */ -+ boolean hasGlint(); -+ -+ /** -+ * Sets whether the trident has an enchanted glow. -+ * This is separate from the underlying item having any enchantments. -+ * -+ * @param glint whether the trident should have an enchanted glow -+ */ -+ void setGlint(boolean glint); -+ -+ /** -+ * Returns the loyalty level of the trident. -+ * This can be separate from the underlying item's enchantments. -+ * -+ * @return loyalty level of the trident -+ */ -+ int getLoyaltyLevel(); -+ -+ /** -+ * Sets the loyalty level of the trident. -+ * This is separate from the underlying item's enchantments. -+ * -+ * @param loyaltyLevel loyalty level -+ * @throws IllegalArgumentException if the loyalty level is lower than 0 or greater than 127 -+ */ -+ void setLoyaltyLevel(int loyaltyLevel); -+} -+// Paper end -diff --git a/src/main/java/org/bukkit/entity/TropicalFish.java b/src/main/java/org/bukkit/entity/TropicalFish.java -index ab31289bb0f9c8e581537a88e1db22bcdbd3d484..84bba32e80d755f094975b667f1bf2a132087f4f 100644 ---- a/src/main/java/org/bukkit/entity/TropicalFish.java -+++ b/src/main/java/org/bukkit/entity/TropicalFish.java -@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Tropical fish. - */ --public interface TropicalFish extends Fish { -+public interface TropicalFish extends io.papermc.paper.entity.SchoolableFish { // Paper - Schooling Fish API - - /** - * Gets the color of the fish's pattern. -diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java -index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f400d6be6f 100644 ---- a/src/main/java/org/bukkit/entity/Vex.java -+++ b/src/main/java/org/bukkit/entity/Vex.java -@@ -57,21 +57,30 @@ public interface Vex extends Monster { - * Gets the remaining lifespan of this entity. - * - * @return life in ticks -+ * @deprecated This API duplicates existing API which uses the more -+ * preferable name due to mirroring internals better - */ -+ @Deprecated - int getLifeTicks(); - - /** - * Sets the remaining lifespan of this entity. - * - * @param lifeTicks life in ticks, or negative for unlimited lifepan -+ * @deprecated This API duplicates existing API which uses the more -+ * preferable name due to mirroring internals better - */ -+ @Deprecated - void setLifeTicks(int lifeTicks); - - /** - * Gets if the entity has a limited life. - * - * @return true if the entity has limited life -+ * @deprecated This API duplicates existing API which uses the more -+ * preferable name due to mirroring internals better - */ -+ @Deprecated - boolean hasLimitedLife(); - // Paper start - -@@ -89,5 +98,37 @@ public interface Vex extends Monster { - * @param summoner New summoner - */ - void setSummoner(@Nullable Mob summoner); -+ -+ /** -+ * Gets if this vex should start to take damage -+ * once {@link Vex#getLimitedLifetimeTicks()} is less than or equal to 0. -+ * -+ * @return will take damage -+ */ -+ boolean hasLimitedLifetime(); -+ -+ /** -+ * Sets if this vex should start to take damage -+ * once {@link Vex#getLimitedLifetimeTicks()} is less than or equal to 0. -+ * -+ * @param hasLimitedLifetime should take damage -+ */ -+ void setLimitedLifetime(boolean hasLimitedLifetime); -+ -+ /** -+ * Gets the number of ticks remaining until the vex will start -+ * to take damage. -+ * -+ * @return ticks until the vex will start to take damage -+ */ -+ int getLimitedLifetimeTicks(); -+ -+ /** -+ * Sets the number of ticks remaining until the vex takes damage. -+ * This number is ticked down only if {@link Vex#hasLimitedLifetime()} is true. -+ * -+ * @param ticks ticks remaining -+ */ -+ void setLimitedLifetimeTicks(int ticks); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java -index da76e1ed5406322073dd8c7a89ca55aa68620ac4..9f25774659b29d8fcca3eb9d9487edff42dbad13 100644 ---- a/src/main/java/org/bukkit/entity/WanderingTrader.java -+++ b/src/main/java/org/bukkit/entity/WanderingTrader.java -@@ -53,5 +53,26 @@ public interface WanderingTrader extends AbstractVillager { - * @return whether the mob will drink - */ - public boolean canDrinkMilk(); -+ -+ /** -+ * Gets the location that this wandering trader is currently -+ * wandering towards. -+ *

-+ * This will return null if the wandering trader has finished -+ * wandering towards the given location. -+ * -+ * @return the location currently wandering towards, or null if not wandering -+ */ -+ @org.jetbrains.annotations.Nullable -+ org.bukkit.Location getWanderingTowards(); -+ -+ /** -+ * Sets the location that this wandering trader is currently wandering towards. -+ *

-+ * This can be set to null to prevent the wandering trader from wandering further. -+ * -+ * @param location location to wander towards (world is ignored, will always use the entity's world) -+ */ -+ void setWanderingTowards(@org.jetbrains.annotations.Nullable org.bukkit.Location location); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java -index 3794db8867b53f3b3735ad82fdd8765a26df2bfb..efaa45f41bc1dc8df6665c55b4e5ade343d60d4c 100644 ---- a/src/main/java/org/bukkit/entity/Warden.java -+++ b/src/main/java/org/bukkit/entity/Warden.java -@@ -30,6 +30,18 @@ public interface Warden extends Monster { - */ - int getAnger(@NotNull Entity entity); - -+ // Paper start -+ /** -+ * Gets the highest anger level of this warden. -+ *

-+ * Anger is an integer from 0 to 150. Once a Warden reaches 80 anger at a -+ * target it will actively pursue it. -+ * -+ * @return highest anger level -+ */ -+ int getHighestAnger(); -+ // Paper end -+ - /** - * Increases the anger level of this warden. - * -diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java -index 87a814f63c3f35be35bfa210c9248ad211c0dd8f..14543c2238b45c526dd9aebea2aa5c22f5df54dc 100644 ---- a/src/main/java/org/bukkit/entity/Wither.java -+++ b/src/main/java/org/bukkit/entity/Wither.java -@@ -43,7 +43,9 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra - * Returns the wither's current invulnerability ticks. - * - * @return amount of invulnerability ticks -+ * @deprecated Duplicate api, use {@link #getInvulnerableTicks()} - */ -+ @Deprecated(forRemoval = true) // Paper - int getInvulnerabilityTicks(); - - /** -@@ -52,7 +54,9 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra - * When invulnerability ticks reach 0, the wither will trigger an explosion. - * - * @param ticks amount of invulnerability ticks -+ * @deprecated Duplicate api, use {@link #setInvulnerableTicks(int)} - */ -+ @Deprecated(forRemoval = true) // Paper - void setInvulnerabilityTicks(int ticks); - - /** -@@ -64,4 +68,43 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra - LEFT, - RIGHT - } -+ -+ // Paper start -+ /** -+ * @return whether the wither is charged -+ */ -+ boolean isCharged(); -+ -+ /** -+ * @return ticks the wither is invulnerable for -+ */ -+ int getInvulnerableTicks(); -+ -+ /** -+ * Sets for how long in the future, the wither should be invulnerable. -+ * -+ * @param ticks ticks the wither is invulnerable for -+ */ -+ void setInvulnerableTicks(int ticks); -+ -+ /** -+ * @return whether the wither can travel through portals -+ */ -+ boolean canTravelThroughPortals(); -+ -+ /** -+ * Sets whether the wither can travel through portals. -+ * -+ * @param value whether the wither can travel through portals -+ */ -+ void setCanTravelThroughPortals(boolean value); -+ -+ /** -+ * Makes the wither invulnerable for 11 seconds and -+ * sets the health to one third of the max health. -+ *
-+ * This is called in vanilla directly after spawning the wither. -+ */ -+ void enterInvulnerabilityPhase(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java -index 7cc1d9a966454af70b7c25735fe474fe3eb97eb4..ac6fd8ca95771c185c145f4589ddd5b2a6e8c2da 100644 ---- a/src/main/java/org/bukkit/entity/ZombieVillager.java -+++ b/src/main/java/org/bukkit/entity/ZombieVillager.java -@@ -90,4 +90,22 @@ public interface ZombieVillager extends Zombie { - * @param conversionPlayer the player - */ - void setConversionPlayer(@Nullable OfflinePlayer conversionPlayer); -+ -+ // Paper start - missing entity behaviour api - converting without entity event -+ /** -+ * Sets the amount of ticks until this entity will be converted to a -+ * Villager as a result of being cured. -+ *

-+ * When this reaches 0, the entity will be converted. A value of less than 0 -+ * will stop the current conversion process without converting the current -+ * entity. -+ * -+ * @param time new conversion time -+ * @param broadcastEntityEvent whether this conversion time mutation should broadcast the -+ * org.bukkit.{@link org.bukkit.EntityEffect#ZOMBIE_TRANSFORM} entity event to the -+ * world. If false, no entity event is published, preventing for example the -+ * org.bukkit.{@link org.bukkit.Sound#ENTITY_ZOMBIE_VILLAGER_CURE} from playing. -+ */ -+ void setConversionTime(int time, boolean broadcastEntityEvent); -+ // Paper end - missing entity behaviour api - converting without entity event - } -diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java -index db69687a7ad4b18d17ab1677cae5d8dd4dcd3678..304b05aeaea5febf493fc40d433a23acb384b4f0 100644 ---- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java -+++ b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java -@@ -24,4 +24,23 @@ public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntit - * @param enabled new enabled state - */ - void setEnabled(boolean enabled); -+ // Paper start -+ /** -+ * Gets the number of ticks that this hopper minecart cannot pickup items up for. -+ * -+ * @return ticks left on cooldown -+ * @deprecated Hopper minecarts don't have cooldowns anymore -+ */ -+ @Deprecated(forRemoval = true) -+ int getPickupCooldown(); -+ -+ /** -+ * Sets the number of ticks that this hopper minecart cannot pickup items for. -+ * -+ * @param cooldown cooldown length in ticks -+ * @deprecated Hopper minecarts don't have cooldowns anymore -+ */ -+ @Deprecated(forRemoval = true) -+ void setPickupCooldown(int cooldown); -+ // Paper end - } diff --git a/patches/api/0296-Add-PlayerSignCommandPreprocessEvent.patch b/patches/api/0296-Add-PlayerSignCommandPreprocessEvent.patch new file mode 100644 index 0000000000..8882c35337 --- /dev/null +++ b/patches/api/0296-Add-PlayerSignCommandPreprocessEvent.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 9 Jul 2021 17:44:33 -0700 +Subject: [PATCH] Add PlayerSignCommandPreprocessEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..dc774403749633a1bf8e8088b8c7b402b0e43863 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java +@@ -0,0 +1,47 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.block.Sign; ++import org.bukkit.block.sign.Side; ++import org.bukkit.entity.Player; ++import org.bukkit.event.player.PlayerCommandPreprocessEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Set; ++ ++/** ++ * Called when a {@link Player} clicks a side on a sign that causes a command to run. ++ *

++ * This command is run with elevated permissions which allows players to access commands on signs they wouldn't ++ * normally be able to run. ++ */ ++public class PlayerSignCommandPreprocessEvent extends PlayerCommandPreprocessEvent { ++ ++ private final Sign sign; ++ private final Side side; ++ ++ @ApiStatus.Internal ++ public PlayerSignCommandPreprocessEvent(@NotNull Player player, @NotNull String message, @NotNull Set recipients, @NotNull Sign sign, @NotNull Side side) { ++ super(player, message, recipients); ++ this.sign = sign; ++ this.side = side; ++ } ++ ++ /** ++ * Gets the sign that the command originated from. ++ * ++ * @return the sign ++ */ ++ public @NotNull Sign getSign() { ++ return this.sign; ++ } ++ ++ /** ++ * Gets the side of the sign that the command originated from. ++ * ++ * @return the sign side ++ */ ++ public @NotNull Side getSide() { ++ return this.side; ++ } ++} diff --git a/patches/api/0296-Adds-PlayerArmSwingEvent.patch b/patches/api/0296-Adds-PlayerArmSwingEvent.patch deleted file mode 100644 index 48e43517eb..0000000000 --- a/patches/api/0296-Adds-PlayerArmSwingEvent.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 12 Mar 2021 19:20:03 -0800 -Subject: [PATCH] Adds PlayerArmSwingEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3e8cbd13eb16e0926130bb8b07e2101602b19565 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerArmSwingEvent.java -@@ -0,0 +1,29 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.player.PlayerAnimationEvent; -+import org.bukkit.event.player.PlayerAnimationType; -+import org.bukkit.inventory.EquipmentSlot; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+public class PlayerArmSwingEvent extends PlayerAnimationEvent { -+ -+ private final EquipmentSlot equipmentSlot; -+ -+ @ApiStatus.Internal -+ public PlayerArmSwingEvent(@NotNull Player player, @NotNull EquipmentSlot equipmentSlot) { -+ super(player, equipmentSlot == EquipmentSlot.HAND ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); -+ this.equipmentSlot = equipmentSlot; -+ } -+ -+ /** -+ * Returns the hand of the arm swing. -+ * -+ * @return the hand -+ */ -+ @NotNull -+ public EquipmentSlot getHand() { -+ return this.equipmentSlot; -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java -index eb722a1e3b987b86fae2fa8346606fa15fada26f..11c27b1a4a749e129ed4b2d906c315d97a4b66e7 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerAnimationEvent.java -@@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull; - - /** - * Represents a player animation event -+ *
Use {@link io.papermc.paper.event.player.PlayerArmSwingEvent} for determining which arm was swung. - */ - public class PlayerAnimationEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0297-Add-PlayerSignCommandPreprocessEvent.patch b/patches/api/0297-Add-PlayerSignCommandPreprocessEvent.patch deleted file mode 100644 index 8882c35337..0000000000 --- a/patches/api/0297-Add-PlayerSignCommandPreprocessEvent.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 9 Jul 2021 17:44:33 -0700 -Subject: [PATCH] Add PlayerSignCommandPreprocessEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..dc774403749633a1bf8e8088b8c7b402b0e43863 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java -@@ -0,0 +1,47 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Sign; -+import org.bukkit.block.sign.Side; -+import org.bukkit.entity.Player; -+import org.bukkit.event.player.PlayerCommandPreprocessEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Set; -+ -+/** -+ * Called when a {@link Player} clicks a side on a sign that causes a command to run. -+ *

-+ * This command is run with elevated permissions which allows players to access commands on signs they wouldn't -+ * normally be able to run. -+ */ -+public class PlayerSignCommandPreprocessEvent extends PlayerCommandPreprocessEvent { -+ -+ private final Sign sign; -+ private final Side side; -+ -+ @ApiStatus.Internal -+ public PlayerSignCommandPreprocessEvent(@NotNull Player player, @NotNull String message, @NotNull Set recipients, @NotNull Sign sign, @NotNull Side side) { -+ super(player, message, recipients); -+ this.sign = sign; -+ this.side = side; -+ } -+ -+ /** -+ * Gets the sign that the command originated from. -+ * -+ * @return the sign -+ */ -+ public @NotNull Sign getSign() { -+ return this.sign; -+ } -+ -+ /** -+ * Gets the side of the sign that the command originated from. -+ * -+ * @return the sign side -+ */ -+ public @NotNull Side getSide() { -+ return this.side; -+ } -+} diff --git a/patches/api/0297-fix-empty-array-elements-in-command-arguments.patch b/patches/api/0297-fix-empty-array-elements-in-command-arguments.patch new file mode 100644 index 0000000000..4b66990211 --- /dev/null +++ b/patches/api/0297-fix-empty-array-elements-in-command-arguments.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Sat, 5 Jun 2021 10:29:39 +0200 +Subject: [PATCH] fix empty array elements in command arguments + +Adjacent spaces caused empty array elements due to how String#split works. +This change removes those empty array elements without modifying anything else. +Adjacent spaces sent by players are removed in PlayerConnection, so this change doesn't affect players. +But it does affect the console, command blocks, Bukkit.dispatchCommand, etc. + +diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java +index 1424060c0a162020d4a680e0a592224561067b16..ac9a28922f8a556944a4c3649d74c32c622f0cb0 100644 +--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java ++++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java +@@ -130,7 +130,7 @@ public class SimpleCommandMap implements CommandMap { + */ + @Override + public boolean dispatch(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException { +- String[] args = commandLine.split(" "); ++ String[] args = org.apache.commons.lang3.StringUtils.split(commandLine, ' '); // Paper - fix adjacent spaces (from console/plugins) causing empty array elements + + if (args.length == 0) { + return false; diff --git a/patches/api/0298-Stinger-API.patch b/patches/api/0298-Stinger-API.patch new file mode 100644 index 0000000000..e209e5da29 --- /dev/null +++ b/patches/api/0298-Stinger-API.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Tue, 22 Jun 2021 23:16:11 -0400 +Subject: [PATCH] Stinger API + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index ce5cf587ce44f2410c1d0bcf459b6309ec70bfee..f05883886928169600b6309dd12de3bdb633cca1 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -451,6 +451,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + int getNextArrowRemoval(); + // Paper end - Add methods for working with arrows stuck in living entities + ++ // Paper start - Bee Stinger API ++ /** ++ * Gets the time in ticks until the next bee stinger leaves the entity's body. ++ * ++ * @return ticks until bee stinger leaves ++ */ ++ public int getBeeStingerCooldown(); ++ ++ /** ++ * Sets the time in ticks until the next stinger leaves the entity's body. ++ * ++ * @param ticks time until bee stinger leaves ++ */ ++ public void setBeeStingerCooldown(int ticks); ++ ++ /** ++ * Gets the amount of bee stingers in an entity's body. ++ * ++ * @return amount of bee stingers in body ++ */ ++ public int getBeeStingersInBody(); ++ ++ /** ++ * Set the amount of bee stingers in the entity's body. ++ * ++ * @param count amount of bee stingers in entity's body ++ */ ++ public void setBeeStingersInBody(int count); ++ ++ /** ++ * Sets the amount of ticks before the next bee stinger gets removed from the entities body. ++ *

++ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick. ++ * ++ * @param ticks Amount of ticks ++ */ ++ void setNextBeeStingerRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks); ++ ++ /** ++ * Gets the amount of ticks before the next bee stinger gets removed from the entities body. ++ * ++ * @return ticks Amount of ticks ++ */ ++ int getNextBeeStingerRemoval(); ++ // Paper end - Stinger API ++ + /** + * Returns the living entity's current maximum no damage ticks. + *

diff --git a/patches/api/0298-fix-empty-array-elements-in-command-arguments.patch b/patches/api/0298-fix-empty-array-elements-in-command-arguments.patch deleted file mode 100644 index 4b66990211..0000000000 --- a/patches/api/0298-fix-empty-array-elements-in-command-arguments.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary -Date: Sat, 5 Jun 2021 10:29:39 +0200 -Subject: [PATCH] fix empty array elements in command arguments - -Adjacent spaces caused empty array elements due to how String#split works. -This change removes those empty array elements without modifying anything else. -Adjacent spaces sent by players are removed in PlayerConnection, so this change doesn't affect players. -But it does affect the console, command blocks, Bukkit.dispatchCommand, etc. - -diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 1424060c0a162020d4a680e0a592224561067b16..ac9a28922f8a556944a4c3649d74c32c622f0cb0 100644 ---- a/src/main/java/org/bukkit/command/SimpleCommandMap.java -+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -130,7 +130,7 @@ public class SimpleCommandMap implements CommandMap { - */ - @Override - public boolean dispatch(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException { -- String[] args = commandLine.split(" "); -+ String[] args = org.apache.commons.lang3.StringUtils.split(commandLine, ' '); // Paper - fix adjacent spaces (from console/plugins) causing empty array elements - - if (args.length == 0) { - return false; diff --git a/patches/api/0299-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/api/0299-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch new file mode 100644 index 0000000000..aefa20a2d9 --- /dev/null +++ b/patches/api/0299-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SirYwell +Date: Sat, 10 Jul 2021 11:11:43 +0200 +Subject: [PATCH] Rewrite LogEvents to contain the source jars in stack traces + + +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index 8c5597e02d71c8db66e9cd11f0a41776eb471c46..de017d10db19ca7ca7f73ff0ac08fe6e1773d7dc 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -56,7 +56,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm + + @org.jetbrains.annotations.ApiStatus.Internal // Paper + public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader, JarFile jarFile, io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext) throws IOException, InvalidPluginException, MalformedURLException { // Paper - use JarFile provided by SpigotPluginProvider +- super(new URL[] {file.toURI().toURL()}, parent); ++ super(file.getName(), new URL[] {file.toURI().toURL()}, parent); + this.loader = null; // Paper - pass null into loader field + + this.description = description; diff --git a/patches/api/0299-Stinger-API.patch b/patches/api/0299-Stinger-API.patch deleted file mode 100644 index e209e5da29..0000000000 --- a/patches/api/0299-Stinger-API.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Tue, 22 Jun 2021 23:16:11 -0400 -Subject: [PATCH] Stinger API - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index ce5cf587ce44f2410c1d0bcf459b6309ec70bfee..f05883886928169600b6309dd12de3bdb633cca1 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -451,6 +451,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - int getNextArrowRemoval(); - // Paper end - Add methods for working with arrows stuck in living entities - -+ // Paper start - Bee Stinger API -+ /** -+ * Gets the time in ticks until the next bee stinger leaves the entity's body. -+ * -+ * @return ticks until bee stinger leaves -+ */ -+ public int getBeeStingerCooldown(); -+ -+ /** -+ * Sets the time in ticks until the next stinger leaves the entity's body. -+ * -+ * @param ticks time until bee stinger leaves -+ */ -+ public void setBeeStingerCooldown(int ticks); -+ -+ /** -+ * Gets the amount of bee stingers in an entity's body. -+ * -+ * @return amount of bee stingers in body -+ */ -+ public int getBeeStingersInBody(); -+ -+ /** -+ * Set the amount of bee stingers in the entity's body. -+ * -+ * @param count amount of bee stingers in entity's body -+ */ -+ public void setBeeStingersInBody(int count); -+ -+ /** -+ * Sets the amount of ticks before the next bee stinger gets removed from the entities body. -+ *

-+ * A value of 0 will cause the server to re-calculate the amount of ticks on the next tick. -+ * -+ * @param ticks Amount of ticks -+ */ -+ void setNextBeeStingerRemoval(@org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE) int ticks); -+ -+ /** -+ * Gets the amount of ticks before the next bee stinger gets removed from the entities body. -+ * -+ * @return ticks Amount of ticks -+ */ -+ int getNextBeeStingerRemoval(); -+ // Paper end - Stinger API -+ - /** - * Returns the living entity's current maximum no damage ticks. - *

diff --git a/patches/api/0300-Add-PlayerSetSpawnEvent.patch b/patches/api/0300-Add-PlayerSetSpawnEvent.patch new file mode 100644 index 0000000000..42bce4d456 --- /dev/null +++ b/patches/api/0300-Add-PlayerSetSpawnEvent.patch @@ -0,0 +1,205 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 19 May 2021 18:58:24 -0700 +Subject: [PATCH] Add PlayerSetSpawnEvent + + +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c15525acce +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java +@@ -0,0 +1,178 @@ ++package com.destroystokyo.paper.event.player; ++ ++import net.kyori.adventure.text.Component; ++import org.bukkit.Location; ++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.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when a player's spawn is set, either by themselves or otherwise. ++ *
++ * Cancelling this event will prevent the spawn from being set. ++ */ ++public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Cause cause; ++ private Location location; ++ private boolean forced; ++ private boolean notifyPlayer; ++ private Component notification; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerSetSpawnEvent(@NotNull Player player, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) { ++ super(player); ++ this.cause = cause; ++ this.location = location; ++ this.forced = forced; ++ this.notifyPlayer = notifyPlayer; ++ this.notification = notification; ++ } ++ ++ /** ++ * Gets the cause of this event. ++ * ++ * @return the cause ++ */ ++ @NotNull ++ public Cause getCause() { ++ return this.cause; ++ } ++ ++ /** ++ * Gets the location that the spawn is set to. The yaw ++ * of this location is the spawn angle. Mutating this location ++ * will change the resulting spawn point of the player. Use ++ * {@link Location#clone()} to get a copy of this location. ++ * ++ * @return the spawn location, or {@code null} if removing the location ++ */ ++ @Nullable ++ public Location getLocation() { ++ return this.location; ++ } ++ ++ /** ++ * Sets the location to be set as the spawn location. The yaw ++ * of this location is the spawn angle. ++ * ++ * @param location the spawn location, or {@code null} to remove the spawn location ++ */ ++ public void setLocation(@Nullable Location location) { ++ this.location = location; ++ } ++ ++ /** ++ * Gets if this is a force spawn location ++ * ++ * @return {@code true} if forced ++ */ ++ public boolean isForced() { ++ return this.forced; ++ } ++ ++ /** ++ * Sets if this is a forced spawn location ++ * ++ * @param forced {@code true} to force ++ */ ++ public void setForced(boolean forced) { ++ this.forced = forced; ++ } ++ ++ /** ++ * Gets if this action will notify the player their spawn ++ * has been set. ++ * ++ * @return {@code true} to notify ++ */ ++ public boolean willNotifyPlayer() { ++ return this.notifyPlayer; ++ } ++ ++ /** ++ * Sets if this action will notify the player that their spawn ++ * has been set. ++ * ++ * @param notifyPlayer {@code true} to notify ++ */ ++ public void setNotifyPlayer(boolean notifyPlayer) { ++ this.notifyPlayer = notifyPlayer; ++ } ++ ++ /** ++ * Gets the notification message that will be sent to the player ++ * if {@link #willNotifyPlayer()} returns true. ++ * ++ * @return {@code null} if no notification ++ */ ++ @Nullable ++ public Component getNotification() { ++ return this.notification; ++ } ++ ++ /** ++ * Sets the notification message that will be sent to the player. ++ * ++ * @param notification {@code null} to send no message ++ */ ++ public void setNotification(@Nullable Component notification) { ++ this.notification = notification; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ public enum Cause { ++ /** ++ * When a player interacts successfully with a bed. ++ */ ++ BED, ++ /** ++ * When a player interacts successfully with a respawn anchor. ++ */ ++ RESPAWN_ANCHOR, ++ /** ++ * When a player respawns. ++ */ ++ PLAYER_RESPAWN, ++ /** ++ * When the {@code /spawnpoint} command is used on a player. ++ */ ++ COMMAND, ++ /** ++ * When a plugin uses {@link Player#setRespawnLocation(Location)} or ++ * {@link Player#setRespawnLocation(Location, boolean)}. ++ */ ++ PLUGIN, ++ /** ++ * Fallback cause. ++ */ ++ UNKNOWN, ++ } ++} +diff --git a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java +index c2884bc20f0040b15dc035f4761d021e7343960d..3ea03540ce2882bbb482d9bd69a015a7fc040bfd 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java +@@ -12,8 +12,10 @@ import org.jetbrains.annotations.Nullable; + /** + * This event is fired when the spawn point of the player is changed. + * @apiNote draft API ++ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerSetSpawnEvent} + */ + @ApiStatus.Experimental ++@Deprecated(forRemoval = true) // Paper + public class PlayerSpawnChangeEvent extends PlayerEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0300-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/api/0300-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch deleted file mode 100644 index aefa20a2d9..0000000000 --- a/patches/api/0300-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SirYwell -Date: Sat, 10 Jul 2021 11:11:43 +0200 -Subject: [PATCH] Rewrite LogEvents to contain the source jars in stack traces - - -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 8c5597e02d71c8db66e9cd11f0a41776eb471c46..de017d10db19ca7ca7f73ff0ac08fe6e1773d7dc 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -56,7 +56,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm - - @org.jetbrains.annotations.ApiStatus.Internal // Paper - public PluginClassLoader(@Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader, JarFile jarFile, io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext) throws IOException, InvalidPluginException, MalformedURLException { // Paper - use JarFile provided by SpigotPluginProvider -- super(new URL[] {file.toURI().toURL()}, parent); -+ super(file.getName(), new URL[] {file.toURI().toURL()}, parent); - this.loader = null; // Paper - pass null into loader field - - this.description = description; diff --git a/patches/api/0301-Add-PlayerSetSpawnEvent.patch b/patches/api/0301-Add-PlayerSetSpawnEvent.patch deleted file mode 100644 index 42bce4d456..0000000000 --- a/patches/api/0301-Add-PlayerSetSpawnEvent.patch +++ /dev/null @@ -1,205 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 19 May 2021 18:58:24 -0700 -Subject: [PATCH] Add PlayerSetSpawnEvent - - -diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6a823008deaf26f751e598bc967f19c15525acce ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java -@@ -0,0 +1,178 @@ -+package com.destroystokyo.paper.event.player; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.Location; -+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.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when a player's spawn is set, either by themselves or otherwise. -+ *
-+ * Cancelling this event will prevent the spawn from being set. -+ */ -+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Cause cause; -+ private Location location; -+ private boolean forced; -+ private boolean notifyPlayer; -+ private Component notification; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerSetSpawnEvent(@NotNull Player player, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) { -+ super(player); -+ this.cause = cause; -+ this.location = location; -+ this.forced = forced; -+ this.notifyPlayer = notifyPlayer; -+ this.notification = notification; -+ } -+ -+ /** -+ * Gets the cause of this event. -+ * -+ * @return the cause -+ */ -+ @NotNull -+ public Cause getCause() { -+ return this.cause; -+ } -+ -+ /** -+ * Gets the location that the spawn is set to. The yaw -+ * of this location is the spawn angle. Mutating this location -+ * will change the resulting spawn point of the player. Use -+ * {@link Location#clone()} to get a copy of this location. -+ * -+ * @return the spawn location, or {@code null} if removing the location -+ */ -+ @Nullable -+ public Location getLocation() { -+ return this.location; -+ } -+ -+ /** -+ * Sets the location to be set as the spawn location. The yaw -+ * of this location is the spawn angle. -+ * -+ * @param location the spawn location, or {@code null} to remove the spawn location -+ */ -+ public void setLocation(@Nullable Location location) { -+ this.location = location; -+ } -+ -+ /** -+ * Gets if this is a force spawn location -+ * -+ * @return {@code true} if forced -+ */ -+ public boolean isForced() { -+ return this.forced; -+ } -+ -+ /** -+ * Sets if this is a forced spawn location -+ * -+ * @param forced {@code true} to force -+ */ -+ public void setForced(boolean forced) { -+ this.forced = forced; -+ } -+ -+ /** -+ * Gets if this action will notify the player their spawn -+ * has been set. -+ * -+ * @return {@code true} to notify -+ */ -+ public boolean willNotifyPlayer() { -+ return this.notifyPlayer; -+ } -+ -+ /** -+ * Sets if this action will notify the player that their spawn -+ * has been set. -+ * -+ * @param notifyPlayer {@code true} to notify -+ */ -+ public void setNotifyPlayer(boolean notifyPlayer) { -+ this.notifyPlayer = notifyPlayer; -+ } -+ -+ /** -+ * Gets the notification message that will be sent to the player -+ * if {@link #willNotifyPlayer()} returns true. -+ * -+ * @return {@code null} if no notification -+ */ -+ @Nullable -+ public Component getNotification() { -+ return this.notification; -+ } -+ -+ /** -+ * Sets the notification message that will be sent to the player. -+ * -+ * @param notification {@code null} to send no message -+ */ -+ public void setNotification(@Nullable Component notification) { -+ this.notification = notification; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum Cause { -+ /** -+ * When a player interacts successfully with a bed. -+ */ -+ BED, -+ /** -+ * When a player interacts successfully with a respawn anchor. -+ */ -+ RESPAWN_ANCHOR, -+ /** -+ * When a player respawns. -+ */ -+ PLAYER_RESPAWN, -+ /** -+ * When the {@code /spawnpoint} command is used on a player. -+ */ -+ COMMAND, -+ /** -+ * When a plugin uses {@link Player#setRespawnLocation(Location)} or -+ * {@link Player#setRespawnLocation(Location, boolean)}. -+ */ -+ PLUGIN, -+ /** -+ * Fallback cause. -+ */ -+ UNKNOWN, -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java -index c2884bc20f0040b15dc035f4761d021e7343960d..3ea03540ce2882bbb482d9bd69a015a7fc040bfd 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java -@@ -12,8 +12,10 @@ import org.jetbrains.annotations.Nullable; - /** - * This event is fired when the spawn point of the player is changed. - * @apiNote draft API -+ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerSetSpawnEvent} - */ - @ApiStatus.Experimental -+@Deprecated(forRemoval = true) // Paper - public class PlayerSpawnChangeEvent extends PlayerEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0301-Added-EntityDamageItemEvent.patch b/patches/api/0301-Added-EntityDamageItemEvent.patch new file mode 100644 index 0000000000..60513a1cbd --- /dev/null +++ b/patches/api/0301-Added-EntityDamageItemEvent.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 22 Dec 2020 13:51:06 -0800 +Subject: [PATCH] Added EntityDamageItemEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..72ac972dea684a3ffac3bd48726746be0620af2e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java +@@ -0,0 +1,81 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when an item on or used by an entity takes durability damage as a result of being hit/used. ++ *

++ * NOTE: default vanilla behaviour dictates that armor/tools picked up by ++ * mobs do not take damage (except via Thorns). ++ */ ++public class EntityDamageItemEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final ItemStack item; ++ private int damage; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityDamageItemEvent(@NotNull Entity entity, @NotNull ItemStack item, int damage) { ++ super(entity); ++ this.item = item; ++ this.damage = damage; ++ } ++ ++ /** ++ * Gets the item being damaged. ++ * ++ * @return the item ++ */ ++ @NotNull ++ public ItemStack getItem() { ++ return this.item; ++ } ++ ++ /** ++ * Gets the amount of durability damage this item will be taking. ++ * ++ * @return durability change ++ */ ++ public int getDamage() { ++ return this.damage; ++ } ++ ++ /** ++ * Sets the amount of durability damage this item will be taking. ++ * ++ * @param damage the damage amount to cause ++ */ ++ public void setDamage(int damage) { ++ this.damage = damage; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0302-Added-EntityDamageItemEvent.patch b/patches/api/0302-Added-EntityDamageItemEvent.patch deleted file mode 100644 index 60513a1cbd..0000000000 --- a/patches/api/0302-Added-EntityDamageItemEvent.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 22 Dec 2020 13:51:06 -0800 -Subject: [PATCH] Added EntityDamageItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..72ac972dea684a3ffac3bd48726746be0620af2e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java -@@ -0,0 +1,81 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when an item on or used by an entity takes durability damage as a result of being hit/used. -+ *

-+ * NOTE: default vanilla behaviour dictates that armor/tools picked up by -+ * mobs do not take damage (except via Thorns). -+ */ -+public class EntityDamageItemEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack item; -+ private int damage; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityDamageItemEvent(@NotNull Entity entity, @NotNull ItemStack item, int damage) { -+ super(entity); -+ this.item = item; -+ this.damage = damage; -+ } -+ -+ /** -+ * Gets the item being damaged. -+ * -+ * @return the item -+ */ -+ @NotNull -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets the amount of durability damage this item will be taking. -+ * -+ * @return durability change -+ */ -+ public int getDamage() { -+ return this.damage; -+ } -+ -+ /** -+ * Sets the amount of durability damage this item will be taking. -+ * -+ * @param damage the damage amount to cause -+ */ -+ public void setDamage(int damage) { -+ this.damage = damage; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0302-Make-EntityUnleashEvent-cancellable.patch b/patches/api/0302-Make-EntityUnleashEvent-cancellable.patch new file mode 100644 index 0000000000..e99584c277 --- /dev/null +++ b/patches/api/0302-Make-EntityUnleashEvent-cancellable.patch @@ -0,0 +1,49 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 3 Jan 2021 21:25:39 -0800 +Subject: [PATCH] Make EntityUnleashEvent cancellable + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java +index e0e068799a1868c8e561869015f41f553ef4fbdb..95248d0f5cf9b62d31a4883955b9088a7fc8a3b3 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java +@@ -6,11 +6,20 @@ import org.jetbrains.annotations.NotNull; + + /** + * Called immediately prior to an entity being unleashed. ++ *

++ * Cancelling this event when either: ++ *

    ++ *
  • the leashed entity dies,
  • ++ *
  • the entity changes dimension, or
  • ++ *
  • the client has disconnected the leash
  • ++ *
++ * will have no effect. + */ +-public class EntityUnleashEvent extends EntityEvent { ++public class EntityUnleashEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper + private static final HandlerList handlers = new HandlerList(); + private final UnleashReason reason; + private boolean dropLeash; // Paper ++ private boolean cancelled; // Paper + + // Paper start - drop leash variable + @Deprecated +@@ -53,6 +62,16 @@ public class EntityUnleashEvent extends EntityEvent { + public void setDropLeash(boolean dropLeash) { + this.dropLeash = dropLeash; + } ++ ++ @Override ++ public boolean isCancelled() { ++ return cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } + // Paper end + + @NotNull diff --git a/patches/api/0303-Change-EnderEye-target-without-changing-other-things.patch b/patches/api/0303-Change-EnderEye-target-without-changing-other-things.patch new file mode 100644 index 0000000000..d8e53593ae --- /dev/null +++ b/patches/api/0303-Change-EnderEye-target-without-changing-other-things.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 21 Aug 2021 12:14:00 -0700 +Subject: [PATCH] Change EnderEye target without changing other things + + +diff --git a/src/main/java/org/bukkit/entity/EnderSignal.java b/src/main/java/org/bukkit/entity/EnderSignal.java +index 1bba155d80621852acd187e181423afc577899ea..c8c74651e1b434e5a0fce6d9e8d01754b2d7287a 100644 +--- a/src/main/java/org/bukkit/entity/EnderSignal.java ++++ b/src/main/java/org/bukkit/entity/EnderSignal.java +@@ -28,6 +28,17 @@ public interface EnderSignal extends Entity { + */ + public void setTargetLocation(@NotNull Location location); + ++ // Paper start ++ /** ++ * Set the {@link Location} this EnderSignal is moving towards. ++ * ++ * @param location the new target location ++ * @param update true to reset the {@link #getDropItem()} ++ * to a random value and {@link #getDespawnTimer()} to 0 ++ */ ++ public void setTargetLocation(@NotNull Location location, boolean update); ++ // Paper end ++ + /** + * Gets if the EnderSignal should drop an item on death.
+ * If {@code true}, it will drop an item. If {@code false}, it will shatter. diff --git a/patches/api/0303-Make-EntityUnleashEvent-cancellable.patch b/patches/api/0303-Make-EntityUnleashEvent-cancellable.patch deleted file mode 100644 index e99584c277..0000000000 --- a/patches/api/0303-Make-EntityUnleashEvent-cancellable.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 3 Jan 2021 21:25:39 -0800 -Subject: [PATCH] Make EntityUnleashEvent cancellable - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -index e0e068799a1868c8e561869015f41f553ef4fbdb..95248d0f5cf9b62d31a4883955b9088a7fc8a3b3 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java -@@ -6,11 +6,20 @@ import org.jetbrains.annotations.NotNull; - - /** - * Called immediately prior to an entity being unleashed. -+ *

-+ * Cancelling this event when either: -+ *

    -+ *
  • the leashed entity dies,
  • -+ *
  • the entity changes dimension, or
  • -+ *
  • the client has disconnected the leash
  • -+ *
-+ * will have no effect. - */ --public class EntityUnleashEvent extends EntityEvent { -+public class EntityUnleashEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper - private static final HandlerList handlers = new HandlerList(); - private final UnleashReason reason; - private boolean dropLeash; // Paper -+ private boolean cancelled; // Paper - - // Paper start - drop leash variable - @Deprecated -@@ -53,6 +62,16 @@ public class EntityUnleashEvent extends EntityEvent { - public void setDropLeash(boolean dropLeash) { - this.dropLeash = dropLeash; - } -+ -+ @Override -+ public boolean isCancelled() { -+ return cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } - // Paper end - - @NotNull diff --git a/patches/api/0304-Add-BlockBreakBlockEvent.patch b/patches/api/0304-Add-BlockBreakBlockEvent.patch new file mode 100644 index 0000000000..dd02c33432 --- /dev/null +++ b/patches/api/0304-Add-BlockBreakBlockEvent.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 3 Jan 2021 17:58:25 -0800 +Subject: [PATCH] Add BlockBreakBlockEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4f7535daf0d9967fadb0c6f8afbd3993eace410d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java +@@ -0,0 +1,61 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockExpEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.List; ++ ++/** ++ * Called when a block forces another block to break and drop items. ++ *

++ * Currently called for piston's and liquid flows. ++ */ ++public class BlockBreakBlockEvent extends BlockExpEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Block source; ++ private final List drops; ++ ++ @ApiStatus.Internal ++ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List drops) { ++ super(block, 0); ++ this.source = source; ++ this.drops = drops; ++ } ++ ++ /** ++ * Gets the drops of this event ++ * ++ * @return the drops ++ */ ++ @NotNull ++ public List getDrops() { ++ return this.drops; ++ } ++ ++ /** ++ * Gets the block that cause this (e.g. a piston, or adjacent liquid) ++ * ++ * @return the source ++ */ ++ @NotNull ++ public Block getSource() { ++ return this.source; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0304-Change-EnderEye-target-without-changing-other-things.patch b/patches/api/0304-Change-EnderEye-target-without-changing-other-things.patch deleted file mode 100644 index d8e53593ae..0000000000 --- a/patches/api/0304-Change-EnderEye-target-without-changing-other-things.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 21 Aug 2021 12:14:00 -0700 -Subject: [PATCH] Change EnderEye target without changing other things - - -diff --git a/src/main/java/org/bukkit/entity/EnderSignal.java b/src/main/java/org/bukkit/entity/EnderSignal.java -index 1bba155d80621852acd187e181423afc577899ea..c8c74651e1b434e5a0fce6d9e8d01754b2d7287a 100644 ---- a/src/main/java/org/bukkit/entity/EnderSignal.java -+++ b/src/main/java/org/bukkit/entity/EnderSignal.java -@@ -28,6 +28,17 @@ public interface EnderSignal extends Entity { - */ - public void setTargetLocation(@NotNull Location location); - -+ // Paper start -+ /** -+ * Set the {@link Location} this EnderSignal is moving towards. -+ * -+ * @param location the new target location -+ * @param update true to reset the {@link #getDropItem()} -+ * to a random value and {@link #getDespawnTimer()} to 0 -+ */ -+ public void setTargetLocation(@NotNull Location location, boolean update); -+ // Paper end -+ - /** - * Gets if the EnderSignal should drop an item on death.
- * If {@code true}, it will drop an item. If {@code false}, it will shatter. diff --git a/patches/api/0305-Add-BlockBreakBlockEvent.patch b/patches/api/0305-Add-BlockBreakBlockEvent.patch deleted file mode 100644 index dd02c33432..0000000000 --- a/patches/api/0305-Add-BlockBreakBlockEvent.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 3 Jan 2021 17:58:25 -0800 -Subject: [PATCH] Add BlockBreakBlockEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..4f7535daf0d9967fadb0c6f8afbd3993eace410d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java -@@ -0,0 +1,61 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockExpEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.List; -+ -+/** -+ * Called when a block forces another block to break and drop items. -+ *

-+ * Currently called for piston's and liquid flows. -+ */ -+public class BlockBreakBlockEvent extends BlockExpEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Block source; -+ private final List drops; -+ -+ @ApiStatus.Internal -+ public BlockBreakBlockEvent(@NotNull Block block, @NotNull Block source, @NotNull List drops) { -+ super(block, 0); -+ this.source = source; -+ this.drops = drops; -+ } -+ -+ /** -+ * Gets the drops of this event -+ * -+ * @return the drops -+ */ -+ @NotNull -+ public List getDrops() { -+ return this.drops; -+ } -+ -+ /** -+ * Gets the block that cause this (e.g. a piston, or adjacent liquid) -+ * -+ * @return the source -+ */ -+ @NotNull -+ public Block getSource() { -+ return this.source; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0305-Add-helpers-for-left-right-click-to-Action.patch b/patches/api/0305-Add-helpers-for-left-right-click-to-Action.patch new file mode 100644 index 0000000000..9dac2fe612 --- /dev/null +++ b/patches/api/0305-Add-helpers-for-left-right-click-to-Action.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Madeline Miller +Date: Sun, 29 Aug 2021 17:00:56 +1000 +Subject: [PATCH] Add helpers for left/right click to Action + + +diff --git a/src/main/java/org/bukkit/event/block/Action.java b/src/main/java/org/bukkit/event/block/Action.java +index 25d26e3fe713311e66d7e634a6c32af61f4cef59..f0b672bbfcd0eb17f3953ffcd0e728f5b3ec909b 100644 +--- a/src/main/java/org/bukkit/event/block/Action.java ++++ b/src/main/java/org/bukkit/event/block/Action.java +@@ -29,5 +29,25 @@ public enum Action { + *

  • Triggering tripwire + * + */ +- PHYSICAL, ++ // Paper start ++ PHYSICAL; ++ ++ /** ++ * Gets whether this action is a result of a left click. ++ * ++ * @return Whether it's a left click ++ */ ++ public boolean isLeftClick() { ++ return this == LEFT_CLICK_AIR || this == LEFT_CLICK_BLOCK; ++ } ++ ++ /** ++ * Gets whether this action is a result of a right click. ++ * ++ * @return Whether it's a right click ++ */ ++ public boolean isRightClick() { ++ return this == RIGHT_CLICK_AIR || this == RIGHT_CLICK_BLOCK; ++ } ++ // Paper end + } diff --git a/patches/api/0306-Add-helpers-for-left-right-click-to-Action.patch b/patches/api/0306-Add-helpers-for-left-right-click-to-Action.patch deleted file mode 100644 index 9dac2fe612..0000000000 --- a/patches/api/0306-Add-helpers-for-left-right-click-to-Action.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Madeline Miller -Date: Sun, 29 Aug 2021 17:00:56 +1000 -Subject: [PATCH] Add helpers for left/right click to Action - - -diff --git a/src/main/java/org/bukkit/event/block/Action.java b/src/main/java/org/bukkit/event/block/Action.java -index 25d26e3fe713311e66d7e634a6c32af61f4cef59..f0b672bbfcd0eb17f3953ffcd0e728f5b3ec909b 100644 ---- a/src/main/java/org/bukkit/event/block/Action.java -+++ b/src/main/java/org/bukkit/event/block/Action.java -@@ -29,5 +29,25 @@ public enum Action { - *
  • Triggering tripwire - * - */ -- PHYSICAL, -+ // Paper start -+ PHYSICAL; -+ -+ /** -+ * Gets whether this action is a result of a left click. -+ * -+ * @return Whether it's a left click -+ */ -+ public boolean isLeftClick() { -+ return this == LEFT_CLICK_AIR || this == LEFT_CLICK_BLOCK; -+ } -+ -+ /** -+ * Gets whether this action is a result of a right click. -+ * -+ * @return Whether it's a right click -+ */ -+ public boolean isRightClick() { -+ return this == RIGHT_CLICK_AIR || this == RIGHT_CLICK_BLOCK; -+ } -+ // Paper end - } diff --git a/patches/api/0306-Option-to-prevent-data-components-copy-in-smithing-r.patch b/patches/api/0306-Option-to-prevent-data-components-copy-in-smithing-r.patch new file mode 100644 index 0000000000..fa4ad55705 --- /dev/null +++ b/patches/api/0306-Option-to-prevent-data-components-copy-in-smithing-r.patch @@ -0,0 +1,122 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 26 Sep 2021 12:57:35 -0700 +Subject: [PATCH] Option to prevent data components copy in smithing recipes + + +diff --git a/src/main/java/org/bukkit/inventory/SmithingRecipe.java b/src/main/java/org/bukkit/inventory/SmithingRecipe.java +index 0235f4aa50eb69f87068005c669bd486899025d6..1ef9a715a2736e88a16083c6873803a8bd6bcf29 100644 +--- a/src/main/java/org/bukkit/inventory/SmithingRecipe.java ++++ b/src/main/java/org/bukkit/inventory/SmithingRecipe.java +@@ -13,6 +13,7 @@ public class SmithingRecipe implements Recipe, Keyed { + private final ItemStack result; + private final RecipeChoice base; + private final RecipeChoice addition; ++ private final boolean copyDataComponents; // Paper + + /** + * Create a smithing recipe to produce the specified result ItemStack. +@@ -28,6 +29,23 @@ public class SmithingRecipe implements Recipe, Keyed { + */ + @Deprecated + public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) { ++ // Paper start ++ this(key, result, base, addition, true); ++ } ++ /** ++ * Create a smithing recipe to produce the specified result ItemStack. ++ * ++ * @param key The unique recipe key ++ * @param result The item you want the recipe to create. ++ * @param base The base ingredient ++ * @param addition The addition ingredient ++ * @param copyDataComponents whether to copy the data components from the input base item to the output ++ * @deprecated use {@link SmithingTrimRecipe} or {@link SmithingTransformRecipe} ++ */ ++ @Deprecated ++ public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { ++ this.copyDataComponents = copyDataComponents; ++ // Paper end + this.key = key; + this.result = result; + this.base = base; +@@ -65,4 +83,26 @@ public class SmithingRecipe implements Recipe, Keyed { + public NamespacedKey getKey() { + return this.key; + } ++ ++ // Paper start ++ /** ++ * Whether to copy the NBT of the input base item to the output. ++ * ++ * @return true to copy the NBT (default for vanilla smithing recipes) ++ * @apiNote use {@link #willCopyDataComponents()} ++ */ ++ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.5") ++ public boolean willCopyNbt() { ++ return this.willCopyDataComponents(); ++ } ++ ++ /** ++ * Whether to copy the data components of the input base item to the output. ++ * ++ * @return true to copy the data components (default for vanilla smithing recipes) ++ */ ++ public boolean willCopyDataComponents() { ++ return this.copyDataComponents; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java +index 08fd3eca8383cdc2d06c3ce973e8c402d279077e..68e7132d77151b7b8312638d8bb79ea59e2fa5a6 100644 +--- a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java ++++ b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java +@@ -23,6 +23,22 @@ public class SmithingTransformRecipe extends SmithingRecipe { + super(key, result, base, addition); + this.template = template; + } ++ // Paper start ++ /** ++ * Create a smithing recipe to produce the specified result ItemStack. ++ * ++ * @param key The unique recipe key ++ * @param result The item you want the recipe to create. ++ * @param template The template item. ++ * @param base The base ingredient ++ * @param addition The addition ingredient ++ * @param copyDataComponents whether to copy the data components from the input base item to the output ++ */ ++ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { ++ super(key, result, base, addition, copyDataComponents); ++ this.template = template; ++ } ++ // Paper end + + /** + * Get the template recipe item. +diff --git a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java +index 32cbdc342615e76ff7a896e67cb0736b0bdf1978..ce36bb5b030f17e11f74e987235be143c1925aa7 100644 +--- a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java ++++ b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java +@@ -23,6 +23,21 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe + super(key, new ItemStack(Material.AIR), base, addition); + this.template = template; + } ++ // Paper start ++ /** ++ * Create a smithing recipe to produce the specified result ItemStack. ++ * ++ * @param key The unique recipe key ++ * @param template The template item. ++ * @param base The base ingredient ++ * @param addition The addition ingredient ++ * @param copyDataComponents whether to copy the data components from the input base item to the output ++ */ ++ public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { ++ super(key, new ItemStack(Material.AIR), base, addition, copyDataComponents); ++ this.template = template; ++ } ++ // Paper end + + /** + * Get the template recipe item. diff --git a/patches/api/0307-More-CommandBlock-API.patch b/patches/api/0307-More-CommandBlock-API.patch new file mode 100644 index 0000000000..c8c52c7587 --- /dev/null +++ b/patches/api/0307-More-CommandBlock-API.patch @@ -0,0 +1,96 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 28 May 2021 21:47:39 -0700 +Subject: [PATCH] More CommandBlock API + + +diff --git a/src/main/java/io/papermc/paper/command/CommandBlockHolder.java b/src/main/java/io/papermc/paper/command/CommandBlockHolder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cbca0e890a8e79c98555c94fb6487e7d181901aa +--- /dev/null ++++ b/src/main/java/io/papermc/paper/command/CommandBlockHolder.java +@@ -0,0 +1,58 @@ ++package io.papermc.paper.command; ++ ++import net.kyori.adventure.text.Component; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public interface CommandBlockHolder { ++ ++ /** ++ * Gets the command that this CommandBlock will run when powered. ++ * This will never return null. If the CommandBlock does not have a ++ * command, an empty String will be returned instead. ++ * ++ * @return Command that this CommandBlock will run when activated. ++ */ ++ @NotNull ++ String getCommand(); ++ ++ /** ++ * Sets the command that this CommandBlock will run when powered. ++ * Setting the command to null is the same as setting it to an empty ++ * String. ++ * ++ * @param command Command that this CommandBlock will run when activated. ++ */ ++ void setCommand(@Nullable String command); ++ ++ /** ++ * Gets the last output from this command block. ++ * ++ * @return the last output ++ */ ++ @NotNull ++ Component lastOutput(); ++ ++ /** ++ * Sets the last output from this command block. ++ * ++ * @param lastOutput the last output ++ */ ++ void lastOutput(@Nullable Component lastOutput); ++ ++ /** ++ * Gets the success count from this command block. ++ * @see Command_Block#Success_count ++ * ++ * @return the success count ++ */ ++ int getSuccessCount(); ++ ++ /** ++ * Sets the success count from this command block. ++ * @see Command_Block#Success_count ++ * ++ * @param successCount the success count ++ */ ++ void setSuccessCount(int successCount); ++} +diff --git a/src/main/java/org/bukkit/block/CommandBlock.java b/src/main/java/org/bukkit/block/CommandBlock.java +index 9c88be68b4f403d0500cb607394b3a1646675ef7..02bf0f8c12052dd5c17422153228083f56bea75b 100644 +--- a/src/main/java/org/bukkit/block/CommandBlock.java ++++ b/src/main/java/org/bukkit/block/CommandBlock.java +@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a captured state of a command block. + */ +-public interface CommandBlock extends TileState { ++public interface CommandBlock extends TileState, io.papermc.paper.command.CommandBlockHolder { // Paper + + /** + * Gets the command that this CommandBlock will run when powered. +diff --git a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java +index 91cab8b13d5bba34007f124838b32a1df58c5ac7..6a6021ad3a0e6aaf51f5144fa126e81bada9cfcf 100644 +--- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java ++++ b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java +@@ -4,7 +4,7 @@ import org.bukkit.entity.Minecart; + import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; + +-public interface CommandMinecart extends Minecart { ++public interface CommandMinecart extends Minecart, io.papermc.paper.command.CommandBlockHolder { // Paper + + /** + * Gets the command that this CommandMinecart will run when activated. diff --git a/patches/api/0307-Option-to-prevent-data-components-copy-in-smithing-r.patch b/patches/api/0307-Option-to-prevent-data-components-copy-in-smithing-r.patch deleted file mode 100644 index fa4ad55705..0000000000 --- a/patches/api/0307-Option-to-prevent-data-components-copy-in-smithing-r.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 26 Sep 2021 12:57:35 -0700 -Subject: [PATCH] Option to prevent data components copy in smithing recipes - - -diff --git a/src/main/java/org/bukkit/inventory/SmithingRecipe.java b/src/main/java/org/bukkit/inventory/SmithingRecipe.java -index 0235f4aa50eb69f87068005c669bd486899025d6..1ef9a715a2736e88a16083c6873803a8bd6bcf29 100644 ---- a/src/main/java/org/bukkit/inventory/SmithingRecipe.java -+++ b/src/main/java/org/bukkit/inventory/SmithingRecipe.java -@@ -13,6 +13,7 @@ public class SmithingRecipe implements Recipe, Keyed { - private final ItemStack result; - private final RecipeChoice base; - private final RecipeChoice addition; -+ private final boolean copyDataComponents; // Paper - - /** - * Create a smithing recipe to produce the specified result ItemStack. -@@ -28,6 +29,23 @@ public class SmithingRecipe implements Recipe, Keyed { - */ - @Deprecated - public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition) { -+ // Paper start -+ this(key, result, base, addition, true); -+ } -+ /** -+ * Create a smithing recipe to produce the specified result ItemStack. -+ * -+ * @param key The unique recipe key -+ * @param result The item you want the recipe to create. -+ * @param base The base ingredient -+ * @param addition The addition ingredient -+ * @param copyDataComponents whether to copy the data components from the input base item to the output -+ * @deprecated use {@link SmithingTrimRecipe} or {@link SmithingTransformRecipe} -+ */ -+ @Deprecated -+ public SmithingRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { -+ this.copyDataComponents = copyDataComponents; -+ // Paper end - this.key = key; - this.result = result; - this.base = base; -@@ -65,4 +83,26 @@ public class SmithingRecipe implements Recipe, Keyed { - public NamespacedKey getKey() { - return this.key; - } -+ -+ // Paper start -+ /** -+ * Whether to copy the NBT of the input base item to the output. -+ * -+ * @return true to copy the NBT (default for vanilla smithing recipes) -+ * @apiNote use {@link #willCopyDataComponents()} -+ */ -+ @org.jetbrains.annotations.ApiStatus.Obsolete(since = "1.20.5") -+ public boolean willCopyNbt() { -+ return this.willCopyDataComponents(); -+ } -+ -+ /** -+ * Whether to copy the data components of the input base item to the output. -+ * -+ * @return true to copy the data components (default for vanilla smithing recipes) -+ */ -+ public boolean willCopyDataComponents() { -+ return this.copyDataComponents; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java -index 08fd3eca8383cdc2d06c3ce973e8c402d279077e..68e7132d77151b7b8312638d8bb79ea59e2fa5a6 100644 ---- a/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java -+++ b/src/main/java/org/bukkit/inventory/SmithingTransformRecipe.java -@@ -23,6 +23,22 @@ public class SmithingTransformRecipe extends SmithingRecipe { - super(key, result, base, addition); - this.template = template; - } -+ // Paper start -+ /** -+ * Create a smithing recipe to produce the specified result ItemStack. -+ * -+ * @param key The unique recipe key -+ * @param result The item you want the recipe to create. -+ * @param template The template item. -+ * @param base The base ingredient -+ * @param addition The addition ingredient -+ * @param copyDataComponents whether to copy the data components from the input base item to the output -+ */ -+ public SmithingTransformRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { -+ super(key, result, base, addition, copyDataComponents); -+ this.template = template; -+ } -+ // Paper end - - /** - * Get the template recipe item. -diff --git a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java -index 32cbdc342615e76ff7a896e67cb0736b0bdf1978..ce36bb5b030f17e11f74e987235be143c1925aa7 100644 ---- a/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java -+++ b/src/main/java/org/bukkit/inventory/SmithingTrimRecipe.java -@@ -23,6 +23,21 @@ public class SmithingTrimRecipe extends SmithingRecipe implements ComplexRecipe - super(key, new ItemStack(Material.AIR), base, addition); - this.template = template; - } -+ // Paper start -+ /** -+ * Create a smithing recipe to produce the specified result ItemStack. -+ * -+ * @param key The unique recipe key -+ * @param template The template item. -+ * @param base The base ingredient -+ * @param addition The addition ingredient -+ * @param copyDataComponents whether to copy the data components from the input base item to the output -+ */ -+ public SmithingTrimRecipe(@NotNull NamespacedKey key, @NotNull RecipeChoice template, @NotNull RecipeChoice base, @NotNull RecipeChoice addition, boolean copyDataComponents) { -+ super(key, new ItemStack(Material.AIR), base, addition, copyDataComponents); -+ this.template = template; -+ } -+ // Paper end - - /** - * Get the template recipe item. diff --git a/patches/api/0308-Add-missing-team-sidebar-display-slots.patch b/patches/api/0308-Add-missing-team-sidebar-display-slots.patch new file mode 100644 index 0000000000..cdecbd1764 --- /dev/null +++ b/patches/api/0308-Add-missing-team-sidebar-display-slots.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 1 Oct 2021 08:04:43 -0700 +Subject: [PATCH] Add missing team sidebar display slots + + +diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java +index 4959bec21d152a17fe4ca9d3f448aef482a05b5e..21cd2ba659504c3a1eb95226539a5701d0c324db 100644 +--- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java ++++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java +@@ -1,26 +1,55 @@ + package org.bukkit.scoreboard; + ++import net.kyori.adventure.text.format.NamedTextColor; // Paper + /** + * Locations for displaying objectives to the player + */ + public enum DisplaySlot { +- BELOW_NAME, +- PLAYER_LIST, +- SIDEBAR, +- SIDEBAR_BLACK, +- SIDEBAR_DARK_BLUE, +- SIDEBAR_DARK_GREEN, +- SIDEBAR_DARK_AQUA, +- SIDEBAR_DARK_RED, +- SIDEBAR_DARK_PURPLE, +- SIDEBAR_GOLD, +- SIDEBAR_GRAY, +- SIDEBAR_DARK_GRAY, +- SIDEBAR_BLUE, +- SIDEBAR_GREEN, +- SIDEBAR_AQUA, +- SIDEBAR_RED, +- SIDEBAR_LIGHT_PURPLE, +- SIDEBAR_YELLOW, +- SIDEBAR_WHITE; ++ // Paper start ++ BELOW_NAME("below_name"), ++ PLAYER_LIST("list"), ++ SIDEBAR("sidebar"), ++ SIDEBAR_TEAM_BLACK(NamedTextColor.BLACK), ++ SIDEBAR_TEAM_DARK_BLUE(NamedTextColor.DARK_BLUE), ++ SIDEBAR_TEAM_DARK_GREEN(NamedTextColor.DARK_GREEN), ++ SIDEBAR_TEAM_DARK_AQUA(NamedTextColor.DARK_AQUA), ++ SIDEBAR_TEAM_DARK_RED(NamedTextColor.DARK_RED), ++ SIDEBAR_TEAM_DARK_PURPLE(NamedTextColor.DARK_PURPLE), ++ SIDEBAR_TEAM_GOLD(NamedTextColor.GOLD), ++ SIDEBAR_TEAM_GRAY(NamedTextColor.GRAY), ++ SIDEBAR_TEAM_DARK_GRAY(NamedTextColor.DARK_GRAY), ++ SIDEBAR_TEAM_BLUE(NamedTextColor.BLUE), ++ SIDEBAR_TEAM_GREEN(NamedTextColor.GREEN), ++ SIDEBAR_TEAM_AQUA(NamedTextColor.AQUA), ++ SIDEBAR_TEAM_RED(NamedTextColor.RED), ++ SIDEBAR_TEAM_LIGHT_PURPLE(NamedTextColor.LIGHT_PURPLE), ++ SIDEBAR_TEAM_YELLOW(NamedTextColor.YELLOW), ++ SIDEBAR_TEAM_WHITE(NamedTextColor.WHITE); ++ ++ public static final net.kyori.adventure.util.Index NAMES = net.kyori.adventure.util.Index.create(DisplaySlot.class, DisplaySlot::getId); ++ ++ private final String id; ++ ++ DisplaySlot(@org.jetbrains.annotations.NotNull String id) { ++ this.id = id; ++ } ++ ++ DisplaySlot(@org.jetbrains.annotations.NotNull NamedTextColor color) { ++ this.id = "sidebar.team." + color; ++ } ++ ++ /** ++ * Get the string id of this display slot. ++ * ++ * @return the string id ++ */ ++ public @org.jetbrains.annotations.NotNull String getId() { ++ return id; ++ } ++ ++ @Override ++ public String toString() { ++ return this.id; ++ } ++ // Paper end + } diff --git a/patches/api/0308-More-CommandBlock-API.patch b/patches/api/0308-More-CommandBlock-API.patch deleted file mode 100644 index c8c52c7587..0000000000 --- a/patches/api/0308-More-CommandBlock-API.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 28 May 2021 21:47:39 -0700 -Subject: [PATCH] More CommandBlock API - - -diff --git a/src/main/java/io/papermc/paper/command/CommandBlockHolder.java b/src/main/java/io/papermc/paper/command/CommandBlockHolder.java -new file mode 100644 -index 0000000000000000000000000000000000000000..cbca0e890a8e79c98555c94fb6487e7d181901aa ---- /dev/null -+++ b/src/main/java/io/papermc/paper/command/CommandBlockHolder.java -@@ -0,0 +1,58 @@ -+package io.papermc.paper.command; -+ -+import net.kyori.adventure.text.Component; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+public interface CommandBlockHolder { -+ -+ /** -+ * Gets the command that this CommandBlock will run when powered. -+ * This will never return null. If the CommandBlock does not have a -+ * command, an empty String will be returned instead. -+ * -+ * @return Command that this CommandBlock will run when activated. -+ */ -+ @NotNull -+ String getCommand(); -+ -+ /** -+ * Sets the command that this CommandBlock will run when powered. -+ * Setting the command to null is the same as setting it to an empty -+ * String. -+ * -+ * @param command Command that this CommandBlock will run when activated. -+ */ -+ void setCommand(@Nullable String command); -+ -+ /** -+ * Gets the last output from this command block. -+ * -+ * @return the last output -+ */ -+ @NotNull -+ Component lastOutput(); -+ -+ /** -+ * Sets the last output from this command block. -+ * -+ * @param lastOutput the last output -+ */ -+ void lastOutput(@Nullable Component lastOutput); -+ -+ /** -+ * Gets the success count from this command block. -+ * @see Command_Block#Success_count -+ * -+ * @return the success count -+ */ -+ int getSuccessCount(); -+ -+ /** -+ * Sets the success count from this command block. -+ * @see Command_Block#Success_count -+ * -+ * @param successCount the success count -+ */ -+ void setSuccessCount(int successCount); -+} -diff --git a/src/main/java/org/bukkit/block/CommandBlock.java b/src/main/java/org/bukkit/block/CommandBlock.java -index 9c88be68b4f403d0500cb607394b3a1646675ef7..02bf0f8c12052dd5c17422153228083f56bea75b 100644 ---- a/src/main/java/org/bukkit/block/CommandBlock.java -+++ b/src/main/java/org/bukkit/block/CommandBlock.java -@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a captured state of a command block. - */ --public interface CommandBlock extends TileState { -+public interface CommandBlock extends TileState, io.papermc.paper.command.CommandBlockHolder { // Paper - - /** - * Gets the command that this CommandBlock will run when powered. -diff --git a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java -index 91cab8b13d5bba34007f124838b32a1df58c5ac7..6a6021ad3a0e6aaf51f5144fa126e81bada9cfcf 100644 ---- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java -+++ b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java -@@ -4,7 +4,7 @@ import org.bukkit.entity.Minecart; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; - --public interface CommandMinecart extends Minecart { -+public interface CommandMinecart extends Minecart, io.papermc.paper.command.CommandBlockHolder { // Paper - - /** - * Gets the command that this CommandMinecart will run when activated. diff --git a/patches/api/0309-Add-missing-team-sidebar-display-slots.patch b/patches/api/0309-Add-missing-team-sidebar-display-slots.patch deleted file mode 100644 index cdecbd1764..0000000000 --- a/patches/api/0309-Add-missing-team-sidebar-display-slots.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 1 Oct 2021 08:04:43 -0700 -Subject: [PATCH] Add missing team sidebar display slots - - -diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java -index 4959bec21d152a17fe4ca9d3f448aef482a05b5e..21cd2ba659504c3a1eb95226539a5701d0c324db 100644 ---- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java -+++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java -@@ -1,26 +1,55 @@ - package org.bukkit.scoreboard; - -+import net.kyori.adventure.text.format.NamedTextColor; // Paper - /** - * Locations for displaying objectives to the player - */ - public enum DisplaySlot { -- BELOW_NAME, -- PLAYER_LIST, -- SIDEBAR, -- SIDEBAR_BLACK, -- SIDEBAR_DARK_BLUE, -- SIDEBAR_DARK_GREEN, -- SIDEBAR_DARK_AQUA, -- SIDEBAR_DARK_RED, -- SIDEBAR_DARK_PURPLE, -- SIDEBAR_GOLD, -- SIDEBAR_GRAY, -- SIDEBAR_DARK_GRAY, -- SIDEBAR_BLUE, -- SIDEBAR_GREEN, -- SIDEBAR_AQUA, -- SIDEBAR_RED, -- SIDEBAR_LIGHT_PURPLE, -- SIDEBAR_YELLOW, -- SIDEBAR_WHITE; -+ // Paper start -+ BELOW_NAME("below_name"), -+ PLAYER_LIST("list"), -+ SIDEBAR("sidebar"), -+ SIDEBAR_TEAM_BLACK(NamedTextColor.BLACK), -+ SIDEBAR_TEAM_DARK_BLUE(NamedTextColor.DARK_BLUE), -+ SIDEBAR_TEAM_DARK_GREEN(NamedTextColor.DARK_GREEN), -+ SIDEBAR_TEAM_DARK_AQUA(NamedTextColor.DARK_AQUA), -+ SIDEBAR_TEAM_DARK_RED(NamedTextColor.DARK_RED), -+ SIDEBAR_TEAM_DARK_PURPLE(NamedTextColor.DARK_PURPLE), -+ SIDEBAR_TEAM_GOLD(NamedTextColor.GOLD), -+ SIDEBAR_TEAM_GRAY(NamedTextColor.GRAY), -+ SIDEBAR_TEAM_DARK_GRAY(NamedTextColor.DARK_GRAY), -+ SIDEBAR_TEAM_BLUE(NamedTextColor.BLUE), -+ SIDEBAR_TEAM_GREEN(NamedTextColor.GREEN), -+ SIDEBAR_TEAM_AQUA(NamedTextColor.AQUA), -+ SIDEBAR_TEAM_RED(NamedTextColor.RED), -+ SIDEBAR_TEAM_LIGHT_PURPLE(NamedTextColor.LIGHT_PURPLE), -+ SIDEBAR_TEAM_YELLOW(NamedTextColor.YELLOW), -+ SIDEBAR_TEAM_WHITE(NamedTextColor.WHITE); -+ -+ public static final net.kyori.adventure.util.Index NAMES = net.kyori.adventure.util.Index.create(DisplaySlot.class, DisplaySlot::getId); -+ -+ private final String id; -+ -+ DisplaySlot(@org.jetbrains.annotations.NotNull String id) { -+ this.id = id; -+ } -+ -+ DisplaySlot(@org.jetbrains.annotations.NotNull NamedTextColor color) { -+ this.id = "sidebar.team." + color; -+ } -+ -+ /** -+ * Get the string id of this display slot. -+ * -+ * @return the string id -+ */ -+ public @org.jetbrains.annotations.NotNull String getId() { -+ return id; -+ } -+ -+ @Override -+ public String toString() { -+ return this.id; -+ } -+ // Paper end - } diff --git a/patches/api/0309-add-back-EntityPortalExitEvent.patch b/patches/api/0309-add-back-EntityPortalExitEvent.patch new file mode 100644 index 0000000000..5a153e2345 --- /dev/null +++ b/patches/api/0309-add-back-EntityPortalExitEvent.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 12 May 2021 02:49:28 -0700 +Subject: [PATCH] add back EntityPortalExitEvent + +Was removed here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/a2d787f6ebeb72fa7d5750788221fb9a0d838ac4 + +diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java +index 869ad3b12ebd8275d04b0c21b5ecc0389da01490..0a87e2934901eb1bcaec72ed8141cd4828a4efce 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java +@@ -11,6 +11,9 @@ import org.jetbrains.annotations.NotNull; + *

    + * This event allows you to modify the velocity of the entity after they have + * successfully exited the portal. ++ *

    ++ * Cancelling this event does not prevent the teleport, but it does prevent ++ * any changes to velocity and location from taking place. + */ + public class EntityPortalExitEvent extends EntityTeleportEvent { + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0310-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/api/0310-Add-methods-to-find-targets-for-lightning-strikes.patch new file mode 100644 index 0000000000..ffa6fc8f05 --- /dev/null +++ b/patches/api/0310-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jakub Zacek +Date: Mon, 4 Oct 2021 08:29:36 +0200 +Subject: [PATCH] Add methods to find targets for lightning strikes + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index f4d31d9d0f4cbd2621adf97a20b65ae83e5fd064..6953851a5177e9df3746f7a743f27ef02845e522 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -746,6 +746,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + @NotNull + public LightningStrike strikeLightningEffect(@NotNull Location loc); + ++ // Paper start ++ /** ++ * Finds the location of the nearest unobstructed Lightning Rod in a 128-block ++ * radius around the given location. Returns {@code null} if no Lightning Rod is found. ++ * ++ *

    Note: To activate a Lightning Rod, the position one block above it must be struck by lightning.

    ++ * ++ * @param location {@link Location} to search for Lightning Rod around ++ * @return {@link Location} of Lightning Rod or {@code null} ++ */ ++ @Nullable ++ public Location findLightningRod(@NotNull Location location); ++ ++ /** ++ * Finds a target {@link Location} for lightning to strike. ++ *

    It selects from (in the following order):

    ++ *
      ++ *
    1. the block above the nearest Lightning Rod, found using {@link World#findLightningRod(Location)}
    2. ++ *
    3. a random {@link LivingEntity} that can see the sky in a 6x6 cuboid ++ * around input X/Z coordinates. Y ranges from the highest motion-blocking ++ * block at the input X/Z - 3 to the height limit + 3
    4. ++ *
    ++ *

    Returns {@code null} if no target is found.

    ++ * ++ * @param location {@link Location} to search for target around ++ * @return lightning target or {@code null} ++ */ ++ @Nullable ++ public Location findLightningTarget(@NotNull Location location); ++ // Paper end ++ + /** + * Get a list of all entities in this World + * diff --git a/patches/api/0310-add-back-EntityPortalExitEvent.patch b/patches/api/0310-add-back-EntityPortalExitEvent.patch deleted file mode 100644 index 5a153e2345..0000000000 --- a/patches/api/0310-add-back-EntityPortalExitEvent.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 12 May 2021 02:49:28 -0700 -Subject: [PATCH] add back EntityPortalExitEvent - -Was removed here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/a2d787f6ebeb72fa7d5750788221fb9a0d838ac4 - -diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java -index 869ad3b12ebd8275d04b0c21b5ecc0389da01490..0a87e2934901eb1bcaec72ed8141cd4828a4efce 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityPortalExitEvent.java -@@ -11,6 +11,9 @@ import org.jetbrains.annotations.NotNull; - *

    - * This event allows you to modify the velocity of the entity after they have - * successfully exited the portal. -+ *

    -+ * Cancelling this event does not prevent the teleport, but it does prevent -+ * any changes to velocity and location from taking place. - */ - public class EntityPortalExitEvent extends EntityTeleportEvent { - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0311-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/api/0311-Add-methods-to-find-targets-for-lightning-strikes.patch deleted file mode 100644 index ffa6fc8f05..0000000000 --- a/patches/api/0311-Add-methods-to-find-targets-for-lightning-strikes.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jakub Zacek -Date: Mon, 4 Oct 2021 08:29:36 +0200 -Subject: [PATCH] Add methods to find targets for lightning strikes - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index f4d31d9d0f4cbd2621adf97a20b65ae83e5fd064..6953851a5177e9df3746f7a743f27ef02845e522 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -746,6 +746,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - @NotNull - public LightningStrike strikeLightningEffect(@NotNull Location loc); - -+ // Paper start -+ /** -+ * Finds the location of the nearest unobstructed Lightning Rod in a 128-block -+ * radius around the given location. Returns {@code null} if no Lightning Rod is found. -+ * -+ *

    Note: To activate a Lightning Rod, the position one block above it must be struck by lightning.

    -+ * -+ * @param location {@link Location} to search for Lightning Rod around -+ * @return {@link Location} of Lightning Rod or {@code null} -+ */ -+ @Nullable -+ public Location findLightningRod(@NotNull Location location); -+ -+ /** -+ * Finds a target {@link Location} for lightning to strike. -+ *

    It selects from (in the following order):

    -+ *
      -+ *
    1. the block above the nearest Lightning Rod, found using {@link World#findLightningRod(Location)}
    2. -+ *
    3. a random {@link LivingEntity} that can see the sky in a 6x6 cuboid -+ * around input X/Z coordinates. Y ranges from the highest motion-blocking -+ * block at the input X/Z - 3 to the height limit + 3
    4. -+ *
    -+ *

    Returns {@code null} if no target is found.

    -+ * -+ * @param location {@link Location} to search for target around -+ * @return lightning target or {@code null} -+ */ -+ @Nullable -+ public Location findLightningTarget(@NotNull Location location); -+ // Paper end -+ - /** - * Get a list of all entities in this World - * diff --git a/patches/api/0311-Get-entity-default-attributes.patch b/patches/api/0311-Get-entity-default-attributes.patch new file mode 100644 index 0000000000..4a094264ca --- /dev/null +++ b/patches/api/0311-Get-entity-default-attributes.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 20 Aug 2021 13:03:55 -0700 +Subject: [PATCH] Get entity default attributes + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 0a8a9e6fbead467737530ce6c84560dcbb803282..5028340475d3742ea407dfb70e0d2b2a3492dda3 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -187,5 +187,22 @@ public interface UnsafeValues { + * @return true if valid repair, false if not + */ + public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial); ++ ++ /** ++ * Checks if the entity represented by the namespaced key has default attributes. ++ * ++ * @param entityKey the entity's key ++ * @return true if it has default attributes ++ */ ++ boolean hasDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); ++ ++ /** ++ * Gets the default attributes for the entity represented by the namespaced key. ++ * ++ * @param entityKey the entity's key ++ * @return an unmodifiable instance of Attributable for reading default attributes. ++ * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) ++ */ ++ @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java +index b7a454ca11d484209d08d0003d4c19a431456687..1d1315262737d99bf9f5aabc0ae66eee4645cc65 100644 +--- a/src/main/java/org/bukkit/entity/EntityType.java ++++ b/src/main/java/org/bukkit/entity/EntityType.java +@@ -453,6 +453,25 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans + Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); + return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); + } ++ ++ /** ++ * Checks if the entity has default attributes. ++ * ++ * @return true if it has default attributes ++ */ ++ public boolean hasDefaultAttributes() { ++ return org.bukkit.Bukkit.getUnsafe().hasDefaultEntityAttributes(this.key); ++ } ++ ++ /** ++ * Gets the default attributes for the entity. ++ * ++ * @return an unmodifiable instance of Attributable for reading default attributes. ++ * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultAttributes()} first) ++ */ ++ public @NotNull org.bukkit.attribute.Attributable getDefaultAttributes() { ++ return org.bukkit.Bukkit.getUnsafe().getDefaultEntityAttributes(this.key); ++ } + // Paper end + + /** diff --git a/patches/api/0312-Get-entity-default-attributes.patch b/patches/api/0312-Get-entity-default-attributes.patch deleted file mode 100644 index f0dd49bec9..0000000000 --- a/patches/api/0312-Get-entity-default-attributes.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 20 Aug 2021 13:03:55 -0700 -Subject: [PATCH] Get entity default attributes - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 4130481843c9e0b847bd656622b0c1107ac1297b..a846f3c6e8dceb90e42db903b8be2c248f2f9d5c 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -186,5 +186,22 @@ public interface UnsafeValues { - * @return true if valid repair, false if not - */ - public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial); -+ -+ /** -+ * Checks if the entity represented by the namespaced key has default attributes. -+ * -+ * @param entityKey the entity's key -+ * @return true if it has default attributes -+ */ -+ boolean hasDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); -+ -+ /** -+ * Gets the default attributes for the entity represented by the namespaced key. -+ * -+ * @param entityKey the entity's key -+ * @return an unmodifiable instance of Attributable for reading default attributes. -+ * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) -+ */ -+ @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java -index b7a454ca11d484209d08d0003d4c19a431456687..1d1315262737d99bf9f5aabc0ae66eee4645cc65 100644 ---- a/src/main/java/org/bukkit/entity/EntityType.java -+++ b/src/main/java/org/bukkit/entity/EntityType.java -@@ -453,6 +453,25 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans - Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys"); - return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this); - } -+ -+ /** -+ * Checks if the entity has default attributes. -+ * -+ * @return true if it has default attributes -+ */ -+ public boolean hasDefaultAttributes() { -+ return org.bukkit.Bukkit.getUnsafe().hasDefaultEntityAttributes(this.key); -+ } -+ -+ /** -+ * Gets the default attributes for the entity. -+ * -+ * @return an unmodifiable instance of Attributable for reading default attributes. -+ * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultAttributes()} first) -+ */ -+ public @NotNull org.bukkit.attribute.Attributable getDefaultAttributes() { -+ return org.bukkit.Bukkit.getUnsafe().getDefaultEntityAttributes(this.key); -+ } - // Paper end - - /** diff --git a/patches/api/0312-Left-handed-API.patch b/patches/api/0312-Left-handed-API.patch new file mode 100644 index 0000000000..cae17a697b --- /dev/null +++ b/patches/api/0312-Left-handed-API.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Thu, 14 Oct 2021 12:36:46 -0500 +Subject: [PATCH] Left handed API + + +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 709c8fc3dde786f45ff13d6ee6c405ffdc765282..0c511b64672f9bafb92be3aea6bab8c1c12a7041 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -196,4 +196,20 @@ public interface Mob extends LivingEntity, Lootable { + */ + void setAggressive(boolean aggressive); + // Paper end ++ ++ // Paper start ++ /** ++ * Check if Mob is left-handed ++ * ++ * @return True if left-handed ++ */ ++ public boolean isLeftHanded(); ++ ++ /** ++ * Set if Mob is left-handed ++ * ++ * @param leftHanded True if left-handed ++ */ ++ public void setLeftHanded(boolean leftHanded); ++ // Paper end + } diff --git a/patches/api/0313-Add-critical-damage-API.patch b/patches/api/0313-Add-critical-damage-API.patch new file mode 100644 index 0000000000..f04ac65ac5 --- /dev/null +++ b/patches/api/0313-Add-critical-damage-API.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dodison +Date: Mon, 26 Jul 2021 17:35:20 +0200 +Subject: [PATCH] Add critical damage API + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java +index 04449ef55caacf2ac910f0916f8afeb428c282e9..6b24d1281cb8f0253430c9c1a1323e2670bb9c93 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java +@@ -5,6 +5,7 @@ import java.util.Map; + import org.bukkit.damage.DamageSource; + import org.bukkit.damage.DamageType; + import org.bukkit.entity.Entity; ++import org.jetbrains.annotations.ApiStatus; + import org.jetbrains.annotations.NotNull; + + /** +@@ -12,15 +13,18 @@ import org.jetbrains.annotations.NotNull; + */ + public class EntityDamageByEntityEvent extends EntityDamageEvent { + private final Entity damager; ++ private final boolean critical; // Paper + + @Deprecated(forRemoval = true) + public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) { + this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), damage); + } + ++ @Deprecated + public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) { + super(damagee, cause, damageSource, damage); + this.damager = damager; ++ this.critical = false; // Paper - add critical damage API + } + + @Deprecated(forRemoval = true) +@@ -28,11 +32,34 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent { + this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), modifiers, modifierFunctions); + } + ++ @Deprecated + public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { + super(damagee, cause, damageSource, modifiers, modifierFunctions); + this.damager = damager; ++ // Paper start ++ this.critical = false; + } + ++ @ApiStatus.Internal ++ public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions, boolean critical) { ++ super(damagee, cause, damageSource, modifiers, modifierFunctions); ++ this.damager = damager; ++ this.critical = critical; ++ } ++ ++ /** ++ * Shows this damage instance was critical. ++ * The damage instance can be critical if the attacking player met the respective conditions. ++ * Furthermore, arrows may also cause a critical damage event if the arrow {@link org.bukkit.entity.AbstractArrow#isCritical()}. ++ * ++ * @return if the hit was critical. ++ * @see https://minecraft.wiki/wiki/Damage#Critical_hit ++ */ ++ public boolean isCritical() { ++ return this.critical; ++ } ++ // Paper end ++ + /** + * Returns the entity that damaged the defender. + * diff --git a/patches/api/0313-Left-handed-API.patch b/patches/api/0313-Left-handed-API.patch deleted file mode 100644 index cae17a697b..0000000000 --- a/patches/api/0313-Left-handed-API.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Thu, 14 Oct 2021 12:36:46 -0500 -Subject: [PATCH] Left handed API - - -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 709c8fc3dde786f45ff13d6ee6c405ffdc765282..0c511b64672f9bafb92be3aea6bab8c1c12a7041 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -196,4 +196,20 @@ public interface Mob extends LivingEntity, Lootable { - */ - void setAggressive(boolean aggressive); - // Paper end -+ -+ // Paper start -+ /** -+ * Check if Mob is left-handed -+ * -+ * @return True if left-handed -+ */ -+ public boolean isLeftHanded(); -+ -+ /** -+ * Set if Mob is left-handed -+ * -+ * @param leftHanded True if left-handed -+ */ -+ public void setLeftHanded(boolean leftHanded); -+ // Paper end - } diff --git a/patches/api/0314-Add-critical-damage-API.patch b/patches/api/0314-Add-critical-damage-API.patch deleted file mode 100644 index f04ac65ac5..0000000000 --- a/patches/api/0314-Add-critical-damage-API.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dodison -Date: Mon, 26 Jul 2021 17:35:20 +0200 -Subject: [PATCH] Add critical damage API - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -index 04449ef55caacf2ac910f0916f8afeb428c282e9..6b24d1281cb8f0253430c9c1a1323e2670bb9c93 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByEntityEvent.java -@@ -5,6 +5,7 @@ import java.util.Map; - import org.bukkit.damage.DamageSource; - import org.bukkit.damage.DamageType; - import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.ApiStatus; - import org.jetbrains.annotations.NotNull; - - /** -@@ -12,15 +13,18 @@ import org.jetbrains.annotations.NotNull; - */ - public class EntityDamageByEntityEvent extends EntityDamageEvent { - private final Entity damager; -+ private final boolean critical; // Paper - - @Deprecated(forRemoval = true) - public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) { - this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), damage); - } - -+ @Deprecated - public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) { - super(damagee, cause, damageSource, damage); - this.damager = damager; -+ this.critical = false; // Paper - add critical damage API - } - - @Deprecated(forRemoval = true) -@@ -28,11 +32,34 @@ public class EntityDamageByEntityEvent extends EntityDamageEvent { - this(damager, damagee, cause, DamageSource.builder(DamageType.GENERIC).withCausingEntity(damager).withDirectEntity(damager).build(), modifiers, modifierFunctions); - } - -+ @Deprecated - public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { - super(damagee, cause, damageSource, modifiers, modifierFunctions); - this.damager = damager; -+ // Paper start -+ this.critical = false; - } - -+ @ApiStatus.Internal -+ public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions, boolean critical) { -+ super(damagee, cause, damageSource, modifiers, modifierFunctions); -+ this.damager = damager; -+ this.critical = critical; -+ } -+ -+ /** -+ * Shows this damage instance was critical. -+ * The damage instance can be critical if the attacking player met the respective conditions. -+ * Furthermore, arrows may also cause a critical damage event if the arrow {@link org.bukkit.entity.AbstractArrow#isCritical()}. -+ * -+ * @return if the hit was critical. -+ * @see https://minecraft.wiki/wiki/Damage#Critical_hit -+ */ -+ public boolean isCritical() { -+ return this.critical; -+ } -+ // Paper end -+ - /** - * Returns the entity that damaged the defender. - * diff --git a/patches/api/0314-Add-more-advancement-API.patch b/patches/api/0314-Add-more-advancement-API.patch new file mode 100644 index 0000000000..179dbdc225 --- /dev/null +++ b/patches/api/0314-Add-more-advancement-API.patch @@ -0,0 +1,270 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: syldium +Date: Fri, 9 Jul 2021 18:49:40 +0200 +Subject: [PATCH] Add more advancement API + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java +new file mode 100644 +index 0000000000000000000000000000000000000000..19202e17f362fdffca472178b102d1336349590c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java +@@ -0,0 +1,166 @@ ++package io.papermc.paper.advancement; ++ ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.format.TextColor; ++import net.kyori.adventure.translation.Translatable; ++import net.kyori.adventure.util.Index; ++import org.bukkit.NamespacedKey; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Describes the display of an advancement. ++ *

    ++ * The display is used in the chat, in the toast messages and the advancements ++ * screen. ++ */ ++public interface AdvancementDisplay { ++ ++ /** ++ * Gets the {@link Frame}. ++ *

    ++ * This defines the appearance of the tile in the advancements screen and ++ * the text when it's completed. ++ * ++ * @return the frame type ++ */ ++ @NotNull ++ Frame frame(); ++ ++ /** ++ * Gets the advancement title. ++ * ++ * @return the title ++ */ ++ @NotNull ++ Component title(); ++ ++ /** ++ * Gets the description. ++ * ++ * @return the description ++ */ ++ @NotNull ++ Component description(); ++ ++ /** ++ * Gets the icon shown in the frame in the advancements screen. ++ * ++ * @return a copy of the icon ++ */ ++ @NotNull ++ ItemStack icon(); ++ ++ /** ++ * Gets whether a toast should be displayed. ++ *

    ++ * A toast is a notification that will be displayed in the top right corner ++ * of the screen. ++ * ++ * @return {@code true} if a toast should be shown ++ */ ++ boolean doesShowToast(); ++ ++ /** ++ * Gets whether a message should be sent in the chat. ++ * ++ * @return {@code true} if a message should be sent ++ * @see org.bukkit.event.player.PlayerAdvancementDoneEvent#message() to edit ++ * the message ++ */ ++ boolean doesAnnounceToChat(); ++ ++ /** ++ * Gets whether this advancement is hidden. ++ *

    ++ * Hidden advancements cannot be viewed by the player until they have been ++ * unlocked. ++ * ++ * @return {@code true} if hidden ++ */ ++ boolean isHidden(); ++ ++ /** ++ * Gets the texture displayed behind the advancement tree when selected. ++ *

    ++ * This only affects root advancements without any parent. If the background ++ * is not specified or doesn't exist, the tab background will be the missing ++ * texture. ++ * ++ * @return the background texture path ++ */ ++ @Nullable ++ NamespacedKey backgroundPath(); ++ ++ /** ++ * Gets the formatted display name for this display. This ++ * is a part of the component that would be shown in chat when a player ++ * completes the advancement. ++ * ++ * @return the display name ++ * @see org.bukkit.advancement.Advancement#displayName() ++ */ ++ @NotNull Component displayName(); ++ ++ /** ++ * Defines how the {@link #icon()} appears in the advancements screen and ++ * the color used with the {@link #title() advancement name}. ++ */ ++ enum Frame implements Translatable { ++ ++ /** ++ * "Challenge complete" advancement. ++ *

    ++ * The client will play the {@code ui.toast.challenge_complete} sound ++ * when the challenge is completed and the toast is shown. ++ */ ++ CHALLENGE("challenge", NamedTextColor.DARK_PURPLE), ++ ++ /** ++ * "Goal reached" advancement. ++ */ ++ GOAL("goal", NamedTextColor.GREEN), ++ ++ /** ++ * "Advancement made" advancement. ++ */ ++ TASK("task", NamedTextColor.GREEN); ++ ++ /** ++ * The name map. ++ */ ++ public static final Index NAMES = Index.create(Frame.class, frame -> frame.name); ++ private final String name; ++ private final TextColor color; ++ ++ Frame(String name, TextColor color) { ++ this.name = name; ++ this.color = color; ++ } ++ ++ /** ++ * Gets the {@link TextColor} used for the advancement name. ++ * ++ * @return the text color ++ */ ++ @NotNull ++ public TextColor color() { ++ return this.color; ++ } ++ ++ /** ++ * Gets the translation key used when an advancement is completed. ++ *

    ++ * This is the first line of the toast displayed by the client. ++ * ++ * @return the toast message key ++ */ ++ @Override ++ @NotNull ++ public String translationKey() { ++ return "advancements.toast." + this.name; ++ } ++ } ++} +diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java +index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..243e5f2debad7f12210169e15ef0b29763e988bb 100644 +--- a/src/main/java/org/bukkit/advancement/Advancement.java ++++ b/src/main/java/org/bukkit/advancement/Advancement.java +@@ -19,13 +19,53 @@ public interface Advancement extends Keyed { + @NotNull + Collection getCriteria(); + ++ // Paper start + /** +- * Returns the display information for this advancement. ++ * Get the display info of this advancement. ++ *

    ++ * Will be {@code null} when totally hidden, for example with crafting ++ * recipes. + * +- * This includes it's name, description and other visible tags. ++ * @return the display info ++ */ ++ @Nullable ++ io.papermc.paper.advancement.AdvancementDisplay getDisplay(); ++ ++ /** ++ * Gets the formatted display name for this display. This ++ * is part of the component that would be shown in chat when a player ++ * completes the advancement. Will return the same as ++ * {@link io.papermc.paper.advancement.AdvancementDisplay#displayName()} when an ++ * {@link io.papermc.paper.advancement.AdvancementDisplay} is present. + * +- * @return a AdvancementDisplay object, or null if not set. ++ * @return the display name ++ * @see io.papermc.paper.advancement.AdvancementDisplay#displayName() ++ */ ++ @NotNull net.kyori.adventure.text.Component displayName(); ++ ++ /** ++ * Gets the parent advancement, if any. ++ * ++ * @return the parent advancement + */ + @Nullable +- AdvancementDisplay getDisplay(); ++ Advancement getParent(); ++ ++ /** ++ * Gets all the direct children advancements. ++ * ++ * @return the children advancements ++ */ ++ @NotNull ++ @org.jetbrains.annotations.Unmodifiable ++ Collection getChildren(); ++ ++ /** ++ * Gets the root advancement of the tree this is located in. ++ * ++ * @return the root advancement ++ */ ++ @NotNull ++ Advancement getRoot(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java +index 0ff86a39025a94ca128364a45bf171728cb81027..aec6be7e121da3eb8a464b6934da29ab6b473885 100644 +--- a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java ++++ b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java +@@ -5,7 +5,10 @@ import org.jetbrains.annotations.NotNull; + + /** + * Holds information about how the advancement is displayed by the game. ++ * ++ * @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay} + */ ++@Deprecated(forRemoval = true) // Paper + public interface AdvancementDisplay { + + /** +diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java +index de767efb9f55448df061e166c66a2cf3439d57ec..06d8b72dd54becc13f40bd6e505115405462cd73 100644 +--- a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java ++++ b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java +@@ -8,7 +8,9 @@ import org.jetbrains.annotations.NotNull; + * + * This enum contains information about these types and how they are + * represented. ++ * @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay.Frame} + */ ++@Deprecated(forRemoval = true) + public enum AdvancementDisplayType { + + /** diff --git a/patches/api/0315-Add-more-advancement-API.patch b/patches/api/0315-Add-more-advancement-API.patch deleted file mode 100644 index 179dbdc225..0000000000 --- a/patches/api/0315-Add-more-advancement-API.patch +++ /dev/null @@ -1,270 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: syldium -Date: Fri, 9 Jul 2021 18:49:40 +0200 -Subject: [PATCH] Add more advancement API - -Co-authored-by: Jake Potrebic - -diff --git a/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java -new file mode 100644 -index 0000000000000000000000000000000000000000..19202e17f362fdffca472178b102d1336349590c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/advancement/AdvancementDisplay.java -@@ -0,0 +1,166 @@ -+package io.papermc.paper.advancement; -+ -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.format.NamedTextColor; -+import net.kyori.adventure.text.format.TextColor; -+import net.kyori.adventure.translation.Translatable; -+import net.kyori.adventure.util.Index; -+import org.bukkit.NamespacedKey; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Describes the display of an advancement. -+ *

    -+ * The display is used in the chat, in the toast messages and the advancements -+ * screen. -+ */ -+public interface AdvancementDisplay { -+ -+ /** -+ * Gets the {@link Frame}. -+ *

    -+ * This defines the appearance of the tile in the advancements screen and -+ * the text when it's completed. -+ * -+ * @return the frame type -+ */ -+ @NotNull -+ Frame frame(); -+ -+ /** -+ * Gets the advancement title. -+ * -+ * @return the title -+ */ -+ @NotNull -+ Component title(); -+ -+ /** -+ * Gets the description. -+ * -+ * @return the description -+ */ -+ @NotNull -+ Component description(); -+ -+ /** -+ * Gets the icon shown in the frame in the advancements screen. -+ * -+ * @return a copy of the icon -+ */ -+ @NotNull -+ ItemStack icon(); -+ -+ /** -+ * Gets whether a toast should be displayed. -+ *

    -+ * A toast is a notification that will be displayed in the top right corner -+ * of the screen. -+ * -+ * @return {@code true} if a toast should be shown -+ */ -+ boolean doesShowToast(); -+ -+ /** -+ * Gets whether a message should be sent in the chat. -+ * -+ * @return {@code true} if a message should be sent -+ * @see org.bukkit.event.player.PlayerAdvancementDoneEvent#message() to edit -+ * the message -+ */ -+ boolean doesAnnounceToChat(); -+ -+ /** -+ * Gets whether this advancement is hidden. -+ *

    -+ * Hidden advancements cannot be viewed by the player until they have been -+ * unlocked. -+ * -+ * @return {@code true} if hidden -+ */ -+ boolean isHidden(); -+ -+ /** -+ * Gets the texture displayed behind the advancement tree when selected. -+ *

    -+ * This only affects root advancements without any parent. If the background -+ * is not specified or doesn't exist, the tab background will be the missing -+ * texture. -+ * -+ * @return the background texture path -+ */ -+ @Nullable -+ NamespacedKey backgroundPath(); -+ -+ /** -+ * Gets the formatted display name for this display. This -+ * is a part of the component that would be shown in chat when a player -+ * completes the advancement. -+ * -+ * @return the display name -+ * @see org.bukkit.advancement.Advancement#displayName() -+ */ -+ @NotNull Component displayName(); -+ -+ /** -+ * Defines how the {@link #icon()} appears in the advancements screen and -+ * the color used with the {@link #title() advancement name}. -+ */ -+ enum Frame implements Translatable { -+ -+ /** -+ * "Challenge complete" advancement. -+ *

    -+ * The client will play the {@code ui.toast.challenge_complete} sound -+ * when the challenge is completed and the toast is shown. -+ */ -+ CHALLENGE("challenge", NamedTextColor.DARK_PURPLE), -+ -+ /** -+ * "Goal reached" advancement. -+ */ -+ GOAL("goal", NamedTextColor.GREEN), -+ -+ /** -+ * "Advancement made" advancement. -+ */ -+ TASK("task", NamedTextColor.GREEN); -+ -+ /** -+ * The name map. -+ */ -+ public static final Index NAMES = Index.create(Frame.class, frame -> frame.name); -+ private final String name; -+ private final TextColor color; -+ -+ Frame(String name, TextColor color) { -+ this.name = name; -+ this.color = color; -+ } -+ -+ /** -+ * Gets the {@link TextColor} used for the advancement name. -+ * -+ * @return the text color -+ */ -+ @NotNull -+ public TextColor color() { -+ return this.color; -+ } -+ -+ /** -+ * Gets the translation key used when an advancement is completed. -+ *

    -+ * This is the first line of the toast displayed by the client. -+ * -+ * @return the toast message key -+ */ -+ @Override -+ @NotNull -+ public String translationKey() { -+ return "advancements.toast." + this.name; -+ } -+ } -+} -diff --git a/src/main/java/org/bukkit/advancement/Advancement.java b/src/main/java/org/bukkit/advancement/Advancement.java -index 17527c2f7bd5b8a5528388a53f2472bc1869c7f3..243e5f2debad7f12210169e15ef0b29763e988bb 100644 ---- a/src/main/java/org/bukkit/advancement/Advancement.java -+++ b/src/main/java/org/bukkit/advancement/Advancement.java -@@ -19,13 +19,53 @@ public interface Advancement extends Keyed { - @NotNull - Collection getCriteria(); - -+ // Paper start - /** -- * Returns the display information for this advancement. -+ * Get the display info of this advancement. -+ *

    -+ * Will be {@code null} when totally hidden, for example with crafting -+ * recipes. - * -- * This includes it's name, description and other visible tags. -+ * @return the display info -+ */ -+ @Nullable -+ io.papermc.paper.advancement.AdvancementDisplay getDisplay(); -+ -+ /** -+ * Gets the formatted display name for this display. This -+ * is part of the component that would be shown in chat when a player -+ * completes the advancement. Will return the same as -+ * {@link io.papermc.paper.advancement.AdvancementDisplay#displayName()} when an -+ * {@link io.papermc.paper.advancement.AdvancementDisplay} is present. - * -- * @return a AdvancementDisplay object, or null if not set. -+ * @return the display name -+ * @see io.papermc.paper.advancement.AdvancementDisplay#displayName() -+ */ -+ @NotNull net.kyori.adventure.text.Component displayName(); -+ -+ /** -+ * Gets the parent advancement, if any. -+ * -+ * @return the parent advancement - */ - @Nullable -- AdvancementDisplay getDisplay(); -+ Advancement getParent(); -+ -+ /** -+ * Gets all the direct children advancements. -+ * -+ * @return the children advancements -+ */ -+ @NotNull -+ @org.jetbrains.annotations.Unmodifiable -+ Collection getChildren(); -+ -+ /** -+ * Gets the root advancement of the tree this is located in. -+ * -+ * @return the root advancement -+ */ -+ @NotNull -+ Advancement getRoot(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java -index 0ff86a39025a94ca128364a45bf171728cb81027..aec6be7e121da3eb8a464b6934da29ab6b473885 100644 ---- a/src/main/java/org/bukkit/advancement/AdvancementDisplay.java -+++ b/src/main/java/org/bukkit/advancement/AdvancementDisplay.java -@@ -5,7 +5,10 @@ import org.jetbrains.annotations.NotNull; - - /** - * Holds information about how the advancement is displayed by the game. -+ * -+ * @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay} - */ -+@Deprecated(forRemoval = true) // Paper - public interface AdvancementDisplay { - - /** -diff --git a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -index de767efb9f55448df061e166c66a2cf3439d57ec..06d8b72dd54becc13f40bd6e505115405462cd73 100644 ---- a/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -+++ b/src/main/java/org/bukkit/advancement/AdvancementDisplayType.java -@@ -8,7 +8,9 @@ import org.jetbrains.annotations.NotNull; - * - * This enum contains information about these types and how they are - * represented. -+ * @deprecated use {@link io.papermc.paper.advancement.AdvancementDisplay.Frame} - */ -+@Deprecated(forRemoval = true) - public enum AdvancementDisplayType { - - /** diff --git a/patches/api/0315-Fix-issues-with-mob-conversion.patch b/patches/api/0315-Fix-issues-with-mob-conversion.patch new file mode 100644 index 0000000000..f451d967b6 --- /dev/null +++ b/patches/api/0315-Fix-issues-with-mob-conversion.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 24 Oct 2021 20:29:27 -0700 +Subject: [PATCH] Fix issues with mob conversion + + +diff --git a/src/main/java/org/bukkit/entity/Hoglin.java b/src/main/java/org/bukkit/entity/Hoglin.java +index 83a9e06fe91bdfe74e771b170966c70e4c47893c..452a8e73fa084f29f3b96793d642bd8ec0bc8aac 100644 +--- a/src/main/java/org/bukkit/entity/Hoglin.java ++++ b/src/main/java/org/bukkit/entity/Hoglin.java +@@ -44,13 +44,17 @@ public interface Hoglin extends Animals, Enemy { + public int getConversionTime(); + + /** +- * Sets the amount of ticks until this entity will be converted to a Zoglin. ++ * Sets the conversion counter value. The counter is incremented ++ * every tick the method {@link #isConverting()} returns true. Setting ++ * this value will not start the conversion if the {@link Hoglin} is ++ * not in a valid environment ({@link org.bukkit.World#isPiglinSafe}) ++ * to convert, is immune to zombification ({@link #isImmuneToZombification()}) ++ * or has no AI ({@link #hasAI}). + * +- * When this reaches 0, the entity will be converted. A value of less than 0 +- * will stop the current conversion process without converting the current +- * entity. ++ * When this reaches 300, the entity will be converted. To stop the ++ * conversion use {@link #setImmuneToZombification(boolean)}. + * +- * @param time new conversion time ++ * @param time new conversion counter + */ + public void setConversionTime(int time); + +diff --git a/src/main/java/org/bukkit/entity/PiglinAbstract.java b/src/main/java/org/bukkit/entity/PiglinAbstract.java +index 87f4b7ad7c0a95a7123d142fa023c5da5c760341..eb2d6db81525d807d42b4c864d1340616424e6d9 100644 +--- a/src/main/java/org/bukkit/entity/PiglinAbstract.java ++++ b/src/main/java/org/bukkit/entity/PiglinAbstract.java +@@ -31,14 +31,17 @@ public interface PiglinAbstract extends Monster, Ageable { + public int getConversionTime(); + + /** +- * Sets the amount of ticks until this entity will be converted to a +- * Zombified Piglin. ++ * Sets the conversion counter value. The counter is incremented ++ * every tick the method {@link #isConverting()} returns true. Setting ++ * this value will not start the conversion if the {@link PiglinAbstract} is ++ * not in a valid environment ({@link org.bukkit.World#isPiglinSafe}) ++ * to convert, is immune to zombification ({@link #isImmuneToZombification()}) ++ * or has no AI ({@link #hasAI}). + * +- * When this reaches 0, the entity will be converted. A value of less than 0 +- * will stop the current conversion process without converting the current +- * entity. ++ * When this reaches 300, the entity will be converted. To stop the ++ * conversion use {@link #setImmuneToZombification(boolean)}. + * +- * @param time new conversion time ++ * @param time new conversion counter + */ + public void setConversionTime(int time); + diff --git a/patches/api/0316-Add-isCollidable-methods-to-various-places.patch b/patches/api/0316-Add-isCollidable-methods-to-various-places.patch new file mode 100644 index 0000000000..ac9d9e1907 --- /dev/null +++ b/patches/api/0316-Add-isCollidable-methods-to-various-places.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 4 Nov 2021 11:50:35 -0700 +Subject: [PATCH] Add isCollidable methods to various places + + +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 3cb658023d738617a310099fa3759af253a9f4c2..1ca448c9e3a3178663a033617d9414ec085c246a 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -4778,6 +4778,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + public Multimap getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { + return this.getDefaultAttributeModifiers(equipmentSlot); + } ++ ++ /** ++ * Checks if this material is collidable. ++ * ++ * @return true if collidable ++ * @throws IllegalArgumentException if {@link #isBlock()} is false ++ */ ++ public boolean isCollidable() { ++ return Bukkit.getUnsafe().isCollidable(this); ++ } + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 5028340475d3742ea407dfb70e0d2b2a3492dda3..c15456fd9801607f848867efdd782ffc4056305b 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -204,5 +204,14 @@ public interface UnsafeValues { + * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) + */ + @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); ++ ++ /** ++ * Checks if this material is collidable. ++ * ++ * @param material the material to check ++ * @return true if collidable ++ * @throws IllegalArgumentException if {@link Material#isBlock()} is false ++ */ ++ boolean isCollidable(@org.jetbrains.annotations.NotNull Material material); + // Paper end + } +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index b5fe76a6353816a2d009dfa5921f8ada92984f34..42cc4f2ee960c0abf9c6688aeee4150754612c32 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -482,6 +482,13 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr + * @return true if block is solid + */ + boolean isSolid(); ++ ++ /** ++ * Checks if this block is collidable. ++ * ++ * @return true if collidable ++ */ ++ boolean isCollidable(); + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java +index fd4a9bdcfb6775dfbdb7492e6c9eb90722d2ecdc..e573e70d9e74e444783a7363e6cdac126124d86d 100644 +--- a/src/main/java/org/bukkit/block/BlockState.java ++++ b/src/main/java/org/bukkit/block/BlockState.java +@@ -245,4 +245,13 @@ public interface BlockState extends Metadatable { + * or 'virtual' (e.g. on an itemstack) + */ + boolean isPlaced(); ++ ++ // Paper start ++ /** ++ * Checks if this block state is collidable. ++ * ++ * @return true if collidable ++ */ ++ boolean isCollidable(); ++ // Paper end + } diff --git a/patches/api/0316-Fix-issues-with-mob-conversion.patch b/patches/api/0316-Fix-issues-with-mob-conversion.patch deleted file mode 100644 index f451d967b6..0000000000 --- a/patches/api/0316-Fix-issues-with-mob-conversion.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 24 Oct 2021 20:29:27 -0700 -Subject: [PATCH] Fix issues with mob conversion - - -diff --git a/src/main/java/org/bukkit/entity/Hoglin.java b/src/main/java/org/bukkit/entity/Hoglin.java -index 83a9e06fe91bdfe74e771b170966c70e4c47893c..452a8e73fa084f29f3b96793d642bd8ec0bc8aac 100644 ---- a/src/main/java/org/bukkit/entity/Hoglin.java -+++ b/src/main/java/org/bukkit/entity/Hoglin.java -@@ -44,13 +44,17 @@ public interface Hoglin extends Animals, Enemy { - public int getConversionTime(); - - /** -- * Sets the amount of ticks until this entity will be converted to a Zoglin. -+ * Sets the conversion counter value. The counter is incremented -+ * every tick the method {@link #isConverting()} returns true. Setting -+ * this value will not start the conversion if the {@link Hoglin} is -+ * not in a valid environment ({@link org.bukkit.World#isPiglinSafe}) -+ * to convert, is immune to zombification ({@link #isImmuneToZombification()}) -+ * or has no AI ({@link #hasAI}). - * -- * When this reaches 0, the entity will be converted. A value of less than 0 -- * will stop the current conversion process without converting the current -- * entity. -+ * When this reaches 300, the entity will be converted. To stop the -+ * conversion use {@link #setImmuneToZombification(boolean)}. - * -- * @param time new conversion time -+ * @param time new conversion counter - */ - public void setConversionTime(int time); - -diff --git a/src/main/java/org/bukkit/entity/PiglinAbstract.java b/src/main/java/org/bukkit/entity/PiglinAbstract.java -index 87f4b7ad7c0a95a7123d142fa023c5da5c760341..eb2d6db81525d807d42b4c864d1340616424e6d9 100644 ---- a/src/main/java/org/bukkit/entity/PiglinAbstract.java -+++ b/src/main/java/org/bukkit/entity/PiglinAbstract.java -@@ -31,14 +31,17 @@ public interface PiglinAbstract extends Monster, Ageable { - public int getConversionTime(); - - /** -- * Sets the amount of ticks until this entity will be converted to a -- * Zombified Piglin. -+ * Sets the conversion counter value. The counter is incremented -+ * every tick the method {@link #isConverting()} returns true. Setting -+ * this value will not start the conversion if the {@link PiglinAbstract} is -+ * not in a valid environment ({@link org.bukkit.World#isPiglinSafe}) -+ * to convert, is immune to zombification ({@link #isImmuneToZombification()}) -+ * or has no AI ({@link #hasAI}). - * -- * When this reaches 0, the entity will be converted. A value of less than 0 -- * will stop the current conversion process without converting the current -- * entity. -+ * When this reaches 300, the entity will be converted. To stop the -+ * conversion use {@link #setImmuneToZombification(boolean)}. - * -- * @param time new conversion time -+ * @param time new conversion counter - */ - public void setConversionTime(int time); - diff --git a/patches/api/0317-Add-isCollidable-methods-to-various-places.patch b/patches/api/0317-Add-isCollidable-methods-to-various-places.patch deleted file mode 100644 index 0c56af5c5d..0000000000 --- a/patches/api/0317-Add-isCollidable-methods-to-various-places.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 4 Nov 2021 11:50:35 -0700 -Subject: [PATCH] Add isCollidable methods to various places - - -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 3cb658023d738617a310099fa3759af253a9f4c2..1ca448c9e3a3178663a033617d9414ec085c246a 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -4778,6 +4778,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - public Multimap getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { - return this.getDefaultAttributeModifiers(equipmentSlot); - } -+ -+ /** -+ * Checks if this material is collidable. -+ * -+ * @return true if collidable -+ * @throws IllegalArgumentException if {@link #isBlock()} is false -+ */ -+ public boolean isCollidable() { -+ return Bukkit.getUnsafe().isCollidable(this); -+ } - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index a846f3c6e8dceb90e42db903b8be2c248f2f9d5c..e1f9d80f0a6481824443339015049f96f3bf86f2 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -203,5 +203,14 @@ public interface UnsafeValues { - * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) - */ - @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); -+ -+ /** -+ * Checks if this material is collidable. -+ * -+ * @param material the material to check -+ * @return true if collidable -+ * @throws IllegalArgumentException if {@link Material#isBlock()} is false -+ */ -+ boolean isCollidable(@org.jetbrains.annotations.NotNull Material material); - // Paper end - } -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index b5fe76a6353816a2d009dfa5921f8ada92984f34..42cc4f2ee960c0abf9c6688aeee4150754612c32 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -482,6 +482,13 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - * @return true if block is solid - */ - boolean isSolid(); -+ -+ /** -+ * Checks if this block is collidable. -+ * -+ * @return true if collidable -+ */ -+ boolean isCollidable(); - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java -index fd4a9bdcfb6775dfbdb7492e6c9eb90722d2ecdc..e573e70d9e74e444783a7363e6cdac126124d86d 100644 ---- a/src/main/java/org/bukkit/block/BlockState.java -+++ b/src/main/java/org/bukkit/block/BlockState.java -@@ -245,4 +245,13 @@ public interface BlockState extends Metadatable { - * or 'virtual' (e.g. on an itemstack) - */ - boolean isPlaced(); -+ -+ // Paper start -+ /** -+ * Checks if this block state is collidable. -+ * -+ * @return true if collidable -+ */ -+ boolean isCollidable(); -+ // Paper end - } diff --git a/patches/api/0317-Goat-ram-API.patch b/patches/api/0317-Goat-ram-API.patch new file mode 100644 index 0000000000..06d426a786 --- /dev/null +++ b/patches/api/0317-Goat-ram-API.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Seggan +Date: Thu, 5 Aug 2021 13:10:31 -0400 +Subject: [PATCH] Goat ram API + + +diff --git a/src/main/java/org/bukkit/entity/Goat.java b/src/main/java/org/bukkit/entity/Goat.java +index 3a24f8cc7a6dee3da30a73f1294cccf03680bdd5..18e48bbb04076f1535b6a4c10e139908e82da44e 100644 +--- a/src/main/java/org/bukkit/entity/Goat.java ++++ b/src/main/java/org/bukkit/entity/Goat.java +@@ -52,4 +52,12 @@ public interface Goat extends Animals { + * @param screaming screaming status + */ + void setScreaming(boolean screaming); ++ ++ // Paper start - Goat ram API ++ /** ++ * Makes the goat ram at the specified entity ++ * @param entity the entity to ram at ++ */ ++ void ram(@org.jetbrains.annotations.NotNull LivingEntity entity); ++ // Paper end + } diff --git a/patches/api/0318-Add-API-for-resetting-a-single-score.patch b/patches/api/0318-Add-API-for-resetting-a-single-score.patch new file mode 100644 index 0000000000..14142e8f6c --- /dev/null +++ b/patches/api/0318-Add-API-for-resetting-a-single-score.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: booky10 +Date: Fri, 5 Nov 2021 21:01:36 +0100 +Subject: [PATCH] Add API for resetting a single score + +It was only possible to reset all scores for a specific entry, instead of resetting only specific scores. + +diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java +index 8579c4f5e877a0db6df52094f2f2d82920f3c869..1eaa9a93f8eff5f18a6cce2d74f21eb19db273c8 100644 +--- a/src/main/java/org/bukkit/scoreboard/Score.java ++++ b/src/main/java/org/bukkit/scoreboard/Score.java +@@ -73,4 +73,14 @@ public interface Score { + */ + @Nullable + Scoreboard getScoreboard(); ++ ++ // Paper start ++ /** ++ * Resets this score, if a value has been set. ++ * ++ * @throws IllegalStateException if the associated objective has been ++ * unregistered ++ */ ++ void resetScore() throws IllegalStateException; ++ // Paper end + } diff --git a/patches/api/0318-Goat-ram-API.patch b/patches/api/0318-Goat-ram-API.patch deleted file mode 100644 index 06d426a786..0000000000 --- a/patches/api/0318-Goat-ram-API.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Seggan -Date: Thu, 5 Aug 2021 13:10:31 -0400 -Subject: [PATCH] Goat ram API - - -diff --git a/src/main/java/org/bukkit/entity/Goat.java b/src/main/java/org/bukkit/entity/Goat.java -index 3a24f8cc7a6dee3da30a73f1294cccf03680bdd5..18e48bbb04076f1535b6a4c10e139908e82da44e 100644 ---- a/src/main/java/org/bukkit/entity/Goat.java -+++ b/src/main/java/org/bukkit/entity/Goat.java -@@ -52,4 +52,12 @@ public interface Goat extends Animals { - * @param screaming screaming status - */ - void setScreaming(boolean screaming); -+ -+ // Paper start - Goat ram API -+ /** -+ * Makes the goat ram at the specified entity -+ * @param entity the entity to ram at -+ */ -+ void ram(@org.jetbrains.annotations.NotNull LivingEntity entity); -+ // Paper end - } diff --git a/patches/api/0319-Add-API-for-resetting-a-single-score.patch b/patches/api/0319-Add-API-for-resetting-a-single-score.patch deleted file mode 100644 index 14142e8f6c..0000000000 --- a/patches/api/0319-Add-API-for-resetting-a-single-score.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: booky10 -Date: Fri, 5 Nov 2021 21:01:36 +0100 -Subject: [PATCH] Add API for resetting a single score - -It was only possible to reset all scores for a specific entry, instead of resetting only specific scores. - -diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java -index 8579c4f5e877a0db6df52094f2f2d82920f3c869..1eaa9a93f8eff5f18a6cce2d74f21eb19db273c8 100644 ---- a/src/main/java/org/bukkit/scoreboard/Score.java -+++ b/src/main/java/org/bukkit/scoreboard/Score.java -@@ -73,4 +73,14 @@ public interface Score { - */ - @Nullable - Scoreboard getScoreboard(); -+ -+ // Paper start -+ /** -+ * Resets this score, if a value has been set. -+ * -+ * @throws IllegalStateException if the associated objective has been -+ * unregistered -+ */ -+ void resetScore() throws IllegalStateException; -+ // Paper end - } diff --git a/patches/api/0319-Add-Raw-Byte-Entity-Serialization.patch b/patches/api/0319-Add-Raw-Byte-Entity-Serialization.patch new file mode 100644 index 0000000000..6c6c9a2f09 --- /dev/null +++ b/patches/api/0319-Add-Raw-Byte-Entity-Serialization.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Sun, 24 Oct 2021 16:19:26 -0400 +Subject: [PATCH] Add Raw Byte Entity Serialization + + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index c15456fd9801607f848867efdd782ffc4056305b..8d63016729fceec3392c81372778764f092c5b22 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -159,6 +159,14 @@ public interface UnsafeValues { + + ItemStack deserializeItem(byte[] data); + ++ byte[] serializeEntity(org.bukkit.entity.Entity entity); ++ ++ default org.bukkit.entity.Entity deserializeEntity(byte[] data, World world) { ++ return deserializeEntity(data, world, false); ++ } ++ ++ org.bukkit.entity.Entity deserializeEntity(byte[] data, World world, boolean preserveUUID); ++ + /** + * Creates and returns the next EntityId available. + *

    +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 795e799fec7cfd65a0e08bb3f941148d85ff4c3b..461a48f8aa049e9b9e13acca3d54978212d9688c 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -942,5 +942,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + @Deprecated + @NotNull Set getTrackedPlayers(); ++ ++ /** ++ * Spawns the entity in the world at the given {@link Location} with the default spawn reason. ++ *

    ++ * This will not spawn the entity if the entity is already spawned or has previously been despawned. ++ *

    ++ * Also, this method will fire the same events as a normal entity spawn. ++ * ++ * @param location The location to spawn the entity at. ++ * @return Whether the entity was successfully spawned. ++ */ ++ public default boolean spawnAt(@NotNull Location location) { ++ return spawnAt(location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT); ++ } ++ ++ /** ++ * Spawns the entity in the world at the given {@link Location} with the reason given. ++ *

    ++ * This will not spawn the entity if the entity is already spawned or has previously been despawned. ++ *

    ++ * Also, this method will fire the same events as a normal entity spawn. ++ * ++ * @param location The location to spawn the entity at. ++ * @param reason The reason for the entity being spawned. ++ * @return Whether the entity was successfully spawned. ++ */ ++ public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason); + // Paper end + } diff --git a/patches/api/0320-Add-PlayerItemFrameChangeEvent.patch b/patches/api/0320-Add-PlayerItemFrameChangeEvent.patch new file mode 100644 index 0000000000..b5d6cf7bd1 --- /dev/null +++ b/patches/api/0320-Add-PlayerItemFrameChangeEvent.patch @@ -0,0 +1,116 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SamB440 +Date: Mon, 15 Nov 2021 18:09:46 +0000 +Subject: [PATCH] Add PlayerItemFrameChangeEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f563552414488079e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java +@@ -0,0 +1,104 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.ItemFrame; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when an {@link ItemFrame} is having an item rotated, added, or removed from it. ++ */ ++public class PlayerItemFrameChangeEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final ItemFrame itemFrame; ++ private final ItemFrameChangeAction action; ++ private ItemStack itemStack; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerItemFrameChangeEvent(@NotNull Player player, @NotNull ItemFrame itemFrame, ++ @NotNull ItemStack itemStack, @NotNull ItemFrameChangeAction action) { ++ super(player); ++ this.itemFrame = itemFrame; ++ this.itemStack = itemStack; ++ this.action = action; ++ } ++ ++ /** ++ * Gets the {@link ItemFrame} involved in this event. ++ * ++ * @return the {@link ItemFrame} ++ */ ++ @NotNull ++ public ItemFrame getItemFrame() { ++ return this.itemFrame; ++ } ++ ++ /** ++ * Gets the {@link ItemStack} involved in this event. ++ * This is the item being added, rotated, or removed from the {@link ItemFrame}. ++ *

    ++ * If this method returns air, then the resulting item in the ItemFrame will be empty. ++ * ++ * @return the {@link ItemStack} being added, rotated, or removed ++ */ ++ @NotNull ++ public ItemStack getItemStack() { ++ return this.itemStack; ++ } ++ ++ /** ++ * Sets the {@link ItemStack} that this {@link ItemFrame} holds. ++ * If {@code null} is provided, the ItemStack will become air and the result in the ItemFrame will be empty. ++ * ++ * @param itemStack {@link ItemFrame} item ++ */ ++ public void setItemStack(@Nullable ItemStack itemStack) { ++ this.itemStack = itemStack == null ? ItemStack.empty() : itemStack; ++ } ++ ++ /** ++ * Gets the action that was performed on this {@link ItemFrame}. ++ * ++ * @return action performed on the item frame in this event ++ */ ++ @NotNull ++ public ItemFrameChangeAction getAction() { ++ return this.action; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ @NotNull ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ public enum ItemFrameChangeAction { ++ PLACE, ++ REMOVE, ++ ROTATE ++ } ++} diff --git a/patches/api/0320-Add-Raw-Byte-Entity-Serialization.patch b/patches/api/0320-Add-Raw-Byte-Entity-Serialization.patch deleted file mode 100644 index b0a70d977f..0000000000 --- a/patches/api/0320-Add-Raw-Byte-Entity-Serialization.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sun, 24 Oct 2021 16:19:26 -0400 -Subject: [PATCH] Add Raw Byte Entity Serialization - - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index e1f9d80f0a6481824443339015049f96f3bf86f2..9245f50b2bac30e956ef6ddc11c551b9b68463ee 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -158,6 +158,14 @@ public interface UnsafeValues { - - ItemStack deserializeItem(byte[] data); - -+ byte[] serializeEntity(org.bukkit.entity.Entity entity); -+ -+ default org.bukkit.entity.Entity deserializeEntity(byte[] data, World world) { -+ return deserializeEntity(data, world, false); -+ } -+ -+ org.bukkit.entity.Entity deserializeEntity(byte[] data, World world, boolean preserveUUID); -+ - /** - * Creates and returns the next EntityId available. - *

    -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 795e799fec7cfd65a0e08bb3f941148d85ff4c3b..461a48f8aa049e9b9e13acca3d54978212d9688c 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -942,5 +942,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - @Deprecated - @NotNull Set getTrackedPlayers(); -+ -+ /** -+ * Spawns the entity in the world at the given {@link Location} with the default spawn reason. -+ *

    -+ * This will not spawn the entity if the entity is already spawned or has previously been despawned. -+ *

    -+ * Also, this method will fire the same events as a normal entity spawn. -+ * -+ * @param location The location to spawn the entity at. -+ * @return Whether the entity was successfully spawned. -+ */ -+ public default boolean spawnAt(@NotNull Location location) { -+ return spawnAt(location, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT); -+ } -+ -+ /** -+ * Spawns the entity in the world at the given {@link Location} with the reason given. -+ *

    -+ * This will not spawn the entity if the entity is already spawned or has previously been despawned. -+ *

    -+ * Also, this method will fire the same events as a normal entity spawn. -+ * -+ * @param location The location to spawn the entity at. -+ * @param reason The reason for the entity being spawned. -+ * @return Whether the entity was successfully spawned. -+ */ -+ public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason); - // Paper end - } diff --git a/patches/api/0321-Add-PlayerItemFrameChangeEvent.patch b/patches/api/0321-Add-PlayerItemFrameChangeEvent.patch deleted file mode 100644 index b5d6cf7bd1..0000000000 --- a/patches/api/0321-Add-PlayerItemFrameChangeEvent.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SamB440 -Date: Mon, 15 Nov 2021 18:09:46 +0000 -Subject: [PATCH] Add PlayerItemFrameChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7bd61b66db42ecc8c9a3a16f563552414488079e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java -@@ -0,0 +1,104 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.ItemFrame; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when an {@link ItemFrame} is having an item rotated, added, or removed from it. -+ */ -+public class PlayerItemFrameChangeEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemFrame itemFrame; -+ private final ItemFrameChangeAction action; -+ private ItemStack itemStack; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerItemFrameChangeEvent(@NotNull Player player, @NotNull ItemFrame itemFrame, -+ @NotNull ItemStack itemStack, @NotNull ItemFrameChangeAction action) { -+ super(player); -+ this.itemFrame = itemFrame; -+ this.itemStack = itemStack; -+ this.action = action; -+ } -+ -+ /** -+ * Gets the {@link ItemFrame} involved in this event. -+ * -+ * @return the {@link ItemFrame} -+ */ -+ @NotNull -+ public ItemFrame getItemFrame() { -+ return this.itemFrame; -+ } -+ -+ /** -+ * Gets the {@link ItemStack} involved in this event. -+ * This is the item being added, rotated, or removed from the {@link ItemFrame}. -+ *

    -+ * If this method returns air, then the resulting item in the ItemFrame will be empty. -+ * -+ * @return the {@link ItemStack} being added, rotated, or removed -+ */ -+ @NotNull -+ public ItemStack getItemStack() { -+ return this.itemStack; -+ } -+ -+ /** -+ * Sets the {@link ItemStack} that this {@link ItemFrame} holds. -+ * If {@code null} is provided, the ItemStack will become air and the result in the ItemFrame will be empty. -+ * -+ * @param itemStack {@link ItemFrame} item -+ */ -+ public void setItemStack(@Nullable ItemStack itemStack) { -+ this.itemStack = itemStack == null ? ItemStack.empty() : itemStack; -+ } -+ -+ /** -+ * Gets the action that was performed on this {@link ItemFrame}. -+ * -+ * @return action performed on the item frame in this event -+ */ -+ @NotNull -+ public ItemFrameChangeAction getAction() { -+ return this.action; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ @NotNull -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ public enum ItemFrameChangeAction { -+ PLACE, -+ REMOVE, -+ ROTATE -+ } -+} diff --git a/patches/api/0321-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/api/0321-Allow-delegation-to-vanilla-chunk-gen.patch new file mode 100644 index 0000000000..bf74f046a9 --- /dev/null +++ b/patches/api/0321-Allow-delegation-to-vanilla-chunk-gen.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MiniDigger +Date: Wed, 29 Apr 2020 02:09:17 +0200 +Subject: [PATCH] Allow delegation to vanilla chunk gen + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index e62d46629305a268906cd2cd5d5977d063c2f484..8f88dc00c73810560070195fcf6e0f955e4ebdde 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2105,6 +2105,24 @@ public final class Bukkit { + return server.createChunkData(world); + } + ++ // Paper start ++ /** ++ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world ++ * ++ * @param world the world to create the ChunkData for ++ * @param x the x coordinate of the chunk ++ * @param z the z coordinate of the chunk ++ * @return a new ChunkData for the world ++ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to ++ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation. ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ public static ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { ++ return server.createVanillaChunkData(world, x, z); ++ } ++ // Paper end ++ + /** + * Creates a boss bar instance to display to players. The progress + * defaults to 1.0 +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 7b6342a3d6ae0716876c958ef6029d5a6dc233bb..93626d79971125abd115ad7577fdee1d9fdd1f1f 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1779,6 +1779,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @NotNull + public ChunkGenerator.ChunkData createChunkData(@NotNull World world); + ++ // Paper start ++ /** ++ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world. ++ * ++ * @param world the world to create the ChunkData for ++ * @param x the x coordinate of the chunk ++ * @param z the z coordinate of the chunk ++ * @return a new ChunkData for the world ++ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to ++ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation. ++ */ ++ @NotNull ++ @Deprecated(forRemoval = true) ++ ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z); ++ // Paper end ++ + /** + * Creates a boss bar instance to display to players. The progress + * defaults to 1.0 +diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java +index 7e7a53b41013f1bf8956c0e278820f18d77b2f0d..c942b7101a38ac7dc70e11e87afa1f9210000bc1 100644 +--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java ++++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java +@@ -577,6 +577,22 @@ public abstract class ChunkGenerator { + return false; + } + ++ // Paper start ++ /** ++ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world ++ * ++ * @param world the world to create the ChunkData for ++ * @param x the x coordinate of the chunk ++ * @param z the z coordinate of the chunk ++ * @return a new ChunkData for the world ++ * ++ */ ++ @NotNull ++ public ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { ++ return Bukkit.getServer().createVanillaChunkData(world, x, z); ++ } ++ // Paper end ++ + /** + * Gets if the server should generate Vanilla structures after this + * ChunkGenerator. diff --git a/patches/api/0322-Add-more-Campfire-API.patch b/patches/api/0322-Add-more-Campfire-API.patch new file mode 100644 index 0000000000..80cdc0bb39 --- /dev/null +++ b/patches/api/0322-Add-more-Campfire-API.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: LemonCaramel +Date: Fri, 16 Jul 2021 00:38:52 +0900 +Subject: [PATCH] Add more Campfire API + + +diff --git a/src/main/java/org/bukkit/block/Campfire.java b/src/main/java/org/bukkit/block/Campfire.java +index f8a344cabb7b5a6d1c5409798a0a98b023bcd756..9c3952459ed216f727b3654b2ed536f17f320402 100644 +--- a/src/main/java/org/bukkit/block/Campfire.java ++++ b/src/main/java/org/bukkit/block/Campfire.java +@@ -69,4 +69,40 @@ public interface Campfire extends TileState { + * @param cookTimeTotal Cook time total + */ + void setCookTimeTotal(int index, int cookTimeTotal); ++ ++ // Paper start ++ /** ++ * Disable cooking in all slots. ++ */ ++ void stopCooking(); ++ ++ /** ++ * Re-enable cooking in all slots. ++ */ ++ void startCooking(); ++ ++ /** ++ * Disable cooking in the specified slot index. ++ * ++ * @param index item slot index ++ * @return whether the slot had cooking enabled before this call ++ */ ++ boolean stopCooking(int index); ++ ++ /** ++ * Re-enable cooking in the specified slot index. ++ * ++ * @param index item slot index ++ * @return whether the slot couldn't cook before this call ++ */ ++ boolean startCooking(int index); ++ ++ /** ++ * State of slot index. ++ * ++ * @param index item slot index ++ * @return {@code true} if the specified slot index cannot cook ++ */ ++ boolean isCookingDisabled(int index); ++ // Paper end + } diff --git a/patches/api/0322-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/api/0322-Allow-delegation-to-vanilla-chunk-gen.patch deleted file mode 100644 index 664279d84f..0000000000 --- a/patches/api/0322-Allow-delegation-to-vanilla-chunk-gen.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MiniDigger -Date: Wed, 29 Apr 2020 02:09:17 +0200 -Subject: [PATCH] Allow delegation to vanilla chunk gen - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index c3d3c7d05a03658157d49c6ff1ea1d7d085a6fd4..fa7a63ea108971790c28c4f32d280ee6f2a86c0b 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2105,6 +2105,24 @@ public final class Bukkit { - return server.createChunkData(world); - } - -+ // Paper start -+ /** -+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world -+ * -+ * @param world the world to create the ChunkData for -+ * @param x the x coordinate of the chunk -+ * @param z the z coordinate of the chunk -+ * @return a new ChunkData for the world -+ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to -+ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation. -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ public static ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { -+ return server.createVanillaChunkData(world, x, z); -+ } -+ // Paper end -+ - /** - * Creates a boss bar instance to display to players. The progress - * defaults to 1.0 -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 61ee087ec4a75ee8b10e204b4cdd1bab5f066819..90b1368303562e1b4af2e658e60ac564bd49ad5f 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -1779,6 +1779,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public ChunkGenerator.ChunkData createChunkData(@NotNull World world); - -+ // Paper start -+ /** -+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world. -+ * -+ * @param world the world to create the ChunkData for -+ * @param x the x coordinate of the chunk -+ * @param z the z coordinate of the chunk -+ * @return a new ChunkData for the world -+ * @deprecated The new multi-stage worldgen API allows a similar effect by overriding all of the "shouldGenerate..." methods to -+ * return true, and then modifying the chunkdata in a later stage such as surface or bedrock generation. -+ */ -+ @NotNull -+ @Deprecated(forRemoval = true) -+ ChunkGenerator.ChunkData createVanillaChunkData(@NotNull World world, int x, int z); -+ // Paper end -+ - /** - * Creates a boss bar instance to display to players. The progress - * defaults to 1.0 -diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java -index 7e7a53b41013f1bf8956c0e278820f18d77b2f0d..c942b7101a38ac7dc70e11e87afa1f9210000bc1 100644 ---- a/src/main/java/org/bukkit/generator/ChunkGenerator.java -+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java -@@ -577,6 +577,22 @@ public abstract class ChunkGenerator { - return false; - } - -+ // Paper start -+ /** -+ * Create a ChunkData for use in a generator, that is populated by the vanilla generator for that world -+ * -+ * @param world the world to create the ChunkData for -+ * @param x the x coordinate of the chunk -+ * @param z the z coordinate of the chunk -+ * @return a new ChunkData for the world -+ * -+ */ -+ @NotNull -+ public ChunkData createVanillaChunkData(@NotNull World world, int x, int z) { -+ return Bukkit.getServer().createVanillaChunkData(world, x, z); -+ } -+ // Paper end -+ - /** - * Gets if the server should generate Vanilla structures after this - * ChunkGenerator. diff --git a/patches/api/0323-Add-more-Campfire-API.patch b/patches/api/0323-Add-more-Campfire-API.patch deleted file mode 100644 index 80cdc0bb39..0000000000 --- a/patches/api/0323-Add-more-Campfire-API.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: LemonCaramel -Date: Fri, 16 Jul 2021 00:38:52 +0900 -Subject: [PATCH] Add more Campfire API - - -diff --git a/src/main/java/org/bukkit/block/Campfire.java b/src/main/java/org/bukkit/block/Campfire.java -index f8a344cabb7b5a6d1c5409798a0a98b023bcd756..9c3952459ed216f727b3654b2ed536f17f320402 100644 ---- a/src/main/java/org/bukkit/block/Campfire.java -+++ b/src/main/java/org/bukkit/block/Campfire.java -@@ -69,4 +69,40 @@ public interface Campfire extends TileState { - * @param cookTimeTotal Cook time total - */ - void setCookTimeTotal(int index, int cookTimeTotal); -+ -+ // Paper start -+ /** -+ * Disable cooking in all slots. -+ */ -+ void stopCooking(); -+ -+ /** -+ * Re-enable cooking in all slots. -+ */ -+ void startCooking(); -+ -+ /** -+ * Disable cooking in the specified slot index. -+ * -+ * @param index item slot index -+ * @return whether the slot had cooking enabled before this call -+ */ -+ boolean stopCooking(int index); -+ -+ /** -+ * Re-enable cooking in the specified slot index. -+ * -+ * @param index item slot index -+ * @return whether the slot couldn't cook before this call -+ */ -+ boolean startCooking(int index); -+ -+ /** -+ * State of slot index. -+ * -+ * @param index item slot index -+ * @return {@code true} if the specified slot index cannot cook -+ */ -+ boolean isCookingDisabled(int index); -+ // Paper end - } diff --git a/patches/api/0323-Extend-VehicleCollisionEvent-move-HandlerList-up.patch b/patches/api/0323-Extend-VehicleCollisionEvent-move-HandlerList-up.patch new file mode 100644 index 0000000000..5f5a4f4140 --- /dev/null +++ b/patches/api/0323-Extend-VehicleCollisionEvent-move-HandlerList-up.patch @@ -0,0 +1,111 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 13 Dec 2021 14:35:27 -0800 +Subject: [PATCH] Extend VehicleCollisionEvent, move HandlerList up + +Co-authored-by: SoSeDiK + +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java +index 316f625aa595d2ada16529b16d09f013fc4daeac..d0a437bd8aeec18f800893f51ece06deb0c8972c 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java +@@ -9,13 +9,31 @@ import org.jetbrains.annotations.NotNull; + * Raised when a vehicle collides with a block. + */ + public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { +- private static final HandlerList handlers = new HandlerList(); + private final Block block; ++ private final org.bukkit.util.Vector velocity; // Paper + ++ // Paper start - Add pre-collision velocity ++ @Deprecated + public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block) { ++ this(vehicle, block, vehicle.getVelocity()); ++ } ++ ++ public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block, @NotNull final org.bukkit.util.Vector velocity) { // Paper - Added velocity + super(vehicle); + this.block = block; ++ this.velocity = velocity; ++ } ++ ++ /** ++ * Gets velocity at which the vehicle collided with the block ++ * ++ * @return pre-collision moving velocity ++ */ ++ @NotNull ++ public org.bukkit.util.Vector getVelocity() { ++ return velocity; + } ++ // Paper end + + /** + * Gets the block the vehicle collided with +@@ -26,15 +44,4 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { + public Block getBlock() { + return block; + } +- +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } + } +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java +index 9d493c155ad5c26430c1e404fcf0db5f734679e4..aa1d74eade479195bde8095aafcc91a83635102d 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java +@@ -7,7 +7,18 @@ import org.jetbrains.annotations.NotNull; + * Raised when a vehicle collides. + */ + public abstract class VehicleCollisionEvent extends VehicleEvent { ++ private static final org.bukkit.event.HandlerList HANDLER_LIST = new org.bukkit.event.HandlerList(); // Paper + public VehicleCollisionEvent(@NotNull final Vehicle vehicle) { + super(vehicle); + } ++ // Paper start ++ @Override ++ public org.bukkit.event.@org.jetbrains.annotations.NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static org.bukkit.event.@NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java +index 50c762d777ac90a05772501a28cacff8fd3f5126..77fb04bdf5b1a6d94693a7374a750e020131dc3d 100644 +--- a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java ++++ b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java +@@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; + * Raised when a vehicle collides with an entity. + */ + public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implements Cancellable { +- private static final HandlerList handlers = new HandlerList(); + private final Entity entity; + private boolean cancelled = false; + private boolean cancelledPickup = false; +@@ -55,15 +54,4 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement + public void setCollisionCancelled(boolean cancel) { + cancelledCollision = cancel; + } +- +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } + } diff --git a/patches/api/0324-Extend-VehicleCollisionEvent-move-HandlerList-up.patch b/patches/api/0324-Extend-VehicleCollisionEvent-move-HandlerList-up.patch deleted file mode 100644 index 5f5a4f4140..0000000000 --- a/patches/api/0324-Extend-VehicleCollisionEvent-move-HandlerList-up.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 13 Dec 2021 14:35:27 -0800 -Subject: [PATCH] Extend VehicleCollisionEvent, move HandlerList up - -Co-authored-by: SoSeDiK - -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java -index 316f625aa595d2ada16529b16d09f013fc4daeac..d0a437bd8aeec18f800893f51ece06deb0c8972c 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleBlockCollisionEvent.java -@@ -9,13 +9,31 @@ import org.jetbrains.annotations.NotNull; - * Raised when a vehicle collides with a block. - */ - public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { -- private static final HandlerList handlers = new HandlerList(); - private final Block block; -+ private final org.bukkit.util.Vector velocity; // Paper - -+ // Paper start - Add pre-collision velocity -+ @Deprecated - public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block) { -+ this(vehicle, block, vehicle.getVelocity()); -+ } -+ -+ public VehicleBlockCollisionEvent(@NotNull final Vehicle vehicle, @NotNull final Block block, @NotNull final org.bukkit.util.Vector velocity) { // Paper - Added velocity - super(vehicle); - this.block = block; -+ this.velocity = velocity; -+ } -+ -+ /** -+ * Gets velocity at which the vehicle collided with the block -+ * -+ * @return pre-collision moving velocity -+ */ -+ @NotNull -+ public org.bukkit.util.Vector getVelocity() { -+ return velocity; - } -+ // Paper end - - /** - * Gets the block the vehicle collided with -@@ -26,15 +44,4 @@ public class VehicleBlockCollisionEvent extends VehicleCollisionEvent { - public Block getBlock() { - return block; - } -- -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } - } -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java -index 9d493c155ad5c26430c1e404fcf0db5f734679e4..aa1d74eade479195bde8095aafcc91a83635102d 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleCollisionEvent.java -@@ -7,7 +7,18 @@ import org.jetbrains.annotations.NotNull; - * Raised when a vehicle collides. - */ - public abstract class VehicleCollisionEvent extends VehicleEvent { -+ private static final org.bukkit.event.HandlerList HANDLER_LIST = new org.bukkit.event.HandlerList(); // Paper - public VehicleCollisionEvent(@NotNull final Vehicle vehicle) { - super(vehicle); - } -+ // Paper start -+ @Override -+ public org.bukkit.event.@org.jetbrains.annotations.NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static org.bukkit.event.@NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java -index 50c762d777ac90a05772501a28cacff8fd3f5126..77fb04bdf5b1a6d94693a7374a750e020131dc3d 100644 ---- a/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java -+++ b/src/main/java/org/bukkit/event/vehicle/VehicleEntityCollisionEvent.java -@@ -10,7 +10,6 @@ import org.jetbrains.annotations.NotNull; - * Raised when a vehicle collides with an entity. - */ - public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); - private final Entity entity; - private boolean cancelled = false; - private boolean cancelledPickup = false; -@@ -55,15 +54,4 @@ public class VehicleEntityCollisionEvent extends VehicleCollisionEvent implement - public void setCollisionCancelled(boolean cancel) { - cancelledCollision = cancel; - } -- -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } - } diff --git a/patches/api/0324-Improve-scoreboard-entries.patch b/patches/api/0324-Improve-scoreboard-entries.patch new file mode 100644 index 0000000000..d6e077bd86 --- /dev/null +++ b/patches/api/0324-Improve-scoreboard-entries.patch @@ -0,0 +1,191 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 4 Nov 2021 12:31:45 -0700 +Subject: [PATCH] Improve scoreboard entries + + +diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java +index a625bcab8e77b05b3341a52c708fae1542b7e3d5..a193ffabb05160b462dee1ba8f687fdbc84405b6 100644 +--- a/src/main/java/org/bukkit/scoreboard/Objective.java ++++ b/src/main/java/org/bukkit/scoreboard/Objective.java +@@ -148,9 +148,8 @@ public interface Objective { + * @return Score tracking the Objective and player specified + * @throws IllegalStateException if this objective has been unregistered + * @see #getScore(String) +- * @deprecated Scoreboards can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + @NotNull + Score getScore(@NotNull OfflinePlayer player); + +@@ -164,4 +163,16 @@ public interface Objective { + */ + @NotNull + Score getScore(@NotNull String entry); ++ ++ // Paper start - improve scoreboard entries ++ /** ++ * Gets an entity's Score for an Objective on this Scoreboard. ++ * ++ * @param entity Entity for the Score ++ * @return Score tracking the Objective and entity specified ++ * @throws IllegalArgumentException if entity is null ++ * @throws IllegalStateException if this objective has been unregistered ++ */ ++ @NotNull Score getScoreFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException; ++ // Paper end - improve scoreboard entries + } +diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java +index 3377511e1a6dd4aeb78871e47169d5bd9456c1aa..4a59f2734833cf39800b9aafbc1c5c6953c2d8f3 100644 +--- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java ++++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java +@@ -215,9 +215,8 @@ public interface Scoreboard { + * @param player the player whose scores are being retrieved + * @return immutable set of all scores tracked for the player + * @see #getScores(String) +- * @deprecated Scoreboards can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + @NotNull + Set getScores(@NotNull OfflinePlayer player); + +@@ -235,9 +234,8 @@ public interface Scoreboard { + * + * @param player the player to drop all current scores for + * @see #resetScores(String) +- * @deprecated Scoreboards can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + void resetScores(@NotNull OfflinePlayer player); + + /** +@@ -253,9 +251,8 @@ public interface Scoreboard { + * @param player the player to search for + * @return the player's Team or null if the player is not on a team + * @see #getEntryTeam(String) +- * @deprecated Scoreboards can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + @Nullable + Team getPlayerTeam(@NotNull OfflinePlayer player); + +@@ -320,4 +317,35 @@ public interface Scoreboard { + * @param slot the slot to remove objectives + */ + void clearSlot(@NotNull DisplaySlot slot); ++ ++ // Paper start - improve scoreboard entries ++ /** ++ * Gets all scores for an entity on this Scoreboard ++ * ++ * @param entity the entity whose scores are being retrieved ++ * @return immutable set of all scores tracked for the entity ++ * @throws IllegalArgumentException if entity is null ++ * @see #getScores(String) ++ */ ++ @NotNull Set getScoresFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException; ++ ++ /** ++ * Removes all scores for an entity on this Scoreboard ++ * ++ * @param entity the entity to drop all current scores for ++ * @throws IllegalArgumentException if entity is null ++ * @see #resetScores(String) ++ */ ++ void resetScoresFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException; ++ ++ /** ++ * Gets an entity's Team on this Scoreboard ++ * ++ * @param entity the entity to search for ++ * @return the entity's Team or null if the entity is not on a team ++ * @throws IllegalArgumentException if entity is null ++ * @see #getEntryTeam(String) ++ */ ++ @Nullable Team getEntityTeam(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException; ++ // Paper end - improve scoreboard entries + } +diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java +index 4d2b8e10263802432dfeac72666487f9547cd2c5..dff76db4a4c37c760144f00c1aa8f2bcac45ba1f 100644 +--- a/src/main/java/org/bukkit/scoreboard/Team.java ++++ b/src/main/java/org/bukkit/scoreboard/Team.java +@@ -295,9 +295,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { + * @param player the player to add + * @throws IllegalStateException if this team has been unregistered + * @see #addEntry(String) +- * @deprecated Teams can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + void addPlayer(@NotNull OfflinePlayer player); + + /** +@@ -317,9 +316,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { + * @return if the player was on this team + * @throws IllegalStateException if this team has been unregistered + * @see #removeEntry(String) +- * @deprecated Teams can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + boolean removePlayer(@NotNull OfflinePlayer player); + + /** +@@ -345,9 +343,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { + * @return true if the player is a member of this team + * @throws IllegalStateException if this team has been unregistered + * @see #hasEntry(String) +- * @deprecated Teams can contain entries that aren't players + */ +- @Deprecated ++ // @Deprecated // Paper + boolean hasPlayer(@NotNull OfflinePlayer player); + /** + * Checks to see if the specified entry is a member of this team. +@@ -377,6 +374,42 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { + */ + void setOption(@NotNull Option option, @NotNull OptionStatus status); + ++ // Paper start - improve scoreboard entries ++ /** ++ * This puts the specified entity onto this team for the scoreboard. ++ *

    ++ * This will remove the entity from any other team on the scoreboard. ++ * ++ * @param entity the entity to add ++ * @throws IllegalArgumentException if entity is null ++ * @throws IllegalStateException if this team has been unregistered ++ * @see #addEntry(String) ++ */ ++ void addEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException; ++ ++ /** ++ * Removes the entity from this team. ++ * ++ * @param entity the entity to remove ++ * @return if the entity was on this team ++ * @throws IllegalArgumentException if entity is null ++ * @throws IllegalStateException if this team has been unregistered ++ * @see #removeEntry(String) ++ */ ++ boolean removeEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException; ++ ++ /** ++ * Checks to see if the specified entity is a member of this team. ++ * ++ * @param entity the entity to search for ++ * @return true if the entity is a member of this team ++ * @throws IllegalArgumentException if entity is null ++ * @throws IllegalStateException if this team has been unregistered ++ * @see #hasEntry(String) ++ */ ++ boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException; ++ // Paper end - improve scoreboard entries ++ + /** + * Represents an option which may be applied to this team. + */ diff --git a/patches/api/0325-Entity-powdered-snow-API.patch b/patches/api/0325-Entity-powdered-snow-API.patch new file mode 100644 index 0000000000..b00af3e946 --- /dev/null +++ b/patches/api/0325-Entity-powdered-snow-API.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 24 Oct 2021 20:58:52 -0700 +Subject: [PATCH] Entity powdered snow API + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 461a48f8aa049e9b9e13acca3d54978212d9688c..1cfeb862f6a036cfd68b60cdc2364834f353f4b4 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -969,5 +969,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * @return Whether the entity was successfully spawned. + */ + public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason); ++ ++ /** ++ * Check if entity is inside powdered snow. ++ * ++ * @return true if in powdered snow. ++ */ ++ boolean isInPowderedSnow(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java +index e0ccc090a0be507ced4d5669491311e410f60a67..472a71ca8dad0d49f0723e5fdf58bf00a55190f2 100644 +--- a/src/main/java/org/bukkit/entity/Skeleton.java ++++ b/src/main/java/org/bukkit/entity/Skeleton.java +@@ -41,6 +41,16 @@ public interface Skeleton extends AbstractSkeleton { + */ + void setConversionTime(int time); + ++ // Paper start ++ /** ++ * Gets the time the skeleton ++ * has been inside powdered snow. ++ * ++ * @return time in ticks ++ */ ++ int inPowderedSnowTime(); ++ // Paper end ++ + /** + * A legacy enum that defines the different variances of skeleton-like + * entities on the server. diff --git a/patches/api/0325-Improve-scoreboard-entries.patch b/patches/api/0325-Improve-scoreboard-entries.patch deleted file mode 100644 index d6e077bd86..0000000000 --- a/patches/api/0325-Improve-scoreboard-entries.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 4 Nov 2021 12:31:45 -0700 -Subject: [PATCH] Improve scoreboard entries - - -diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java -index a625bcab8e77b05b3341a52c708fae1542b7e3d5..a193ffabb05160b462dee1ba8f687fdbc84405b6 100644 ---- a/src/main/java/org/bukkit/scoreboard/Objective.java -+++ b/src/main/java/org/bukkit/scoreboard/Objective.java -@@ -148,9 +148,8 @@ public interface Objective { - * @return Score tracking the Objective and player specified - * @throws IllegalStateException if this objective has been unregistered - * @see #getScore(String) -- * @deprecated Scoreboards can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - @NotNull - Score getScore(@NotNull OfflinePlayer player); - -@@ -164,4 +163,16 @@ public interface Objective { - */ - @NotNull - Score getScore(@NotNull String entry); -+ -+ // Paper start - improve scoreboard entries -+ /** -+ * Gets an entity's Score for an Objective on this Scoreboard. -+ * -+ * @param entity Entity for the Score -+ * @return Score tracking the Objective and entity specified -+ * @throws IllegalArgumentException if entity is null -+ * @throws IllegalStateException if this objective has been unregistered -+ */ -+ @NotNull Score getScoreFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException, IllegalStateException; -+ // Paper end - improve scoreboard entries - } -diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java -index 3377511e1a6dd4aeb78871e47169d5bd9456c1aa..4a59f2734833cf39800b9aafbc1c5c6953c2d8f3 100644 ---- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java -+++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java -@@ -215,9 +215,8 @@ public interface Scoreboard { - * @param player the player whose scores are being retrieved - * @return immutable set of all scores tracked for the player - * @see #getScores(String) -- * @deprecated Scoreboards can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - @NotNull - Set getScores(@NotNull OfflinePlayer player); - -@@ -235,9 +234,8 @@ public interface Scoreboard { - * - * @param player the player to drop all current scores for - * @see #resetScores(String) -- * @deprecated Scoreboards can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - void resetScores(@NotNull OfflinePlayer player); - - /** -@@ -253,9 +251,8 @@ public interface Scoreboard { - * @param player the player to search for - * @return the player's Team or null if the player is not on a team - * @see #getEntryTeam(String) -- * @deprecated Scoreboards can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - @Nullable - Team getPlayerTeam(@NotNull OfflinePlayer player); - -@@ -320,4 +317,35 @@ public interface Scoreboard { - * @param slot the slot to remove objectives - */ - void clearSlot(@NotNull DisplaySlot slot); -+ -+ // Paper start - improve scoreboard entries -+ /** -+ * Gets all scores for an entity on this Scoreboard -+ * -+ * @param entity the entity whose scores are being retrieved -+ * @return immutable set of all scores tracked for the entity -+ * @throws IllegalArgumentException if entity is null -+ * @see #getScores(String) -+ */ -+ @NotNull Set getScoresFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException; -+ -+ /** -+ * Removes all scores for an entity on this Scoreboard -+ * -+ * @param entity the entity to drop all current scores for -+ * @throws IllegalArgumentException if entity is null -+ * @see #resetScores(String) -+ */ -+ void resetScoresFor(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException; -+ -+ /** -+ * Gets an entity's Team on this Scoreboard -+ * -+ * @param entity the entity to search for -+ * @return the entity's Team or null if the entity is not on a team -+ * @throws IllegalArgumentException if entity is null -+ * @see #getEntryTeam(String) -+ */ -+ @Nullable Team getEntityTeam(@NotNull org.bukkit.entity.Entity entity) throws IllegalArgumentException; -+ // Paper end - improve scoreboard entries - } -diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java -index 4d2b8e10263802432dfeac72666487f9547cd2c5..dff76db4a4c37c760144f00c1aa8f2bcac45ba1f 100644 ---- a/src/main/java/org/bukkit/scoreboard/Team.java -+++ b/src/main/java/org/bukkit/scoreboard/Team.java -@@ -295,9 +295,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { - * @param player the player to add - * @throws IllegalStateException if this team has been unregistered - * @see #addEntry(String) -- * @deprecated Teams can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - void addPlayer(@NotNull OfflinePlayer player); - - /** -@@ -317,9 +316,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { - * @return if the player was on this team - * @throws IllegalStateException if this team has been unregistered - * @see #removeEntry(String) -- * @deprecated Teams can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - boolean removePlayer(@NotNull OfflinePlayer player); - - /** -@@ -345,9 +343,8 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { - * @return true if the player is a member of this team - * @throws IllegalStateException if this team has been unregistered - * @see #hasEntry(String) -- * @deprecated Teams can contain entries that aren't players - */ -- @Deprecated -+ // @Deprecated // Paper - boolean hasPlayer(@NotNull OfflinePlayer player); - /** - * Checks to see if the specified entry is a member of this team. -@@ -377,6 +374,42 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { - */ - void setOption(@NotNull Option option, @NotNull OptionStatus status); - -+ // Paper start - improve scoreboard entries -+ /** -+ * This puts the specified entity onto this team for the scoreboard. -+ *

    -+ * This will remove the entity from any other team on the scoreboard. -+ * -+ * @param entity the entity to add -+ * @throws IllegalArgumentException if entity is null -+ * @throws IllegalStateException if this team has been unregistered -+ * @see #addEntry(String) -+ */ -+ void addEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException; -+ -+ /** -+ * Removes the entity from this team. -+ * -+ * @param entity the entity to remove -+ * @return if the entity was on this team -+ * @throws IllegalArgumentException if entity is null -+ * @throws IllegalStateException if this team has been unregistered -+ * @see #removeEntry(String) -+ */ -+ boolean removeEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException; -+ -+ /** -+ * Checks to see if the specified entity is a member of this team. -+ * -+ * @param entity the entity to search for -+ * @return true if the entity is a member of this team -+ * @throws IllegalArgumentException if entity is null -+ * @throws IllegalStateException if this team has been unregistered -+ * @see #hasEntry(String) -+ */ -+ boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException; -+ // Paper end - improve scoreboard entries -+ - /** - * Represents an option which may be applied to this team. - */ diff --git a/patches/api/0326-Add-API-for-item-entity-health.patch b/patches/api/0326-Add-API-for-item-entity-health.patch new file mode 100644 index 0000000000..572034e557 --- /dev/null +++ b/patches/api/0326-Add-API-for-item-entity-health.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 28 Aug 2021 09:00:35 -0700 +Subject: [PATCH] Add API for item entity health + + +diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java +index 6239aec4f6c625a814fa4fd610cdc5ab1a9f6e0f..ced419f8655bff72f0257b639d5f7d73afe3c2e2 100644 +--- a/src/main/java/org/bukkit/entity/Item.java ++++ b/src/main/java/org/bukkit/entity/Item.java +@@ -133,5 +133,24 @@ public interface Item extends Entity { + * @param willAge True if the item should age + */ + public void setWillAge(boolean willAge); ++ ++ /** ++ * Gets the health of item stack. ++ *

    ++ * Currently the default max health is 5. ++ * ++ * @return the health ++ */ ++ public int getHealth(); ++ ++ /** ++ * Sets the health of the item stack. If the value is non-positive ++ * the itemstack's normal "on destroy" functionality will be run. ++ *

    ++ * Currently, the default max health is 5. ++ * ++ * @param health the health, a non-positive value will destroy the entity ++ */ ++ public void setHealth(int health); + // Paper end + } diff --git a/patches/api/0326-Entity-powdered-snow-API.patch b/patches/api/0326-Entity-powdered-snow-API.patch deleted file mode 100644 index b00af3e946..0000000000 --- a/patches/api/0326-Entity-powdered-snow-API.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 24 Oct 2021 20:58:52 -0700 -Subject: [PATCH] Entity powdered snow API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 461a48f8aa049e9b9e13acca3d54978212d9688c..1cfeb862f6a036cfd68b60cdc2364834f353f4b4 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -969,5 +969,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * @return Whether the entity was successfully spawned. - */ - public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason); -+ -+ /** -+ * Check if entity is inside powdered snow. -+ * -+ * @return true if in powdered snow. -+ */ -+ boolean isInPowderedSnow(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java -index e0ccc090a0be507ced4d5669491311e410f60a67..472a71ca8dad0d49f0723e5fdf58bf00a55190f2 100644 ---- a/src/main/java/org/bukkit/entity/Skeleton.java -+++ b/src/main/java/org/bukkit/entity/Skeleton.java -@@ -41,6 +41,16 @@ public interface Skeleton extends AbstractSkeleton { - */ - void setConversionTime(int time); - -+ // Paper start -+ /** -+ * Gets the time the skeleton -+ * has been inside powdered snow. -+ * -+ * @return time in ticks -+ */ -+ int inPowderedSnowTime(); -+ // Paper end -+ - /** - * A legacy enum that defines the different variances of skeleton-like - * entities on the server. diff --git a/patches/api/0327-Add-API-for-item-entity-health.patch b/patches/api/0327-Add-API-for-item-entity-health.patch deleted file mode 100644 index 572034e557..0000000000 --- a/patches/api/0327-Add-API-for-item-entity-health.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 28 Aug 2021 09:00:35 -0700 -Subject: [PATCH] Add API for item entity health - - -diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java -index 6239aec4f6c625a814fa4fd610cdc5ab1a9f6e0f..ced419f8655bff72f0257b639d5f7d73afe3c2e2 100644 ---- a/src/main/java/org/bukkit/entity/Item.java -+++ b/src/main/java/org/bukkit/entity/Item.java -@@ -133,5 +133,24 @@ public interface Item extends Entity { - * @param willAge True if the item should age - */ - public void setWillAge(boolean willAge); -+ -+ /** -+ * Gets the health of item stack. -+ *

    -+ * Currently the default max health is 5. -+ * -+ * @return the health -+ */ -+ public int getHealth(); -+ -+ /** -+ * Sets the health of the item stack. If the value is non-positive -+ * the itemstack's normal "on destroy" functionality will be run. -+ *

    -+ * Currently, the default max health is 5. -+ * -+ * @param health the health, a non-positive value will destroy the entity -+ */ -+ public void setHealth(int health); - // Paper end - } diff --git a/patches/api/0327-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/api/0327-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch new file mode 100644 index 0000000000..f094cdc255 --- /dev/null +++ b/patches/api/0327-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Thu, 23 Dec 2021 15:32:40 -0600 +Subject: [PATCH] Expose isFuel and canSmelt methods to FurnaceInventory + + +diff --git a/src/main/java/org/bukkit/inventory/FurnaceInventory.java b/src/main/java/org/bukkit/inventory/FurnaceInventory.java +index 3f46259c1e0f82941ffc3038d1b51be199114abd..b9d4f05980d924a4831b1d213d4963199f5b9a5d 100644 +--- a/src/main/java/org/bukkit/inventory/FurnaceInventory.java ++++ b/src/main/java/org/bukkit/inventory/FurnaceInventory.java +@@ -53,6 +53,24 @@ public interface FurnaceInventory extends Inventory { + */ + void setSmelting(@Nullable ItemStack stack); + ++ // Paper start ++ /** ++ * Check if an item can be used as a fuel source in this furnace container ++ * ++ * @param item Item to check ++ * @return True if a valid fuel source ++ */ ++ public boolean isFuel(@Nullable ItemStack item); ++ ++ /** ++ * Check if an item can be smelted in this furnace container ++ * ++ * @param item Item to check ++ * @return True if can be smelt ++ */ ++ public boolean canSmelt(@Nullable ItemStack item); ++ // Paper end ++ + @Override + @Nullable + Furnace getHolder(); diff --git a/patches/api/0328-Bucketable-API.patch b/patches/api/0328-Bucketable-API.patch new file mode 100644 index 0000000000..26dbdc9f5d --- /dev/null +++ b/patches/api/0328-Bucketable-API.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 26 Dec 2021 14:03:11 -0500 +Subject: [PATCH] Bucketable API + + +diff --git a/src/main/java/io/papermc/paper/entity/Bucketable.java b/src/main/java/io/papermc/paper/entity/Bucketable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..84e360a16de956834a91142d45e4b5a0fe3d3a92 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/Bucketable.java +@@ -0,0 +1,42 @@ ++package io.papermc.paper.entity; ++ ++import org.bukkit.Sound; ++import org.bukkit.entity.Entity; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents an entity that can be bucketed. ++ */ ++public interface Bucketable extends Entity { ++ ++ /** ++ * Gets if this entity originated from a bucket. ++ * ++ * @return originated from bucket ++ */ ++ boolean isFromBucket(); ++ ++ /** ++ * Sets if this entity originated from a bucket. ++ * ++ * @param fromBucket is from a bucket ++ */ ++ void setFromBucket(boolean fromBucket); ++ ++ /** ++ * Gets the base itemstack of this entity in a bucket form. ++ * ++ * @return bucket form ++ */ ++ @NotNull ++ ItemStack getBaseBucketItem(); ++ ++ /** ++ * Gets the sound that is played when this entity ++ * is picked up in a bucket. ++ * @return bucket pickup sound ++ */ ++ @NotNull ++ Sound getPickupSound(); ++} +diff --git a/src/main/java/org/bukkit/entity/Axolotl.java b/src/main/java/org/bukkit/entity/Axolotl.java +index 9763f3b9ac8f32c082a476f4b50a32622b2720a0..c8c738b1b72e9ad89d97b7a1f5450d58045a72ca 100644 +--- a/src/main/java/org/bukkit/entity/Axolotl.java ++++ b/src/main/java/org/bukkit/entity/Axolotl.java +@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull; + /** + * An Axolotl. + */ +-public interface Axolotl extends Animals { ++public interface Axolotl extends Animals, io.papermc.paper.entity.Bucketable { // Paper - Bucketable API + + /** + * Gets if this axolotl is playing dead. +diff --git a/src/main/java/org/bukkit/entity/Fish.java b/src/main/java/org/bukkit/entity/Fish.java +index 82e390b2152e7c881006ca30f2527d160c01f8a1..86da8dc401ed7db19a39bc682721055cd341ccde 100644 +--- a/src/main/java/org/bukkit/entity/Fish.java ++++ b/src/main/java/org/bukkit/entity/Fish.java +@@ -3,4 +3,4 @@ package org.bukkit.entity; + /** + * Represents a fish entity. + */ +-public interface Fish extends WaterMob { } ++public interface Fish extends WaterMob, io.papermc.paper.entity.Bucketable { } // Paper - Bucketable API diff --git a/patches/api/0328-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/api/0328-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch deleted file mode 100644 index f094cdc255..0000000000 --- a/patches/api/0328-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Thu, 23 Dec 2021 15:32:40 -0600 -Subject: [PATCH] Expose isFuel and canSmelt methods to FurnaceInventory - - -diff --git a/src/main/java/org/bukkit/inventory/FurnaceInventory.java b/src/main/java/org/bukkit/inventory/FurnaceInventory.java -index 3f46259c1e0f82941ffc3038d1b51be199114abd..b9d4f05980d924a4831b1d213d4963199f5b9a5d 100644 ---- a/src/main/java/org/bukkit/inventory/FurnaceInventory.java -+++ b/src/main/java/org/bukkit/inventory/FurnaceInventory.java -@@ -53,6 +53,24 @@ public interface FurnaceInventory extends Inventory { - */ - void setSmelting(@Nullable ItemStack stack); - -+ // Paper start -+ /** -+ * Check if an item can be used as a fuel source in this furnace container -+ * -+ * @param item Item to check -+ * @return True if a valid fuel source -+ */ -+ public boolean isFuel(@Nullable ItemStack item); -+ -+ /** -+ * Check if an item can be smelted in this furnace container -+ * -+ * @param item Item to check -+ * @return True if can be smelt -+ */ -+ public boolean canSmelt(@Nullable ItemStack item); -+ // Paper end -+ - @Override - @Nullable - Furnace getHolder(); diff --git a/patches/api/0329-Bucketable-API.patch b/patches/api/0329-Bucketable-API.patch deleted file mode 100644 index 26dbdc9f5d..0000000000 --- a/patches/api/0329-Bucketable-API.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 26 Dec 2021 14:03:11 -0500 -Subject: [PATCH] Bucketable API - - -diff --git a/src/main/java/io/papermc/paper/entity/Bucketable.java b/src/main/java/io/papermc/paper/entity/Bucketable.java -new file mode 100644 -index 0000000000000000000000000000000000000000..84e360a16de956834a91142d45e4b5a0fe3d3a92 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/Bucketable.java -@@ -0,0 +1,42 @@ -+package io.papermc.paper.entity; -+ -+import org.bukkit.Sound; -+import org.bukkit.entity.Entity; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents an entity that can be bucketed. -+ */ -+public interface Bucketable extends Entity { -+ -+ /** -+ * Gets if this entity originated from a bucket. -+ * -+ * @return originated from bucket -+ */ -+ boolean isFromBucket(); -+ -+ /** -+ * Sets if this entity originated from a bucket. -+ * -+ * @param fromBucket is from a bucket -+ */ -+ void setFromBucket(boolean fromBucket); -+ -+ /** -+ * Gets the base itemstack of this entity in a bucket form. -+ * -+ * @return bucket form -+ */ -+ @NotNull -+ ItemStack getBaseBucketItem(); -+ -+ /** -+ * Gets the sound that is played when this entity -+ * is picked up in a bucket. -+ * @return bucket pickup sound -+ */ -+ @NotNull -+ Sound getPickupSound(); -+} -diff --git a/src/main/java/org/bukkit/entity/Axolotl.java b/src/main/java/org/bukkit/entity/Axolotl.java -index 9763f3b9ac8f32c082a476f4b50a32622b2720a0..c8c738b1b72e9ad89d97b7a1f5450d58045a72ca 100644 ---- a/src/main/java/org/bukkit/entity/Axolotl.java -+++ b/src/main/java/org/bukkit/entity/Axolotl.java -@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull; - /** - * An Axolotl. - */ --public interface Axolotl extends Animals { -+public interface Axolotl extends Animals, io.papermc.paper.entity.Bucketable { // Paper - Bucketable API - - /** - * Gets if this axolotl is playing dead. -diff --git a/src/main/java/org/bukkit/entity/Fish.java b/src/main/java/org/bukkit/entity/Fish.java -index 82e390b2152e7c881006ca30f2527d160c01f8a1..86da8dc401ed7db19a39bc682721055cd341ccde 100644 ---- a/src/main/java/org/bukkit/entity/Fish.java -+++ b/src/main/java/org/bukkit/entity/Fish.java -@@ -3,4 +3,4 @@ package org.bukkit.entity; - /** - * Represents a fish entity. - */ --public interface Fish extends WaterMob { } -+public interface Fish extends WaterMob, io.papermc.paper.entity.Bucketable { } // Paper - Bucketable API diff --git a/patches/api/0329-System-prop-for-default-config-comment-parsing.patch b/patches/api/0329-System-prop-for-default-config-comment-parsing.patch new file mode 100644 index 0000000000..632f71e519 --- /dev/null +++ b/patches/api/0329-System-prop-for-default-config-comment-parsing.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 30 Dec 2021 16:35:56 -0800 +Subject: [PATCH] System prop for default config comment parsing + +Allows for certain legacy plugins to continue to work without changing +by setting `Paper.parseYamlCommentsByDefault` to false + +diff --git a/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java b/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java +index c71f8a7b96fc5abc499802a79fcb3b0771de021c..121dbbf163588690d0678ae73a6ab8edf82f8367 100644 +--- a/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java ++++ b/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java +@@ -15,7 +15,10 @@ import org.jetbrains.annotations.Nullable; + public class FileConfigurationOptions extends MemoryConfigurationOptions { + private List header = Collections.emptyList(); + private List footer = Collections.emptyList(); +- private boolean parseComments = true; ++ // Paper start - add system prop for comment parsing ++ private static final boolean PAPER_PARSE_COMMENTS_BY_DEFAULT = Boolean.parseBoolean(System.getProperty("Paper.parseYamlCommentsByDefault", "true")); ++ private boolean parseComments = PAPER_PARSE_COMMENTS_BY_DEFAULT; ++ // Paper end + + protected FileConfigurationOptions(@NotNull MemoryConfiguration configuration) { + super(configuration); diff --git a/patches/api/0330-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/api/0330-Expose-vanilla-BiomeProvider-from-WorldInfo.patch new file mode 100644 index 0000000000..9b189fc918 --- /dev/null +++ b/patches/api/0330-Expose-vanilla-BiomeProvider-from-WorldInfo.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Thu, 6 Jan 2022 15:56:16 -0800 +Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo + + +diff --git a/src/main/java/org/bukkit/generator/WorldInfo.java b/src/main/java/org/bukkit/generator/WorldInfo.java +index 5bf00f46e8f3a80fec2a8a738e4d0d92461cfc92..5067f1371433cccd3287af7f03e152f2c3c1ece3 100644 +--- a/src/main/java/org/bukkit/generator/WorldInfo.java ++++ b/src/main/java/org/bukkit/generator/WorldInfo.java +@@ -57,4 +57,13 @@ public interface WorldInfo { + * @return Maximum height of the world + */ + int getMaxHeight(); ++ ++ // Paper start ++ /** ++ * Get the vanilla {@link BiomeProvider} for this world. ++ * ++ * @return vanilla biome provider ++ */ ++ @NotNull BiomeProvider vanillaBiomeProvider(); ++ // Paper end + } diff --git a/patches/api/0330-System-prop-for-default-config-comment-parsing.patch b/patches/api/0330-System-prop-for-default-config-comment-parsing.patch deleted file mode 100644 index 632f71e519..0000000000 --- a/patches/api/0330-System-prop-for-default-config-comment-parsing.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 30 Dec 2021 16:35:56 -0800 -Subject: [PATCH] System prop for default config comment parsing - -Allows for certain legacy plugins to continue to work without changing -by setting `Paper.parseYamlCommentsByDefault` to false - -diff --git a/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java b/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java -index c71f8a7b96fc5abc499802a79fcb3b0771de021c..121dbbf163588690d0678ae73a6ab8edf82f8367 100644 ---- a/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java -+++ b/src/main/java/org/bukkit/configuration/file/FileConfigurationOptions.java -@@ -15,7 +15,10 @@ import org.jetbrains.annotations.Nullable; - public class FileConfigurationOptions extends MemoryConfigurationOptions { - private List header = Collections.emptyList(); - private List footer = Collections.emptyList(); -- private boolean parseComments = true; -+ // Paper start - add system prop for comment parsing -+ private static final boolean PAPER_PARSE_COMMENTS_BY_DEFAULT = Boolean.parseBoolean(System.getProperty("Paper.parseYamlCommentsByDefault", "true")); -+ private boolean parseComments = PAPER_PARSE_COMMENTS_BY_DEFAULT; -+ // Paper end - - protected FileConfigurationOptions(@NotNull MemoryConfiguration configuration) { - super(configuration); diff --git a/patches/api/0331-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/api/0331-Expose-vanilla-BiomeProvider-from-WorldInfo.patch deleted file mode 100644 index 9b189fc918..0000000000 --- a/patches/api/0331-Expose-vanilla-BiomeProvider-from-WorldInfo.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Thu, 6 Jan 2022 15:56:16 -0800 -Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo - - -diff --git a/src/main/java/org/bukkit/generator/WorldInfo.java b/src/main/java/org/bukkit/generator/WorldInfo.java -index 5bf00f46e8f3a80fec2a8a738e4d0d92461cfc92..5067f1371433cccd3287af7f03e152f2c3c1ece3 100644 ---- a/src/main/java/org/bukkit/generator/WorldInfo.java -+++ b/src/main/java/org/bukkit/generator/WorldInfo.java -@@ -57,4 +57,13 @@ public interface WorldInfo { - * @return Maximum height of the world - */ - int getMaxHeight(); -+ -+ // Paper start -+ /** -+ * Get the vanilla {@link BiomeProvider} for this world. -+ * -+ * @return vanilla biome provider -+ */ -+ @NotNull BiomeProvider vanillaBiomeProvider(); -+ // Paper end - } diff --git a/patches/api/0331-Multiple-Entries-with-Scoreboards.patch b/patches/api/0331-Multiple-Entries-with-Scoreboards.patch new file mode 100644 index 0000000000..920c2f117e --- /dev/null +++ b/patches/api/0331-Multiple-Entries-with-Scoreboards.patch @@ -0,0 +1,128 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Tue, 21 Sep 2021 18:17:34 -0500 +Subject: [PATCH] Multiple Entries with Scoreboards + + +diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java +index dff76db4a4c37c760144f00c1aa8f2bcac45ba1f..cacb58d25c249e2ecd6083ed0f30d5ffb345220a 100644 +--- a/src/main/java/org/bukkit/scoreboard/Team.java ++++ b/src/main/java/org/bukkit/scoreboard/Team.java +@@ -309,6 +309,60 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { + */ + void addEntry(@NotNull String entry); + ++ // Paper start ++ /** ++ * This puts a collection of entities onto this team for the scoreboard which results in one ++ * packet for the updates rather than a packet-per-entity. ++ *

    ++ * Entities on other teams will be removed from their respective teams. ++ * ++ * @param entities the entities to add ++ * @throws IllegalArgumentException if entities are null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ default void addEntities(@NotNull org.bukkit.entity.Entity @NotNull ...entities) { ++ this.addEntities(java.util.List.of(entities)); ++ } ++ ++ /** ++ * This puts a collection of entities onto this team for the scoreboard which results in one ++ * packet for the updates rather than a packet-per-entity. ++ *

    ++ * Entities on other teams will be removed from their respective teams. ++ * ++ * @param entities the entities to add ++ * @throws IllegalArgumentException if entities are null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ void addEntities(@NotNull java.util.Collection entities) throws IllegalStateException, IllegalArgumentException; ++ ++ /** ++ * This puts a collection of entries onto this team for the scoreboard which results in one ++ * packet for the updates rather than a packet-per-entry. ++ *

    ++ * Entries on other teams will be removed from their respective teams. ++ * ++ * @param entries the entries to add ++ * @throws IllegalArgumentException if entries are null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ default void addEntries(@NotNull String... entries) throws IllegalStateException, IllegalArgumentException { ++ this.addEntries(java.util.List.of(entries)); ++ } ++ ++ /** ++ * This puts a collection of entries onto this team for the scoreboard which results in one ++ * packet for the updates rather than a packet-per-entry. ++ *

    ++ * Entries on other teams will be removed from their respective teams. ++ * ++ * @param entries the entries to add ++ * @throws IllegalArgumentException if entries are null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ void addEntries(@NotNull java.util.Collection entries) throws IllegalStateException, IllegalArgumentException; ++ // Paper end ++ + /** + * Removes the player from this team. + * +@@ -329,6 +383,56 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { + */ + boolean removeEntry(@NotNull String entry); + ++ // Paper start ++ /** ++ * Removes a collection of entities from this team which results in one ++ * packet for the updates rather than a packet-per-entity. ++ * ++ * @param entities the entries to remove ++ * @return if any of the entities were a part of this team ++ * @throws IllegalArgumentException if entities is null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ default boolean removeEntities(@NotNull org.bukkit.entity.Entity @NotNull ... entities) throws IllegalStateException, IllegalArgumentException { ++ return this.removeEntities(java.util.List.of(entities)); ++ } ++ ++ /** ++ * Removes a collection of entities from this team which results in one ++ * packet for the updates rather than a packet-per-entity. ++ * ++ * @param entities the entries to remove ++ * @return if any of the entities were a part of this team ++ * @throws IllegalArgumentException if entities is null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ boolean removeEntities(@NotNull java.util.Collection entities) throws IllegalStateException, IllegalArgumentException; ++ ++ /** ++ * Removes a collection of entries from this team which results in one ++ * packet for the updates rather than a packet-per-entry. ++ * ++ * @param entries the entries to remove ++ * @return if any of the entries were a part of this team ++ * @throws IllegalArgumentException if entries is null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ default boolean removeEntries(@NotNull String... entries) throws IllegalStateException, IllegalArgumentException { ++ return this.removeEntries(java.util.List.of(entries)); ++ } ++ ++ /** ++ * Removes a collection of entries from this team which results in one ++ * packet for the updates rather than a packet-per-entry. ++ * ++ * @param entries the entries to remove ++ * @return if any of the entries were a part of this team ++ * @throws IllegalArgumentException if entries is null ++ * @throws IllegalStateException if this team has been unregistered ++ */ ++ boolean removeEntries(@NotNull java.util.Collection entries) throws IllegalStateException, IllegalArgumentException; ++ // Paper end ++ + /** + * Unregisters this team from the Scoreboard + * diff --git a/patches/api/0332-Multiple-Entries-with-Scoreboards.patch b/patches/api/0332-Multiple-Entries-with-Scoreboards.patch deleted file mode 100644 index 920c2f117e..0000000000 --- a/patches/api/0332-Multiple-Entries-with-Scoreboards.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cryptite -Date: Tue, 21 Sep 2021 18:17:34 -0500 -Subject: [PATCH] Multiple Entries with Scoreboards - - -diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java -index dff76db4a4c37c760144f00c1aa8f2bcac45ba1f..cacb58d25c249e2ecd6083ed0f30d5ffb345220a 100644 ---- a/src/main/java/org/bukkit/scoreboard/Team.java -+++ b/src/main/java/org/bukkit/scoreboard/Team.java -@@ -309,6 +309,60 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { - */ - void addEntry(@NotNull String entry); - -+ // Paper start -+ /** -+ * This puts a collection of entities onto this team for the scoreboard which results in one -+ * packet for the updates rather than a packet-per-entity. -+ *

    -+ * Entities on other teams will be removed from their respective teams. -+ * -+ * @param entities the entities to add -+ * @throws IllegalArgumentException if entities are null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ default void addEntities(@NotNull org.bukkit.entity.Entity @NotNull ...entities) { -+ this.addEntities(java.util.List.of(entities)); -+ } -+ -+ /** -+ * This puts a collection of entities onto this team for the scoreboard which results in one -+ * packet for the updates rather than a packet-per-entity. -+ *

    -+ * Entities on other teams will be removed from their respective teams. -+ * -+ * @param entities the entities to add -+ * @throws IllegalArgumentException if entities are null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ void addEntities(@NotNull java.util.Collection entities) throws IllegalStateException, IllegalArgumentException; -+ -+ /** -+ * This puts a collection of entries onto this team for the scoreboard which results in one -+ * packet for the updates rather than a packet-per-entry. -+ *

    -+ * Entries on other teams will be removed from their respective teams. -+ * -+ * @param entries the entries to add -+ * @throws IllegalArgumentException if entries are null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ default void addEntries(@NotNull String... entries) throws IllegalStateException, IllegalArgumentException { -+ this.addEntries(java.util.List.of(entries)); -+ } -+ -+ /** -+ * This puts a collection of entries onto this team for the scoreboard which results in one -+ * packet for the updates rather than a packet-per-entry. -+ *

    -+ * Entries on other teams will be removed from their respective teams. -+ * -+ * @param entries the entries to add -+ * @throws IllegalArgumentException if entries are null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ void addEntries(@NotNull java.util.Collection entries) throws IllegalStateException, IllegalArgumentException; -+ // Paper end -+ - /** - * Removes the player from this team. - * -@@ -329,6 +383,56 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience { - */ - boolean removeEntry(@NotNull String entry); - -+ // Paper start -+ /** -+ * Removes a collection of entities from this team which results in one -+ * packet for the updates rather than a packet-per-entity. -+ * -+ * @param entities the entries to remove -+ * @return if any of the entities were a part of this team -+ * @throws IllegalArgumentException if entities is null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ default boolean removeEntities(@NotNull org.bukkit.entity.Entity @NotNull ... entities) throws IllegalStateException, IllegalArgumentException { -+ return this.removeEntities(java.util.List.of(entities)); -+ } -+ -+ /** -+ * Removes a collection of entities from this team which results in one -+ * packet for the updates rather than a packet-per-entity. -+ * -+ * @param entities the entries to remove -+ * @return if any of the entities were a part of this team -+ * @throws IllegalArgumentException if entities is null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ boolean removeEntities(@NotNull java.util.Collection entities) throws IllegalStateException, IllegalArgumentException; -+ -+ /** -+ * Removes a collection of entries from this team which results in one -+ * packet for the updates rather than a packet-per-entry. -+ * -+ * @param entries the entries to remove -+ * @return if any of the entries were a part of this team -+ * @throws IllegalArgumentException if entries is null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ default boolean removeEntries(@NotNull String... entries) throws IllegalStateException, IllegalArgumentException { -+ return this.removeEntries(java.util.List.of(entries)); -+ } -+ -+ /** -+ * Removes a collection of entries from this team which results in one -+ * packet for the updates rather than a packet-per-entry. -+ * -+ * @param entries the entries to remove -+ * @return if any of the entries were a part of this team -+ * @throws IllegalArgumentException if entries is null -+ * @throws IllegalStateException if this team has been unregistered -+ */ -+ boolean removeEntries(@NotNull java.util.Collection entries) throws IllegalStateException, IllegalArgumentException; -+ // Paper end -+ - /** - * Unregisters this team from the Scoreboard - * diff --git a/patches/api/0332-Warn-on-strange-EventHandler-return-types.patch b/patches/api/0332-Warn-on-strange-EventHandler-return-types.patch new file mode 100644 index 0000000000..c7807b823b --- /dev/null +++ b/patches/api/0332-Warn-on-strange-EventHandler-return-types.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Tue, 18 Jan 2022 11:07:54 -0700 +Subject: [PATCH] Warn on strange @EventHandler return types + + +diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java +index 9026e108ccd3a88aee1267ee275137befa646455..5fa52419f21d8e8b3d8f9aafd248b05774a28348 100644 +--- a/src/main/java/org/bukkit/plugin/EventExecutor.java ++++ b/src/main/java/org/bukkit/plugin/EventExecutor.java +@@ -51,6 +51,12 @@ public interface EventExecutor { + Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount()); + Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass); + ClassDefiner definer = ClassDefiner.getInstance(); ++ if (m.getReturnType() != Void.TYPE) { ++ final org.bukkit.plugin.java.JavaPlugin plugin = org.bukkit.plugin.java.JavaPlugin.getProvidingPlugin(m.getDeclaringClass()); ++ org.bukkit.Bukkit.getLogger().warning("@EventHandler method " + m.getDeclaringClass().getName() + (Modifier.isStatic(m.getModifiers()) ? '.' : '#') + m.getName() ++ + " returns non-void type " + m.getReturnType().getName() + ". This is unsupported behavior and will no longer work in a future version of Paper." ++ + " This should be reported to the developers of " + plugin.getPluginMeta().getDisplayName() + " (" + String.join(",", plugin.getPluginMeta().getAuthors()) + ')'); ++ } + if (Modifier.isStatic(m.getModifiers())) { + return new StaticMethodHandleEventExecutor(eventClass, m); + } else if (definer.isBypassAccessChecks() || Modifier.isPublic(m.getDeclaringClass().getModifiers()) && Modifier.isPublic(m.getModifiers())) { diff --git a/patches/api/0333-Multi-Block-Change-API.patch b/patches/api/0333-Multi-Block-Change-API.patch new file mode 100644 index 0000000000..46d8adeb56 --- /dev/null +++ b/patches/api/0333-Multi-Block-Change-API.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brody Beckwith +Date: Fri, 14 Jan 2022 00:40:42 -0500 +Subject: [PATCH] Multi Block Change API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index b177daa7a974125dc4ccf1bc6d119ad42dba3514..cd2d59a8a098227ec7725d121a63cc90e2a139fa 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -939,6 +939,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void sendBlockDamage(@NotNull Location loc, float progress); + ++ // Paper start ++ /** ++ * Send multiple block changes. This fakes a multi block change packet for each ++ * chunk section that a block change occurs. This will not actually change the world in any way. ++ * ++ * @param blockChanges A map of the positions you want to change to their new block data ++ */ ++ void sendMultiBlockChange(@NotNull Map blockChanges); ++ ++ /** ++ * Send multiple block changes. This fakes a multi block change packet for each ++ * chunk section that a block change occurs. This will not actually change the world in any way. ++ * ++ * @param blockChanges A map of the positions you want to change to their new block data ++ * @param suppressLightUpdates Whether to suppress light updates or not ++ * @deprecated suppressLightUpdates is no longer available in 1.20+, use {@link #sendMultiBlockChange(Map)} ++ */ ++ @Deprecated ++ default void sendMultiBlockChange(@NotNull Map blockChanges, boolean suppressLightUpdates) { ++ this.sendMultiBlockChange(blockChanges); ++ } ++ // Paper end ++ + /** + * Send block damage. This fakes block break progress at a certain location + * sourced by the provided entity. This will not actually change the block's diff --git a/patches/api/0333-Warn-on-strange-EventHandler-return-types.patch b/patches/api/0333-Warn-on-strange-EventHandler-return-types.patch deleted file mode 100644 index c7807b823b..0000000000 --- a/patches/api/0333-Warn-on-strange-EventHandler-return-types.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Tue, 18 Jan 2022 11:07:54 -0700 -Subject: [PATCH] Warn on strange @EventHandler return types - - -diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java -index 9026e108ccd3a88aee1267ee275137befa646455..5fa52419f21d8e8b3d8f9aafd248b05774a28348 100644 ---- a/src/main/java/org/bukkit/plugin/EventExecutor.java -+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java -@@ -51,6 +51,12 @@ public interface EventExecutor { - Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount()); - Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass); - ClassDefiner definer = ClassDefiner.getInstance(); -+ if (m.getReturnType() != Void.TYPE) { -+ final org.bukkit.plugin.java.JavaPlugin plugin = org.bukkit.plugin.java.JavaPlugin.getProvidingPlugin(m.getDeclaringClass()); -+ org.bukkit.Bukkit.getLogger().warning("@EventHandler method " + m.getDeclaringClass().getName() + (Modifier.isStatic(m.getModifiers()) ? '.' : '#') + m.getName() -+ + " returns non-void type " + m.getReturnType().getName() + ". This is unsupported behavior and will no longer work in a future version of Paper." -+ + " This should be reported to the developers of " + plugin.getPluginMeta().getDisplayName() + " (" + String.join(",", plugin.getPluginMeta().getAuthors()) + ')'); -+ } - if (Modifier.isStatic(m.getModifiers())) { - return new StaticMethodHandleEventExecutor(eventClass, m); - } else if (definer.isBypassAccessChecks() || Modifier.isPublic(m.getDeclaringClass().getModifiers()) && Modifier.isPublic(m.getModifiers())) { diff --git a/patches/api/0334-Fix-NotePlayEvent.patch b/patches/api/0334-Fix-NotePlayEvent.patch new file mode 100644 index 0000000000..d3f827bfd8 --- /dev/null +++ b/patches/api/0334-Fix-NotePlayEvent.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kieran Wallbanks +Date: Mon, 21 Jun 2021 12:33:45 +0100 +Subject: [PATCH] Fix NotePlayEvent + + +diff --git a/src/main/java/org/bukkit/event/block/NotePlayEvent.java b/src/main/java/org/bukkit/event/block/NotePlayEvent.java +index a3887067d1b65fb100ac1407a43c455f5d215510..ea7cb75ba3ecbe40e0390fd5568db77de56c4f16 100644 +--- a/src/main/java/org/bukkit/event/block/NotePlayEvent.java ++++ b/src/main/java/org/bukkit/event/block/NotePlayEvent.java +@@ -56,11 +56,13 @@ public class NotePlayEvent extends BlockEvent implements Cancellable { + + /** + * Overrides the {@link Instrument} to be used. ++ *

    ++ * Only works when the note block isn't under a player head. ++ * For this specific case the 'note_block_sound' property of the ++ * player head state takes the priority. + * + * @param instrument the Instrument. Has no effect if null. +- * @deprecated no effect on newer Minecraft versions + */ +- @Deprecated + public void setInstrument(@NotNull Instrument instrument) { + if (instrument != null) { + this.instrument = instrument; +@@ -71,9 +73,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable { + * Overrides the {@link Note} to be played. + * + * @param note the Note. Has no effect if null. +- * @deprecated no effect on newer Minecraft versions + */ +- @Deprecated + public void setNote(@NotNull Note note) { + if (note != null) { + this.note = note; diff --git a/patches/api/0334-Multi-Block-Change-API.patch b/patches/api/0334-Multi-Block-Change-API.patch deleted file mode 100644 index 46d8adeb56..0000000000 --- a/patches/api/0334-Multi-Block-Change-API.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brody Beckwith -Date: Fri, 14 Jan 2022 00:40:42 -0500 -Subject: [PATCH] Multi Block Change API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b177daa7a974125dc4ccf1bc6d119ad42dba3514..cd2d59a8a098227ec7725d121a63cc90e2a139fa 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -939,6 +939,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public void sendBlockDamage(@NotNull Location loc, float progress); - -+ // Paper start -+ /** -+ * Send multiple block changes. This fakes a multi block change packet for each -+ * chunk section that a block change occurs. This will not actually change the world in any way. -+ * -+ * @param blockChanges A map of the positions you want to change to their new block data -+ */ -+ void sendMultiBlockChange(@NotNull Map blockChanges); -+ -+ /** -+ * Send multiple block changes. This fakes a multi block change packet for each -+ * chunk section that a block change occurs. This will not actually change the world in any way. -+ * -+ * @param blockChanges A map of the positions you want to change to their new block data -+ * @param suppressLightUpdates Whether to suppress light updates or not -+ * @deprecated suppressLightUpdates is no longer available in 1.20+, use {@link #sendMultiBlockChange(Map)} -+ */ -+ @Deprecated -+ default void sendMultiBlockChange(@NotNull Map blockChanges, boolean suppressLightUpdates) { -+ this.sendMultiBlockChange(blockChanges); -+ } -+ // Paper end -+ - /** - * Send block damage. This fakes block break progress at a certain location - * sourced by the provided entity. This will not actually change the block's diff --git a/patches/api/0335-Fix-NotePlayEvent.patch b/patches/api/0335-Fix-NotePlayEvent.patch deleted file mode 100644 index d3f827bfd8..0000000000 --- a/patches/api/0335-Fix-NotePlayEvent.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kieran Wallbanks -Date: Mon, 21 Jun 2021 12:33:45 +0100 -Subject: [PATCH] Fix NotePlayEvent - - -diff --git a/src/main/java/org/bukkit/event/block/NotePlayEvent.java b/src/main/java/org/bukkit/event/block/NotePlayEvent.java -index a3887067d1b65fb100ac1407a43c455f5d215510..ea7cb75ba3ecbe40e0390fd5568db77de56c4f16 100644 ---- a/src/main/java/org/bukkit/event/block/NotePlayEvent.java -+++ b/src/main/java/org/bukkit/event/block/NotePlayEvent.java -@@ -56,11 +56,13 @@ public class NotePlayEvent extends BlockEvent implements Cancellable { - - /** - * Overrides the {@link Instrument} to be used. -+ *

    -+ * Only works when the note block isn't under a player head. -+ * For this specific case the 'note_block_sound' property of the -+ * player head state takes the priority. - * - * @param instrument the Instrument. Has no effect if null. -- * @deprecated no effect on newer Minecraft versions - */ -- @Deprecated - public void setInstrument(@NotNull Instrument instrument) { - if (instrument != null) { - this.instrument = instrument; -@@ -71,9 +73,7 @@ public class NotePlayEvent extends BlockEvent implements Cancellable { - * Overrides the {@link Note} to be played. - * - * @param note the Note. Has no effect if null. -- * @deprecated no effect on newer Minecraft versions - */ -- @Deprecated - public void setNote(@NotNull Note note) { - if (note != null) { - this.note = note; diff --git a/patches/api/0335-Freeze-Tick-Lock-API.patch b/patches/api/0335-Freeze-Tick-Lock-API.patch new file mode 100644 index 0000000000..baaf0b2462 --- /dev/null +++ b/patches/api/0335-Freeze-Tick-Lock-API.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 26 Dec 2021 20:27:49 -0500 +Subject: [PATCH] Freeze Tick Lock API + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 1cfeb862f6a036cfd68b60cdc2364834f353f4b4..0cbf946c4f0f47ddfb59b23905968313f25294b1 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -323,6 +323,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + boolean hasNoPhysics(); + // Paper end - missing entity api + ++ // Paper start - Freeze Tick Lock API ++ /** ++ * Gets if the entity currently has its freeze ticks locked ++ * to a set amount. ++ *

    ++ * This is only set by plugins ++ * ++ * @return locked or not ++ */ ++ boolean isFreezeTickingLocked(); ++ ++ /** ++ * Sets if the entity currently has its freeze ticks locked, ++ * preventing default vanilla freeze tick modification. ++ * ++ * @param locked prevent vanilla modification or not ++ */ ++ void lockFreezeTicks(boolean locked); ++ // Paper end - Freeze Tick Lock API ++ + /** + * Mark the entity's removal. + * diff --git a/patches/api/0336-Dolphin-API.patch b/patches/api/0336-Dolphin-API.patch new file mode 100644 index 0000000000..73beed437b --- /dev/null +++ b/patches/api/0336-Dolphin-API.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Tue, 7 Dec 2021 19:34:11 -0500 +Subject: [PATCH] Dolphin API + + +diff --git a/src/main/java/org/bukkit/entity/Dolphin.java b/src/main/java/org/bukkit/entity/Dolphin.java +index f00eaadcdde7ceef95def2d8ec6eb63a76c177bd..8ab329946daaff25646f3dd4582feb9e4c0685ca 100644 +--- a/src/main/java/org/bukkit/entity/Dolphin.java ++++ b/src/main/java/org/bukkit/entity/Dolphin.java +@@ -1,3 +1,52 @@ + package org.bukkit.entity; + +-public interface Dolphin extends WaterMob { } ++import org.bukkit.Location; ++ ++public interface Dolphin extends WaterMob { // Paper start - Dolphin API ++ ++ /** ++ * Gets the moistness level of this dolphin ++ */ ++ int getMoistness(); ++ ++ /** ++ * Sets the moistness of this dolphin, once this is less than 0 the dolphin will start to take damage. ++ * ++ * @param moistness moistness level ++ */ ++ void setMoistness(int moistness); ++ ++ /** ++ * Sets if this dolphin was fed a fish. ++ * ++ * @param hasFish has a fish ++ */ ++ void setHasFish(boolean hasFish); ++ ++ /** ++ * Gets if this dolphin has a fish. ++ * ++ * @return has a fish ++ */ ++ boolean hasFish(); ++ ++ /** ++ * Gets the treasure location this dolphin tries to guide players to. ++ *

    ++ * This value is calculated if the player has fed the dolphin a fish, and it tries to start the {@link com.destroystokyo.paper.entity.ai.VanillaGoal#DOLPHIN_SWIM_TO_TREASURE} goal. ++ * ++ * @return calculated closest treasure location ++ */ ++ @org.jetbrains.annotations.NotNull ++ Location getTreasureLocation(); ++ ++ /** ++ * Sets the treasure location that this dolphin will try to lead the player to. ++ * This only has an effect if the dolphin is currently leading a player, as this value is recalculated next time it leads a player. ++ *

    ++ * The world of the location does not matter, as the dolphin will always use the world it is currently in. ++ * ++ * @param location location to guide to ++ */ ++ void setTreasureLocation(@org.jetbrains.annotations.NotNull Location location); ++} // Paper end - Dolphin API diff --git a/patches/api/0336-Freeze-Tick-Lock-API.patch b/patches/api/0336-Freeze-Tick-Lock-API.patch deleted file mode 100644 index baaf0b2462..0000000000 --- a/patches/api/0336-Freeze-Tick-Lock-API.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 26 Dec 2021 20:27:49 -0500 -Subject: [PATCH] Freeze Tick Lock API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 1cfeb862f6a036cfd68b60cdc2364834f353f4b4..0cbf946c4f0f47ddfb59b23905968313f25294b1 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -323,6 +323,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - boolean hasNoPhysics(); - // Paper end - missing entity api - -+ // Paper start - Freeze Tick Lock API -+ /** -+ * Gets if the entity currently has its freeze ticks locked -+ * to a set amount. -+ *

    -+ * This is only set by plugins -+ * -+ * @return locked or not -+ */ -+ boolean isFreezeTickingLocked(); -+ -+ /** -+ * Sets if the entity currently has its freeze ticks locked, -+ * preventing default vanilla freeze tick modification. -+ * -+ * @param locked prevent vanilla modification or not -+ */ -+ void lockFreezeTicks(boolean locked); -+ // Paper end - Freeze Tick Lock API -+ - /** - * Mark the entity's removal. - * diff --git a/patches/api/0337-Dolphin-API.patch b/patches/api/0337-Dolphin-API.patch deleted file mode 100644 index 73beed437b..0000000000 --- a/patches/api/0337-Dolphin-API.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Tue, 7 Dec 2021 19:34:11 -0500 -Subject: [PATCH] Dolphin API - - -diff --git a/src/main/java/org/bukkit/entity/Dolphin.java b/src/main/java/org/bukkit/entity/Dolphin.java -index f00eaadcdde7ceef95def2d8ec6eb63a76c177bd..8ab329946daaff25646f3dd4582feb9e4c0685ca 100644 ---- a/src/main/java/org/bukkit/entity/Dolphin.java -+++ b/src/main/java/org/bukkit/entity/Dolphin.java -@@ -1,3 +1,52 @@ - package org.bukkit.entity; - --public interface Dolphin extends WaterMob { } -+import org.bukkit.Location; -+ -+public interface Dolphin extends WaterMob { // Paper start - Dolphin API -+ -+ /** -+ * Gets the moistness level of this dolphin -+ */ -+ int getMoistness(); -+ -+ /** -+ * Sets the moistness of this dolphin, once this is less than 0 the dolphin will start to take damage. -+ * -+ * @param moistness moistness level -+ */ -+ void setMoistness(int moistness); -+ -+ /** -+ * Sets if this dolphin was fed a fish. -+ * -+ * @param hasFish has a fish -+ */ -+ void setHasFish(boolean hasFish); -+ -+ /** -+ * Gets if this dolphin has a fish. -+ * -+ * @return has a fish -+ */ -+ boolean hasFish(); -+ -+ /** -+ * Gets the treasure location this dolphin tries to guide players to. -+ *

    -+ * This value is calculated if the player has fed the dolphin a fish, and it tries to start the {@link com.destroystokyo.paper.entity.ai.VanillaGoal#DOLPHIN_SWIM_TO_TREASURE} goal. -+ * -+ * @return calculated closest treasure location -+ */ -+ @org.jetbrains.annotations.NotNull -+ Location getTreasureLocation(); -+ -+ /** -+ * Sets the treasure location that this dolphin will try to lead the player to. -+ * This only has an effect if the dolphin is currently leading a player, as this value is recalculated next time it leads a player. -+ *

    -+ * The world of the location does not matter, as the dolphin will always use the world it is currently in. -+ * -+ * @param location location to guide to -+ */ -+ void setTreasureLocation(@org.jetbrains.annotations.NotNull Location location); -+} // Paper end - Dolphin API diff --git a/patches/api/0337-More-PotionEffectType-API.patch b/patches/api/0337-More-PotionEffectType-API.patch new file mode 100644 index 0000000000..cad46c8765 --- /dev/null +++ b/patches/api/0337-More-PotionEffectType-API.patch @@ -0,0 +1,159 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 27 May 2021 21:58:33 -0700 +Subject: [PATCH] More PotionEffectType API + + +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index 43f410326d6d68242113e2fefe31af256889ed9c..90ab3bef4c5b6b6e215e9c759c886ed6d0f3302b 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -300,6 +300,31 @@ public interface Registry extends Iterable { + */ + @Deprecated(forRemoval = true) + Registry CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug."); ++ ++ /** ++ * Potion effect types. ++ * ++ * @see org.bukkit.potion.PotionEffectType ++ */ ++ Registry POTION_EFFECT_TYPE = new Registry() { ++ ++ @Nullable ++ @Override ++ public org.bukkit.potion.PotionEffectType get(@NotNull NamespacedKey key) { ++ return org.bukkit.potion.PotionEffectType.getByKey(key); ++ } ++ ++ @NotNull ++ @Override ++ public Iterator iterator() { ++ return java.util.Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator(); ++ } ++ ++ @Override ++ public @NotNull Stream stream() { ++ return StreamSupport.stream(this.spliterator(), false); ++ } ++ }; + // Paper end + /** + * Get the object by its key. +diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java +index e045e6a74821f291938cc6af86e313c1f1c4626c..e77cf365cefafbeba09123187e70fd5274f10d53 100644 +--- a/src/main/java/org/bukkit/potion/PotionEffectType.java ++++ b/src/main/java/org/bukkit/potion/PotionEffectType.java +@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a type of potion and its effect on an entity. + */ +-public abstract class PotionEffectType implements Keyed, Translatable { ++public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - implement Translatable + private static final BiMap ID_MAP = HashBiMap.create(); + + /** +@@ -352,4 +352,57 @@ public abstract class PotionEffectType implements Keyed, Translatable { + public static PotionEffectType[] values() { + return Lists.newArrayList(Registry.EFFECT).toArray(new PotionEffectType[0]); + } ++ ++ // Paper start ++ /** ++ * Gets the effect attributes in an immutable map. ++ * ++ * @return the attribute map ++ */ ++ public abstract @NotNull java.util.Map getEffectAttributes(); ++ ++ /** ++ * Gets the true modifier amount based on the effect amplifier. ++ * ++ * @param attribute the attribute ++ * @param effectAmplifier the effect amplifier (0 indexed) ++ * @return the modifier amount ++ * @throws IllegalArgumentException if the supplied attribute is not present in the map from {@link #getEffectAttributes()} ++ */ ++ public abstract double getAttributeModifierAmount(@NotNull org.bukkit.attribute.Attribute attribute, int effectAmplifier); ++ ++ /** ++ * Gets the category of this effect ++ * ++ * @return the category ++ */ ++ public abstract @NotNull PotionEffectType.Category getEffectCategory(); ++ ++ /** ++ * Category of {@link PotionEffectType}s ++ */ ++ public enum Category { ++ ++ BENEFICIAL(net.kyori.adventure.text.format.NamedTextColor.BLUE), ++ HARMFUL(net.kyori.adventure.text.format.NamedTextColor.RED), ++ NEUTRAL(net.kyori.adventure.text.format.NamedTextColor.BLUE); ++ ++ private final net.kyori.adventure.text.format.TextColor color; ++ ++ Category(net.kyori.adventure.text.format.TextColor color) { ++ this.color = color; ++ } ++ ++ /** ++ * Gets the text color used when displaying potions ++ * of this category. ++ * ++ * @return the text color ++ */ ++ @NotNull ++ public net.kyori.adventure.text.format.TextColor getColor() { ++ return color; ++ } ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java b/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java +index a613debb03f6440583f57dd1adb7bb1bebbd636b..718f216c9153a5f03b91ce1de9ee9574e867e32b 100644 +--- a/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java ++++ b/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java +@@ -19,4 +19,41 @@ public abstract class PotionEffectTypeWrapper extends PotionEffectType { + public PotionEffectType getType() { + return this; + } ++ ++ @Override ++ public boolean isInstant() { ++ return getType().isInstant(); ++ } ++ ++ @NotNull ++ @Override ++ public org.bukkit.Color getColor() { ++ return getType().getColor(); ++ } ++ // Paper start ++ @Override ++ public @NotNull org.bukkit.NamespacedKey getKey() { ++ return this.getType().getKey(); ++ } ++ ++ @Override ++ public @NotNull java.util.Map getEffectAttributes() { ++ return this.getType().getEffectAttributes(); ++ } ++ ++ @Override ++ public double getAttributeModifierAmount(@NotNull org.bukkit.attribute.Attribute attribute, int effectAmplifier) { ++ return this.getType().getAttributeModifierAmount(attribute, effectAmplifier); ++ } ++ ++ @Override ++ public @NotNull PotionEffectType.Category getEffectCategory() { ++ return this.getType().getEffectCategory(); ++ } ++ ++ @Override ++ public @NotNull String translationKey() { ++ return this.getType().translationKey(); ++ } ++ // Paper end + } diff --git a/patches/api/0338-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/0338-API-for-creating-command-sender-which-forwards-feedb.patch new file mode 100644 index 0000000000..0a8e2307da --- /dev/null +++ b/patches/api/0338-API-for-creating-command-sender-which-forwards-feedb.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Tue, 1 Feb 2022 15:51:44 -0700 +Subject: [PATCH] API for creating command sender which forwards feedback + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 8f88dc00c73810560070195fcf6e0f955e4ebdde..1e96494c8080458f260ba94c4975ab18c4b4eefd 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1583,6 +1583,20 @@ public final class Bukkit { + return server.getConsoleSender(); + } + ++ // Paper start ++ /** ++ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the ++ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}. ++ * ++ * @param feedback feedback listener ++ * @return a command sender ++ */ ++ @NotNull ++ public static CommandSender createCommandSender(final @NotNull java.util.function.Consumer feedback) { ++ return server.createCommandSender(feedback); ++ } ++ // Paper end ++ + /** + * Gets the folder that contains all of the various {@link World}s. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 93626d79971125abd115ad7577fdee1d9fdd1f1f..4b987d01c4f912ab567f1d3b3a91288b263f208a 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1334,6 +1334,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @NotNull + public ConsoleCommandSender getConsoleSender(); + ++ // Paper start ++ /** ++ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the ++ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}. ++ * ++ * @param feedback feedback listener ++ * @return a command sender ++ */ ++ @NotNull ++ public CommandSender createCommandSender(final @NotNull java.util.function.Consumer feedback); ++ // Paper end ++ + /** + * Gets the folder that contains all of the various {@link World}s. + * diff --git a/patches/api/0338-More-PotionEffectType-API.patch b/patches/api/0338-More-PotionEffectType-API.patch deleted file mode 100644 index cad46c8765..0000000000 --- a/patches/api/0338-More-PotionEffectType-API.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 27 May 2021 21:58:33 -0700 -Subject: [PATCH] More PotionEffectType API - - -diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 43f410326d6d68242113e2fefe31af256889ed9c..90ab3bef4c5b6b6e215e9c759c886ed6d0f3302b 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -300,6 +300,31 @@ public interface Registry extends Iterable { - */ - @Deprecated(forRemoval = true) - Registry CONFIGURED_STRUCTURE = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class), "No registry present for ConfiguredStructure. This is a bug."); -+ -+ /** -+ * Potion effect types. -+ * -+ * @see org.bukkit.potion.PotionEffectType -+ */ -+ Registry POTION_EFFECT_TYPE = new Registry() { -+ -+ @Nullable -+ @Override -+ public org.bukkit.potion.PotionEffectType get(@NotNull NamespacedKey key) { -+ return org.bukkit.potion.PotionEffectType.getByKey(key); -+ } -+ -+ @NotNull -+ @Override -+ public Iterator iterator() { -+ return java.util.Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator(); -+ } -+ -+ @Override -+ public @NotNull Stream stream() { -+ return StreamSupport.stream(this.spliterator(), false); -+ } -+ }; - // Paper end - /** - * Get the object by its key. -diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java -index e045e6a74821f291938cc6af86e313c1f1c4626c..e77cf365cefafbeba09123187e70fd5274f10d53 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffectType.java -+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java -@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a type of potion and its effect on an entity. - */ --public abstract class PotionEffectType implements Keyed, Translatable { -+public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - implement Translatable - private static final BiMap ID_MAP = HashBiMap.create(); - - /** -@@ -352,4 +352,57 @@ public abstract class PotionEffectType implements Keyed, Translatable { - public static PotionEffectType[] values() { - return Lists.newArrayList(Registry.EFFECT).toArray(new PotionEffectType[0]); - } -+ -+ // Paper start -+ /** -+ * Gets the effect attributes in an immutable map. -+ * -+ * @return the attribute map -+ */ -+ public abstract @NotNull java.util.Map getEffectAttributes(); -+ -+ /** -+ * Gets the true modifier amount based on the effect amplifier. -+ * -+ * @param attribute the attribute -+ * @param effectAmplifier the effect amplifier (0 indexed) -+ * @return the modifier amount -+ * @throws IllegalArgumentException if the supplied attribute is not present in the map from {@link #getEffectAttributes()} -+ */ -+ public abstract double getAttributeModifierAmount(@NotNull org.bukkit.attribute.Attribute attribute, int effectAmplifier); -+ -+ /** -+ * Gets the category of this effect -+ * -+ * @return the category -+ */ -+ public abstract @NotNull PotionEffectType.Category getEffectCategory(); -+ -+ /** -+ * Category of {@link PotionEffectType}s -+ */ -+ public enum Category { -+ -+ BENEFICIAL(net.kyori.adventure.text.format.NamedTextColor.BLUE), -+ HARMFUL(net.kyori.adventure.text.format.NamedTextColor.RED), -+ NEUTRAL(net.kyori.adventure.text.format.NamedTextColor.BLUE); -+ -+ private final net.kyori.adventure.text.format.TextColor color; -+ -+ Category(net.kyori.adventure.text.format.TextColor color) { -+ this.color = color; -+ } -+ -+ /** -+ * Gets the text color used when displaying potions -+ * of this category. -+ * -+ * @return the text color -+ */ -+ @NotNull -+ public net.kyori.adventure.text.format.TextColor getColor() { -+ return color; -+ } -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java b/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java -index a613debb03f6440583f57dd1adb7bb1bebbd636b..718f216c9153a5f03b91ce1de9ee9574e867e32b 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java -+++ b/src/main/java/org/bukkit/potion/PotionEffectTypeWrapper.java -@@ -19,4 +19,41 @@ public abstract class PotionEffectTypeWrapper extends PotionEffectType { - public PotionEffectType getType() { - return this; - } -+ -+ @Override -+ public boolean isInstant() { -+ return getType().isInstant(); -+ } -+ -+ @NotNull -+ @Override -+ public org.bukkit.Color getColor() { -+ return getType().getColor(); -+ } -+ // Paper start -+ @Override -+ public @NotNull org.bukkit.NamespacedKey getKey() { -+ return this.getType().getKey(); -+ } -+ -+ @Override -+ public @NotNull java.util.Map getEffectAttributes() { -+ return this.getType().getEffectAttributes(); -+ } -+ -+ @Override -+ public double getAttributeModifierAmount(@NotNull org.bukkit.attribute.Attribute attribute, int effectAmplifier) { -+ return this.getType().getAttributeModifierAmount(attribute, effectAmplifier); -+ } -+ -+ @Override -+ public @NotNull PotionEffectType.Category getEffectCategory() { -+ return this.getType().getEffectCategory(); -+ } -+ -+ @Override -+ public @NotNull String translationKey() { -+ return this.getType().translationKey(); -+ } -+ // Paper end - } diff --git a/patches/api/0339-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/0339-API-for-creating-command-sender-which-forwards-feedb.patch deleted file mode 100644 index 13d096a366..0000000000 --- a/patches/api/0339-API-for-creating-command-sender-which-forwards-feedb.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Tue, 1 Feb 2022 15:51:44 -0700 -Subject: [PATCH] API for creating command sender which forwards feedback - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index fa7a63ea108971790c28c4f32d280ee6f2a86c0b..fb6a3b71cf3c304c5d0177747bc098e134b22d58 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1583,6 +1583,20 @@ public final class Bukkit { - return server.getConsoleSender(); - } - -+ // Paper start -+ /** -+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the -+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}. -+ * -+ * @param feedback feedback listener -+ * @return a command sender -+ */ -+ @NotNull -+ public static CommandSender createCommandSender(final @NotNull java.util.function.Consumer feedback) { -+ return server.createCommandSender(feedback); -+ } -+ // Paper end -+ - /** - * Gets the folder that contains all of the various {@link World}s. - * -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 90b1368303562e1b4af2e658e60ac564bd49ad5f..43b049b68a8af548cd05c67dafc23dabd07bab27 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -1334,6 +1334,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public ConsoleCommandSender getConsoleSender(); - -+ // Paper start -+ /** -+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the -+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}. -+ * -+ * @param feedback feedback listener -+ * @return a command sender -+ */ -+ @NotNull -+ public CommandSender createCommandSender(final @NotNull java.util.function.Consumer feedback); -+ // Paper end -+ - /** - * Gets the folder that contains all of the various {@link World}s. - * diff --git a/patches/api/0339-Implement-regenerateChunk.patch b/patches/api/0339-Implement-regenerateChunk.patch new file mode 100644 index 0000000000..8f63e4dd7a --- /dev/null +++ b/patches/api/0339-Implement-regenerateChunk.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 5 Feb 2022 20:25:28 +0100 +Subject: [PATCH] Implement regenerateChunk + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 6953851a5177e9df3746f7a743f27ef02845e522..d7f4a9c634b3a7b2668f296dce108cc6fc3046df 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -486,8 +486,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * @return Whether the chunk was actually regenerated + * + * @deprecated regenerating a single chunk is not likely to produce the same +- * chunk as before as terrain decoration may be spread across chunks. Use of +- * this method should be avoided as it is known to produce buggy results. ++ * chunk as before as terrain decoration may be spread across chunks. It may ++ * or may not change blocks in the adjacent chunks as well. + */ + @Deprecated + public boolean regenerateChunk(int x, int z); diff --git a/patches/api/0340-Add-GameEvent-tags.patch b/patches/api/0340-Add-GameEvent-tags.patch new file mode 100644 index 0000000000..73554bb169 --- /dev/null +++ b/patches/api/0340-Add-GameEvent-tags.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 18 Dec 2021 10:34:21 -0800 +Subject: [PATCH] Add GameEvent tags + + +diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java +index 298ae1294a122705bca6bd74ea540185839d1ed5..cb5890e0e7bccfee2ba32dd4776f1ae1fdd539e8 100644 +--- a/src/main/java/org/bukkit/Tag.java ++++ b/src/main/java/org/bukkit/Tag.java +@@ -1306,6 +1306,25 @@ public interface Tag extends Keyed { + */ + Tag ENTITY_TYPES_REDIRECTABLE_PROJECTILE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("redirectable_projectile"), EntityType.class); + ++ // Paper start ++ String REGISTRY_GAME_EVENTS = "game_events"; ++ ++ /** ++ * Tag for game events that trigger sculk sensors ++ */ ++ Tag GAME_EVENT_VIBRATIONS = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("vibrations"), GameEvent.class); ++ ++ /** ++ * Tag for game events that are ignored if the entity is sneaking ++ */ ++ Tag GAME_EVENT_IGNORE_VIBRATIONS_SNEAKING = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("ignore_vibrations_sneaking"), GameEvent.class); ++ ++ /** ++ * Tag for game events that an allay can listen to ++ */ ++ Tag GAME_EVENT_ALLAY_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("allay_can_listen"), GameEvent.class); ++ // Paper end ++ + /** + * Returns whether or not this tag has an entry for the specified item. + * diff --git a/patches/api/0340-Implement-regenerateChunk.patch b/patches/api/0340-Implement-regenerateChunk.patch deleted file mode 100644 index 8f63e4dd7a..0000000000 --- a/patches/api/0340-Implement-regenerateChunk.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Sat, 5 Feb 2022 20:25:28 +0100 -Subject: [PATCH] Implement regenerateChunk - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 6953851a5177e9df3746f7a743f27ef02845e522..d7f4a9c634b3a7b2668f296dce108cc6fc3046df 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -486,8 +486,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * @return Whether the chunk was actually regenerated - * - * @deprecated regenerating a single chunk is not likely to produce the same -- * chunk as before as terrain decoration may be spread across chunks. Use of -- * this method should be avoided as it is known to produce buggy results. -+ * chunk as before as terrain decoration may be spread across chunks. It may -+ * or may not change blocks in the adjacent chunks as well. - */ - @Deprecated - public boolean regenerateChunk(int x, int z); diff --git a/patches/api/0341-Add-GameEvent-tags.patch b/patches/api/0341-Add-GameEvent-tags.patch deleted file mode 100644 index 73554bb169..0000000000 --- a/patches/api/0341-Add-GameEvent-tags.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 18 Dec 2021 10:34:21 -0800 -Subject: [PATCH] Add GameEvent tags - - -diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index 298ae1294a122705bca6bd74ea540185839d1ed5..cb5890e0e7bccfee2ba32dd4776f1ae1fdd539e8 100644 ---- a/src/main/java/org/bukkit/Tag.java -+++ b/src/main/java/org/bukkit/Tag.java -@@ -1306,6 +1306,25 @@ public interface Tag extends Keyed { - */ - Tag ENTITY_TYPES_REDIRECTABLE_PROJECTILE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("redirectable_projectile"), EntityType.class); - -+ // Paper start -+ String REGISTRY_GAME_EVENTS = "game_events"; -+ -+ /** -+ * Tag for game events that trigger sculk sensors -+ */ -+ Tag GAME_EVENT_VIBRATIONS = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("vibrations"), GameEvent.class); -+ -+ /** -+ * Tag for game events that are ignored if the entity is sneaking -+ */ -+ Tag GAME_EVENT_IGNORE_VIBRATIONS_SNEAKING = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("ignore_vibrations_sneaking"), GameEvent.class); -+ -+ /** -+ * Tag for game events that an allay can listen to -+ */ -+ Tag GAME_EVENT_ALLAY_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("allay_can_listen"), GameEvent.class); -+ // Paper end -+ - /** - * Returns whether or not this tag has an entry for the specified item. - * diff --git a/patches/api/0341-Furnace-RecipesUsed-API.patch b/patches/api/0341-Furnace-RecipesUsed-API.patch new file mode 100644 index 0000000000..7fed82db21 --- /dev/null +++ b/patches/api/0341-Furnace-RecipesUsed-API.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 13 Jan 2022 15:21:08 -0800 +Subject: [PATCH] Furnace RecipesUsed API + + +diff --git a/src/main/java/org/bukkit/block/Furnace.java b/src/main/java/org/bukkit/block/Furnace.java +index dbdf3dbe9517b09a7965cf9d65cae1edd87af67d..8745e5aeaa81cd42d6625f415c623daa28776647 100644 +--- a/src/main/java/org/bukkit/block/Furnace.java ++++ b/src/main/java/org/bukkit/block/Furnace.java +@@ -92,6 +92,40 @@ public interface Furnace extends Container { + * @throws IllegalArgumentException if value is more than 200 + */ + public void setCookSpeedMultiplier(double multiplier); ++ ++ /** ++ * Gets the number of times a recipe has been used since the ++ * last player removed items from the result slot. This is used ++ * to calculate experience rewards when withdrawing items from furnaces. ++ * ++ * @param furnaceRecipe the recipe to query the count for ++ * @return the count or 0 if none found ++ */ ++ int getRecipeUsedCount(@NotNull org.bukkit.NamespacedKey furnaceRecipe); ++ ++ /** ++ * Checks if the recipe has a used count present on this furnace. ++ * ++ * @param furnaceRecipe the recipe to check if a count exists for ++ * @return true if there is a positive count, else false ++ */ ++ boolean hasRecipeUsedCount(@NotNull org.bukkit.NamespacedKey furnaceRecipe); ++ ++ /** ++ * Sets the number of times a recipe has been used. This is used ++ * to calculate experience rewards when withdrawing items from furnaces. ++ * ++ * @param furnaceRecipe the recipe to set the count for ++ * @param count the count, a non-positive number will remove the recipe ++ */ ++ void setRecipeUsedCount(@NotNull org.bukkit.inventory.CookingRecipe furnaceRecipe, int count); ++ ++ /** ++ * Sets all recipes used by this furnace. ++ * ++ * @param recipesUsed the recipes used ++ */ ++ void setRecipesUsed(@NotNull Map, Integer> recipesUsed); + // Paper end + + @NotNull diff --git a/patches/api/0342-Configurable-sculk-sensor-listener-range.patch b/patches/api/0342-Configurable-sculk-sensor-listener-range.patch new file mode 100644 index 0000000000..b1ad0cdb5b --- /dev/null +++ b/patches/api/0342-Configurable-sculk-sensor-listener-range.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 19 Aug 2021 18:43:16 -0700 +Subject: [PATCH] Configurable sculk sensor listener range + + +diff --git a/src/main/java/org/bukkit/block/SculkSensor.java b/src/main/java/org/bukkit/block/SculkSensor.java +index 18966117823eda97e37627fe72b3dbc2c67cab7c..95a822613093479821c22c9aeea32b27d3ec2e21 100644 +--- a/src/main/java/org/bukkit/block/SculkSensor.java ++++ b/src/main/java/org/bukkit/block/SculkSensor.java +@@ -24,4 +24,19 @@ public interface SculkSensor extends TileState { + * @param lastVibrationFrequency frequency between 0-15. + */ + void setLastVibrationFrequency(int lastVibrationFrequency); ++ // Paper start ++ /** ++ * Gets the range this sensor listens to events at. ++ * ++ * @return the range (defaults to 8) ++ */ ++ int getListenerRange(); ++ ++ /** ++ * Sets the range this sensor will listen to events from. ++ * ++ * @param range the range (must be greater than 0) ++ */ ++ void setListenerRange(int range); ++ // Paper end + } diff --git a/patches/api/0342-Furnace-RecipesUsed-API.patch b/patches/api/0342-Furnace-RecipesUsed-API.patch deleted file mode 100644 index 7fed82db21..0000000000 --- a/patches/api/0342-Furnace-RecipesUsed-API.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 13 Jan 2022 15:21:08 -0800 -Subject: [PATCH] Furnace RecipesUsed API - - -diff --git a/src/main/java/org/bukkit/block/Furnace.java b/src/main/java/org/bukkit/block/Furnace.java -index dbdf3dbe9517b09a7965cf9d65cae1edd87af67d..8745e5aeaa81cd42d6625f415c623daa28776647 100644 ---- a/src/main/java/org/bukkit/block/Furnace.java -+++ b/src/main/java/org/bukkit/block/Furnace.java -@@ -92,6 +92,40 @@ public interface Furnace extends Container { - * @throws IllegalArgumentException if value is more than 200 - */ - public void setCookSpeedMultiplier(double multiplier); -+ -+ /** -+ * Gets the number of times a recipe has been used since the -+ * last player removed items from the result slot. This is used -+ * to calculate experience rewards when withdrawing items from furnaces. -+ * -+ * @param furnaceRecipe the recipe to query the count for -+ * @return the count or 0 if none found -+ */ -+ int getRecipeUsedCount(@NotNull org.bukkit.NamespacedKey furnaceRecipe); -+ -+ /** -+ * Checks if the recipe has a used count present on this furnace. -+ * -+ * @param furnaceRecipe the recipe to check if a count exists for -+ * @return true if there is a positive count, else false -+ */ -+ boolean hasRecipeUsedCount(@NotNull org.bukkit.NamespacedKey furnaceRecipe); -+ -+ /** -+ * Sets the number of times a recipe has been used. This is used -+ * to calculate experience rewards when withdrawing items from furnaces. -+ * -+ * @param furnaceRecipe the recipe to set the count for -+ * @param count the count, a non-positive number will remove the recipe -+ */ -+ void setRecipeUsedCount(@NotNull org.bukkit.inventory.CookingRecipe furnaceRecipe, int count); -+ -+ /** -+ * Sets all recipes used by this furnace. -+ * -+ * @param recipesUsed the recipes used -+ */ -+ void setRecipesUsed(@NotNull Map, Integer> recipesUsed); - // Paper end - - @NotNull diff --git a/patches/api/0343-Add-missing-block-data-mins-and-maxes.patch b/patches/api/0343-Add-missing-block-data-mins-and-maxes.patch new file mode 100644 index 0000000000..63a647706a --- /dev/null +++ b/patches/api/0343-Add-missing-block-data-mins-and-maxes.patch @@ -0,0 +1,87 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 16 Oct 2021 22:57:10 -0700 +Subject: [PATCH] Add missing block data mins and maxes + + +diff --git a/src/main/java/org/bukkit/block/data/Levelled.java b/src/main/java/org/bukkit/block/data/Levelled.java +index 5255538fecae6da413546be3adacd2a99f6c74e9..860f072dee391b300cb1629058a3f9c23dfd95e2 100644 +--- a/src/main/java/org/bukkit/block/data/Levelled.java ++++ b/src/main/java/org/bukkit/block/data/Levelled.java +@@ -36,4 +36,13 @@ public interface Levelled extends BlockData { + * @return the maximum 'level' value + */ + int getMaximumLevel(); ++ ++ // Paper start ++ /** ++ * Gets the minimum allowed value of the 'level' property. ++ * ++ * @return the minimum 'level' value ++ */ ++ int getMinimumLevel(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/block/data/type/Candle.java b/src/main/java/org/bukkit/block/data/type/Candle.java +index d4d08bd424f84523200d1a2012f4d37c07cc3497..7baccce27f2db2242f628ea92a9d040267caef75 100644 +--- a/src/main/java/org/bukkit/block/data/type/Candle.java ++++ b/src/main/java/org/bukkit/block/data/type/Candle.java +@@ -28,4 +28,13 @@ public interface Candle extends Lightable, Waterlogged { + * @return the maximum 'candles' value + */ + int getMaximumCandles(); ++ ++ // Paper start ++ /** ++ * Gets the minimum allowed value of the 'candles' property. ++ * ++ * @return the minimum 'candles' value ++ */ ++ int getMinimumCandles(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/block/data/type/Leaves.java b/src/main/java/org/bukkit/block/data/type/Leaves.java +index 3ea21dfad26222ee70fbc627595f54de1a28aa96..cd013a7c42648d819d1e91c7cf9f97a8190c1fad 100644 +--- a/src/main/java/org/bukkit/block/data/type/Leaves.java ++++ b/src/main/java/org/bukkit/block/data/type/Leaves.java +@@ -39,4 +39,20 @@ public interface Leaves extends Waterlogged { + * @param distance the new 'distance' value + */ + void setDistance(int distance); ++ ++ // Paper start ++ /** ++ * Gets the maximum allowed value of the 'distance' property. ++ * ++ * @return the maximum 'distance' value ++ */ ++ int getMaximumDistance(); ++ ++ /** ++ * Gets the minimum allowed value of the 'distance' property. ++ * ++ * @return the minimum 'distance' value ++ */ ++ int getMinimumDistance(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/block/data/type/PinkPetals.java b/src/main/java/org/bukkit/block/data/type/PinkPetals.java +index a84b36f7587eb2ed9e9177973b3166dc94cdf3df..eae9c9cdd0f47a7480ee23ac7b655692f5ee9c1e 100644 +--- a/src/main/java/org/bukkit/block/data/type/PinkPetals.java ++++ b/src/main/java/org/bukkit/block/data/type/PinkPetals.java +@@ -21,6 +21,15 @@ public interface PinkPetals extends Directional { + */ + void setFlowerAmount(int flower_amount); + ++ // Paper start ++ /** ++ * Gets the minimum allowed value of the 'flower_amount' property. ++ * ++ * @return the minimum 'flower_amount' value ++ */ ++ int getMinimumFlowerAmount(); ++ // Paper end ++ + /** + * Gets the maximum allowed value of the 'flower_amount' property. + * diff --git a/patches/api/0343-Configurable-sculk-sensor-listener-range.patch b/patches/api/0343-Configurable-sculk-sensor-listener-range.patch deleted file mode 100644 index b1ad0cdb5b..0000000000 --- a/patches/api/0343-Configurable-sculk-sensor-listener-range.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 19 Aug 2021 18:43:16 -0700 -Subject: [PATCH] Configurable sculk sensor listener range - - -diff --git a/src/main/java/org/bukkit/block/SculkSensor.java b/src/main/java/org/bukkit/block/SculkSensor.java -index 18966117823eda97e37627fe72b3dbc2c67cab7c..95a822613093479821c22c9aeea32b27d3ec2e21 100644 ---- a/src/main/java/org/bukkit/block/SculkSensor.java -+++ b/src/main/java/org/bukkit/block/SculkSensor.java -@@ -24,4 +24,19 @@ public interface SculkSensor extends TileState { - * @param lastVibrationFrequency frequency between 0-15. - */ - void setLastVibrationFrequency(int lastVibrationFrequency); -+ // Paper start -+ /** -+ * Gets the range this sensor listens to events at. -+ * -+ * @return the range (defaults to 8) -+ */ -+ int getListenerRange(); -+ -+ /** -+ * Sets the range this sensor will listen to events from. -+ * -+ * @param range the range (must be greater than 0) -+ */ -+ void setListenerRange(int range); -+ // Paper end - } diff --git a/patches/api/0344-Add-missing-block-data-mins-and-maxes.patch b/patches/api/0344-Add-missing-block-data-mins-and-maxes.patch deleted file mode 100644 index 63a647706a..0000000000 --- a/patches/api/0344-Add-missing-block-data-mins-and-maxes.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 16 Oct 2021 22:57:10 -0700 -Subject: [PATCH] Add missing block data mins and maxes - - -diff --git a/src/main/java/org/bukkit/block/data/Levelled.java b/src/main/java/org/bukkit/block/data/Levelled.java -index 5255538fecae6da413546be3adacd2a99f6c74e9..860f072dee391b300cb1629058a3f9c23dfd95e2 100644 ---- a/src/main/java/org/bukkit/block/data/Levelled.java -+++ b/src/main/java/org/bukkit/block/data/Levelled.java -@@ -36,4 +36,13 @@ public interface Levelled extends BlockData { - * @return the maximum 'level' value - */ - int getMaximumLevel(); -+ -+ // Paper start -+ /** -+ * Gets the minimum allowed value of the 'level' property. -+ * -+ * @return the minimum 'level' value -+ */ -+ int getMinimumLevel(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/data/type/Candle.java b/src/main/java/org/bukkit/block/data/type/Candle.java -index d4d08bd424f84523200d1a2012f4d37c07cc3497..7baccce27f2db2242f628ea92a9d040267caef75 100644 ---- a/src/main/java/org/bukkit/block/data/type/Candle.java -+++ b/src/main/java/org/bukkit/block/data/type/Candle.java -@@ -28,4 +28,13 @@ public interface Candle extends Lightable, Waterlogged { - * @return the maximum 'candles' value - */ - int getMaximumCandles(); -+ -+ // Paper start -+ /** -+ * Gets the minimum allowed value of the 'candles' property. -+ * -+ * @return the minimum 'candles' value -+ */ -+ int getMinimumCandles(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/data/type/Leaves.java b/src/main/java/org/bukkit/block/data/type/Leaves.java -index 3ea21dfad26222ee70fbc627595f54de1a28aa96..cd013a7c42648d819d1e91c7cf9f97a8190c1fad 100644 ---- a/src/main/java/org/bukkit/block/data/type/Leaves.java -+++ b/src/main/java/org/bukkit/block/data/type/Leaves.java -@@ -39,4 +39,20 @@ public interface Leaves extends Waterlogged { - * @param distance the new 'distance' value - */ - void setDistance(int distance); -+ -+ // Paper start -+ /** -+ * Gets the maximum allowed value of the 'distance' property. -+ * -+ * @return the maximum 'distance' value -+ */ -+ int getMaximumDistance(); -+ -+ /** -+ * Gets the minimum allowed value of the 'distance' property. -+ * -+ * @return the minimum 'distance' value -+ */ -+ int getMinimumDistance(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/block/data/type/PinkPetals.java b/src/main/java/org/bukkit/block/data/type/PinkPetals.java -index a84b36f7587eb2ed9e9177973b3166dc94cdf3df..eae9c9cdd0f47a7480ee23ac7b655692f5ee9c1e 100644 ---- a/src/main/java/org/bukkit/block/data/type/PinkPetals.java -+++ b/src/main/java/org/bukkit/block/data/type/PinkPetals.java -@@ -21,6 +21,15 @@ public interface PinkPetals extends Directional { - */ - void setFlowerAmount(int flower_amount); - -+ // Paper start -+ /** -+ * Gets the minimum allowed value of the 'flower_amount' property. -+ * -+ * @return the minimum 'flower_amount' value -+ */ -+ int getMinimumFlowerAmount(); -+ // Paper end -+ - /** - * Gets the maximum allowed value of the 'flower_amount' property. - * diff --git a/patches/api/0344-Custom-Potion-Mixes.patch b/patches/api/0344-Custom-Potion-Mixes.patch new file mode 100644 index 0000000000..07d8b8735c --- /dev/null +++ b/patches/api/0344-Custom-Potion-Mixes.patch @@ -0,0 +1,271 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 7 Oct 2021 14:34:59 -0700 +Subject: [PATCH] Custom Potion Mixes + + +diff --git a/src/main/java/io/papermc/paper/potion/PotionMix.java b/src/main/java/io/papermc/paper/potion/PotionMix.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3fc922ebf972418b84181cd02e68d8ef0efd739b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/potion/PotionMix.java +@@ -0,0 +1,105 @@ ++package io.papermc.paper.potion; ++ ++import java.util.function.Predicate; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.RecipeChoice; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Objects; ++ ++/** ++ * Represents a potion mix made in a Brewing Stand. ++ */ ++@ApiStatus.NonExtendable ++public class PotionMix implements Keyed { ++ ++ private final NamespacedKey key; ++ private final ItemStack result; ++ private final RecipeChoice input; ++ private final RecipeChoice ingredient; ++ ++ /** ++ * Creates a new potion mix. Add it to the server with {@link org.bukkit.potion.PotionBrewer#addPotionMix(PotionMix)}. ++ * ++ * @param key a unique key for the mix ++ * @param result the resulting itemstack that will appear in the 3 bottom slots ++ * @param input the input placed into the bottom 3 slots ++ * @param ingredient the ingredient placed into the top slot ++ */ ++ public PotionMix(final @NotNull NamespacedKey key, final @NotNull ItemStack result, final @NotNull RecipeChoice input, final @NotNull RecipeChoice ingredient) { ++ this.key = key; ++ this.result = result; ++ this.input = input; ++ this.ingredient = ingredient; ++ } ++ ++ /** ++ * Create a {@link RecipeChoice} based on a Predicate. These RecipeChoices are only ++ * valid for {@link PotionMix}, not anywhere else RecipeChoices may be used. ++ * ++ * @param stackPredicate a predicate for an itemstack. ++ * @return a new RecipeChoice ++ */ ++ @Contract(value = "_ -> new", pure = true) ++ public static @NotNull RecipeChoice createPredicateChoice(final @NotNull Predicate stackPredicate) { ++ return new PredicateRecipeChoice(stackPredicate); ++ } ++ ++ @Override ++ public @NotNull NamespacedKey getKey() { ++ return this.key; ++ } ++ ++ /** ++ * Gets the resulting itemstack after the brew has finished. ++ * ++ * @return the result itemstack ++ */ ++ public @NotNull ItemStack getResult() { ++ return this.result; ++ } ++ ++ /** ++ * Gets the input for the bottom 3 slots in the brewing stand. ++ * ++ * @return the bottom 3 slot ingredients ++ */ ++ public @NotNull RecipeChoice getInput() { ++ return this.input; ++ } ++ ++ /** ++ * Gets the ingredient in the top slot of the brewing stand. ++ * ++ * @return the top slot input ++ */ ++ public @NotNull RecipeChoice getIngredient() { ++ return this.ingredient; ++ } ++ ++ @Override ++ public String toString() { ++ return "PotionMix{" + ++ "result=" + this.result + ++ ", base=" + this.input + ++ ", addition=" + this.ingredient + ++ '}'; ++ } ++ ++ @Override ++ public boolean equals(final Object o) { ++ if (this == o) return true; ++ if (o == null || this.getClass() != o.getClass()) return false; ++ final PotionMix potionMix = (PotionMix) o; ++ return this.key.equals(potionMix.key) && this.result.equals(potionMix.result) && this.input.equals(potionMix.input) && this.ingredient.equals(potionMix.ingredient); ++ } ++ ++ @Override ++ public int hashCode() { ++ return Objects.hash(this.key, this.result, this.input, this.ingredient); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java b/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3ede1e8f7bf0436fdc5bf395c0f9eaf11c252453 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java +@@ -0,0 +1,33 @@ ++package io.papermc.paper.potion; ++ ++import java.util.function.Predicate; ++import org.bukkit.inventory.ItemStack; ++import org.bukkit.inventory.RecipeChoice; ++import org.checkerframework.checker.nullness.qual.NonNull; ++import org.checkerframework.framework.qual.DefaultQualifier; ++import org.jetbrains.annotations.ApiStatus; ++ ++@ApiStatus.Internal ++@DefaultQualifier(NonNull.class) ++record PredicateRecipeChoice(Predicate itemStackPredicate) implements RecipeChoice, Cloneable { ++ ++ @Override ++ @Deprecated ++ public ItemStack getItemStack() { ++ throw new UnsupportedOperationException("PredicateRecipeChoice does not support this"); ++ } ++ ++ @Override ++ public RecipeChoice clone() { ++ try { ++ return (PredicateRecipeChoice) super.clone(); ++ } catch (final CloneNotSupportedException ex) { ++ throw new AssertionError(ex); ++ } ++ } ++ ++ @Override ++ public boolean test(final ItemStack itemStack) { ++ return this.itemStackPredicate.test(itemStack); ++ } ++} +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 1e96494c8080458f260ba94c4975ab18c4b4eefd..d56baf72235173121a694e8bb5331f2c515d3aa8 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2630,6 +2630,15 @@ public final class Bukkit { + public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { + return server.getDatapackManager(); + } ++ ++ /** ++ * Gets the potion brewer. ++ * ++ * @return the potion brewer ++ */ ++ public static @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer() { ++ return server.getPotionBrewer(); ++ } + // Paper end + + @NotNull +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 4b987d01c4f912ab567f1d3b3a91288b263f208a..bad717c09db4bfa8c5fe65878bb053e14ca22356 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2290,5 +2290,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + @NotNull + io.papermc.paper.datapack.DatapackManager getDatapackManager(); ++ ++ /** ++ * Gets the potion brewer. ++ * ++ * @return the potion brewer ++ */ ++ @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/org/bukkit/potion/PotionBrewer.java +index 2072f048e10eba829cef047d854b5a22c8f055a3..c1bcbeef9cb634e6cb8c4b58bf06883c37cc028b 100644 +--- a/src/main/java/org/bukkit/potion/PotionBrewer.java ++++ b/src/main/java/org/bukkit/potion/PotionBrewer.java +@@ -4,10 +4,31 @@ import java.util.Collection; + import org.jetbrains.annotations.NotNull; + + /** +- * Represents a brewer that can create {@link PotionEffect}s. ++ * Used to manage custom {@link io.papermc.paper.potion.PotionMix}s. + */ + public interface PotionBrewer { + ++ // Paper start ++ /** ++ * Adds a new potion mix recipe. ++ * ++ * @param potionMix the potion mix to add ++ */ ++ void addPotionMix(@NotNull io.papermc.paper.potion.PotionMix potionMix); ++ ++ /** ++ * Removes a potion mix recipe. ++ * ++ * @param key the key of the mix to remove ++ */ ++ void removePotionMix(@NotNull org.bukkit.NamespacedKey key); ++ ++ /** ++ * Resets potion mixes to their default, removing all custom ones. ++ */ ++ void resetPotionMixes(); ++ // Paper end ++ + /** + * Creates a {@link PotionEffect} from the given {@link PotionEffectType}, + * applying duration modifiers and checks. +@@ -16,9 +37,15 @@ public interface PotionBrewer { + * @param duration The duration in ticks + * @param amplifier The amplifier of the effect + * @return The resulting potion effect ++ * @deprecated use {@link PotionEffectType#createEffect(int, int)} instead. + */ ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper + @NotNull +- public PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier); ++ // Paper start - make default ++ default PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier) { ++ return potion.createEffect(duration, amplifier); ++ } ++ // Paper end + + /** + * Returns a collection of {@link PotionEffect} that would be applied from +@@ -28,9 +55,13 @@ public interface PotionBrewer { + * @return The list of effects + * @deprecated Non-Functional + */ +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper + @NotNull +- public Collection getEffectsFromDamage(int damage); ++ // Paper start - make default ++ default Collection getEffectsFromDamage(final int damage) { ++ return new java.util.ArrayList<>(); ++ } ++ // Paper end + + /** + * Returns a collection of {@link PotionEffect} that would be applied from +@@ -43,6 +74,6 @@ public interface PotionBrewer { + * @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link PotionType#getPotionEffects()} instead + */ + @NotNull +- @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper + public Collection getEffects(@NotNull PotionType type, boolean upgraded, boolean extended); + } diff --git a/patches/api/0345-Custom-Potion-Mixes.patch b/patches/api/0345-Custom-Potion-Mixes.patch deleted file mode 100644 index 7987206bf8..0000000000 --- a/patches/api/0345-Custom-Potion-Mixes.patch +++ /dev/null @@ -1,271 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 7 Oct 2021 14:34:59 -0700 -Subject: [PATCH] Custom Potion Mixes - - -diff --git a/src/main/java/io/papermc/paper/potion/PotionMix.java b/src/main/java/io/papermc/paper/potion/PotionMix.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3fc922ebf972418b84181cd02e68d8ef0efd739b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/potion/PotionMix.java -@@ -0,0 +1,105 @@ -+package io.papermc.paper.potion; -+ -+import java.util.function.Predicate; -+import org.bukkit.Keyed; -+import org.bukkit.NamespacedKey; -+import org.bukkit.inventory.ItemStack; -+import org.bukkit.inventory.RecipeChoice; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.Objects; -+ -+/** -+ * Represents a potion mix made in a Brewing Stand. -+ */ -+@ApiStatus.NonExtendable -+public class PotionMix implements Keyed { -+ -+ private final NamespacedKey key; -+ private final ItemStack result; -+ private final RecipeChoice input; -+ private final RecipeChoice ingredient; -+ -+ /** -+ * Creates a new potion mix. Add it to the server with {@link org.bukkit.potion.PotionBrewer#addPotionMix(PotionMix)}. -+ * -+ * @param key a unique key for the mix -+ * @param result the resulting itemstack that will appear in the 3 bottom slots -+ * @param input the input placed into the bottom 3 slots -+ * @param ingredient the ingredient placed into the top slot -+ */ -+ public PotionMix(final @NotNull NamespacedKey key, final @NotNull ItemStack result, final @NotNull RecipeChoice input, final @NotNull RecipeChoice ingredient) { -+ this.key = key; -+ this.result = result; -+ this.input = input; -+ this.ingredient = ingredient; -+ } -+ -+ /** -+ * Create a {@link RecipeChoice} based on a Predicate. These RecipeChoices are only -+ * valid for {@link PotionMix}, not anywhere else RecipeChoices may be used. -+ * -+ * @param stackPredicate a predicate for an itemstack. -+ * @return a new RecipeChoice -+ */ -+ @Contract(value = "_ -> new", pure = true) -+ public static @NotNull RecipeChoice createPredicateChoice(final @NotNull Predicate stackPredicate) { -+ return new PredicateRecipeChoice(stackPredicate); -+ } -+ -+ @Override -+ public @NotNull NamespacedKey getKey() { -+ return this.key; -+ } -+ -+ /** -+ * Gets the resulting itemstack after the brew has finished. -+ * -+ * @return the result itemstack -+ */ -+ public @NotNull ItemStack getResult() { -+ return this.result; -+ } -+ -+ /** -+ * Gets the input for the bottom 3 slots in the brewing stand. -+ * -+ * @return the bottom 3 slot ingredients -+ */ -+ public @NotNull RecipeChoice getInput() { -+ return this.input; -+ } -+ -+ /** -+ * Gets the ingredient in the top slot of the brewing stand. -+ * -+ * @return the top slot input -+ */ -+ public @NotNull RecipeChoice getIngredient() { -+ return this.ingredient; -+ } -+ -+ @Override -+ public String toString() { -+ return "PotionMix{" + -+ "result=" + this.result + -+ ", base=" + this.input + -+ ", addition=" + this.ingredient + -+ '}'; -+ } -+ -+ @Override -+ public boolean equals(final Object o) { -+ if (this == o) return true; -+ if (o == null || this.getClass() != o.getClass()) return false; -+ final PotionMix potionMix = (PotionMix) o; -+ return this.key.equals(potionMix.key) && this.result.equals(potionMix.result) && this.input.equals(potionMix.input) && this.ingredient.equals(potionMix.ingredient); -+ } -+ -+ @Override -+ public int hashCode() { -+ return Objects.hash(this.key, this.result, this.input, this.ingredient); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java b/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3ede1e8f7bf0436fdc5bf395c0f9eaf11c252453 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java -@@ -0,0 +1,33 @@ -+package io.papermc.paper.potion; -+ -+import java.util.function.Predicate; -+import org.bukkit.inventory.ItemStack; -+import org.bukkit.inventory.RecipeChoice; -+import org.checkerframework.checker.nullness.qual.NonNull; -+import org.checkerframework.framework.qual.DefaultQualifier; -+import org.jetbrains.annotations.ApiStatus; -+ -+@ApiStatus.Internal -+@DefaultQualifier(NonNull.class) -+record PredicateRecipeChoice(Predicate itemStackPredicate) implements RecipeChoice, Cloneable { -+ -+ @Override -+ @Deprecated -+ public ItemStack getItemStack() { -+ throw new UnsupportedOperationException("PredicateRecipeChoice does not support this"); -+ } -+ -+ @Override -+ public RecipeChoice clone() { -+ try { -+ return (PredicateRecipeChoice) super.clone(); -+ } catch (final CloneNotSupportedException ex) { -+ throw new AssertionError(ex); -+ } -+ } -+ -+ @Override -+ public boolean test(final ItemStack itemStack) { -+ return this.itemStackPredicate.test(itemStack); -+ } -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 1bbf2306fd6fdb3ead79fc770434541c2e054875..88223f062665c2c738e73a725d292b868e5372af 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2630,6 +2630,15 @@ public final class Bukkit { - public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { - return server.getDatapackManager(); - } -+ -+ /** -+ * Gets the potion brewer. -+ * -+ * @return the potion brewer -+ */ -+ public static @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer() { -+ return server.getPotionBrewer(); -+ } - // Paper end - - @NotNull -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 5b13d84b39a006f84c74008d3141b1a2ac954b7d..0c2906de839fe8211ed431df2e5e94740f04b94a 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2290,5 +2290,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull - io.papermc.paper.datapack.DatapackManager getDatapackManager(); -+ -+ /** -+ * Gets the potion brewer. -+ * -+ * @return the potion brewer -+ */ -+ @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); - // Paper end - } -diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/org/bukkit/potion/PotionBrewer.java -index 2072f048e10eba829cef047d854b5a22c8f055a3..c1bcbeef9cb634e6cb8c4b58bf06883c37cc028b 100644 ---- a/src/main/java/org/bukkit/potion/PotionBrewer.java -+++ b/src/main/java/org/bukkit/potion/PotionBrewer.java -@@ -4,10 +4,31 @@ import java.util.Collection; - import org.jetbrains.annotations.NotNull; - - /** -- * Represents a brewer that can create {@link PotionEffect}s. -+ * Used to manage custom {@link io.papermc.paper.potion.PotionMix}s. - */ - public interface PotionBrewer { - -+ // Paper start -+ /** -+ * Adds a new potion mix recipe. -+ * -+ * @param potionMix the potion mix to add -+ */ -+ void addPotionMix(@NotNull io.papermc.paper.potion.PotionMix potionMix); -+ -+ /** -+ * Removes a potion mix recipe. -+ * -+ * @param key the key of the mix to remove -+ */ -+ void removePotionMix(@NotNull org.bukkit.NamespacedKey key); -+ -+ /** -+ * Resets potion mixes to their default, removing all custom ones. -+ */ -+ void resetPotionMixes(); -+ // Paper end -+ - /** - * Creates a {@link PotionEffect} from the given {@link PotionEffectType}, - * applying duration modifiers and checks. -@@ -16,9 +37,15 @@ public interface PotionBrewer { - * @param duration The duration in ticks - * @param amplifier The amplifier of the effect - * @return The resulting potion effect -+ * @deprecated use {@link PotionEffectType#createEffect(int, int)} instead. - */ -+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper - @NotNull -- public PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier); -+ // Paper start - make default -+ default PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier) { -+ return potion.createEffect(duration, amplifier); -+ } -+ // Paper end - - /** - * Returns a collection of {@link PotionEffect} that would be applied from -@@ -28,9 +55,13 @@ public interface PotionBrewer { - * @return The list of effects - * @deprecated Non-Functional - */ -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper - @NotNull -- public Collection getEffectsFromDamage(int damage); -+ // Paper start - make default -+ default Collection getEffectsFromDamage(final int damage) { -+ return new java.util.ArrayList<>(); -+ } -+ // Paper end - - /** - * Returns a collection of {@link PotionEffect} that would be applied from -@@ -43,6 +74,6 @@ public interface PotionBrewer { - * @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link PotionType#getPotionEffects()} instead - */ - @NotNull -- @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper - public Collection getEffects(@NotNull PotionType type, boolean upgraded, boolean extended); - } diff --git a/patches/api/0345-Expose-furnace-minecart-push-values.patch b/patches/api/0345-Expose-furnace-minecart-push-values.patch new file mode 100644 index 0000000000..3d8c2336e7 --- /dev/null +++ b/patches/api/0345-Expose-furnace-minecart-push-values.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: EpicKnarvik97 +Date: Sat, 5 Mar 2022 20:58:47 +0100 +Subject: [PATCH] Expose furnace minecart push values + +Adds methods for getting and setting a furnace minecart's push values + +diff --git a/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java b/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java +index 2076af6c029027d3243ebfa518f4d69b716de7fe..b95df59f780da9291d1d2db77a8eb7a9cd460777 100644 +--- a/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java ++++ b/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java +@@ -21,4 +21,34 @@ public interface PoweredMinecart extends Minecart { + * @param fuel Number of ticks until the minecart runs out of fuel + */ + public void setFuel(int fuel); ++ ++ // Paper start ++ /** ++ * Get the x push of the minecart. ++ * ++ * @return The x push of the minecart ++ */ ++ public double getPushX(); ++ ++ /** ++ * Get the z push of the minecart. ++ * ++ * @return The z push of the minecart ++ */ ++ public double getPushZ(); ++ ++ /** ++ * Set the x push of the minecart. ++ * ++ * @param xPush The new x push of the minecart ++ */ ++ public void setPushX(double xPush); ++ ++ /** ++ * Set the z push of the minecart. ++ * ++ * @param zPush The new z push of the minecart ++ */ ++ public void setPushZ(double zPush); ++ // Paper end + } diff --git a/patches/api/0346-Expose-furnace-minecart-push-values.patch b/patches/api/0346-Expose-furnace-minecart-push-values.patch deleted file mode 100644 index 3d8c2336e7..0000000000 --- a/patches/api/0346-Expose-furnace-minecart-push-values.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: EpicKnarvik97 -Date: Sat, 5 Mar 2022 20:58:47 +0100 -Subject: [PATCH] Expose furnace minecart push values - -Adds methods for getting and setting a furnace minecart's push values - -diff --git a/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java b/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java -index 2076af6c029027d3243ebfa518f4d69b716de7fe..b95df59f780da9291d1d2db77a8eb7a9cd460777 100644 ---- a/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java -+++ b/src/main/java/org/bukkit/entity/minecart/PoweredMinecart.java -@@ -21,4 +21,34 @@ public interface PoweredMinecart extends Minecart { - * @param fuel Number of ticks until the minecart runs out of fuel - */ - public void setFuel(int fuel); -+ -+ // Paper start -+ /** -+ * Get the x push of the minecart. -+ * -+ * @return The x push of the minecart -+ */ -+ public double getPushX(); -+ -+ /** -+ * Get the z push of the minecart. -+ * -+ * @return The z push of the minecart -+ */ -+ public double getPushZ(); -+ -+ /** -+ * Set the x push of the minecart. -+ * -+ * @param xPush The new x push of the minecart -+ */ -+ public void setPushX(double xPush); -+ -+ /** -+ * Set the z push of the minecart. -+ * -+ * @param zPush The new z push of the minecart -+ */ -+ public void setPushZ(double zPush); -+ // Paper end - } diff --git a/patches/api/0346-More-Projectile-API.patch b/patches/api/0346-More-Projectile-API.patch new file mode 100644 index 0000000000..ba63dbcd3b --- /dev/null +++ b/patches/api/0346-More-Projectile-API.patch @@ -0,0 +1,449 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 26 May 2021 19:34:43 -0400 +Subject: [PATCH] More Projectile API + +Co-authored-by: Nassim Jahnke + +diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java +index 839e5b7df49f42b5fec7729997bef3370ba36d80..b36298679d6d52d09fe4bb8e52e19e18f6df742a 100644 +--- a/src/main/java/org/bukkit/entity/AbstractArrow.java ++++ b/src/main/java/org/bukkit/entity/AbstractArrow.java +@@ -130,17 +130,21 @@ public interface AbstractArrow extends Projectile { + * Gets the ItemStack which will be picked up from this arrow. + * + * @return The picked up ItemStack ++ * @deprecated use {@link #getItemStack()} + */ + @NotNull + @ApiStatus.Experimental ++ @Deprecated(forRemoval = true, since = "1.20.4") // Paper + public ItemStack getItem(); + + /** + * Sets the ItemStack which will be picked up from this arrow. + * + * @param item ItemStack set to be picked up ++ * @deprecated until 1.20.5 when the behavior is more defined + */ + @ApiStatus.Experimental ++ @Deprecated // Paper - remove in 1.20.5 + public void setItem(@NotNull ItemStack item); + + /** +@@ -194,4 +198,44 @@ public interface AbstractArrow extends Projectile { + CREATIVE_ONLY; + } + // Paper end ++ ++ // Paper start - more projectile API ++ /** ++ * Gets the ItemStack for this arrow. ++ * ++ * @return The ItemStack, as if a player picked up the arrow ++ */ ++ @NotNull ++ org.bukkit.inventory.ItemStack getItemStack(); ++ ++ /** ++ * Sets the amount of ticks this arrow has been alive in the world ++ * This is used to determine when the arrow should be automatically despawned. ++ * ++ * @param ticks lifetime ticks ++ */ ++ void setLifetimeTicks(int ticks); ++ ++ /** ++ * Gets how many ticks this arrow has been in the world for. ++ * ++ * @return ticks this arrow has been in the world ++ */ ++ int getLifetimeTicks(); ++ ++ /** ++ * Gets the sound that is played when this arrow hits an entity. ++ * ++ * @return sound that plays ++ */ ++ @NotNull ++ org.bukkit.Sound getHitSound(); ++ ++ /** ++ * Sets the sound that is played when this arrow hits an entity. ++ * ++ * @param sound sound that is played ++ */ ++ void setHitSound(@NotNull org.bukkit.Sound sound); ++ // Paper end - more projectile API + } +diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java +index 0d31aa0b22cf1e849572294e2cfe38b48c9210af..217d348ad0bbef720b25d3b507a55ca8105b7731 100644 +--- a/src/main/java/org/bukkit/entity/Firework.java ++++ b/src/main/java/org/bukkit/entity/Firework.java +@@ -16,6 +16,8 @@ public interface Firework extends Projectile { + + /** + * Apply the provided meta to the fireworks ++ *

    ++ * Adjusts detonation ticks automatically. + * + * @param meta The FireworkMeta to apply + */ +@@ -54,31 +56,39 @@ public interface Firework extends Projectile { + * {@link #getMaxLife()}, the firework will detonate. + * + * @param ticks the ticks to set. Must be greater than or equal to 0 ++ * @deprecated use {@link #setTicksFlown(int)} + * @return true if the life was set, false if this firework has already detonated + */ ++ @Deprecated(forRemoval = true) // Paper + boolean setLife(int ticks); + + /** + * Get the ticks that this firework has been alive. When this value reaches + * {@link #getMaxLife()}, the firework will detonate. + * ++ * @deprecated use {@link #getTicksFlown()} + * @return the life ticks + */ ++ @Deprecated(forRemoval = true) // Paper + int getLife(); + + /** + * Set the time in ticks this firework will exist until it is detonated. + * + * @param ticks the ticks to set. Must be greater than 0 ++ * @deprecated use {@link #setTicksToDetonate(int)} + * @return true if the time was set, false if this firework has already detonated + */ ++ @Deprecated(forRemoval = true) // Paper + boolean setMaxLife(int ticks); + + /** + * Get the time in ticks this firework will exist until it is detonated. + * ++ * @deprecated use {@link #getTicksToDetonate()} + * @return the maximum life in ticks + */ ++ @Deprecated(forRemoval = true) // Paper + int getMaxLife(); + + /** +@@ -127,4 +137,52 @@ public interface Firework extends Projectile { + return getAttachedTo(); + } + // Paper end ++ ++ // Paper start - Firework API ++ /** ++ * Gets the item used in the firework. ++ * ++ * @return firework item ++ */ ++ @NotNull ++ public org.bukkit.inventory.ItemStack getItem(); ++ ++ /** ++ * Sets the item used in the firework. ++ *

    ++ * Firework explosion effects are used from this item. ++ * ++ * @param itemStack item to set ++ */ ++ void setItem(@org.jetbrains.annotations.Nullable org.bukkit.inventory.ItemStack itemStack); ++ ++ /** ++ * Gets the number of ticks the firework has flown. ++ * ++ * @return ticks flown ++ */ ++ int getTicksFlown(); ++ ++ /** ++ * Sets the number of ticks the firework has flown. ++ * Setting this greater than detonation ticks will cause the firework to explode. ++ * ++ * @param ticks ticks flown ++ */ ++ void setTicksFlown(int ticks); ++ ++ /** ++ * Gets the number of ticks the firework will detonate on. ++ * ++ * @return the tick to detonate on ++ */ ++ int getTicksToDetonate(); ++ ++ /** ++ * Set the amount of ticks the firework will detonate on. ++ * ++ * @param ticks ticks to detonate on ++ */ ++ void setTicksToDetonate(int ticks); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/FishHook.java b/src/main/java/org/bukkit/entity/FishHook.java +index 94e1a30ea1bc26821065a6d89c1f5669bd1d08ae..6ed83d3e4d23e0dc0e1b156a1ee221aaba5c7210 100644 +--- a/src/main/java/org/bukkit/entity/FishHook.java ++++ b/src/main/java/org/bukkit/entity/FishHook.java +@@ -322,4 +322,20 @@ public interface FishHook extends Projectile { + */ + BOBBING; + } ++ ++ // Paper start - More FishHook API ++ /** ++ * Get the number of ticks the hook needs to wait for a fish to bite. ++ * ++ * @return Number of ticks ++ */ ++ int getWaitTime(); ++ ++ /** ++ * Sets the number of ticks the hook needs to wait for a fish to bite. ++ * ++ * @param ticks Number of ticks ++ */ ++ void setWaitTime(int ticks); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java +index 06e3ad9cd8f39de0ef6ead794df1492415bc4302..c3933fb5cd9708826effeef2ad2f81c9f7900a37 100644 +--- a/src/main/java/org/bukkit/entity/Projectile.java ++++ b/src/main/java/org/bukkit/entity/Projectile.java +@@ -12,6 +12,7 @@ public interface Projectile extends Entity { + * Retrieve the shooter of this projectile. + * + * @return the {@link ProjectileSource} that shot this projectile ++ * @see #getOwnerUniqueId() + */ + @Nullable + public ProjectileSource getShooter(); +@@ -41,4 +42,89 @@ public interface Projectile extends Entity { + */ + @Deprecated(forRemoval = true) + public void setBounce(boolean doesBounce); ++ // Paper start ++ ++ /** ++ * Gets whether the projectile has left the ++ * hitbox of their shooter and can now hit entities. ++ * ++ * @return has left shooter's hitbox ++ */ ++ boolean hasLeftShooter(); ++ ++ /** ++ * Sets whether the projectile has left the ++ * hitbox of their shooter and can now hit entities. ++ * ++ * This is recalculated each tick if the projectile has a shooter. ++ * ++ * @param leftShooter has left shooter's hitbox ++ */ ++ void setHasLeftShooter(boolean leftShooter); ++ ++ /** ++ * Gets whether the projectile has been ++ * shot into the world and has sent a projectile ++ * shot game event. ++ * ++ * @return has been shot into the world ++ */ ++ boolean hasBeenShot(); ++ ++ /** ++ * Sets whether the projectile has been ++ * shot into the world and has sent a projectile ++ * shot game event in the next tick. ++ * ++ * Setting this to false will cause a game event ++ * to fire and the value to be set back to true. ++ * ++ * @param beenShot has been in shot into the world ++ */ ++ void setHasBeenShot(boolean beenShot); ++ ++ /** ++ * Gets whether this projectile can hit an entity. ++ *

    ++ * This method returns true under the following conditions: ++ *

    ++ * - The shooter can see the entity ({@link Player#canSee(Entity)})

    ++ * - The entity is alive and not a spectator

    ++ * - The projectile has left the hitbox of the shooter ({@link #hasLeftShooter()})

    ++ * - If this is an arrow with piercing, it has not pierced the entity already ++ * ++ * @param entity the entity to check if this projectile can hit ++ * @return true if this projectile can damage the entity, false otherwise ++ */ ++ boolean canHitEntity(@org.jetbrains.annotations.NotNull Entity entity); ++ ++ /** ++ * Makes this projectile hit a specific entity. ++ * This uses the current position of the projectile for the hit point. ++ * Using this method will result in {@link org.bukkit.event.entity.ProjectileHitEvent} being called. ++ * @param entity the entity to hit ++ * @see #hitEntity(Entity, org.bukkit.util.Vector) ++ * @see #canHitEntity(Entity) ++ */ ++ void hitEntity(@org.jetbrains.annotations.NotNull Entity entity); ++ ++ /** ++ * Makes this projectile hit a specific entity from a specific point. ++ * Using this method will result in {@link org.bukkit.event.entity.ProjectileHitEvent} being called. ++ * @param entity the entity to hit ++ * @param vector the direction to hit from ++ * @see #hitEntity(Entity) ++ * @see #canHitEntity(Entity) ++ */ ++ void hitEntity(@org.jetbrains.annotations.NotNull Entity entity, @org.jetbrains.annotations.NotNull org.bukkit.util.Vector vector); ++ ++ /** ++ * Gets the owner's UUID ++ * ++ * @return the owner's UUID, or null if not owned ++ * @see #getShooter() ++ */ ++ @Nullable ++ java.util.UUID getOwnerUniqueId(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/ShulkerBullet.java b/src/main/java/org/bukkit/entity/ShulkerBullet.java +index 4623e0d767b343cbdc6fcf20b3b2ff7ff14863cf..dd69a68d1f005c25329bb0366d161ae9b061e108 100644 +--- a/src/main/java/org/bukkit/entity/ShulkerBullet.java ++++ b/src/main/java/org/bukkit/entity/ShulkerBullet.java +@@ -18,4 +18,61 @@ public interface ShulkerBullet extends Projectile { + * @param target the entity to target + */ + void setTarget(@Nullable Entity target); ++ // Paper start ++ /** ++ * Gets the relative offset that this shulker bullet should move towards, ++ * note that this will change each tick as the skulker bullet approaches the target. ++ * ++ * @return target delta offset ++ */ ++ @org.jetbrains.annotations.NotNull ++ org.bukkit.util.Vector getTargetDelta(); ++ ++ ++ /** ++ * Sets the relative offset that this shulker bullet should move towards, ++ * note that this will change each tick as the skulker bullet approaches the target. ++ * This is usually relative towards their target. ++ * ++ * @param vector target ++ */ ++ void setTargetDelta(@org.jetbrains.annotations.NotNull org.bukkit.util.Vector vector); ++ ++ /** ++ * Gets the current movement direction. ++ * This is used to determine the next movement direction to ensure ++ * that the bullet does not move in the same direction. ++ * ++ * @return null or their current direction ++ */ ++ @Nullable ++ org.bukkit.block.BlockFace getCurrentMovementDirection(); ++ ++ /** ++ * Set the current movement direction. ++ * This is used to determine the next movement direction to ensure ++ * that the bullet does not move in the same direction. ++ * ++ * Set to null to simply pick a random direction. ++ * ++ * @param movementDirection null or a direction ++ */ ++ void setCurrentMovementDirection(@Nullable org.bukkit.block.BlockFace movementDirection); ++ ++ /** ++ * Gets how many ticks this shulker bullet ++ * will attempt to move in its current direction. ++ * ++ * @return number of steps ++ */ ++ int getFlightSteps(); ++ ++ /** ++ * Sets how many ticks this shulker bullet ++ * will attempt to move in its current direction. ++ * ++ * @param steps number of steps ++ */ ++ void setFlightSteps(int steps); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/ThrownPotion.java b/src/main/java/org/bukkit/entity/ThrownPotion.java +index 7051e07b4e456aae0ec9e37808b59e5fa62a4027..225ac312613b9e8f3cf680819f2ebe350d1bf48a 100644 +--- a/src/main/java/org/bukkit/entity/ThrownPotion.java ++++ b/src/main/java/org/bukkit/entity/ThrownPotion.java +@@ -32,12 +32,34 @@ public interface ThrownPotion extends ThrowableProjectile { + + /** + * Set the ItemStack for this thrown potion. +- *

    +- * The ItemStack must be of type {@link org.bukkit.Material#SPLASH_POTION} +- * or {@link org.bukkit.Material#LINGERING_POTION}, otherwise an exception +- * is thrown. + * + * @param item New ItemStack + */ + public void setItem(@NotNull ItemStack item); ++ ++ // Paper start - Projectile API ++ /** ++ * Gets a copy of the PotionMeta for this thrown potion. ++ * This includes what effects will be applied by this potion. ++ * ++ * @return potion meta ++ */ ++ @NotNull ++ org.bukkit.inventory.meta.PotionMeta getPotionMeta(); ++ ++ /** ++ * Sets the PotionMeta of this thrown potion. ++ * This will modify the effects applied by this potion. ++ *

    ++ * Note that the type of {@link #getItem()} is irrelevant ++ * ++ * @param meta potion meta ++ */ ++ void setPotionMeta(@NotNull org.bukkit.inventory.meta.PotionMeta meta); ++ ++ /** ++ * Splashes the potion at its current location. ++ */ ++ void splash(); ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java +index c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7..02584eced96944a551140f8150c65a7c0f4bb55e 100644 +--- a/src/main/java/org/bukkit/entity/Trident.java ++++ b/src/main/java/org/bukkit/entity/Trident.java +@@ -38,5 +38,24 @@ public interface Trident extends AbstractArrow, ThrowableProjectile { + * @throws IllegalArgumentException if the loyalty level is lower than 0 or greater than 127 + */ + void setLoyaltyLevel(int loyaltyLevel); ++ ++ /** ++ * Gets if this trident has dealt damage to an ++ * entity yet or has hit the floor. ++ * ++ * If neither of these events have occurred yet, this will ++ * return false. ++ * ++ * @return has dealt damage ++ */ ++ boolean hasDealtDamage(); ++ ++ /** ++ * Sets if this trident has dealt damage to an entity ++ * yet or has hit the floor. ++ * ++ * @param hasDealtDamage has dealt damage or hit the floor ++ */ ++ void setHasDealtDamage(boolean hasDealtDamage); + } + // Paper end diff --git a/patches/api/0347-Add-getComputedBiome-API.patch b/patches/api/0347-Add-getComputedBiome-API.patch new file mode 100644 index 0000000000..6d24c2c66a --- /dev/null +++ b/patches/api/0347-Add-getComputedBiome-API.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Mon, 14 Mar 2022 22:45:32 -0700 +Subject: [PATCH] Add getComputedBiome API + + +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index b68367f123f029c3ff47eab6bfabd7a894a99da4..44ee56a5956cc17194c767a0c1071a2abffe818a 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -25,6 +25,7 @@ public interface RegionAccessor extends Keyed { // Paper + * + * @param location the location of the biome + * @return Biome at the given location ++ * @see #getComputedBiome(int, int, int) + */ + @NotNull + Biome getBiome(@NotNull Location location); +@@ -36,10 +37,33 @@ public interface RegionAccessor extends Keyed { // Paper + * @param y Y-coordinate of the block + * @param z Z-coordinate of the block + * @return Biome at the given coordinates ++ * @see #getComputedBiome(int, int, int) + */ + @NotNull + Biome getBiome(int x, int y, int z); + ++ // Paper start ++ /** ++ * Gets the computed {@link Biome} at the given coordinates. ++ * ++ *

    The computed Biome is the Biome as seen by clients for rendering ++ * purposes and in the "F3" debug menu. This is computed by looking at the noise biome ++ * at this and surrounding quarts and applying complex math operations.

    ++ * ++ *

    Most other Biome-related methods named getBiome, setBiome, and similar ++ * operate on the "noise biome", which is stored per-quart, or in other words, ++ * 1 Biome per 4x4x4 block region. This is how Biomes are currently generated and ++ * stored on disk.

    ++ * ++ * @param x X-coordinate of the block ++ * @param y Y-coordinate of the block ++ * @param z Z-coordinate of the block ++ * @return Biome at the given coordinates ++ */ ++ @NotNull ++ Biome getComputedBiome(int x, int y, int z); ++ // Paper end ++ + /** + * Sets the {@link Biome} at the given {@link Location}. + * +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index 42cc4f2ee960c0abf9c6688aeee4150754612c32..cf9600c743e977312c0a15c455d602391797ef34 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -371,10 +371,22 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr + * Returns the biome that this block resides in + * + * @return Biome type containing this block ++ * @see #getComputedBiome() + */ + @NotNull + Biome getBiome(); + ++ // Paper start ++ /** ++ * Gets the computed biome at the location of this Block. ++ * ++ * @return computed biome at the location of this Block. ++ * @see org.bukkit.RegionAccessor#getComputedBiome(int, int, int) ++ */ ++ @NotNull ++ Biome getComputedBiome(); ++ // Paper end ++ + /** + * Sets the biome that this block resides in + * diff --git a/patches/api/0347-More-Projectile-API.patch b/patches/api/0347-More-Projectile-API.patch deleted file mode 100644 index ba63dbcd3b..0000000000 --- a/patches/api/0347-More-Projectile-API.patch +++ /dev/null @@ -1,449 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 26 May 2021 19:34:43 -0400 -Subject: [PATCH] More Projectile API - -Co-authored-by: Nassim Jahnke - -diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java -index 839e5b7df49f42b5fec7729997bef3370ba36d80..b36298679d6d52d09fe4bb8e52e19e18f6df742a 100644 ---- a/src/main/java/org/bukkit/entity/AbstractArrow.java -+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java -@@ -130,17 +130,21 @@ public interface AbstractArrow extends Projectile { - * Gets the ItemStack which will be picked up from this arrow. - * - * @return The picked up ItemStack -+ * @deprecated use {@link #getItemStack()} - */ - @NotNull - @ApiStatus.Experimental -+ @Deprecated(forRemoval = true, since = "1.20.4") // Paper - public ItemStack getItem(); - - /** - * Sets the ItemStack which will be picked up from this arrow. - * - * @param item ItemStack set to be picked up -+ * @deprecated until 1.20.5 when the behavior is more defined - */ - @ApiStatus.Experimental -+ @Deprecated // Paper - remove in 1.20.5 - public void setItem(@NotNull ItemStack item); - - /** -@@ -194,4 +198,44 @@ public interface AbstractArrow extends Projectile { - CREATIVE_ONLY; - } - // Paper end -+ -+ // Paper start - more projectile API -+ /** -+ * Gets the ItemStack for this arrow. -+ * -+ * @return The ItemStack, as if a player picked up the arrow -+ */ -+ @NotNull -+ org.bukkit.inventory.ItemStack getItemStack(); -+ -+ /** -+ * Sets the amount of ticks this arrow has been alive in the world -+ * This is used to determine when the arrow should be automatically despawned. -+ * -+ * @param ticks lifetime ticks -+ */ -+ void setLifetimeTicks(int ticks); -+ -+ /** -+ * Gets how many ticks this arrow has been in the world for. -+ * -+ * @return ticks this arrow has been in the world -+ */ -+ int getLifetimeTicks(); -+ -+ /** -+ * Gets the sound that is played when this arrow hits an entity. -+ * -+ * @return sound that plays -+ */ -+ @NotNull -+ org.bukkit.Sound getHitSound(); -+ -+ /** -+ * Sets the sound that is played when this arrow hits an entity. -+ * -+ * @param sound sound that is played -+ */ -+ void setHitSound(@NotNull org.bukkit.Sound sound); -+ // Paper end - more projectile API - } -diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java -index 0d31aa0b22cf1e849572294e2cfe38b48c9210af..217d348ad0bbef720b25d3b507a55ca8105b7731 100644 ---- a/src/main/java/org/bukkit/entity/Firework.java -+++ b/src/main/java/org/bukkit/entity/Firework.java -@@ -16,6 +16,8 @@ public interface Firework extends Projectile { - - /** - * Apply the provided meta to the fireworks -+ *

    -+ * Adjusts detonation ticks automatically. - * - * @param meta The FireworkMeta to apply - */ -@@ -54,31 +56,39 @@ public interface Firework extends Projectile { - * {@link #getMaxLife()}, the firework will detonate. - * - * @param ticks the ticks to set. Must be greater than or equal to 0 -+ * @deprecated use {@link #setTicksFlown(int)} - * @return true if the life was set, false if this firework has already detonated - */ -+ @Deprecated(forRemoval = true) // Paper - boolean setLife(int ticks); - - /** - * Get the ticks that this firework has been alive. When this value reaches - * {@link #getMaxLife()}, the firework will detonate. - * -+ * @deprecated use {@link #getTicksFlown()} - * @return the life ticks - */ -+ @Deprecated(forRemoval = true) // Paper - int getLife(); - - /** - * Set the time in ticks this firework will exist until it is detonated. - * - * @param ticks the ticks to set. Must be greater than 0 -+ * @deprecated use {@link #setTicksToDetonate(int)} - * @return true if the time was set, false if this firework has already detonated - */ -+ @Deprecated(forRemoval = true) // Paper - boolean setMaxLife(int ticks); - - /** - * Get the time in ticks this firework will exist until it is detonated. - * -+ * @deprecated use {@link #getTicksToDetonate()} - * @return the maximum life in ticks - */ -+ @Deprecated(forRemoval = true) // Paper - int getMaxLife(); - - /** -@@ -127,4 +137,52 @@ public interface Firework extends Projectile { - return getAttachedTo(); - } - // Paper end -+ -+ // Paper start - Firework API -+ /** -+ * Gets the item used in the firework. -+ * -+ * @return firework item -+ */ -+ @NotNull -+ public org.bukkit.inventory.ItemStack getItem(); -+ -+ /** -+ * Sets the item used in the firework. -+ *

    -+ * Firework explosion effects are used from this item. -+ * -+ * @param itemStack item to set -+ */ -+ void setItem(@org.jetbrains.annotations.Nullable org.bukkit.inventory.ItemStack itemStack); -+ -+ /** -+ * Gets the number of ticks the firework has flown. -+ * -+ * @return ticks flown -+ */ -+ int getTicksFlown(); -+ -+ /** -+ * Sets the number of ticks the firework has flown. -+ * Setting this greater than detonation ticks will cause the firework to explode. -+ * -+ * @param ticks ticks flown -+ */ -+ void setTicksFlown(int ticks); -+ -+ /** -+ * Gets the number of ticks the firework will detonate on. -+ * -+ * @return the tick to detonate on -+ */ -+ int getTicksToDetonate(); -+ -+ /** -+ * Set the amount of ticks the firework will detonate on. -+ * -+ * @param ticks ticks to detonate on -+ */ -+ void setTicksToDetonate(int ticks); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/FishHook.java b/src/main/java/org/bukkit/entity/FishHook.java -index 94e1a30ea1bc26821065a6d89c1f5669bd1d08ae..6ed83d3e4d23e0dc0e1b156a1ee221aaba5c7210 100644 ---- a/src/main/java/org/bukkit/entity/FishHook.java -+++ b/src/main/java/org/bukkit/entity/FishHook.java -@@ -322,4 +322,20 @@ public interface FishHook extends Projectile { - */ - BOBBING; - } -+ -+ // Paper start - More FishHook API -+ /** -+ * Get the number of ticks the hook needs to wait for a fish to bite. -+ * -+ * @return Number of ticks -+ */ -+ int getWaitTime(); -+ -+ /** -+ * Sets the number of ticks the hook needs to wait for a fish to bite. -+ * -+ * @param ticks Number of ticks -+ */ -+ void setWaitTime(int ticks); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java -index 06e3ad9cd8f39de0ef6ead794df1492415bc4302..c3933fb5cd9708826effeef2ad2f81c9f7900a37 100644 ---- a/src/main/java/org/bukkit/entity/Projectile.java -+++ b/src/main/java/org/bukkit/entity/Projectile.java -@@ -12,6 +12,7 @@ public interface Projectile extends Entity { - * Retrieve the shooter of this projectile. - * - * @return the {@link ProjectileSource} that shot this projectile -+ * @see #getOwnerUniqueId() - */ - @Nullable - public ProjectileSource getShooter(); -@@ -41,4 +42,89 @@ public interface Projectile extends Entity { - */ - @Deprecated(forRemoval = true) - public void setBounce(boolean doesBounce); -+ // Paper start -+ -+ /** -+ * Gets whether the projectile has left the -+ * hitbox of their shooter and can now hit entities. -+ * -+ * @return has left shooter's hitbox -+ */ -+ boolean hasLeftShooter(); -+ -+ /** -+ * Sets whether the projectile has left the -+ * hitbox of their shooter and can now hit entities. -+ * -+ * This is recalculated each tick if the projectile has a shooter. -+ * -+ * @param leftShooter has left shooter's hitbox -+ */ -+ void setHasLeftShooter(boolean leftShooter); -+ -+ /** -+ * Gets whether the projectile has been -+ * shot into the world and has sent a projectile -+ * shot game event. -+ * -+ * @return has been shot into the world -+ */ -+ boolean hasBeenShot(); -+ -+ /** -+ * Sets whether the projectile has been -+ * shot into the world and has sent a projectile -+ * shot game event in the next tick. -+ * -+ * Setting this to false will cause a game event -+ * to fire and the value to be set back to true. -+ * -+ * @param beenShot has been in shot into the world -+ */ -+ void setHasBeenShot(boolean beenShot); -+ -+ /** -+ * Gets whether this projectile can hit an entity. -+ *

    -+ * This method returns true under the following conditions: -+ *

    -+ * - The shooter can see the entity ({@link Player#canSee(Entity)})

    -+ * - The entity is alive and not a spectator

    -+ * - The projectile has left the hitbox of the shooter ({@link #hasLeftShooter()})

    -+ * - If this is an arrow with piercing, it has not pierced the entity already -+ * -+ * @param entity the entity to check if this projectile can hit -+ * @return true if this projectile can damage the entity, false otherwise -+ */ -+ boolean canHitEntity(@org.jetbrains.annotations.NotNull Entity entity); -+ -+ /** -+ * Makes this projectile hit a specific entity. -+ * This uses the current position of the projectile for the hit point. -+ * Using this method will result in {@link org.bukkit.event.entity.ProjectileHitEvent} being called. -+ * @param entity the entity to hit -+ * @see #hitEntity(Entity, org.bukkit.util.Vector) -+ * @see #canHitEntity(Entity) -+ */ -+ void hitEntity(@org.jetbrains.annotations.NotNull Entity entity); -+ -+ /** -+ * Makes this projectile hit a specific entity from a specific point. -+ * Using this method will result in {@link org.bukkit.event.entity.ProjectileHitEvent} being called. -+ * @param entity the entity to hit -+ * @param vector the direction to hit from -+ * @see #hitEntity(Entity) -+ * @see #canHitEntity(Entity) -+ */ -+ void hitEntity(@org.jetbrains.annotations.NotNull Entity entity, @org.jetbrains.annotations.NotNull org.bukkit.util.Vector vector); -+ -+ /** -+ * Gets the owner's UUID -+ * -+ * @return the owner's UUID, or null if not owned -+ * @see #getShooter() -+ */ -+ @Nullable -+ java.util.UUID getOwnerUniqueId(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/ShulkerBullet.java b/src/main/java/org/bukkit/entity/ShulkerBullet.java -index 4623e0d767b343cbdc6fcf20b3b2ff7ff14863cf..dd69a68d1f005c25329bb0366d161ae9b061e108 100644 ---- a/src/main/java/org/bukkit/entity/ShulkerBullet.java -+++ b/src/main/java/org/bukkit/entity/ShulkerBullet.java -@@ -18,4 +18,61 @@ public interface ShulkerBullet extends Projectile { - * @param target the entity to target - */ - void setTarget(@Nullable Entity target); -+ // Paper start -+ /** -+ * Gets the relative offset that this shulker bullet should move towards, -+ * note that this will change each tick as the skulker bullet approaches the target. -+ * -+ * @return target delta offset -+ */ -+ @org.jetbrains.annotations.NotNull -+ org.bukkit.util.Vector getTargetDelta(); -+ -+ -+ /** -+ * Sets the relative offset that this shulker bullet should move towards, -+ * note that this will change each tick as the skulker bullet approaches the target. -+ * This is usually relative towards their target. -+ * -+ * @param vector target -+ */ -+ void setTargetDelta(@org.jetbrains.annotations.NotNull org.bukkit.util.Vector vector); -+ -+ /** -+ * Gets the current movement direction. -+ * This is used to determine the next movement direction to ensure -+ * that the bullet does not move in the same direction. -+ * -+ * @return null or their current direction -+ */ -+ @Nullable -+ org.bukkit.block.BlockFace getCurrentMovementDirection(); -+ -+ /** -+ * Set the current movement direction. -+ * This is used to determine the next movement direction to ensure -+ * that the bullet does not move in the same direction. -+ * -+ * Set to null to simply pick a random direction. -+ * -+ * @param movementDirection null or a direction -+ */ -+ void setCurrentMovementDirection(@Nullable org.bukkit.block.BlockFace movementDirection); -+ -+ /** -+ * Gets how many ticks this shulker bullet -+ * will attempt to move in its current direction. -+ * -+ * @return number of steps -+ */ -+ int getFlightSteps(); -+ -+ /** -+ * Sets how many ticks this shulker bullet -+ * will attempt to move in its current direction. -+ * -+ * @param steps number of steps -+ */ -+ void setFlightSteps(int steps); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/ThrownPotion.java b/src/main/java/org/bukkit/entity/ThrownPotion.java -index 7051e07b4e456aae0ec9e37808b59e5fa62a4027..225ac312613b9e8f3cf680819f2ebe350d1bf48a 100644 ---- a/src/main/java/org/bukkit/entity/ThrownPotion.java -+++ b/src/main/java/org/bukkit/entity/ThrownPotion.java -@@ -32,12 +32,34 @@ public interface ThrownPotion extends ThrowableProjectile { - - /** - * Set the ItemStack for this thrown potion. -- *

    -- * The ItemStack must be of type {@link org.bukkit.Material#SPLASH_POTION} -- * or {@link org.bukkit.Material#LINGERING_POTION}, otherwise an exception -- * is thrown. - * - * @param item New ItemStack - */ - public void setItem(@NotNull ItemStack item); -+ -+ // Paper start - Projectile API -+ /** -+ * Gets a copy of the PotionMeta for this thrown potion. -+ * This includes what effects will be applied by this potion. -+ * -+ * @return potion meta -+ */ -+ @NotNull -+ org.bukkit.inventory.meta.PotionMeta getPotionMeta(); -+ -+ /** -+ * Sets the PotionMeta of this thrown potion. -+ * This will modify the effects applied by this potion. -+ *

    -+ * Note that the type of {@link #getItem()} is irrelevant -+ * -+ * @param meta potion meta -+ */ -+ void setPotionMeta(@NotNull org.bukkit.inventory.meta.PotionMeta meta); -+ -+ /** -+ * Splashes the potion at its current location. -+ */ -+ void splash(); -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java -index c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7..02584eced96944a551140f8150c65a7c0f4bb55e 100644 ---- a/src/main/java/org/bukkit/entity/Trident.java -+++ b/src/main/java/org/bukkit/entity/Trident.java -@@ -38,5 +38,24 @@ public interface Trident extends AbstractArrow, ThrowableProjectile { - * @throws IllegalArgumentException if the loyalty level is lower than 0 or greater than 127 - */ - void setLoyaltyLevel(int loyaltyLevel); -+ -+ /** -+ * Gets if this trident has dealt damage to an -+ * entity yet or has hit the floor. -+ * -+ * If neither of these events have occurred yet, this will -+ * return false. -+ * -+ * @return has dealt damage -+ */ -+ boolean hasDealtDamage(); -+ -+ /** -+ * Sets if this trident has dealt damage to an entity -+ * yet or has hit the floor. -+ * -+ * @param hasDealtDamage has dealt damage or hit the floor -+ */ -+ void setHasDealtDamage(boolean hasDealtDamage); - } - // Paper end diff --git a/patches/api/0348-Add-enchantWithLevels-API.patch b/patches/api/0348-Add-enchantWithLevels-API.patch new file mode 100644 index 0000000000..02d301e15a --- /dev/null +++ b/patches/api/0348-Add-enchantWithLevels-API.patch @@ -0,0 +1,100 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Wed, 16 Mar 2022 20:35:13 -0700 +Subject: [PATCH] Add enchantWithLevels API + +Deprecate upstream's newer and poorly implemented similar +API. + +diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java +index dbebaf8172ec6872f56958b9583affde4f8400a4..98a970a6582dca22e719a31559c7becea4725cb2 100644 +--- a/src/main/java/org/bukkit/inventory/ItemFactory.java ++++ b/src/main/java/org/bukkit/inventory/ItemFactory.java +@@ -185,8 +185,11 @@ public interface ItemFactory { + * @param level the level to use, which is the level in the enchantment table + * @param allowTreasures allows treasure enchants, e.g. mending, if true. + * @return a new ItemStack containing the result of the Enchantment ++ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly ++ * designed and was originally broken. + */ + @NotNull ++ @Deprecated // Paper + ItemStack enchantItem(@NotNull final Entity entity, @NotNull final ItemStack item, final int level, final boolean allowTreasures); + + /** +@@ -199,8 +202,11 @@ public interface ItemFactory { + * @param level the level to use, which is the level in the enchantment table + * @param allowTreasures allow the treasure enchants, e.g. mending, if true. + * @return a new ItemStack containing the result of the Enchantment ++ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly ++ * designed and was originally broken. + */ + @NotNull ++ @Deprecated // Paper + ItemStack enchantItem(@NotNull final World world, @NotNull final ItemStack item, final int level, final boolean allowTreasures); + + /** +@@ -212,8 +218,11 @@ public interface ItemFactory { + * @param level the level to use, which is the level in the enchantment table + * @param allowTreasures allow treasure enchantments, e.g. mending, if true. + * @return a new ItemStack containing the result of the Enchantment ++ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly ++ * designed and was originally broken. + */ + @NotNull ++ @Deprecated // Paper + ItemStack enchantItem(@NotNull final ItemStack item, final int level, final boolean allowTreasures); + + // Paper start - Adventure +@@ -326,4 +335,22 @@ public interface ItemFactory { + @Deprecated + net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName); + // Paper end - bungee hover events ++ ++ // Paper start - enchantWithLevels API ++ /** ++ * Randomly enchants a copy of the provided {@link ItemStack} using the given experience levels. ++ * ++ *

    If the provided ItemStack is already enchanted, the existing enchants will be removed before enchanting.

    ++ * ++ *

    Levels must be in range {@code [1, 30]}.

    ++ * ++ * @param itemStack ItemStack to enchant ++ * @param levels levels to use for enchanting ++ * @param allowTreasure whether to allow enchantments where {@link org.bukkit.enchantments.Enchantment#isTreasure()} returns true ++ * @param random {@link java.util.Random} instance to use for enchanting ++ * @return enchanted copy of the provided ItemStack ++ * @throws IllegalArgumentException on bad arguments ++ */ ++ @NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, boolean allowTreasure, @NotNull java.util.Random random); ++ // Paper end - enchantWithLevels API + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 351f5c0feec38377fccf09bfc1cef2df88fc2dcd..7eb4cf0b2f162d650252d81e9d38393f69a69046 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -670,6 +670,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + } + + // Paper start ++ /** ++ * Randomly enchants a copy of this {@link ItemStack} using the given experience levels. ++ * ++ *

    If this ItemStack is already enchanted, the existing enchants will be removed before enchanting.

    ++ * ++ *

    Levels must be in range {@code [1, 30]}.

    ++ * ++ * @param levels levels to use for enchanting ++ * @param allowTreasure whether to allow enchantments where {@link org.bukkit.enchantments.Enchantment#isTreasure()} returns true ++ * @param random {@link java.util.Random} instance to use for enchanting ++ * @return enchanted copy of the provided ItemStack ++ * @throws IllegalArgumentException on bad arguments ++ */ ++ @NotNull ++ public ItemStack enchantWithLevels(final @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, final boolean allowTreasure, final @NotNull java.util.Random random) { ++ return Bukkit.getServer().getItemFactory().enchantWithLevels(this, levels, allowTreasure, random); ++ } ++ + @NotNull + @Override + public net.kyori.adventure.text.event.HoverEvent asHoverEvent(final @NotNull java.util.function.UnaryOperator op) { diff --git a/patches/api/0348-Add-getComputedBiome-API.patch b/patches/api/0348-Add-getComputedBiome-API.patch deleted file mode 100644 index 6d24c2c66a..0000000000 --- a/patches/api/0348-Add-getComputedBiome-API.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Mon, 14 Mar 2022 22:45:32 -0700 -Subject: [PATCH] Add getComputedBiome API - - -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index b68367f123f029c3ff47eab6bfabd7a894a99da4..44ee56a5956cc17194c767a0c1071a2abffe818a 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -25,6 +25,7 @@ public interface RegionAccessor extends Keyed { // Paper - * - * @param location the location of the biome - * @return Biome at the given location -+ * @see #getComputedBiome(int, int, int) - */ - @NotNull - Biome getBiome(@NotNull Location location); -@@ -36,10 +37,33 @@ public interface RegionAccessor extends Keyed { // Paper - * @param y Y-coordinate of the block - * @param z Z-coordinate of the block - * @return Biome at the given coordinates -+ * @see #getComputedBiome(int, int, int) - */ - @NotNull - Biome getBiome(int x, int y, int z); - -+ // Paper start -+ /** -+ * Gets the computed {@link Biome} at the given coordinates. -+ * -+ *

    The computed Biome is the Biome as seen by clients for rendering -+ * purposes and in the "F3" debug menu. This is computed by looking at the noise biome -+ * at this and surrounding quarts and applying complex math operations.

    -+ * -+ *

    Most other Biome-related methods named getBiome, setBiome, and similar -+ * operate on the "noise biome", which is stored per-quart, or in other words, -+ * 1 Biome per 4x4x4 block region. This is how Biomes are currently generated and -+ * stored on disk.

    -+ * -+ * @param x X-coordinate of the block -+ * @param y Y-coordinate of the block -+ * @param z Z-coordinate of the block -+ * @return Biome at the given coordinates -+ */ -+ @NotNull -+ Biome getComputedBiome(int x, int y, int z); -+ // Paper end -+ - /** - * Sets the {@link Biome} at the given {@link Location}. - * -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 42cc4f2ee960c0abf9c6688aeee4150754612c32..cf9600c743e977312c0a15c455d602391797ef34 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -371,10 +371,22 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - * Returns the biome that this block resides in - * - * @return Biome type containing this block -+ * @see #getComputedBiome() - */ - @NotNull - Biome getBiome(); - -+ // Paper start -+ /** -+ * Gets the computed biome at the location of this Block. -+ * -+ * @return computed biome at the location of this Block. -+ * @see org.bukkit.RegionAccessor#getComputedBiome(int, int, int) -+ */ -+ @NotNull -+ Biome getComputedBiome(); -+ // Paper end -+ - /** - * Sets the biome that this block resides in - * diff --git a/patches/api/0349-Add-TameableDeathMessageEvent.patch b/patches/api/0349-Add-TameableDeathMessageEvent.patch new file mode 100644 index 0000000000..aec53f13ba --- /dev/null +++ b/patches/api/0349-Add-TameableDeathMessageEvent.patch @@ -0,0 +1,84 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Fri, 19 Mar 2021 23:25:38 -0400 +Subject: [PATCH] Add TameableDeathMessageEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..5d449b90829bca7a6ff3060b637561d8f99dc156 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java +@@ -0,0 +1,72 @@ ++package io.papermc.paper.event.entity; ++ ++import net.kyori.adventure.text.Component; ++import org.bukkit.entity.Tameable; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a {@link Tameable} dies and sends a death message. ++ */ ++public class TameableDeathMessageEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private Component deathMessage; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public TameableDeathMessageEvent(@NotNull Tameable tameable, @NotNull Component deathMessage) { ++ super(tameable); ++ this.deathMessage = deathMessage; ++ } ++ ++ /** ++ * Set the death message that appears to the owner of the tameable. ++ * ++ * @param deathMessage Death message to appear ++ */ ++ public void deathMessage(@NotNull Component deathMessage) { ++ this.deathMessage = deathMessage; ++ } ++ ++ /** ++ * Get the death message that appears to the owner of the tameable. ++ * ++ * @return Death message to appear ++ */ ++ @NotNull ++ public Component deathMessage() { ++ return this.deathMessage; ++ } ++ ++ @NotNull ++ @Override ++ public Tameable getEntity() { ++ return (Tameable) super.getEntity(); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0349-Add-enchantWithLevels-API.patch b/patches/api/0349-Add-enchantWithLevels-API.patch deleted file mode 100644 index 02d301e15a..0000000000 --- a/patches/api/0349-Add-enchantWithLevels-API.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> -Date: Wed, 16 Mar 2022 20:35:13 -0700 -Subject: [PATCH] Add enchantWithLevels API - -Deprecate upstream's newer and poorly implemented similar -API. - -diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java -index dbebaf8172ec6872f56958b9583affde4f8400a4..98a970a6582dca22e719a31559c7becea4725cb2 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFactory.java -+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java -@@ -185,8 +185,11 @@ public interface ItemFactory { - * @param level the level to use, which is the level in the enchantment table - * @param allowTreasures allows treasure enchants, e.g. mending, if true. - * @return a new ItemStack containing the result of the Enchantment -+ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly -+ * designed and was originally broken. - */ - @NotNull -+ @Deprecated // Paper - ItemStack enchantItem(@NotNull final Entity entity, @NotNull final ItemStack item, final int level, final boolean allowTreasures); - - /** -@@ -199,8 +202,11 @@ public interface ItemFactory { - * @param level the level to use, which is the level in the enchantment table - * @param allowTreasures allow the treasure enchants, e.g. mending, if true. - * @return a new ItemStack containing the result of the Enchantment -+ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly -+ * designed and was originally broken. - */ - @NotNull -+ @Deprecated // Paper - ItemStack enchantItem(@NotNull final World world, @NotNull final ItemStack item, final int level, final boolean allowTreasures); - - /** -@@ -212,8 +218,11 @@ public interface ItemFactory { - * @param level the level to use, which is the level in the enchantment table - * @param allowTreasures allow treasure enchantments, e.g. mending, if true. - * @return a new ItemStack containing the result of the Enchantment -+ * @deprecated use {@link #enchantWithLevels(ItemStack, int, boolean, java.util.Random)}. This method's implementation is poorly -+ * designed and was originally broken. - */ - @NotNull -+ @Deprecated // Paper - ItemStack enchantItem(@NotNull final ItemStack item, final int level, final boolean allowTreasures); - - // Paper start - Adventure -@@ -326,4 +335,22 @@ public interface ItemFactory { - @Deprecated - net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName); - // Paper end - bungee hover events -+ -+ // Paper start - enchantWithLevels API -+ /** -+ * Randomly enchants a copy of the provided {@link ItemStack} using the given experience levels. -+ * -+ *

    If the provided ItemStack is already enchanted, the existing enchants will be removed before enchanting.

    -+ * -+ *

    Levels must be in range {@code [1, 30]}.

    -+ * -+ * @param itemStack ItemStack to enchant -+ * @param levels levels to use for enchanting -+ * @param allowTreasure whether to allow enchantments where {@link org.bukkit.enchantments.Enchantment#isTreasure()} returns true -+ * @param random {@link java.util.Random} instance to use for enchanting -+ * @return enchanted copy of the provided ItemStack -+ * @throws IllegalArgumentException on bad arguments -+ */ -+ @NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, boolean allowTreasure, @NotNull java.util.Random random); -+ // Paper end - enchantWithLevels API - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 351f5c0feec38377fccf09bfc1cef2df88fc2dcd..7eb4cf0b2f162d650252d81e9d38393f69a69046 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -670,6 +670,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - } - - // Paper start -+ /** -+ * Randomly enchants a copy of this {@link ItemStack} using the given experience levels. -+ * -+ *

    If this ItemStack is already enchanted, the existing enchants will be removed before enchanting.

    -+ * -+ *

    Levels must be in range {@code [1, 30]}.

    -+ * -+ * @param levels levels to use for enchanting -+ * @param allowTreasure whether to allow enchantments where {@link org.bukkit.enchantments.Enchantment#isTreasure()} returns true -+ * @param random {@link java.util.Random} instance to use for enchanting -+ * @return enchanted copy of the provided ItemStack -+ * @throws IllegalArgumentException on bad arguments -+ */ -+ @NotNull -+ public ItemStack enchantWithLevels(final @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, final boolean allowTreasure, final @NotNull java.util.Random random) { -+ return Bukkit.getServer().getItemFactory().enchantWithLevels(this, levels, allowTreasure, random); -+ } -+ - @NotNull - @Override - public net.kyori.adventure.text.event.HoverEvent asHoverEvent(final @NotNull java.util.function.UnaryOperator op) { diff --git a/patches/api/0350-Add-TameableDeathMessageEvent.patch b/patches/api/0350-Add-TameableDeathMessageEvent.patch deleted file mode 100644 index aec53f13ba..0000000000 --- a/patches/api/0350-Add-TameableDeathMessageEvent.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Fri, 19 Mar 2021 23:25:38 -0400 -Subject: [PATCH] Add TameableDeathMessageEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..5d449b90829bca7a6ff3060b637561d8f99dc156 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/TameableDeathMessageEvent.java -@@ -0,0 +1,72 @@ -+package io.papermc.paper.event.entity; -+ -+import net.kyori.adventure.text.Component; -+import org.bukkit.entity.Tameable; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a {@link Tameable} dies and sends a death message. -+ */ -+public class TameableDeathMessageEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private Component deathMessage; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public TameableDeathMessageEvent(@NotNull Tameable tameable, @NotNull Component deathMessage) { -+ super(tameable); -+ this.deathMessage = deathMessage; -+ } -+ -+ /** -+ * Set the death message that appears to the owner of the tameable. -+ * -+ * @param deathMessage Death message to appear -+ */ -+ public void deathMessage(@NotNull Component deathMessage) { -+ this.deathMessage = deathMessage; -+ } -+ -+ /** -+ * Get the death message that appears to the owner of the tameable. -+ * -+ * @return Death message to appear -+ */ -+ @NotNull -+ public Component deathMessage() { -+ return this.deathMessage; -+ } -+ -+ @NotNull -+ @Override -+ public Tameable getEntity() { -+ return (Tameable) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0350-Allow-to-change-the-podium-of-the-EnderDragon.patch b/patches/api/0350-Allow-to-change-the-podium-of-the-EnderDragon.patch new file mode 100644 index 0000000000..08ffa1fdde --- /dev/null +++ b/patches/api/0350-Allow-to-change-the-podium-of-the-EnderDragon.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Doc +Date: Sat, 2 Apr 2022 23:03:32 -0300 +Subject: [PATCH] Allow to change the podium of the EnderDragon + + +diff --git a/src/main/java/org/bukkit/entity/EnderDragon.java b/src/main/java/org/bukkit/entity/EnderDragon.java +index 92cd35c87bad578c2b714761c93a5b72ebf4bc9e..68f58c40a56791df177967de5661cca976a7e98c 100644 +--- a/src/main/java/org/bukkit/entity/EnderDragon.java ++++ b/src/main/java/org/bukkit/entity/EnderDragon.java +@@ -108,4 +108,22 @@ public interface EnderDragon extends ComplexLivingEntity, Boss, Mob, Enemy { + * @return this dragon's death animation ticks + */ + int getDeathAnimationTicks(); ++ ++ // Paper start ++ ++ /** ++ * Get the podium location used by the ender dragon. ++ * ++ * @return the podium location of the dragon ++ */ ++ @NotNull ++ org.bukkit.Location getPodium(); ++ ++ /** ++ * Sets the location of the podium for the ender dragon. ++ * ++ * @param location the location of the podium or null to use the default podium location (exit portal of the end) ++ */ ++ void setPodium(@Nullable org.bukkit.Location location); ++ // Paper end + } diff --git a/patches/api/0351-Allow-to-change-the-podium-of-the-EnderDragon.patch b/patches/api/0351-Allow-to-change-the-podium-of-the-EnderDragon.patch deleted file mode 100644 index 08ffa1fdde..0000000000 --- a/patches/api/0351-Allow-to-change-the-podium-of-the-EnderDragon.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Doc -Date: Sat, 2 Apr 2022 23:03:32 -0300 -Subject: [PATCH] Allow to change the podium of the EnderDragon - - -diff --git a/src/main/java/org/bukkit/entity/EnderDragon.java b/src/main/java/org/bukkit/entity/EnderDragon.java -index 92cd35c87bad578c2b714761c93a5b72ebf4bc9e..68f58c40a56791df177967de5661cca976a7e98c 100644 ---- a/src/main/java/org/bukkit/entity/EnderDragon.java -+++ b/src/main/java/org/bukkit/entity/EnderDragon.java -@@ -108,4 +108,22 @@ public interface EnderDragon extends ComplexLivingEntity, Boss, Mob, Enemy { - * @return this dragon's death animation ticks - */ - int getDeathAnimationTicks(); -+ -+ // Paper start -+ -+ /** -+ * Get the podium location used by the ender dragon. -+ * -+ * @return the podium location of the dragon -+ */ -+ @NotNull -+ org.bukkit.Location getPodium(); -+ -+ /** -+ * Sets the location of the podium for the ender dragon. -+ * -+ * @param location the location of the podium or null to use the default podium location (exit portal of the end) -+ */ -+ void setPodium(@Nullable org.bukkit.Location location); -+ // Paper end - } diff --git a/patches/api/0351-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch b/patches/api/0351-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch new file mode 100644 index 0000000000..21b3f85c0b --- /dev/null +++ b/patches/api/0351-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 2 Jul 2023 22:14:09 -0700 +Subject: [PATCH] Fix incorrect new blockstate in EntityBreakDoorEvent + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java +index 30b9bdca89a8d4b226824b3de8b9ac5bc8243c7d..b7889e3b6cc5d3ed4d7fc2380d0acb060cb0905a 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java +@@ -12,8 +12,8 @@ import org.jetbrains.annotations.NotNull; + * Cancelling the event will cause the event to be delayed + */ + public class EntityBreakDoorEvent extends EntityChangeBlockEvent { +- public EntityBreakDoorEvent(@NotNull final LivingEntity entity, @NotNull final Block targetBlock) { +- super(entity, targetBlock, Material.AIR.createBlockData()); ++ public EntityBreakDoorEvent(@NotNull final LivingEntity entity, @NotNull final Block targetBlock, @NotNull final org.bukkit.block.data.BlockData to) { // Paper ++ super(entity, targetBlock, to); // Paper + } + + @NotNull diff --git a/patches/api/0352-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/api/0352-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch new file mode 100644 index 0000000000..5775b6f33c --- /dev/null +++ b/patches/api/0352-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: HexedHero <6012891+HexedHero@users.noreply.github.com> +Date: Sun, 10 Apr 2022 06:21:19 +0100 +Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java +index 2d049633998b3965ce0f4a6a4cea3169da0d5658..a2993c7434c9775483a1b4628f2f66454b0d666d 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java +@@ -15,12 +15,21 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private final ItemStack item; + private int damage; ++ private int originalDamage; // Paper - Add pre-reduction damage + private boolean cancelled = false; + ++ @Deprecated // Paper - Add pre-reduction damage + public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage) { ++ // Paper start - Add pre-reduction damage ++ this(player, what, damage, damage); ++ } ++ ++ public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage, int originalDamage) { + super(player); + this.item = what; + this.damage = damage; ++ this.originalDamage = originalDamage; ++ // Paper end + } + + /** +@@ -42,6 +51,19 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { + return damage; + } + ++ // Paper start - Add pre-reduction damage ++ /** ++ * Gets the amount of durability damage this item would have taken before ++ * the Unbreaking reduction. If the item has no Unbreaking level then ++ * this value will be the same as the {@link #getDamage()} value. ++ * ++ * @return pre-reduction damage amount ++ */ ++ public int getOriginalDamage() { ++ return originalDamage; ++ } ++ // Paper end ++ + public void setDamage(int damage) { + this.damage = damage; + } diff --git a/patches/api/0352-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch b/patches/api/0352-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch deleted file mode 100644 index 21b3f85c0b..0000000000 --- a/patches/api/0352-Fix-incorrect-new-blockstate-in-EntityBreakDoorEvent.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 2 Jul 2023 22:14:09 -0700 -Subject: [PATCH] Fix incorrect new blockstate in EntityBreakDoorEvent - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java -index 30b9bdca89a8d4b226824b3de8b9ac5bc8243c7d..b7889e3b6cc5d3ed4d7fc2380d0acb060cb0905a 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityBreakDoorEvent.java -@@ -12,8 +12,8 @@ import org.jetbrains.annotations.NotNull; - * Cancelling the event will cause the event to be delayed - */ - public class EntityBreakDoorEvent extends EntityChangeBlockEvent { -- public EntityBreakDoorEvent(@NotNull final LivingEntity entity, @NotNull final Block targetBlock) { -- super(entity, targetBlock, Material.AIR.createBlockData()); -+ public EntityBreakDoorEvent(@NotNull final LivingEntity entity, @NotNull final Block targetBlock, @NotNull final org.bukkit.block.data.BlockData to) { // Paper -+ super(entity, targetBlock, to); // Paper - } - - @NotNull diff --git a/patches/api/0353-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch b/patches/api/0353-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch deleted file mode 100644 index 5775b6f33c..0000000000 --- a/patches/api/0353-Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: HexedHero <6012891+HexedHero@users.noreply.github.com> -Date: Sun, 10 Apr 2022 06:21:19 +0100 -Subject: [PATCH] Add pre-unbreaking amount to PlayerItemDamageEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -index 2d049633998b3965ce0f4a6a4cea3169da0d5658..a2993c7434c9775483a1b4628f2f66454b0d666d 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerItemDamageEvent.java -@@ -15,12 +15,21 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { - private static final HandlerList handlers = new HandlerList(); - private final ItemStack item; - private int damage; -+ private int originalDamage; // Paper - Add pre-reduction damage - private boolean cancelled = false; - -+ @Deprecated // Paper - Add pre-reduction damage - public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage) { -+ // Paper start - Add pre-reduction damage -+ this(player, what, damage, damage); -+ } -+ -+ public PlayerItemDamageEvent(@NotNull Player player, @NotNull ItemStack what, int damage, int originalDamage) { - super(player); - this.item = what; - this.damage = damage; -+ this.originalDamage = originalDamage; -+ // Paper end - } - - /** -@@ -42,6 +51,19 @@ public class PlayerItemDamageEvent extends PlayerEvent implements Cancellable { - return damage; - } - -+ // Paper start - Add pre-reduction damage -+ /** -+ * Gets the amount of durability damage this item would have taken before -+ * the Unbreaking reduction. If the item has no Unbreaking level then -+ * this value will be the same as the {@link #getDamage()} value. -+ * -+ * @return pre-reduction damage amount -+ */ -+ public int getOriginalDamage() { -+ return originalDamage; -+ } -+ // Paper end -+ - public void setDamage(int damage) { - this.damage = damage; - } diff --git a/patches/api/0353-WorldCreator-keepSpawnLoaded.patch b/patches/api/0353-WorldCreator-keepSpawnLoaded.patch new file mode 100644 index 0000000000..287c313c58 --- /dev/null +++ b/patches/api/0353-WorldCreator-keepSpawnLoaded.patch @@ -0,0 +1,97 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sat, 3 Jul 2021 21:18:41 +0100 +Subject: [PATCH] WorldCreator#keepSpawnLoaded + + +diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java +index afc0ce2eaa7cf48d1255fec7377103b1f7a99734..58e3e3e0e772640b3944b4acb5a92d96431728a7 100644 +--- a/src/main/java/org/bukkit/WorldCreator.java ++++ b/src/main/java/org/bukkit/WorldCreator.java +@@ -23,7 +23,7 @@ public class WorldCreator { + private boolean generateStructures = true; + private String generatorSettings = ""; + private boolean hardcore = false; +- private boolean keepSpawnInMemory = true; ++ private net.kyori.adventure.util.TriState keepSpawnLoaded = net.kyori.adventure.util.TriState.NOT_SET; // Paper + + /** + * Creates an empty WorldCreationOptions for the given world name +@@ -123,7 +123,7 @@ public class WorldCreator { + type = world.getWorldType(); + generateStructures = world.canGenerateStructures(); + hardcore = world.isHardcore(); +- keepSpawnInMemory = world.getKeepSpawnInMemory(); ++ this.keepSpawnLoaded = net.kyori.adventure.util.TriState.byBoolean(world.getKeepSpawnInMemory()); // Paper + + return this; + } +@@ -146,7 +146,7 @@ public class WorldCreator { + generateStructures = creator.generateStructures(); + generatorSettings = creator.generatorSettings(); + hardcore = creator.hardcore(); +- keepSpawnInMemory = creator.keepSpawnInMemory(); ++ keepSpawnLoaded = creator.keepSpawnLoaded(); // Paper + + return this; + } +@@ -470,21 +470,23 @@ public class WorldCreator { + * + * @param keepSpawnInMemory Whether the spawn chunks will be kept loaded + * @return This object, for chaining ++ * @deprecated use {@link #keepSpawnLoaded(net.kyori.adventure.util.TriState)} + */ + @NotNull ++ @Deprecated(forRemoval = true) // Paper + public WorldCreator keepSpawnInMemory(boolean keepSpawnInMemory) { +- this.keepSpawnInMemory = keepSpawnInMemory; +- +- return this; ++ return this.keepSpawnLoaded(net.kyori.adventure.util.TriState.byBoolean(keepSpawnInMemory)); // Paper + } + + /** + * Gets whether or not the spawn chunks will be kept loaded. + * + * @return True if the spawn chunks will be kept loaded ++ * @deprecated use {@link #keepSpawnLoaded()} + */ ++ @Deprecated(forRemoval = true) // Paper + public boolean keepSpawnInMemory() { +- return keepSpawnInMemory; ++ return this.keepSpawnLoaded() == net.kyori.adventure.util.TriState.TRUE; // Paper + } + + /** +@@ -594,4 +596,31 @@ public class WorldCreator { + + return result; + } ++ ++ // Paper start - keep spawn loaded tristate ++ /** ++ * Returns the current intent to keep the world loaded, @see {@link WorldCreator#keepSpawnLoaded(net.kyori.adventure.util.TriState)} ++ * ++ * @return the current tristate value ++ */ ++ @NotNull ++ public net.kyori.adventure.util.TriState keepSpawnLoaded() { ++ return keepSpawnLoaded; ++ } ++ ++ /** ++ * Controls if a world should be kept loaded or not, default (NOT_SET) will use the servers standard ++ * configuration, otherwise, will act as an override towards this setting ++ * ++ * @param keepSpawnLoaded the new value ++ * @return This object, for chaining ++ */ ++ @NotNull ++ public WorldCreator keepSpawnLoaded(@NotNull net.kyori.adventure.util.TriState keepSpawnLoaded) { ++ Preconditions.checkArgument(keepSpawnLoaded != null, "keepSpawnLoaded"); ++ this.keepSpawnLoaded = keepSpawnLoaded; ++ return this; ++ } ++ ++ // Paper end - keep spawn loaded tristate + } diff --git a/patches/api/0354-Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/api/0354-Add-EntityDyeEvent-and-CollarColorable-interface.patch new file mode 100644 index 0000000000..e7a4ad2089 --- /dev/null +++ b/patches/api/0354-Add-EntityDyeEvent-and-CollarColorable-interface.patch @@ -0,0 +1,268 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 18 Mar 2022 21:16:38 -0700 +Subject: [PATCH] Add EntityDyeEvent and CollarColorable interface + + +diff --git a/src/main/java/io/papermc/paper/entity/CollarColorable.java b/src/main/java/io/papermc/paper/entity/CollarColorable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bb68e6a2528eee81eb3f26f22b9c35508f1e69c1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/CollarColorable.java +@@ -0,0 +1,25 @@ ++package io.papermc.paper.entity; ++ ++import org.bukkit.DyeColor; ++import org.bukkit.entity.LivingEntity; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Entities that can have their collars colored. ++ */ ++public interface CollarColorable extends LivingEntity { ++ ++ /** ++ * Get the collar color of this entity ++ * ++ * @return the color of the collar ++ */ ++ @NotNull DyeColor getCollarColor(); ++ ++ /** ++ * Set the collar color of this entity ++ * ++ * @param color the color to apply ++ */ ++ void setCollarColor(@NotNull DyeColor color); ++} +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c43a3ad32902dbb13287e801375213745ce07b3c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java +@@ -0,0 +1,81 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.DyeColor; ++import org.bukkit.entity.Cat; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Player; ++import org.bukkit.entity.Sheep; ++import org.bukkit.entity.Wolf; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when an entity is dyed. Currently, this is called for {@link Sheep} ++ * being dyed, and {@link Wolf}/{@link Cat} collars being dyed. ++ */ ++public class EntityDyeEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Player player; ++ private DyeColor dyeColor; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityDyeEvent(@NotNull Entity entity, @NotNull DyeColor dyeColor, @Nullable Player player) { ++ super(entity); ++ this.dyeColor = dyeColor; ++ this.player = player; ++ } ++ ++ /** ++ * Gets the DyeColor the entity is being dyed ++ * ++ * @return the DyeColor the entity is being dyed ++ */ ++ public @NotNull DyeColor getColor() { ++ return this.dyeColor; ++ } ++ ++ /** ++ * Sets the DyeColor the entity is being dyed ++ * ++ * @param dyeColor the DyeColor the entity will be dyed ++ */ ++ public void setColor(@NotNull DyeColor dyeColor) { ++ this.dyeColor = dyeColor; ++ } ++ ++ /** ++ * Returns the player dyeing the entity, if available. ++ * ++ * @return player or {@code null} ++ */ ++ public @Nullable Player getPlayer() { ++ return this.player; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java +index 0534fbc228f64cf3b361ab097d9b88212bdb0f36..d03adfaa4176617ef2ace2754fe02b63860e3aee 100644 +--- a/src/main/java/org/bukkit/entity/Cat.java ++++ b/src/main/java/org/bukkit/entity/Cat.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Meow. + */ +-public interface Cat extends Tameable, Sittable { ++public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable + + /** + * Gets the current type of this cat. +@@ -31,6 +31,7 @@ public interface Cat extends Tameable, Sittable { + * @return the color of the collar + */ + @NotNull ++ @Override // Paper + public DyeColor getCollarColor(); + + /** +@@ -38,6 +39,7 @@ public interface Cat extends Tameable, Sittable { + * + * @param color the color to apply + */ ++ @Override // Paper + public void setCollarColor(@NotNull DyeColor color); + + /** +diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java +index 03c4a3dedf97e06734f1ec975055214809f1fe61..4b84c04675775e2a606630b00de8afe51665cebc 100644 +--- a/src/main/java/org/bukkit/entity/Wolf.java ++++ b/src/main/java/org/bukkit/entity/Wolf.java +@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a Wolf + */ +-public interface Wolf extends Tameable, Sittable { ++public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable + + /** + * Checks if this wolf is angry +@@ -35,6 +35,7 @@ public interface Wolf extends Tameable, Sittable { + * @return the color of the collar + */ + @NotNull ++ @Override // Paper + public DyeColor getCollarColor(); + + /** +@@ -42,6 +43,7 @@ public interface Wolf extends Tameable, Sittable { + * + * @param color the color to apply + */ ++ @Override // Paper + public void setCollarColor(@NotNull DyeColor color); + + /** +diff --git a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java +index 10d2466fb69919cead26af2fcdf6bd2e678f2927..ddf4aec01e4873aa799721ce615f5d7c929dc915 100644 +--- a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java ++++ b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java +@@ -11,11 +11,8 @@ import org.jetbrains.annotations.Nullable; + /** + * Called when a sheep's wool is dyed + */ +-public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { +- private static final HandlerList handlers = new HandlerList(); +- private boolean cancel; +- private DyeColor color; +- private final Player player; ++public class SheepDyeWoolEvent extends io.papermc.paper.event.entity.EntityDyeEvent implements Cancellable { ++ // Paper - move everything to superclass + + @Deprecated + public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) { +@@ -23,20 +20,7 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { + } + + public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color, @Nullable Player player) { +- super(sheep); +- this.cancel = false; +- this.color = color; +- this.player = player; +- } +- +- @Override +- public boolean isCancelled() { +- return cancel; +- } +- +- @Override +- public void setCancelled(boolean cancel) { +- this.cancel = cancel; ++ super(sheep, color, player); // Paper + } + + @NotNull +@@ -44,45 +28,4 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { + public Sheep getEntity() { + return (Sheep) entity; + } +- +- /** +- * Returns the player dyeing the sheep, if available. +- * +- * @return player or null +- */ +- @Nullable +- public Player getPlayer() { +- return player; +- } +- +- /** +- * Gets the DyeColor the sheep is being dyed +- * +- * @return the DyeColor the sheep is being dyed +- */ +- @NotNull +- public DyeColor getColor() { +- return color; +- } +- +- /** +- * Sets the DyeColor the sheep is being dyed +- * +- * @param color the DyeColor the sheep will be dyed +- */ +- public void setColor(@NotNull DyeColor color) { +- this.color = color; +- } +- +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } +- + } diff --git a/patches/api/0354-WorldCreator-keepSpawnLoaded.patch b/patches/api/0354-WorldCreator-keepSpawnLoaded.patch deleted file mode 100644 index 287c313c58..0000000000 --- a/patches/api/0354-WorldCreator-keepSpawnLoaded.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sat, 3 Jul 2021 21:18:41 +0100 -Subject: [PATCH] WorldCreator#keepSpawnLoaded - - -diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java -index afc0ce2eaa7cf48d1255fec7377103b1f7a99734..58e3e3e0e772640b3944b4acb5a92d96431728a7 100644 ---- a/src/main/java/org/bukkit/WorldCreator.java -+++ b/src/main/java/org/bukkit/WorldCreator.java -@@ -23,7 +23,7 @@ public class WorldCreator { - private boolean generateStructures = true; - private String generatorSettings = ""; - private boolean hardcore = false; -- private boolean keepSpawnInMemory = true; -+ private net.kyori.adventure.util.TriState keepSpawnLoaded = net.kyori.adventure.util.TriState.NOT_SET; // Paper - - /** - * Creates an empty WorldCreationOptions for the given world name -@@ -123,7 +123,7 @@ public class WorldCreator { - type = world.getWorldType(); - generateStructures = world.canGenerateStructures(); - hardcore = world.isHardcore(); -- keepSpawnInMemory = world.getKeepSpawnInMemory(); -+ this.keepSpawnLoaded = net.kyori.adventure.util.TriState.byBoolean(world.getKeepSpawnInMemory()); // Paper - - return this; - } -@@ -146,7 +146,7 @@ public class WorldCreator { - generateStructures = creator.generateStructures(); - generatorSettings = creator.generatorSettings(); - hardcore = creator.hardcore(); -- keepSpawnInMemory = creator.keepSpawnInMemory(); -+ keepSpawnLoaded = creator.keepSpawnLoaded(); // Paper - - return this; - } -@@ -470,21 +470,23 @@ public class WorldCreator { - * - * @param keepSpawnInMemory Whether the spawn chunks will be kept loaded - * @return This object, for chaining -+ * @deprecated use {@link #keepSpawnLoaded(net.kyori.adventure.util.TriState)} - */ - @NotNull -+ @Deprecated(forRemoval = true) // Paper - public WorldCreator keepSpawnInMemory(boolean keepSpawnInMemory) { -- this.keepSpawnInMemory = keepSpawnInMemory; -- -- return this; -+ return this.keepSpawnLoaded(net.kyori.adventure.util.TriState.byBoolean(keepSpawnInMemory)); // Paper - } - - /** - * Gets whether or not the spawn chunks will be kept loaded. - * - * @return True if the spawn chunks will be kept loaded -+ * @deprecated use {@link #keepSpawnLoaded()} - */ -+ @Deprecated(forRemoval = true) // Paper - public boolean keepSpawnInMemory() { -- return keepSpawnInMemory; -+ return this.keepSpawnLoaded() == net.kyori.adventure.util.TriState.TRUE; // Paper - } - - /** -@@ -594,4 +596,31 @@ public class WorldCreator { - - return result; - } -+ -+ // Paper start - keep spawn loaded tristate -+ /** -+ * Returns the current intent to keep the world loaded, @see {@link WorldCreator#keepSpawnLoaded(net.kyori.adventure.util.TriState)} -+ * -+ * @return the current tristate value -+ */ -+ @NotNull -+ public net.kyori.adventure.util.TriState keepSpawnLoaded() { -+ return keepSpawnLoaded; -+ } -+ -+ /** -+ * Controls if a world should be kept loaded or not, default (NOT_SET) will use the servers standard -+ * configuration, otherwise, will act as an override towards this setting -+ * -+ * @param keepSpawnLoaded the new value -+ * @return This object, for chaining -+ */ -+ @NotNull -+ public WorldCreator keepSpawnLoaded(@NotNull net.kyori.adventure.util.TriState keepSpawnLoaded) { -+ Preconditions.checkArgument(keepSpawnLoaded != null, "keepSpawnLoaded"); -+ this.keepSpawnLoaded = keepSpawnLoaded; -+ return this; -+ } -+ -+ // Paper end - keep spawn loaded tristate - } diff --git a/patches/api/0355-Add-EntityDyeEvent-and-CollarColorable-interface.patch b/patches/api/0355-Add-EntityDyeEvent-and-CollarColorable-interface.patch deleted file mode 100644 index e7a4ad2089..0000000000 --- a/patches/api/0355-Add-EntityDyeEvent-and-CollarColorable-interface.patch +++ /dev/null @@ -1,268 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 18 Mar 2022 21:16:38 -0700 -Subject: [PATCH] Add EntityDyeEvent and CollarColorable interface - - -diff --git a/src/main/java/io/papermc/paper/entity/CollarColorable.java b/src/main/java/io/papermc/paper/entity/CollarColorable.java -new file mode 100644 -index 0000000000000000000000000000000000000000..bb68e6a2528eee81eb3f26f22b9c35508f1e69c1 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/CollarColorable.java -@@ -0,0 +1,25 @@ -+package io.papermc.paper.entity; -+ -+import org.bukkit.DyeColor; -+import org.bukkit.entity.LivingEntity; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Entities that can have their collars colored. -+ */ -+public interface CollarColorable extends LivingEntity { -+ -+ /** -+ * Get the collar color of this entity -+ * -+ * @return the color of the collar -+ */ -+ @NotNull DyeColor getCollarColor(); -+ -+ /** -+ * Set the collar color of this entity -+ * -+ * @param color the color to apply -+ */ -+ void setCollarColor(@NotNull DyeColor color); -+} -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c43a3ad32902dbb13287e801375213745ce07b3c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java -@@ -0,0 +1,81 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.DyeColor; -+import org.bukkit.entity.Cat; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.entity.Sheep; -+import org.bukkit.entity.Wolf; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when an entity is dyed. Currently, this is called for {@link Sheep} -+ * being dyed, and {@link Wolf}/{@link Cat} collars being dyed. -+ */ -+public class EntityDyeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Player player; -+ private DyeColor dyeColor; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityDyeEvent(@NotNull Entity entity, @NotNull DyeColor dyeColor, @Nullable Player player) { -+ super(entity); -+ this.dyeColor = dyeColor; -+ this.player = player; -+ } -+ -+ /** -+ * Gets the DyeColor the entity is being dyed -+ * -+ * @return the DyeColor the entity is being dyed -+ */ -+ public @NotNull DyeColor getColor() { -+ return this.dyeColor; -+ } -+ -+ /** -+ * Sets the DyeColor the entity is being dyed -+ * -+ * @param dyeColor the DyeColor the entity will be dyed -+ */ -+ public void setColor(@NotNull DyeColor dyeColor) { -+ this.dyeColor = dyeColor; -+ } -+ -+ /** -+ * Returns the player dyeing the entity, if available. -+ * -+ * @return player or {@code null} -+ */ -+ public @Nullable Player getPlayer() { -+ return this.player; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java -index 0534fbc228f64cf3b361ab097d9b88212bdb0f36..d03adfaa4176617ef2ace2754fe02b63860e3aee 100644 ---- a/src/main/java/org/bukkit/entity/Cat.java -+++ b/src/main/java/org/bukkit/entity/Cat.java -@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Meow. - */ --public interface Cat extends Tameable, Sittable { -+public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable - - /** - * Gets the current type of this cat. -@@ -31,6 +31,7 @@ public interface Cat extends Tameable, Sittable { - * @return the color of the collar - */ - @NotNull -+ @Override // Paper - public DyeColor getCollarColor(); - - /** -@@ -38,6 +39,7 @@ public interface Cat extends Tameable, Sittable { - * - * @param color the color to apply - */ -+ @Override // Paper - public void setCollarColor(@NotNull DyeColor color); - - /** -diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java -index 03c4a3dedf97e06734f1ec975055214809f1fe61..4b84c04675775e2a606630b00de8afe51665cebc 100644 ---- a/src/main/java/org/bukkit/entity/Wolf.java -+++ b/src/main/java/org/bukkit/entity/Wolf.java -@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a Wolf - */ --public interface Wolf extends Tameable, Sittable { -+public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable - - /** - * Checks if this wolf is angry -@@ -35,6 +35,7 @@ public interface Wolf extends Tameable, Sittable { - * @return the color of the collar - */ - @NotNull -+ @Override // Paper - public DyeColor getCollarColor(); - - /** -@@ -42,6 +43,7 @@ public interface Wolf extends Tameable, Sittable { - * - * @param color the color to apply - */ -+ @Override // Paper - public void setCollarColor(@NotNull DyeColor color); - - /** -diff --git a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java -index 10d2466fb69919cead26af2fcdf6bd2e678f2927..ddf4aec01e4873aa799721ce615f5d7c929dc915 100644 ---- a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java -+++ b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java -@@ -11,11 +11,8 @@ import org.jetbrains.annotations.Nullable; - /** - * Called when a sheep's wool is dyed - */ --public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { -- private static final HandlerList handlers = new HandlerList(); -- private boolean cancel; -- private DyeColor color; -- private final Player player; -+public class SheepDyeWoolEvent extends io.papermc.paper.event.entity.EntityDyeEvent implements Cancellable { -+ // Paper - move everything to superclass - - @Deprecated - public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) { -@@ -23,20 +20,7 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { - } - - public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color, @Nullable Player player) { -- super(sheep); -- this.cancel = false; -- this.color = color; -- this.player = player; -- } -- -- @Override -- public boolean isCancelled() { -- return cancel; -- } -- -- @Override -- public void setCancelled(boolean cancel) { -- this.cancel = cancel; -+ super(sheep, color, player); // Paper - } - - @NotNull -@@ -44,45 +28,4 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable { - public Sheep getEntity() { - return (Sheep) entity; - } -- -- /** -- * Returns the player dyeing the sheep, if available. -- * -- * @return player or null -- */ -- @Nullable -- public Player getPlayer() { -- return player; -- } -- -- /** -- * Gets the DyeColor the sheep is being dyed -- * -- * @return the DyeColor the sheep is being dyed -- */ -- @NotNull -- public DyeColor getColor() { -- return color; -- } -- -- /** -- * Sets the DyeColor the sheep is being dyed -- * -- * @param color the DyeColor the sheep will be dyed -- */ -- public void setColor(@NotNull DyeColor color) { -- this.color = color; -- } -- -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -- - } diff --git a/patches/api/0355-Add-PlayerStopUsingItemEvent.patch b/patches/api/0355-Add-PlayerStopUsingItemEvent.patch new file mode 100644 index 0000000000..c8de1f6ed0 --- /dev/null +++ b/patches/api/0355-Add-PlayerStopUsingItemEvent.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: u9g +Date: Tue, 3 May 2022 20:41:30 -0400 +Subject: [PATCH] Add PlayerStopUsingItemEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..bbe5f0543a567f1484ab700b1b2ceeb4a22b411b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java +@@ -0,0 +1,55 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when the server detects a player stopping using an item. ++ * Examples of this are letting go of the interact button when holding a bow, an edible item, or a spyglass. ++ */ ++public class PlayerStopUsingItemEvent extends PlayerEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final ItemStack item; ++ private final int ticksHeldFor; ++ ++ public PlayerStopUsingItemEvent(@NotNull final Player player, @NotNull final ItemStack item, final int ticksHeldFor) { ++ super(player); ++ this.item = item; ++ this.ticksHeldFor = ticksHeldFor; ++ } ++ ++ /** ++ * Gets the exact item the player is releasing ++ * ++ * @return ItemStack the exact item the player released ++ */ ++ @NotNull ++ public ItemStack getItem() { ++ return this.item; ++ } ++ ++ /** ++ * Gets the number of ticks the item was held for ++ * ++ * @return int the number of ticks the item was held for ++ */ ++ public int getTicksHeldFor() { ++ return this.ticksHeldFor; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0356-Add-PlayerStopUsingItemEvent.patch b/patches/api/0356-Add-PlayerStopUsingItemEvent.patch deleted file mode 100644 index c8de1f6ed0..0000000000 --- a/patches/api/0356-Add-PlayerStopUsingItemEvent.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: u9g -Date: Tue, 3 May 2022 20:41:30 -0400 -Subject: [PATCH] Add PlayerStopUsingItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..bbe5f0543a567f1484ab700b1b2ceeb4a22b411b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java -@@ -0,0 +1,55 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when the server detects a player stopping using an item. -+ * Examples of this are letting go of the interact button when holding a bow, an edible item, or a spyglass. -+ */ -+public class PlayerStopUsingItemEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final ItemStack item; -+ private final int ticksHeldFor; -+ -+ public PlayerStopUsingItemEvent(@NotNull final Player player, @NotNull final ItemStack item, final int ticksHeldFor) { -+ super(player); -+ this.item = item; -+ this.ticksHeldFor = ticksHeldFor; -+ } -+ -+ /** -+ * Gets the exact item the player is releasing -+ * -+ * @return ItemStack the exact item the player released -+ */ -+ @NotNull -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets the number of ticks the item was held for -+ * -+ * @return int the number of ticks the item was held for -+ */ -+ public int getTicksHeldFor() { -+ return this.ticksHeldFor; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0356-Expand-FallingBlock-API.patch b/patches/api/0356-Expand-FallingBlock-API.patch new file mode 100644 index 0000000000..d98776cf63 --- /dev/null +++ b/patches/api/0356-Expand-FallingBlock-API.patch @@ -0,0 +1,108 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 5 Dec 2021 14:58:55 -0500 +Subject: [PATCH] Expand FallingBlock API + +- add auto expire setting +- add setter for block data +- add accessors for block state + +Co-authored-by: Lukas Planz + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index d7f4a9c634b3a7b2668f296dce108cc6fc3046df..00fbc02a1751902edda327236e51a6991f5366f8 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -2282,8 +2282,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * @return The spawned {@link FallingBlock} instance + * @throws IllegalArgumentException if {@link Location} or {@link + * MaterialData} are null or {@link Material} of the {@link MaterialData} is not a block ++ * @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)} + */ + @NotNull ++ @Deprecated // Paper + public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException; + + /** +@@ -2296,8 +2298,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * @return The spawned {@link FallingBlock} instance + * @throws IllegalArgumentException if {@link Location} or {@link + * BlockData} are null ++ * @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)} + */ + @NotNull ++ @org.jetbrains.annotations.ApiStatus.Obsolete // Paper + public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException; + + /** +@@ -2314,7 +2318,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient + * @return The spawned {@link FallingBlock} instance + * @throws IllegalArgumentException if {@link Location} or {@link + * Material} are null or {@link Material} is not a block +- * @deprecated Magic value ++ * @deprecated Magic value. Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)} + */ + @Deprecated + @NotNull +diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java +index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..7904c716a3b0869ebf2f9b416536c59121a539a8 100644 +--- a/src/main/java/org/bukkit/entity/FallingBlock.java ++++ b/src/main/java/org/bukkit/entity/FallingBlock.java +@@ -26,6 +26,33 @@ public interface FallingBlock extends Entity { + */ + @NotNull + BlockData getBlockData(); ++ // Paper start ++ /** ++ * Sets the data for the falling block. ++ *
    ++ * Any potential additional data currently stored in the falling blocks {@link #getBlockState()} will be ++ * purged by calling this setter. ++ * ++ * @param blockData the data to use as the block ++ */ ++ void setBlockData(@NotNull BlockData blockData); ++ ++ /** ++ * Get the data of the falling block represented as a {@link org.bukkit.block.BlockState BlockState} ++ * which includes potential NBT data that gets applied when the block gets placed on landing. ++ * ++ * @return the BlockState representing this block ++ */ ++ @NotNull ++ org.bukkit.block.BlockState getBlockState(); ++ ++ /** ++ * Sets the {@link BlockData} and possibly present tile entity data for the falling block. ++ * ++ * @param blockState the BlockState to use ++ */ ++ void setBlockState(@NotNull org.bukkit.block.BlockState blockState); ++ // Paper end + + /** + * Get if the falling block will break into an item if it cannot be placed. +@@ -137,4 +164,23 @@ public interface FallingBlock extends Entity { + default org.bukkit.Location getSourceLoc() { + return this.getOrigin(); + } ++ // Paper start - Auto expire setting ++ /** ++ * Sets if this falling block should expire after: ++ * - 30 seconds ++ * - 5 seconds and is outside of the world ++ * ++ * @return if this behavior occurs ++ */ ++ boolean doesAutoExpire(); ++ ++ /** ++ * Sets if this falling block should expire after: ++ * - 30 seconds ++ * - 5 seconds and is outside of the world ++ * ++ * @param autoExpires if this behavior should occur ++ */ ++ void shouldAutoExpire(boolean autoExpires); ++ // Paper end - Auto expire setting + } diff --git a/patches/api/0357-Add-method-isTickingWorlds-to-Bukkit.patch b/patches/api/0357-Add-method-isTickingWorlds-to-Bukkit.patch new file mode 100644 index 0000000000..c174049007 --- /dev/null +++ b/patches/api/0357-Add-method-isTickingWorlds-to-Bukkit.patch @@ -0,0 +1,117 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BuildTools <46540330+willkroboth@users.noreply.github.com> +Date: Fri, 19 Aug 2022 16:11:51 -0400 +Subject: [PATCH] Add method isTickingWorlds() to Bukkit. + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index d56baf72235173121a694e8bb5331f2c515d3aa8..a1d9663730d5a63685d337f5eba40532b47ffbfc 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -808,12 +808,26 @@ public final class Bukkit { + return server.getWorlds(); + } + ++ // Paper start ++ /** ++ * Gets whether the worlds are being ticked right now. ++ * ++ * @return true if the worlds are being ticked, false otherwise. ++ */ ++ public static boolean isTickingWorlds(){ ++ return server.isTickingWorlds(); ++ } ++ // Paper end ++ + /** + * Creates or loads a world with the given name using the specified + * options. + *

    + * If the world is already loaded, it will just return the equivalent of + * getWorld(creator.name()). ++ *

    ++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param creator the options to use when creating the world + * @return newly created or loaded world +@@ -825,6 +839,9 @@ public final class Bukkit { + + /** + * Unloads a world with the given name. ++ *

    ++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param name Name of the world to unload + * @param save whether to save the chunks before unloading +@@ -836,6 +853,9 @@ public final class Bukkit { + + /** + * Unloads the given world. ++ *

    ++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param world the world to unload + * @param save whether to save the chunks before unloading +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index bad717c09db4bfa8c5fe65878bb053e14ca22356..d9acfac02a151e084789fb607f49ad511fe4e9de 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -675,34 +675,55 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + @NotNull + public List getWorlds(); + ++ // Paper start ++ /** ++ * Gets whether the worlds are being ticked right now. ++ * ++ * @return true if the worlds are being ticked, false otherwise. ++ */ ++ public boolean isTickingWorlds(); ++ // Paper end ++ + /** + * Creates or loads a world with the given name using the specified + * options. + *

    + * If the world is already loaded, it will just return the equivalent of + * getWorld(creator.name()). ++ *

    ++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param creator the options to use when creating the world + * @return newly created or loaded world ++ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true + */ + @Nullable + public World createWorld(@NotNull WorldCreator creator); + + /** + * Unloads a world with the given name. ++ *

    ++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param name Name of the world to unload + * @param save whether to save the chunks before unloading + * @return true if successful, false otherwise ++ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true + */ + public boolean unloadWorld(@NotNull String name, boolean save); + + /** + * Unloads the given world. ++ *

    ++ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend ++ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} + * + * @param world the world to unload + * @param save whether to save the chunks before unloading + * @return true if successful, false otherwise ++ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true + */ + public boolean unloadWorld(@NotNull World world, boolean save); + diff --git a/patches/api/0357-Expand-FallingBlock-API.patch b/patches/api/0357-Expand-FallingBlock-API.patch deleted file mode 100644 index d98776cf63..0000000000 --- a/patches/api/0357-Expand-FallingBlock-API.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 5 Dec 2021 14:58:55 -0500 -Subject: [PATCH] Expand FallingBlock API - -- add auto expire setting -- add setter for block data -- add accessors for block state - -Co-authored-by: Lukas Planz - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index d7f4a9c634b3a7b2668f296dce108cc6fc3046df..00fbc02a1751902edda327236e51a6991f5366f8 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -2282,8 +2282,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * @return The spawned {@link FallingBlock} instance - * @throws IllegalArgumentException if {@link Location} or {@link - * MaterialData} are null or {@link Material} of the {@link MaterialData} is not a block -+ * @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)} - */ - @NotNull -+ @Deprecated // Paper - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException; - - /** -@@ -2296,8 +2298,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * @return The spawned {@link FallingBlock} instance - * @throws IllegalArgumentException if {@link Location} or {@link - * BlockData} are null -+ * @deprecated Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)} - */ - @NotNull -+ @org.jetbrains.annotations.ApiStatus.Obsolete // Paper - public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException; - - /** -@@ -2314,7 +2318,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - * @return The spawned {@link FallingBlock} instance - * @throws IllegalArgumentException if {@link Location} or {@link - * Material} are null or {@link Material} is not a block -- * @deprecated Magic value -+ * @deprecated Magic value. Use {@link #spawn(Location, Class, Consumer)} (or a variation thereof) in combination with {@link FallingBlock#setBlockData(BlockData)} - */ - @Deprecated - @NotNull -diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java -index ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9..7904c716a3b0869ebf2f9b416536c59121a539a8 100644 ---- a/src/main/java/org/bukkit/entity/FallingBlock.java -+++ b/src/main/java/org/bukkit/entity/FallingBlock.java -@@ -26,6 +26,33 @@ public interface FallingBlock extends Entity { - */ - @NotNull - BlockData getBlockData(); -+ // Paper start -+ /** -+ * Sets the data for the falling block. -+ *
    -+ * Any potential additional data currently stored in the falling blocks {@link #getBlockState()} will be -+ * purged by calling this setter. -+ * -+ * @param blockData the data to use as the block -+ */ -+ void setBlockData(@NotNull BlockData blockData); -+ -+ /** -+ * Get the data of the falling block represented as a {@link org.bukkit.block.BlockState BlockState} -+ * which includes potential NBT data that gets applied when the block gets placed on landing. -+ * -+ * @return the BlockState representing this block -+ */ -+ @NotNull -+ org.bukkit.block.BlockState getBlockState(); -+ -+ /** -+ * Sets the {@link BlockData} and possibly present tile entity data for the falling block. -+ * -+ * @param blockState the BlockState to use -+ */ -+ void setBlockState(@NotNull org.bukkit.block.BlockState blockState); -+ // Paper end - - /** - * Get if the falling block will break into an item if it cannot be placed. -@@ -137,4 +164,23 @@ public interface FallingBlock extends Entity { - default org.bukkit.Location getSourceLoc() { - return this.getOrigin(); - } -+ // Paper start - Auto expire setting -+ /** -+ * Sets if this falling block should expire after: -+ * - 30 seconds -+ * - 5 seconds and is outside of the world -+ * -+ * @return if this behavior occurs -+ */ -+ boolean doesAutoExpire(); -+ -+ /** -+ * Sets if this falling block should expire after: -+ * - 30 seconds -+ * - 5 seconds and is outside of the world -+ * -+ * @param autoExpires if this behavior should occur -+ */ -+ void shouldAutoExpire(boolean autoExpires); -+ // Paper end - Auto expire setting - } diff --git a/patches/api/0358-Add-WardenAngerChangeEvent.patch b/patches/api/0358-Add-WardenAngerChangeEvent.patch new file mode 100644 index 0000000000..4291ccd615 --- /dev/null +++ b/patches/api/0358-Add-WardenAngerChangeEvent.patch @@ -0,0 +1,122 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: nopjar +Date: Sun, 12 Jun 2022 00:56:45 +0200 +Subject: [PATCH] Add WardenAngerChangeEvent + +Adding a event which gets called when a warden is angered by +another entity. + +diff --git a/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2ab6c0244e +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java +@@ -0,0 +1,108 @@ ++package io.papermc.paper.event.entity; ++ ++import com.google.common.base.Preconditions; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Warden; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Range; ++ ++/** ++ * Called when a Warden's anger level has changed due to another entity. ++ *

    ++ * If the event is cancelled, the warden's anger level will not change. ++ */ ++public class WardenAngerChangeEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Entity target; ++ private final int oldAnger; ++ private int newAnger; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public WardenAngerChangeEvent(@NotNull final Warden warden, @NotNull final Entity target, final int oldAnger, final int newAnger) { ++ super(warden); ++ this.target = target; ++ this.oldAnger = oldAnger; ++ this.newAnger = newAnger; ++ } ++ ++ /** ++ * Gets the entity which triggered this anger update. ++ * ++ * @return triggering entity ++ */ ++ @NotNull ++ public Entity getTarget() { ++ return this.target; ++ } ++ ++ /** ++ * Gets the old anger level. ++ * ++ * @return old anger level ++ * @see Warden#getAnger(Entity) ++ */ ++ @Range(from = 0, to = 150) ++ public int getOldAnger() { ++ return this.oldAnger; ++ } ++ ++ /** ++ * Gets the new anger level resulting from this event. ++ * ++ * @return new anger level ++ * @see Warden#getAnger(Entity) ++ */ ++ @Range(from = 0, to = 150) ++ public int getNewAnger() { ++ return this.newAnger; ++ } ++ ++ /** ++ * Sets the new anger level resulting from this event. ++ *

    ++ * The anger of a warden is capped at 150. ++ * ++ * @param newAnger the new anger level, max 150 ++ * @see Warden#setAnger(Entity, int) ++ * @throws IllegalArgumentException if newAnger is greater than 150 ++ */ ++ public void setNewAnger(@Range(from = 0, to = 150) int newAnger) { ++ Preconditions.checkArgument(newAnger <= 150, "newAnger must not be greater than 150"); ++ this.newAnger = newAnger; ++ } ++ ++ @NotNull ++ @Override ++ public Warden getEntity() { ++ return (Warden) super.getEntity(); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0358-Add-method-isTickingWorlds-to-Bukkit.patch b/patches/api/0358-Add-method-isTickingWorlds-to-Bukkit.patch deleted file mode 100644 index eb982e565a..0000000000 --- a/patches/api/0358-Add-method-isTickingWorlds-to-Bukkit.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BuildTools <46540330+willkroboth@users.noreply.github.com> -Date: Fri, 19 Aug 2022 16:11:51 -0400 -Subject: [PATCH] Add method isTickingWorlds() to Bukkit. - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index eb6d59bad1e4f0b394290d683f5dfed6ba6dd75b..a2e5e917a7a0f6763f2ac13583dc28d9ea35ca64 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -808,12 +808,26 @@ public final class Bukkit { - return server.getWorlds(); - } - -+ // Paper start -+ /** -+ * Gets whether the worlds are being ticked right now. -+ * -+ * @return true if the worlds are being ticked, false otherwise. -+ */ -+ public static boolean isTickingWorlds(){ -+ return server.isTickingWorlds(); -+ } -+ // Paper end -+ - /** - * Creates or loads a world with the given name using the specified - * options. - *

    - * If the world is already loaded, it will just return the equivalent of - * getWorld(creator.name()). -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param creator the options to use when creating the world - * @return newly created or loaded world -@@ -825,6 +839,9 @@ public final class Bukkit { - - /** - * Unloads a world with the given name. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param name Name of the world to unload - * @param save whether to save the chunks before unloading -@@ -836,6 +853,9 @@ public final class Bukkit { - - /** - * Unloads the given world. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param world the world to unload - * @param save whether to save the chunks before unloading -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 6da6c20b684eba64b85d67db2482b4a968749070..708ea9556510b2e9de2f7f1c381572e3bde540d1 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -675,34 +675,55 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - @NotNull - public List getWorlds(); - -+ // Paper start -+ /** -+ * Gets whether the worlds are being ticked right now. -+ * -+ * @return true if the worlds are being ticked, false otherwise. -+ */ -+ public boolean isTickingWorlds(); -+ // Paper end -+ - /** - * Creates or loads a world with the given name using the specified - * options. - *

    - * If the world is already loaded, it will just return the equivalent of - * getWorld(creator.name()). -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param creator the options to use when creating the world - * @return newly created or loaded world -+ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true - */ - @Nullable - public World createWorld(@NotNull WorldCreator creator); - - /** - * Unloads a world with the given name. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param name Name of the world to unload - * @param save whether to save the chunks before unloading - * @return true if successful, false otherwise -+ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true - */ - public boolean unloadWorld(@NotNull String name, boolean save); - - /** - * Unloads the given world. -+ *

    -+ * Do note that un/loading worlds mid-tick may have potential side effects, we strongly recommend -+ * ensuring that you're not un/loading worlds midtick by checking {@link Bukkit#isTickingWorlds()} - * - * @param world the world to unload - * @param save whether to save the chunks before unloading - * @return true if successful, false otherwise -+ * @throws IllegalStateException when {@link #isTickingWorlds() isTickingWorlds} is true - */ - public boolean unloadWorld(@NotNull World world, boolean save); - diff --git a/patches/api/0359-Add-WardenAngerChangeEvent.patch b/patches/api/0359-Add-WardenAngerChangeEvent.patch deleted file mode 100644 index 4291ccd615..0000000000 --- a/patches/api/0359-Add-WardenAngerChangeEvent.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: nopjar -Date: Sun, 12 Jun 2022 00:56:45 +0200 -Subject: [PATCH] Add WardenAngerChangeEvent - -Adding a event which gets called when a warden is angered by -another entity. - -diff --git a/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7f738c1116feae8e8571488d516fab2ab6c0244e ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/WardenAngerChangeEvent.java -@@ -0,0 +1,108 @@ -+package io.papermc.paper.event.entity; -+ -+import com.google.common.base.Preconditions; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Warden; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Range; -+ -+/** -+ * Called when a Warden's anger level has changed due to another entity. -+ *

    -+ * If the event is cancelled, the warden's anger level will not change. -+ */ -+public class WardenAngerChangeEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity target; -+ private final int oldAnger; -+ private int newAnger; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WardenAngerChangeEvent(@NotNull final Warden warden, @NotNull final Entity target, final int oldAnger, final int newAnger) { -+ super(warden); -+ this.target = target; -+ this.oldAnger = oldAnger; -+ this.newAnger = newAnger; -+ } -+ -+ /** -+ * Gets the entity which triggered this anger update. -+ * -+ * @return triggering entity -+ */ -+ @NotNull -+ public Entity getTarget() { -+ return this.target; -+ } -+ -+ /** -+ * Gets the old anger level. -+ * -+ * @return old anger level -+ * @see Warden#getAnger(Entity) -+ */ -+ @Range(from = 0, to = 150) -+ public int getOldAnger() { -+ return this.oldAnger; -+ } -+ -+ /** -+ * Gets the new anger level resulting from this event. -+ * -+ * @return new anger level -+ * @see Warden#getAnger(Entity) -+ */ -+ @Range(from = 0, to = 150) -+ public int getNewAnger() { -+ return this.newAnger; -+ } -+ -+ /** -+ * Sets the new anger level resulting from this event. -+ *

    -+ * The anger of a warden is capped at 150. -+ * -+ * @param newAnger the new anger level, max 150 -+ * @see Warden#setAnger(Entity, int) -+ * @throws IllegalArgumentException if newAnger is greater than 150 -+ */ -+ public void setNewAnger(@Range(from = 0, to = 150) int newAnger) { -+ Preconditions.checkArgument(newAnger <= 150, "newAnger must not be greater than 150"); -+ this.newAnger = newAnger; -+ } -+ -+ @NotNull -+ @Override -+ public Warden getEntity() { -+ return (Warden) super.getEntity(); -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0359-Nameable-Banner-API.patch b/patches/api/0359-Nameable-Banner-API.patch new file mode 100644 index 0000000000..eba196daaf --- /dev/null +++ b/patches/api/0359-Nameable-Banner-API.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Thu, 7 Apr 2022 17:49:38 -0400 +Subject: [PATCH] Nameable Banner API + +Co-Authored-By: Swedz + +diff --git a/src/main/java/org/bukkit/block/Banner.java b/src/main/java/org/bukkit/block/Banner.java +index e6eb3c04b9fa6cd232f95dd5851d365234972efd..4dfd4bd40cb2f852d01a628994964700b9b20dc9 100644 +--- a/src/main/java/org/bukkit/block/Banner.java ++++ b/src/main/java/org/bukkit/block/Banner.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a captured state of a banner. + */ +-public interface Banner extends TileState { ++public interface Banner extends TileState, org.bukkit.Nameable { // Paper - Nameable API + + /** + * Returns the base color for this banner diff --git a/patches/api/0360-Add-Player-getFishHook.patch b/patches/api/0360-Add-Player-getFishHook.patch new file mode 100644 index 0000000000..feae3b2e47 --- /dev/null +++ b/patches/api/0360-Add-Player-getFishHook.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: u9g +Date: Tue, 14 Jun 2022 19:35:21 -0400 +Subject: [PATCH] Add Player#getFishHook + + +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index a47ea595c2a23b361a56f13877b67892ecfed826..ee866f3497ed56708d4062685f5585ca06a03955 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -386,6 +386,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + @Nullable + public Location getPotentialBedLocation(); + // Paper end ++ // Paper start ++ /** ++ * @return the player's fishing hook if they are fishing ++ */ ++ @Nullable ++ FishHook getFishHook(); ++ // Paper end + + /** + * Attempts to make the entity sleep at the given location. diff --git a/patches/api/0360-Nameable-Banner-API.patch b/patches/api/0360-Nameable-Banner-API.patch deleted file mode 100644 index eba196daaf..0000000000 --- a/patches/api/0360-Nameable-Banner-API.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Thu, 7 Apr 2022 17:49:38 -0400 -Subject: [PATCH] Nameable Banner API - -Co-Authored-By: Swedz - -diff --git a/src/main/java/org/bukkit/block/Banner.java b/src/main/java/org/bukkit/block/Banner.java -index e6eb3c04b9fa6cd232f95dd5851d365234972efd..4dfd4bd40cb2f852d01a628994964700b9b20dc9 100644 ---- a/src/main/java/org/bukkit/block/Banner.java -+++ b/src/main/java/org/bukkit/block/Banner.java -@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a captured state of a banner. - */ --public interface Banner extends TileState { -+public interface Banner extends TileState, org.bukkit.Nameable { // Paper - Nameable API - - /** - * Returns the base color for this banner diff --git a/patches/api/0361-Add-Player-getFishHook.patch b/patches/api/0361-Add-Player-getFishHook.patch deleted file mode 100644 index feae3b2e47..0000000000 --- a/patches/api/0361-Add-Player-getFishHook.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: u9g -Date: Tue, 14 Jun 2022 19:35:21 -0400 -Subject: [PATCH] Add Player#getFishHook - - -diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index a47ea595c2a23b361a56f13877b67892ecfed826..ee866f3497ed56708d4062685f5585ca06a03955 100644 ---- a/src/main/java/org/bukkit/entity/HumanEntity.java -+++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -386,6 +386,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - @Nullable - public Location getPotentialBedLocation(); - // Paper end -+ // Paper start -+ /** -+ * @return the player's fishing hook if they are fishing -+ */ -+ @Nullable -+ FishHook getFishHook(); -+ // Paper end - - /** - * Attempts to make the entity sleep at the given location. diff --git a/patches/api/0361-More-Teleport-API.patch b/patches/api/0361-More-Teleport-API.patch new file mode 100644 index 0000000000..eb36f5ee5d --- /dev/null +++ b/patches/api/0361-More-Teleport-API.patch @@ -0,0 +1,275 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 5 Sep 2021 00:36:05 -0400 +Subject: [PATCH] More Teleport API + + +diff --git a/src/main/java/io/papermc/paper/entity/LookAnchor.java b/src/main/java/io/papermc/paper/entity/LookAnchor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..544eec787ea837f7d29df6519255840d6fe087d7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/LookAnchor.java +@@ -0,0 +1,24 @@ ++package io.papermc.paper.entity; ++ ++import io.papermc.paper.math.Position; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.LivingEntity; ++ ++/** ++ * Represents what part of the entity should be used when determining where to face a position/entity. ++ * ++ * @see org.bukkit.entity.Player#lookAt(Position, LookAnchor) ++ * @see org.bukkit.entity.Player#lookAt(Entity, LookAnchor, LookAnchor) ++ */ ++public enum LookAnchor { ++ /** ++ * Represents the entity's feet. ++ * @see LivingEntity#getLocation() ++ */ ++ FEET, ++ /** ++ * Represents the entity's eyes. ++ * @see LivingEntity#getEyeLocation() ++ */ ++ EYES; ++} +diff --git a/src/main/java/io/papermc/paper/entity/TeleportFlag.java b/src/main/java/io/papermc/paper/entity/TeleportFlag.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c8b5b570d44da9524bfc59c7e11b2ae59d4b79b9 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/TeleportFlag.java +@@ -0,0 +1,79 @@ ++package io.papermc.paper.entity; ++ ++import org.bukkit.Location; ++import org.bukkit.event.player.PlayerTeleportEvent; ++ ++/** ++ * Represents a flag that can be set on teleportation that may ++ * slightly modify the behavior. ++ * ++ * @see EntityState ++ * @see Relative ++ */ ++public sealed interface TeleportFlag permits TeleportFlag.EntityState, TeleportFlag.Relative { ++ ++ /** ++ * Note: These flags only work on {@link org.bukkit.entity.Player} entities. ++ *

    ++ * Represents coordinates in a teleportation that should be handled relatively. ++ *

    ++ * Coordinates of the location that the client should handle as relative teleportation ++ * Relative teleportation flags are only used client side, and cause the player to not lose velocity in that ++ * specific coordinate. The location of the teleportation will not change. ++ * ++ * @see org.bukkit.entity.Player#teleport(Location, PlayerTeleportEvent.TeleportCause, TeleportFlag...) ++ */ ++ enum Relative implements TeleportFlag { ++ /** ++ * Represents the player's X coordinate ++ */ ++ X, ++ /** ++ * Represents the player's Y coordinate ++ */ ++ Y, ++ /** ++ * Represents the player's Z coordinate ++ */ ++ Z, ++ /** ++ * Represents the player's yaw ++ */ ++ YAW, ++ /** ++ * Represents the player's pitch ++ */ ++ PITCH; ++ } ++ ++ /** ++ * Represents flags that effect the entity's state on ++ * teleportation. ++ */ ++ enum EntityState implements TeleportFlag { ++ /** ++ * If all passengers should not be required to be removed prior to teleportation. ++ *

    ++ * Note: ++ * Teleporting to a different world with this flag present while the entity has entities riding it ++ * will cause this teleportation to return false and not occur. ++ */ ++ RETAIN_PASSENGERS, ++ /** ++ * If the entity should not be dismounted if they are riding another entity. ++ *

    ++ * Note: ++ * Teleporting to a different world with this flag present while this entity is riding another entity will ++ * cause this teleportation to return false and not occur. ++ */ ++ RETAIN_VEHICLE, ++ /** ++ * Indicates that a player should not have their current open inventory closed when teleporting. ++ *

    ++ * Note: ++ * This option will be ignored when teleported to a different world. ++ */ ++ RETAIN_OPEN_INVENTORY; ++ } ++ ++} +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 0cbf946c4f0f47ddfb59b23905968313f25294b1..a2223907c6e6780ca25dae255f321f9add11c912 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -126,10 +126,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * + * @param yaw the yaw + * @param pitch the pitch +- * @throws UnsupportedOperationException if used for players + */ + public void setRotation(float yaw, float pitch); + ++ // Paper start - Teleport API ++ /** ++ * Teleports this entity to the given location. ++ * ++ * @param location New location to teleport this entity to ++ * @param teleportFlags Flags to be used in this teleportation ++ * @return true if the teleport was successful ++ */ ++ default boolean teleport(@NotNull Location location, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags) { ++ return this.teleport(location, TeleportCause.PLUGIN, teleportFlags); ++ } ++ ++ /** ++ * Teleports this entity to the given location. ++ * ++ * @param location New location to teleport this entity to ++ * @param cause The cause of this teleportation ++ * @param teleportFlags Flags to be used in this teleportation ++ * @return true if the teleport was successful ++ */ ++ boolean teleport(@NotNull Location location, @NotNull TeleportCause cause, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags); ++ // Paper end - Teleport API ++ + /** + * Teleports this entity to the given location. If this entity is riding a + * vehicle, it will be dismounted prior to teleportation. +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index cd2d59a8a098227ec7725d121a63cc90e2a139fa..25064aafd5871a7168e8a0ba3e87d6de89e2b083 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3468,6 +3468,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + String getClientBrandName(); + // Paper end + ++ // Paper start - Teleport API ++ /** ++ * Sets the player's rotation. ++ * ++ * @param yaw the yaw ++ * @param pitch the pitch ++ */ ++ void setRotation(float yaw, float pitch); ++ ++ /** ++ * Causes the player to look towards the given position. ++ * ++ * @param x x coordinate ++ * @param y y coordinate ++ * @param z z coordinate ++ * @param playerAnchor What part of the player should face the given position ++ */ ++ void lookAt(double x, double y, double z, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor); ++ ++ /** ++ * Causes the player to look towards the given position. ++ * ++ * @param position Position to look at in the player's current world ++ * @param playerAnchor What part of the player should face the given position ++ */ ++ default void lookAt(@NotNull io.papermc.paper.math.Position position, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor) { ++ this.lookAt(position.x(), position.y(), position.z(), playerAnchor); ++ } ++ ++ /** ++ * Causes the player to look towards the given entity. ++ * ++ * @param entity Entity to look at ++ * @param playerAnchor What part of the player should face the entity ++ * @param entityAnchor What part of the entity the player should face ++ */ ++ void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); ++ // Paper end - Teleport API ++ + @NotNull + @Override + Spigot spigot(); +diff --git a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java +index 2deae344c88920ab95eefd2f65df5c858e04750b..ccfb08af8c57ddac3062c2cec28d7ff428082709 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java +@@ -13,8 +13,14 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { + private static final HandlerList handlers = new HandlerList(); + private TeleportCause cause = TeleportCause.UNKNOWN; + ++ // Paper start - Teleport API ++ private boolean dismounted = true; ++ private final java.util.Set teleportFlagSet; ++ // Paper end ++ + public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to) { + super(player, from, to); ++ teleportFlagSet = java.util.Collections.emptySet(); // Paper - Teleport API + } + + public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause) { +@@ -23,6 +29,15 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { + this.cause = cause; + } + ++ // Paper start - Teleport API ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause, @NotNull java.util.Set teleportFlagSet) { ++ super(player, from, to); ++ this.teleportFlagSet = teleportFlagSet; ++ this.cause = cause; ++ } ++ // Paper end ++ + /** + * Gets the cause of this teleportation event + * +@@ -88,6 +103,30 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { + UNKNOWN; + } + ++ // Paper start - Teleport API ++ /** ++ * Gets if the player will be dismounted in this teleportation. ++ * ++ * @return dismounted or not ++ * @deprecated dismounting on tp is no longer controlled by the server ++ */ ++ @Deprecated(forRemoval = true) ++ public boolean willDismountPlayer() { ++ return this.dismounted; ++ } ++ ++ /** ++ * Returns the relative teleportation flags used in this teleportation. ++ * This determines which axis the player will not lose their velocity in. ++ * ++ * @return an immutable set of relative teleportation flags ++ */ ++ @NotNull ++ public java.util.Set getRelativeTeleportationFlags() { ++ return this.teleportFlagSet; ++ } ++ // Paper end ++ + @NotNull + @Override + public HandlerList getHandlers() { diff --git a/patches/api/0362-Add-EntityPortalReadyEvent.patch b/patches/api/0362-Add-EntityPortalReadyEvent.patch new file mode 100644 index 0000000000..b9321a8e0d --- /dev/null +++ b/patches/api/0362-Add-EntityPortalReadyEvent.patch @@ -0,0 +1,106 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 12 May 2021 04:30:53 -0700 +Subject: [PATCH] Add EntityPortalReadyEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..3450735c86a8af45491c010a796262ae892f14dc +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java +@@ -0,0 +1,94 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.PortalType; ++import org.bukkit.World; ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.bukkit.event.entity.EntityPortalEvent; ++import org.bukkit.event.player.PlayerPortalEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when an entity is ready to be teleported by a plugin. ++ * Currently this is only called after the required ++ * ticks have passed for a Nether Portal. ++ *

    ++ * Cancelling this event resets the entity's readiness ++ * regarding the current portal. ++ */ ++public class EntityPortalReadyEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final PortalType portalType; ++ private World targetWorld; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityPortalReadyEvent(final @NotNull Entity entity, final @Nullable World targetWorld, final @NotNull PortalType portalType) { ++ super(entity); ++ this.targetWorld = targetWorld; ++ this.portalType = portalType; ++ } ++ ++ /** ++ * Gets the world this portal will teleport to. ++ * Can be {@code null} if "allow-nether" is false in server.properties ++ * or if there is another situation where there is no world to teleport to. ++ *

    ++ * This world may be modified by later events such as {@link PlayerPortalEvent} ++ * or {@link EntityPortalEvent}. ++ * ++ * @return the world the portal will teleport the entity to. ++ */ ++ public @Nullable World getTargetWorld() { ++ return this.targetWorld; ++ } ++ ++ /** ++ * Sets the world this portal will teleport to. A {@code null} value ++ * will essentially cancel the teleport and prevent further events ++ * such as {@link PlayerPortalEvent} from firing. ++ *

    ++ * This world may be modified by later events such as {@link PlayerPortalEvent} ++ * or {@link EntityPortalEvent}. ++ * ++ * @param targetWorld the world ++ */ ++ public void setTargetWorld(final @Nullable World targetWorld) { ++ this.targetWorld = targetWorld; ++ } ++ ++ /** ++ * Gets the portal type for this event. ++ * ++ * @return the portal type ++ */ ++ public @NotNull PortalType getPortalType() { ++ return this.portalType; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(final boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0362-More-Teleport-API.patch b/patches/api/0362-More-Teleport-API.patch deleted file mode 100644 index eb36f5ee5d..0000000000 --- a/patches/api/0362-More-Teleport-API.patch +++ /dev/null @@ -1,275 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 5 Sep 2021 00:36:05 -0400 -Subject: [PATCH] More Teleport API - - -diff --git a/src/main/java/io/papermc/paper/entity/LookAnchor.java b/src/main/java/io/papermc/paper/entity/LookAnchor.java -new file mode 100644 -index 0000000000000000000000000000000000000000..544eec787ea837f7d29df6519255840d6fe087d7 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/LookAnchor.java -@@ -0,0 +1,24 @@ -+package io.papermc.paper.entity; -+ -+import io.papermc.paper.math.Position; -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.LivingEntity; -+ -+/** -+ * Represents what part of the entity should be used when determining where to face a position/entity. -+ * -+ * @see org.bukkit.entity.Player#lookAt(Position, LookAnchor) -+ * @see org.bukkit.entity.Player#lookAt(Entity, LookAnchor, LookAnchor) -+ */ -+public enum LookAnchor { -+ /** -+ * Represents the entity's feet. -+ * @see LivingEntity#getLocation() -+ */ -+ FEET, -+ /** -+ * Represents the entity's eyes. -+ * @see LivingEntity#getEyeLocation() -+ */ -+ EYES; -+} -diff --git a/src/main/java/io/papermc/paper/entity/TeleportFlag.java b/src/main/java/io/papermc/paper/entity/TeleportFlag.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c8b5b570d44da9524bfc59c7e11b2ae59d4b79b9 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/TeleportFlag.java -@@ -0,0 +1,79 @@ -+package io.papermc.paper.entity; -+ -+import org.bukkit.Location; -+import org.bukkit.event.player.PlayerTeleportEvent; -+ -+/** -+ * Represents a flag that can be set on teleportation that may -+ * slightly modify the behavior. -+ * -+ * @see EntityState -+ * @see Relative -+ */ -+public sealed interface TeleportFlag permits TeleportFlag.EntityState, TeleportFlag.Relative { -+ -+ /** -+ * Note: These flags only work on {@link org.bukkit.entity.Player} entities. -+ *

    -+ * Represents coordinates in a teleportation that should be handled relatively. -+ *

    -+ * Coordinates of the location that the client should handle as relative teleportation -+ * Relative teleportation flags are only used client side, and cause the player to not lose velocity in that -+ * specific coordinate. The location of the teleportation will not change. -+ * -+ * @see org.bukkit.entity.Player#teleport(Location, PlayerTeleportEvent.TeleportCause, TeleportFlag...) -+ */ -+ enum Relative implements TeleportFlag { -+ /** -+ * Represents the player's X coordinate -+ */ -+ X, -+ /** -+ * Represents the player's Y coordinate -+ */ -+ Y, -+ /** -+ * Represents the player's Z coordinate -+ */ -+ Z, -+ /** -+ * Represents the player's yaw -+ */ -+ YAW, -+ /** -+ * Represents the player's pitch -+ */ -+ PITCH; -+ } -+ -+ /** -+ * Represents flags that effect the entity's state on -+ * teleportation. -+ */ -+ enum EntityState implements TeleportFlag { -+ /** -+ * If all passengers should not be required to be removed prior to teleportation. -+ *

    -+ * Note: -+ * Teleporting to a different world with this flag present while the entity has entities riding it -+ * will cause this teleportation to return false and not occur. -+ */ -+ RETAIN_PASSENGERS, -+ /** -+ * If the entity should not be dismounted if they are riding another entity. -+ *

    -+ * Note: -+ * Teleporting to a different world with this flag present while this entity is riding another entity will -+ * cause this teleportation to return false and not occur. -+ */ -+ RETAIN_VEHICLE, -+ /** -+ * Indicates that a player should not have their current open inventory closed when teleporting. -+ *

    -+ * Note: -+ * This option will be ignored when teleported to a different world. -+ */ -+ RETAIN_OPEN_INVENTORY; -+ } -+ -+} -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 0cbf946c4f0f47ddfb59b23905968313f25294b1..a2223907c6e6780ca25dae255f321f9add11c912 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -126,10 +126,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * - * @param yaw the yaw - * @param pitch the pitch -- * @throws UnsupportedOperationException if used for players - */ - public void setRotation(float yaw, float pitch); - -+ // Paper start - Teleport API -+ /** -+ * Teleports this entity to the given location. -+ * -+ * @param location New location to teleport this entity to -+ * @param teleportFlags Flags to be used in this teleportation -+ * @return true if the teleport was successful -+ */ -+ default boolean teleport(@NotNull Location location, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags) { -+ return this.teleport(location, TeleportCause.PLUGIN, teleportFlags); -+ } -+ -+ /** -+ * Teleports this entity to the given location. -+ * -+ * @param location New location to teleport this entity to -+ * @param cause The cause of this teleportation -+ * @param teleportFlags Flags to be used in this teleportation -+ * @return true if the teleport was successful -+ */ -+ boolean teleport(@NotNull Location location, @NotNull TeleportCause cause, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags); -+ // Paper end - Teleport API -+ - /** - * Teleports this entity to the given location. If this entity is riding a - * vehicle, it will be dismounted prior to teleportation. -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index cd2d59a8a098227ec7725d121a63cc90e2a139fa..25064aafd5871a7168e8a0ba3e87d6de89e2b083 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3468,6 +3468,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - String getClientBrandName(); - // Paper end - -+ // Paper start - Teleport API -+ /** -+ * Sets the player's rotation. -+ * -+ * @param yaw the yaw -+ * @param pitch the pitch -+ */ -+ void setRotation(float yaw, float pitch); -+ -+ /** -+ * Causes the player to look towards the given position. -+ * -+ * @param x x coordinate -+ * @param y y coordinate -+ * @param z z coordinate -+ * @param playerAnchor What part of the player should face the given position -+ */ -+ void lookAt(double x, double y, double z, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor); -+ -+ /** -+ * Causes the player to look towards the given position. -+ * -+ * @param position Position to look at in the player's current world -+ * @param playerAnchor What part of the player should face the given position -+ */ -+ default void lookAt(@NotNull io.papermc.paper.math.Position position, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor) { -+ this.lookAt(position.x(), position.y(), position.z(), playerAnchor); -+ } -+ -+ /** -+ * Causes the player to look towards the given entity. -+ * -+ * @param entity Entity to look at -+ * @param playerAnchor What part of the player should face the entity -+ * @param entityAnchor What part of the entity the player should face -+ */ -+ void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); -+ // Paper end - Teleport API -+ - @NotNull - @Override - Spigot spigot(); -diff --git a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java -index 2deae344c88920ab95eefd2f65df5c858e04750b..ccfb08af8c57ddac3062c2cec28d7ff428082709 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerTeleportEvent.java -@@ -13,8 +13,14 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { - private static final HandlerList handlers = new HandlerList(); - private TeleportCause cause = TeleportCause.UNKNOWN; - -+ // Paper start - Teleport API -+ private boolean dismounted = true; -+ private final java.util.Set teleportFlagSet; -+ // Paper end -+ - public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to) { - super(player, from, to); -+ teleportFlagSet = java.util.Collections.emptySet(); // Paper - Teleport API - } - - public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause) { -@@ -23,6 +29,15 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { - this.cause = cause; - } - -+ // Paper start - Teleport API -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public PlayerTeleportEvent(@NotNull final Player player, @NotNull final Location from, @Nullable final Location to, @NotNull final TeleportCause cause, @NotNull java.util.Set teleportFlagSet) { -+ super(player, from, to); -+ this.teleportFlagSet = teleportFlagSet; -+ this.cause = cause; -+ } -+ // Paper end -+ - /** - * Gets the cause of this teleportation event - * -@@ -88,6 +103,30 @@ public class PlayerTeleportEvent extends PlayerMoveEvent { - UNKNOWN; - } - -+ // Paper start - Teleport API -+ /** -+ * Gets if the player will be dismounted in this teleportation. -+ * -+ * @return dismounted or not -+ * @deprecated dismounting on tp is no longer controlled by the server -+ */ -+ @Deprecated(forRemoval = true) -+ public boolean willDismountPlayer() { -+ return this.dismounted; -+ } -+ -+ /** -+ * Returns the relative teleportation flags used in this teleportation. -+ * This determines which axis the player will not lose their velocity in. -+ * -+ * @return an immutable set of relative teleportation flags -+ */ -+ @NotNull -+ public java.util.Set getRelativeTeleportationFlags() { -+ return this.teleportFlagSet; -+ } -+ // Paper end -+ - @NotNull - @Override - public HandlerList getHandlers() { diff --git a/patches/api/0363-Add-EntityPortalReadyEvent.patch b/patches/api/0363-Add-EntityPortalReadyEvent.patch deleted file mode 100644 index b9321a8e0d..0000000000 --- a/patches/api/0363-Add-EntityPortalReadyEvent.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 12 May 2021 04:30:53 -0700 -Subject: [PATCH] Add EntityPortalReadyEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..3450735c86a8af45491c010a796262ae892f14dc ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java -@@ -0,0 +1,94 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.PortalType; -+import org.bukkit.World; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.event.entity.EntityPortalEvent; -+import org.bukkit.event.player.PlayerPortalEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when an entity is ready to be teleported by a plugin. -+ * Currently this is only called after the required -+ * ticks have passed for a Nether Portal. -+ *

    -+ * Cancelling this event resets the entity's readiness -+ * regarding the current portal. -+ */ -+public class EntityPortalReadyEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final PortalType portalType; -+ private World targetWorld; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityPortalReadyEvent(final @NotNull Entity entity, final @Nullable World targetWorld, final @NotNull PortalType portalType) { -+ super(entity); -+ this.targetWorld = targetWorld; -+ this.portalType = portalType; -+ } -+ -+ /** -+ * Gets the world this portal will teleport to. -+ * Can be {@code null} if "allow-nether" is false in server.properties -+ * or if there is another situation where there is no world to teleport to. -+ *

    -+ * This world may be modified by later events such as {@link PlayerPortalEvent} -+ * or {@link EntityPortalEvent}. -+ * -+ * @return the world the portal will teleport the entity to. -+ */ -+ public @Nullable World getTargetWorld() { -+ return this.targetWorld; -+ } -+ -+ /** -+ * Sets the world this portal will teleport to. A {@code null} value -+ * will essentially cancel the teleport and prevent further events -+ * such as {@link PlayerPortalEvent} from firing. -+ *

    -+ * This world may be modified by later events such as {@link PlayerPortalEvent} -+ * or {@link EntityPortalEvent}. -+ * -+ * @param targetWorld the world -+ */ -+ public void setTargetWorld(final @Nullable World targetWorld) { -+ this.targetWorld = targetWorld; -+ } -+ -+ /** -+ * Gets the portal type for this event. -+ * -+ * @return the portal type -+ */ -+ public @NotNull PortalType getPortalType() { -+ return this.portalType; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(final boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0363-Custom-Chat-Completion-Suggestions-API.patch b/patches/api/0363-Custom-Chat-Completion-Suggestions-API.patch new file mode 100644 index 0000000000..e22c1feefa --- /dev/null +++ b/patches/api/0363-Custom-Chat-Completion-Suggestions-API.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sat, 30 Jul 2022 11:23:11 -0400 +Subject: [PATCH] Custom Chat Completion Suggestions API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 25064aafd5871a7168e8a0ba3e87d6de89e2b083..ac9227472443ecb819cc7480a217cd78a98a9b35 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3352,6 +3352,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + void sendOpLevel(byte level); + // Paper end - sendOpLevel API + ++ // Paper start - custom chat completions API ++ /** ++ * Adds custom chat completion suggestions that the client will ++ * suggest when typing in chat. ++ * ++ * @param completions custom completions ++ * @deprecated use {@link #addCustomChatCompletions(Collection)} ++ */ ++ @Deprecated(since = "1.20.1") ++ void addAdditionalChatCompletions(@NotNull java.util.Collection completions); ++ ++ /** ++ * Removes custom chat completion suggestions that the client ++ * suggests when typing in chat. ++ * ++ * Note: this only applies to previously added custom completions, ++ * online player names are always suggested and cannot be removed. ++ * ++ * @param completions custom completions ++ * @deprecated use {@link #addCustomChatCompletions(Collection)} ++ */ ++ @Deprecated(since = "1.20.1") ++ void removeAdditionalChatCompletions(@NotNull java.util.Collection completions); ++ // Paper end - custom chat completions API ++ + // Spigot start + public class Spigot extends Entity.Spigot { + diff --git a/patches/api/0364-Collision-API.patch b/patches/api/0364-Collision-API.patch new file mode 100644 index 0000000000..f59dc05fbb --- /dev/null +++ b/patches/api/0364-Collision-API.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 6 Oct 2021 20:10:36 -0400 +Subject: [PATCH] Collision API + + +diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java +index 44ee56a5956cc17194c767a0c1071a2abffe818a..43dd6c59cceba12f27e6b265acc3ad97eea37abd 100644 +--- a/src/main/java/org/bukkit/RegionAccessor.java ++++ b/src/main/java/org/bukkit/RegionAccessor.java +@@ -493,5 +493,15 @@ public interface RegionAccessor extends Keyed { // Paper + * @return whether a line of sight exists between {@code from} and {@code to} + */ + public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to); ++ ++ /** ++ * Checks if the world collides with the given boundingbox. ++ * This will check for any colliding hard entities (boats, shulkers) / worldborder / blocks. ++ * Does not load chunks that are within the bounding box. ++ * ++ * @param boundingBox the box to check collisions in ++ * @return collides or not ++ */ ++ boolean hasCollisionsIn(@NotNull org.bukkit.util.BoundingBox boundingBox); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index a2223907c6e6780ca25dae255f321f9add11c912..11885ef53ed97738d0a50e5f459a9f76c975c085 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -1019,4 +1019,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + boolean isInPowderedSnow(); + // Paper end ++ ++ // Paper start - Collision API ++ /** ++ * Checks for any collisions with the entity's bounding box at the provided location. ++ * This will check for any colliding entities (boats, shulkers) / worldborder / blocks. ++ * Does not load chunks that are within the bounding box at the specified location. ++ * ++ * @param location the location to check collisions in ++ * @return collides or not ++ */ ++ boolean collidesAt(@NotNull Location location); ++ ++ /** ++ * This checks using the given boundingbox as the entity's boundingbox if the entity would collide with anything. ++ * This will check for any colliding entities (boats, shulkers) / worldborder / blocks. ++ * Does not load chunks that are within the bounding box. ++ * ++ * @param boundingBox the box to check collisions in ++ * @return collides or not ++ */ ++ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); ++ // Paper end - Collision API + } diff --git a/patches/api/0364-Custom-Chat-Completion-Suggestions-API.patch b/patches/api/0364-Custom-Chat-Completion-Suggestions-API.patch deleted file mode 100644 index e22c1feefa..0000000000 --- a/patches/api/0364-Custom-Chat-Completion-Suggestions-API.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sat, 30 Jul 2022 11:23:11 -0400 -Subject: [PATCH] Custom Chat Completion Suggestions API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 25064aafd5871a7168e8a0ba3e87d6de89e2b083..ac9227472443ecb819cc7480a217cd78a98a9b35 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3352,6 +3352,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void sendOpLevel(byte level); - // Paper end - sendOpLevel API - -+ // Paper start - custom chat completions API -+ /** -+ * Adds custom chat completion suggestions that the client will -+ * suggest when typing in chat. -+ * -+ * @param completions custom completions -+ * @deprecated use {@link #addCustomChatCompletions(Collection)} -+ */ -+ @Deprecated(since = "1.20.1") -+ void addAdditionalChatCompletions(@NotNull java.util.Collection completions); -+ -+ /** -+ * Removes custom chat completion suggestions that the client -+ * suggests when typing in chat. -+ * -+ * Note: this only applies to previously added custom completions, -+ * online player names are always suggested and cannot be removed. -+ * -+ * @param completions custom completions -+ * @deprecated use {@link #addCustomChatCompletions(Collection)} -+ */ -+ @Deprecated(since = "1.20.1") -+ void removeAdditionalChatCompletions(@NotNull java.util.Collection completions); -+ // Paper end - custom chat completions API -+ - // Spigot start - public class Spigot extends Entity.Spigot { - diff --git a/patches/api/0365-Block-Ticking-API.patch b/patches/api/0365-Block-Ticking-API.patch new file mode 100644 index 0000000000..02fed74c9e --- /dev/null +++ b/patches/api/0365-Block-Ticking-API.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 26 Dec 2021 13:23:52 -0500 +Subject: [PATCH] Block Ticking API + + +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index cf9600c743e977312c0a15c455d602391797ef34..8a842840e1a2652a6356d4a56e4749a5ba36e902 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -589,6 +589,41 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr + * @return true if the block was destroyed + */ + boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience); ++ ++ /** ++ * Causes the block to be ticked, this is different from {@link Block#randomTick()}, ++ * in that it is usually scheduled to occur, for example ++ * redstone components being activated, sand falling, etc. ++ *

    ++ * This method may directly fire events relating to block ticking. ++ * ++ * @see #fluidTick() ++ */ ++ void tick(); ++ ++ /** ++ * Causes the fluid to be ticked, this is different from {@link Block#randomTick()}, ++ * in that it is usually scheduled to occur, for example ++ * causing waterlogged blocks to spread. ++ *

    ++ * This method may directly fire events relating to fluid ticking. ++ * ++ * @see #tick() ++ */ ++ void fluidTick(); ++ ++ /** ++ * Causes the block to be ticked randomly. ++ * This has a chance to execute naturally if {@link BlockData#isRandomlyTicked()} is true. ++ *

    ++ * For certain blocks, this behavior may be the same as {@link Block#tick()}. ++ *

    ++ * This method may directly fire events relating to block random ticking. ++ * ++ * @see #tick() ++ * @see #fluidTick() ++ */ ++ void randomTick(); + // Paper end + + /** +diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java +index 8a26e7215672f5fd4555fd455c9b1571488f0259..64188a78211195fe792eac427e483e1984f52318 100644 +--- a/src/main/java/org/bukkit/block/data/BlockData.java ++++ b/src/main/java/org/bukkit/block/data/BlockData.java +@@ -291,4 +291,14 @@ public interface BlockData extends Cloneable { + */ + float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants); + // Paper end - destroy speed API ++ ++ // Paper start - Tick API ++ /** ++ * Gets if this block is ticked randomly in the world. ++ * The blocks current state may change this value. ++ * ++ * @return is ticked randomly ++ */ ++ boolean isRandomlyTicked(); ++ // Paper end - Tick API + } diff --git a/patches/api/0365-Collision-API.patch b/patches/api/0365-Collision-API.patch deleted file mode 100644 index f59dc05fbb..0000000000 --- a/patches/api/0365-Collision-API.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 6 Oct 2021 20:10:36 -0400 -Subject: [PATCH] Collision API - - -diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java -index 44ee56a5956cc17194c767a0c1071a2abffe818a..43dd6c59cceba12f27e6b265acc3ad97eea37abd 100644 ---- a/src/main/java/org/bukkit/RegionAccessor.java -+++ b/src/main/java/org/bukkit/RegionAccessor.java -@@ -493,5 +493,15 @@ public interface RegionAccessor extends Keyed { // Paper - * @return whether a line of sight exists between {@code from} and {@code to} - */ - public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to); -+ -+ /** -+ * Checks if the world collides with the given boundingbox. -+ * This will check for any colliding hard entities (boats, shulkers) / worldborder / blocks. -+ * Does not load chunks that are within the bounding box. -+ * -+ * @param boundingBox the box to check collisions in -+ * @return collides or not -+ */ -+ boolean hasCollisionsIn(@NotNull org.bukkit.util.BoundingBox boundingBox); - // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index a2223907c6e6780ca25dae255f321f9add11c912..11885ef53ed97738d0a50e5f459a9f76c975c085 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1019,4 +1019,26 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - boolean isInPowderedSnow(); - // Paper end -+ -+ // Paper start - Collision API -+ /** -+ * Checks for any collisions with the entity's bounding box at the provided location. -+ * This will check for any colliding entities (boats, shulkers) / worldborder / blocks. -+ * Does not load chunks that are within the bounding box at the specified location. -+ * -+ * @param location the location to check collisions in -+ * @return collides or not -+ */ -+ boolean collidesAt(@NotNull Location location); -+ -+ /** -+ * This checks using the given boundingbox as the entity's boundingbox if the entity would collide with anything. -+ * This will check for any colliding entities (boats, shulkers) / worldborder / blocks. -+ * Does not load chunks that are within the bounding box. -+ * -+ * @param boundingBox the box to check collisions in -+ * @return collides or not -+ */ -+ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); -+ // Paper end - Collision API - } diff --git a/patches/api/0366-Add-NamespacedKey-biome-methods.patch b/patches/api/0366-Add-NamespacedKey-biome-methods.patch new file mode 100644 index 0000000000..33cb3ec8a0 --- /dev/null +++ b/patches/api/0366-Add-NamespacedKey-biome-methods.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Josh Roy <10731363+JRoy@users.noreply.github.com> +Date: Sun, 14 Aug 2022 12:22:54 -0400 +Subject: [PATCH] Add NamespacedKey biome methods + +Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> + +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 8d63016729fceec3392c81372778764f092c5b22..c16e03d0676b46b3b74e706309d34e66b5e7a4b3 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -221,5 +221,32 @@ public interface UnsafeValues { + * @throws IllegalArgumentException if {@link Material#isBlock()} is false + */ + boolean isCollidable(@org.jetbrains.annotations.NotNull Material material); ++ ++ /** ++ * Gets the {@link NamespacedKey} for the biome at the given location. ++ * ++ * @param accessor The {@link RegionAccessor} of the provided coordinates ++ * @param x X-coordinate of the block ++ * @param y Y-coordinate of the block ++ * @param z Z-coordinate of the block ++ * @return the biome's {@link NamespacedKey} ++ */ ++ @org.jetbrains.annotations.NotNull ++ NamespacedKey getBiomeKey(RegionAccessor accessor, int x, int y, int z); ++ ++ /** ++ * Sets the biome at the given location to a biome registered ++ * to the given {@link NamespacedKey}. If no biome by the given ++ * {@link NamespacedKey} exists, an {@link IllegalStateException} ++ * will be thrown. ++ * ++ * @param accessor The {@link RegionAccessor} of the provided coordinates ++ * @param x X-coordinate of the block ++ * @param y Y-coordinate of the block ++ * @param z Z-coordinate of the block ++ * @param biomeKey Biome key ++ * @throws IllegalStateException if no biome by the given key is registered. ++ */ ++ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); + // Paper end + } diff --git a/patches/api/0366-Block-Ticking-API.patch b/patches/api/0366-Block-Ticking-API.patch deleted file mode 100644 index 02fed74c9e..0000000000 --- a/patches/api/0366-Block-Ticking-API.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 26 Dec 2021 13:23:52 -0500 -Subject: [PATCH] Block Ticking API - - -diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index cf9600c743e977312c0a15c455d602391797ef34..8a842840e1a2652a6356d4a56e4749a5ba36e902 100644 ---- a/src/main/java/org/bukkit/block/Block.java -+++ b/src/main/java/org/bukkit/block/Block.java -@@ -589,6 +589,41 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr - * @return true if the block was destroyed - */ - boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience); -+ -+ /** -+ * Causes the block to be ticked, this is different from {@link Block#randomTick()}, -+ * in that it is usually scheduled to occur, for example -+ * redstone components being activated, sand falling, etc. -+ *

    -+ * This method may directly fire events relating to block ticking. -+ * -+ * @see #fluidTick() -+ */ -+ void tick(); -+ -+ /** -+ * Causes the fluid to be ticked, this is different from {@link Block#randomTick()}, -+ * in that it is usually scheduled to occur, for example -+ * causing waterlogged blocks to spread. -+ *

    -+ * This method may directly fire events relating to fluid ticking. -+ * -+ * @see #tick() -+ */ -+ void fluidTick(); -+ -+ /** -+ * Causes the block to be ticked randomly. -+ * This has a chance to execute naturally if {@link BlockData#isRandomlyTicked()} is true. -+ *

    -+ * For certain blocks, this behavior may be the same as {@link Block#tick()}. -+ *

    -+ * This method may directly fire events relating to block random ticking. -+ * -+ * @see #tick() -+ * @see #fluidTick() -+ */ -+ void randomTick(); - // Paper end - - /** -diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java -index 8a26e7215672f5fd4555fd455c9b1571488f0259..64188a78211195fe792eac427e483e1984f52318 100644 ---- a/src/main/java/org/bukkit/block/data/BlockData.java -+++ b/src/main/java/org/bukkit/block/data/BlockData.java -@@ -291,4 +291,14 @@ public interface BlockData extends Cloneable { - */ - float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants); - // Paper end - destroy speed API -+ -+ // Paper start - Tick API -+ /** -+ * Gets if this block is ticked randomly in the world. -+ * The blocks current state may change this value. -+ * -+ * @return is ticked randomly -+ */ -+ boolean isRandomlyTicked(); -+ // Paper end - Tick API - } diff --git a/patches/api/0367-Add-NamespacedKey-biome-methods.patch b/patches/api/0367-Add-NamespacedKey-biome-methods.patch deleted file mode 100644 index 9b5cd7d737..0000000000 --- a/patches/api/0367-Add-NamespacedKey-biome-methods.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Sun, 14 Aug 2022 12:22:54 -0400 -Subject: [PATCH] Add NamespacedKey biome methods - -Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> - -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 9245f50b2bac30e956ef6ddc11c551b9b68463ee..5d862c9221d1ce6d577295a5181f951c2f71a631 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -220,5 +220,32 @@ public interface UnsafeValues { - * @throws IllegalArgumentException if {@link Material#isBlock()} is false - */ - boolean isCollidable(@org.jetbrains.annotations.NotNull Material material); -+ -+ /** -+ * Gets the {@link NamespacedKey} for the biome at the given location. -+ * -+ * @param accessor The {@link RegionAccessor} of the provided coordinates -+ * @param x X-coordinate of the block -+ * @param y Y-coordinate of the block -+ * @param z Z-coordinate of the block -+ * @return the biome's {@link NamespacedKey} -+ */ -+ @org.jetbrains.annotations.NotNull -+ NamespacedKey getBiomeKey(RegionAccessor accessor, int x, int y, int z); -+ -+ /** -+ * Sets the biome at the given location to a biome registered -+ * to the given {@link NamespacedKey}. If no biome by the given -+ * {@link NamespacedKey} exists, an {@link IllegalStateException} -+ * will be thrown. -+ * -+ * @param accessor The {@link RegionAccessor} of the provided coordinates -+ * @param x X-coordinate of the block -+ * @param y Y-coordinate of the block -+ * @param z Z-coordinate of the block -+ * @param biomeKey Biome key -+ * @throws IllegalStateException if no biome by the given key is registered. -+ */ -+ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); - // Paper end - } diff --git a/patches/api/0367-Also-load-resources-from-LibraryLoader.patch b/patches/api/0367-Also-load-resources-from-LibraryLoader.patch new file mode 100644 index 0000000000..c2a41c2e53 --- /dev/null +++ b/patches/api/0367-Also-load-resources-from-LibraryLoader.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nick Hensel +Date: Sun, 28 Aug 2022 23:44:18 +0200 +Subject: [PATCH] Also load resources from LibraryLoader + + +diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +index de017d10db19ca7ca7f73ff0ac08fe6e1773d7dc..7e4f7cb2afbc145e532285c793573ad107bc3033 100644 +--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +@@ -109,14 +109,35 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm + + @Override + public URL getResource(String name) { +- return findResource(name); ++ // Paper start ++ URL resource = findResource(name); ++ if (resource == null && libraryLoader != null) { ++ return libraryLoader.getResource(name); ++ } ++ return resource; ++ // Paper end + } + + @Override + public Enumeration getResources(String name) throws IOException { +- return findResources(name); ++ // Paper start ++ java.util.ArrayList resources = new java.util.ArrayList<>(); ++ addEnumeration(resources, findResources(name)); ++ if (libraryLoader != null) { ++ addEnumeration(resources, libraryLoader.getResources(name)); ++ } ++ return Collections.enumeration(resources); ++ // Paper end + } + ++ // Paper start ++ private void addEnumeration(java.util.ArrayList list, Enumeration enumeration) { ++ while (enumeration.hasMoreElements()) { ++ list.add(enumeration.nextElement()); ++ } ++ } ++ // Paper end ++ + // Paper start + @Override + public Class loadClass(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException { diff --git a/patches/api/0368-Added-byte-array-serialization-deserialization-for-P.patch b/patches/api/0368-Added-byte-array-serialization-deserialization-for-P.patch new file mode 100644 index 0000000000..9b71f12681 --- /dev/null +++ b/patches/api/0368-Added-byte-array-serialization-deserialization-for-P.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nex +Date: Thu, 24 Feb 2022 16:28:08 +0100 +Subject: [PATCH] Added byte array serialization/deserialization for + PersistentDataContainers + + +diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java +index 18fc4f1c7151bfdeed32a52cf5050a76ebc391d6..decf3b1949d4653a9fb01684b93ff91048137076 100644 +--- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java ++++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java +@@ -184,4 +184,39 @@ public interface PersistentDataContainer { + */ + @NotNull + PersistentDataAdapterContext getAdapterContext(); ++ ++ // Paper start - byte array serialization ++ /** ++ * Serialize this {@link PersistentDataContainer} instance to a ++ * byte array. ++ * ++ * @return a binary representation of this container ++ * @throws java.io.IOException if we fail to write this container to a byte array ++ */ ++ byte @NotNull [] serializeToBytes() throws java.io.IOException; ++ ++ /** ++ * Read values from a serialised byte array into this ++ * {@link PersistentDataContainer} instance. ++ * ++ * @param bytes the byte array to read from ++ * @param clear if true, this {@link PersistentDataContainer} instance ++ * will be cleared before reading ++ * @throws java.io.IOException if the byte array has an invalid format ++ */ ++ void readFromBytes(byte @NotNull [] bytes, boolean clear) throws java.io.IOException; ++ ++ /** ++ * Read values from a serialised byte array into this ++ * {@link PersistentDataContainer} instance. ++ * This method has the same effect as ++ * PersistentDataContainer#readFromBytes(bytes, true) ++ * ++ * @param bytes the byte array to read from ++ * @throws java.io.IOException if the byte array has an invalid format ++ */ ++ default void readFromBytes(final byte @NotNull [] bytes) throws java.io.IOException { ++ this.readFromBytes(bytes, true); ++ } ++ // Paper end - byte array serialization + } diff --git a/patches/api/0368-Also-load-resources-from-LibraryLoader.patch b/patches/api/0368-Also-load-resources-from-LibraryLoader.patch deleted file mode 100644 index c2a41c2e53..0000000000 --- a/patches/api/0368-Also-load-resources-from-LibraryLoader.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nick Hensel -Date: Sun, 28 Aug 2022 23:44:18 +0200 -Subject: [PATCH] Also load resources from LibraryLoader - - -diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index de017d10db19ca7ca7f73ff0ac08fe6e1773d7dc..7e4f7cb2afbc145e532285c793573ad107bc3033 100644 ---- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -@@ -109,14 +109,35 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm - - @Override - public URL getResource(String name) { -- return findResource(name); -+ // Paper start -+ URL resource = findResource(name); -+ if (resource == null && libraryLoader != null) { -+ return libraryLoader.getResource(name); -+ } -+ return resource; -+ // Paper end - } - - @Override - public Enumeration getResources(String name) throws IOException { -- return findResources(name); -+ // Paper start -+ java.util.ArrayList resources = new java.util.ArrayList<>(); -+ addEnumeration(resources, findResources(name)); -+ if (libraryLoader != null) { -+ addEnumeration(resources, libraryLoader.getResources(name)); -+ } -+ return Collections.enumeration(resources); -+ // Paper end - } - -+ // Paper start -+ private void addEnumeration(java.util.ArrayList list, Enumeration enumeration) { -+ while (enumeration.hasMoreElements()) { -+ list.add(enumeration.nextElement()); -+ } -+ } -+ // Paper end -+ - // Paper start - @Override - public Class loadClass(@NotNull String name, boolean resolve, boolean checkGlobal, boolean checkLibraries) throws ClassNotFoundException { diff --git a/patches/api/0369-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/0369-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch new file mode 100644 index 0000000000..291761dadb --- /dev/null +++ b/patches/api/0369-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MelnCat +Date: Mon, 19 Sep 2022 14:04:13 -0700 +Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile + + +diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java +index eabd8b926ec1c934cd7e77b7cc6adfae16771021..96ebd30d339060758e726e9e1e7428d1d0813c17 100644 +--- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java ++++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java +@@ -31,4 +31,23 @@ public interface ProjectileSource { + */ + @NotNull + public T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity); ++ ++ // Paper start - add consumer to launchProjectile ++ /** ++ * Launches a {@link Projectile} from the ProjectileSource with an ++ * initial velocity, with the supplied function run before the ++ * entity is added to the world. ++ *
    ++ * Note that when the function is run, the entity will not be actually in ++ * the world. Any operation involving such as teleporting the entity is undefined ++ * until after this function returns. ++ * ++ * @param a projectile subclass ++ * @param projectile class of the projectile to launch ++ * @param velocity the velocity with which to launch ++ * @param function the function to be run before the entity is spawned ++ * @return the launched projectile ++ */ ++ @NotNull T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity, java.util.function.@Nullable Consumer function); ++ // Paper end - add consumer to launchProjectile + } diff --git a/patches/api/0369-Added-byte-array-serialization-deserialization-for-P.patch b/patches/api/0369-Added-byte-array-serialization-deserialization-for-P.patch deleted file mode 100644 index 9b71f12681..0000000000 --- a/patches/api/0369-Added-byte-array-serialization-deserialization-for-P.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nex -Date: Thu, 24 Feb 2022 16:28:08 +0100 -Subject: [PATCH] Added byte array serialization/deserialization for - PersistentDataContainers - - -diff --git a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java -index 18fc4f1c7151bfdeed32a52cf5050a76ebc391d6..decf3b1949d4653a9fb01684b93ff91048137076 100644 ---- a/src/main/java/org/bukkit/persistence/PersistentDataContainer.java -+++ b/src/main/java/org/bukkit/persistence/PersistentDataContainer.java -@@ -184,4 +184,39 @@ public interface PersistentDataContainer { - */ - @NotNull - PersistentDataAdapterContext getAdapterContext(); -+ -+ // Paper start - byte array serialization -+ /** -+ * Serialize this {@link PersistentDataContainer} instance to a -+ * byte array. -+ * -+ * @return a binary representation of this container -+ * @throws java.io.IOException if we fail to write this container to a byte array -+ */ -+ byte @NotNull [] serializeToBytes() throws java.io.IOException; -+ -+ /** -+ * Read values from a serialised byte array into this -+ * {@link PersistentDataContainer} instance. -+ * -+ * @param bytes the byte array to read from -+ * @param clear if true, this {@link PersistentDataContainer} instance -+ * will be cleared before reading -+ * @throws java.io.IOException if the byte array has an invalid format -+ */ -+ void readFromBytes(byte @NotNull [] bytes, boolean clear) throws java.io.IOException; -+ -+ /** -+ * Read values from a serialised byte array into this -+ * {@link PersistentDataContainer} instance. -+ * This method has the same effect as -+ * PersistentDataContainer#readFromBytes(bytes, true) -+ * -+ * @param bytes the byte array to read from -+ * @throws java.io.IOException if the byte array has an invalid format -+ */ -+ default void readFromBytes(final byte @NotNull [] bytes) throws java.io.IOException { -+ this.readFromBytes(bytes, true); -+ } -+ // Paper end - byte array serialization - } diff --git a/patches/api/0370-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/0370-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch deleted file mode 100644 index 291761dadb..0000000000 --- a/patches/api/0370-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MelnCat -Date: Mon, 19 Sep 2022 14:04:13 -0700 -Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile - - -diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java -index eabd8b926ec1c934cd7e77b7cc6adfae16771021..96ebd30d339060758e726e9e1e7428d1d0813c17 100644 ---- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java -+++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java -@@ -31,4 +31,23 @@ public interface ProjectileSource { - */ - @NotNull - public T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity); -+ -+ // Paper start - add consumer to launchProjectile -+ /** -+ * Launches a {@link Projectile} from the ProjectileSource with an -+ * initial velocity, with the supplied function run before the -+ * entity is added to the world. -+ *
    -+ * Note that when the function is run, the entity will not be actually in -+ * the world. Any operation involving such as teleporting the entity is undefined -+ * until after this function returns. -+ * -+ * @param a projectile subclass -+ * @param projectile class of the projectile to launch -+ * @param velocity the velocity with which to launch -+ * @param function the function to be run before the entity is spawned -+ * @return the launched projectile -+ */ -+ @NotNull T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity, java.util.function.@Nullable Consumer function); -+ // Paper end - add consumer to launchProjectile - } diff --git a/patches/api/0370-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch b/patches/api/0370-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch new file mode 100644 index 0000000000..9b5ef25cf4 --- /dev/null +++ b/patches/api/0370-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Thu, 22 Sep 2022 07:04:30 +0100 +Subject: [PATCH] Expose codepoint limit in YamlConfigOptions, and increase + default + + +diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java +index a090ef390dddd546ebf323aee4545cbe9950e098..488e4931006d12700782c76766876e3863308775 100644 +--- a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java ++++ b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java +@@ -97,6 +97,7 @@ public class YamlConfiguration extends FileConfiguration { + public void loadFromString(@NotNull String contents) throws InvalidConfigurationException { + Preconditions.checkArgument(contents != null, "Contents cannot be null"); + yamlLoaderOptions.setProcessComments(options().parseComments()); ++ yamlLoaderOptions.setCodePointLimit(options().codePointLimit()); // Paper + + MappingNode node; + try (Reader reader = new UnicodeReader(new ByteArrayInputStream(contents.getBytes(StandardCharsets.UTF_8)))) { +diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java b/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java +index 3f7f6caf5fcf38b65c282cd83b93e45a272b138f..5d0ec7436f4487c686473248f332689224156fd5 100644 +--- a/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java ++++ b/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java +@@ -12,6 +12,7 @@ import org.jetbrains.annotations.Nullable; + public class YamlConfigurationOptions extends FileConfigurationOptions { + private int indent = 2; + private int width = 80; ++ private int codePointLimit = Integer.MAX_VALUE; // Paper - use upstream's default from YamlConfiguration + + protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration) { + super(configuration); +@@ -122,4 +123,29 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { + this.width = value; + return this; + } ++ ++ // Paper start ++ /** ++ * Gets the maximum code point limit, that being, the maximum length of the document ++ * in which the loader will read ++ * ++ * @return The current value ++ */ ++ public int codePointLimit() { ++ return codePointLimit; ++ } ++ ++ /** ++ * Sets the maximum code point limit, that being, the maximum length of the document ++ * in which the loader will read ++ * ++ * @param codePointLimit new codepoint limit ++ * @return This object, for chaining ++ */ ++ @NotNull ++ public YamlConfigurationOptions codePointLimit(int codePointLimit) { ++ this.codePointLimit = codePointLimit; ++ return this; ++ } ++ // Paper end + } diff --git a/patches/api/0371-Add-getDrops-to-BlockState.patch b/patches/api/0371-Add-getDrops-to-BlockState.patch new file mode 100644 index 0000000000..f9e8152229 --- /dev/null +++ b/patches/api/0371-Add-getDrops-to-BlockState.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MelnCat +Date: Fri, 12 Aug 2022 23:24:53 -0700 +Subject: [PATCH] Add getDrops to BlockState + +Originally added isPreferredTool to BlockData but +upstream added that. + +diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java +index e573e70d9e74e444783a7363e6cdac126124d86d..80e5d39afe8a6cf882b29c0da78450b958812137 100644 +--- a/src/main/java/org/bukkit/block/BlockState.java ++++ b/src/main/java/org/bukkit/block/BlockState.java +@@ -253,5 +253,41 @@ public interface BlockState extends Metadatable { + * @return true if collidable + */ + boolean isCollidable(); ++ ++ /** ++ * Returns an immutable list of items which would drop by destroying this block state. ++ * ++ * @return an immutable list of dropped items for the block state ++ * @throws IllegalStateException if this block state is not placed ++ */ ++ @NotNull ++ default java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops() { ++ return this.getDrops(null); ++ } ++ ++ /** ++ * Returns an immutable list of items which would drop by destroying this block state ++ * with a specific tool ++ * ++ * @param tool The tool or item in hand used for digging ++ * @return an immutable list of dropped items for the block state ++ * @throws IllegalStateException if this block state is not placed ++ */ ++ @NotNull ++ default java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@Nullable org.bukkit.inventory.ItemStack tool) { ++ return this.getDrops(tool, null); ++ } ++ ++ /** ++ * Returns an immutable list of items which would drop by the entity destroying this ++ * block state with a specific tool ++ * ++ * @param tool The tool or item in hand used for digging ++ * @param entity the entity destroying the block ++ * @return an immutable list of dropped items for the block state ++ * @throws IllegalStateException if this block state is not placed ++ */ ++ @NotNull ++ java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@Nullable org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity); + // Paper end + } diff --git a/patches/api/0371-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch b/patches/api/0371-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch deleted file mode 100644 index 9b5ef25cf4..0000000000 --- a/patches/api/0371-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Thu, 22 Sep 2022 07:04:30 +0100 -Subject: [PATCH] Expose codepoint limit in YamlConfigOptions, and increase - default - - -diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java -index a090ef390dddd546ebf323aee4545cbe9950e098..488e4931006d12700782c76766876e3863308775 100644 ---- a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java -+++ b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java -@@ -97,6 +97,7 @@ public class YamlConfiguration extends FileConfiguration { - public void loadFromString(@NotNull String contents) throws InvalidConfigurationException { - Preconditions.checkArgument(contents != null, "Contents cannot be null"); - yamlLoaderOptions.setProcessComments(options().parseComments()); -+ yamlLoaderOptions.setCodePointLimit(options().codePointLimit()); // Paper - - MappingNode node; - try (Reader reader = new UnicodeReader(new ByteArrayInputStream(contents.getBytes(StandardCharsets.UTF_8)))) { -diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java b/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java -index 3f7f6caf5fcf38b65c282cd83b93e45a272b138f..5d0ec7436f4487c686473248f332689224156fd5 100644 ---- a/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java -+++ b/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java -@@ -12,6 +12,7 @@ import org.jetbrains.annotations.Nullable; - public class YamlConfigurationOptions extends FileConfigurationOptions { - private int indent = 2; - private int width = 80; -+ private int codePointLimit = Integer.MAX_VALUE; // Paper - use upstream's default from YamlConfiguration - - protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration) { - super(configuration); -@@ -122,4 +123,29 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { - this.width = value; - return this; - } -+ -+ // Paper start -+ /** -+ * Gets the maximum code point limit, that being, the maximum length of the document -+ * in which the loader will read -+ * -+ * @return The current value -+ */ -+ public int codePointLimit() { -+ return codePointLimit; -+ } -+ -+ /** -+ * Sets the maximum code point limit, that being, the maximum length of the document -+ * in which the loader will read -+ * -+ * @param codePointLimit new codepoint limit -+ * @return This object, for chaining -+ */ -+ @NotNull -+ public YamlConfigurationOptions codePointLimit(int codePointLimit) { -+ this.codePointLimit = codePointLimit; -+ return this; -+ } -+ // Paper end - } diff --git a/patches/api/0372-Add-PlayerInventorySlotChangeEvent.patch b/patches/api/0372-Add-PlayerInventorySlotChangeEvent.patch new file mode 100644 index 0000000000..d76df6d87d --- /dev/null +++ b/patches/api/0372-Add-PlayerInventorySlotChangeEvent.patch @@ -0,0 +1,113 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jakub Zacek +Date: Sun, 24 Apr 2022 22:56:31 +0200 +Subject: [PATCH] Add PlayerInventorySlotChangeEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0be9708dbf84fa51a754474834406f9fa7457dbe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java +@@ -0,0 +1,101 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.bukkit.inventory.Inventory; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when a slot contents change in a player's inventory. ++ */ ++public class PlayerInventorySlotChangeEvent extends PlayerEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final int rawSlot; ++ private final int slot; ++ private final ItemStack oldItemStack; ++ private final ItemStack newItemStack; ++ private boolean triggerAdvancements = true; ++ ++ public PlayerInventorySlotChangeEvent(@NotNull Player player, int rawSlot, @NotNull ItemStack oldItemStack, @NotNull ItemStack newItemStack) { ++ super(player); ++ this.rawSlot = rawSlot; ++ this.slot = player.getOpenInventory().convertSlot(rawSlot); ++ this.oldItemStack = oldItemStack; ++ this.newItemStack = newItemStack; ++ } ++ ++ /** ++ * The raw slot number that was changed. ++ * ++ * @return The raw slot number. ++ */ ++ public int getRawSlot() { ++ return this.rawSlot; ++ } ++ ++ /** ++ * The slot number that was changed, ready for passing to ++ * {@link Inventory#getItem(int)}. Note that there may be two slots with ++ * the same slot number, since a view links two different inventories. ++ *

    ++ * If no inventory is opened, internal crafting view is used for conversion. ++ * ++ * @return The slot number. ++ */ ++ public int getSlot() { ++ return this.slot; ++ } ++ ++ /** ++ * Clone of ItemStack that was in the slot before the change. ++ * ++ * @return The old ItemStack in the slot. ++ */ ++ @NotNull ++ public ItemStack getOldItemStack() { ++ return this.oldItemStack; ++ } ++ ++ /** ++ * Clone of ItemStack that is in the slot after the change. ++ * ++ * @return The new ItemStack in the slot. ++ */ ++ @NotNull ++ public ItemStack getNewItemStack() { ++ return this.newItemStack; ++ } ++ ++ /** ++ * Gets whether the slot change advancements will be triggered. ++ * ++ * @return Whether the slot change advancements will be triggered. ++ */ ++ public boolean shouldTriggerAdvancements() { ++ return this.triggerAdvancements; ++ } ++ ++ /** ++ * Sets whether the slot change advancements will be triggered. ++ * ++ * @param triggerAdvancements Whether the slot change advancements will be triggered. ++ */ ++ public void setShouldTriggerAdvancements(boolean triggerAdvancements) { ++ this.triggerAdvancements = triggerAdvancements; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0372-Add-getDrops-to-BlockState.patch b/patches/api/0372-Add-getDrops-to-BlockState.patch deleted file mode 100644 index f9e8152229..0000000000 --- a/patches/api/0372-Add-getDrops-to-BlockState.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MelnCat -Date: Fri, 12 Aug 2022 23:24:53 -0700 -Subject: [PATCH] Add getDrops to BlockState - -Originally added isPreferredTool to BlockData but -upstream added that. - -diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java -index e573e70d9e74e444783a7363e6cdac126124d86d..80e5d39afe8a6cf882b29c0da78450b958812137 100644 ---- a/src/main/java/org/bukkit/block/BlockState.java -+++ b/src/main/java/org/bukkit/block/BlockState.java -@@ -253,5 +253,41 @@ public interface BlockState extends Metadatable { - * @return true if collidable - */ - boolean isCollidable(); -+ -+ /** -+ * Returns an immutable list of items which would drop by destroying this block state. -+ * -+ * @return an immutable list of dropped items for the block state -+ * @throws IllegalStateException if this block state is not placed -+ */ -+ @NotNull -+ default java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops() { -+ return this.getDrops(null); -+ } -+ -+ /** -+ * Returns an immutable list of items which would drop by destroying this block state -+ * with a specific tool -+ * -+ * @param tool The tool or item in hand used for digging -+ * @return an immutable list of dropped items for the block state -+ * @throws IllegalStateException if this block state is not placed -+ */ -+ @NotNull -+ default java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@Nullable org.bukkit.inventory.ItemStack tool) { -+ return this.getDrops(tool, null); -+ } -+ -+ /** -+ * Returns an immutable list of items which would drop by the entity destroying this -+ * block state with a specific tool -+ * -+ * @param tool The tool or item in hand used for digging -+ * @param entity the entity destroying the block -+ * @return an immutable list of dropped items for the block state -+ * @throws IllegalStateException if this block state is not placed -+ */ -+ @NotNull -+ java.util.@org.jetbrains.annotations.Unmodifiable Collection getDrops(@Nullable org.bukkit.inventory.ItemStack tool, @Nullable org.bukkit.entity.Entity entity); - // Paper end - } diff --git a/patches/api/0373-Add-PlayerInventorySlotChangeEvent.patch b/patches/api/0373-Add-PlayerInventorySlotChangeEvent.patch deleted file mode 100644 index d76df6d87d..0000000000 --- a/patches/api/0373-Add-PlayerInventorySlotChangeEvent.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jakub Zacek -Date: Sun, 24 Apr 2022 22:56:31 +0200 -Subject: [PATCH] Add PlayerInventorySlotChangeEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0be9708dbf84fa51a754474834406f9fa7457dbe ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java -@@ -0,0 +1,101 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.bukkit.inventory.Inventory; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when a slot contents change in a player's inventory. -+ */ -+public class PlayerInventorySlotChangeEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final int rawSlot; -+ private final int slot; -+ private final ItemStack oldItemStack; -+ private final ItemStack newItemStack; -+ private boolean triggerAdvancements = true; -+ -+ public PlayerInventorySlotChangeEvent(@NotNull Player player, int rawSlot, @NotNull ItemStack oldItemStack, @NotNull ItemStack newItemStack) { -+ super(player); -+ this.rawSlot = rawSlot; -+ this.slot = player.getOpenInventory().convertSlot(rawSlot); -+ this.oldItemStack = oldItemStack; -+ this.newItemStack = newItemStack; -+ } -+ -+ /** -+ * The raw slot number that was changed. -+ * -+ * @return The raw slot number. -+ */ -+ public int getRawSlot() { -+ return this.rawSlot; -+ } -+ -+ /** -+ * The slot number that was changed, ready for passing to -+ * {@link Inventory#getItem(int)}. Note that there may be two slots with -+ * the same slot number, since a view links two different inventories. -+ *

    -+ * If no inventory is opened, internal crafting view is used for conversion. -+ * -+ * @return The slot number. -+ */ -+ public int getSlot() { -+ return this.slot; -+ } -+ -+ /** -+ * Clone of ItemStack that was in the slot before the change. -+ * -+ * @return The old ItemStack in the slot. -+ */ -+ @NotNull -+ public ItemStack getOldItemStack() { -+ return this.oldItemStack; -+ } -+ -+ /** -+ * Clone of ItemStack that is in the slot after the change. -+ * -+ * @return The new ItemStack in the slot. -+ */ -+ @NotNull -+ public ItemStack getNewItemStack() { -+ return this.newItemStack; -+ } -+ -+ /** -+ * Gets whether the slot change advancements will be triggered. -+ * -+ * @return Whether the slot change advancements will be triggered. -+ */ -+ public boolean shouldTriggerAdvancements() { -+ return this.triggerAdvancements; -+ } -+ -+ /** -+ * Sets whether the slot change advancements will be triggered. -+ * -+ * @param triggerAdvancements Whether the slot change advancements will be triggered. -+ */ -+ public void setShouldTriggerAdvancements(boolean triggerAdvancements) { -+ this.triggerAdvancements = triggerAdvancements; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0373-Elder-Guardian-appearance-API.patch b/patches/api/0373-Elder-Guardian-appearance-API.patch new file mode 100644 index 0000000000..3490b6d5db --- /dev/null +++ b/patches/api/0373-Elder-Guardian-appearance-API.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Tue, 11 Oct 2022 20:38:47 +0300 +Subject: [PATCH] Elder Guardian appearance API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index ac9227472443ecb819cc7480a217cd78a98a9b35..ad61c664af66a15e214c5db14a5c9e172f5309ae 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3532,6 +3532,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); + // Paper end - Teleport API + ++ // Paper start ++ /** ++ * Displays elder guardian effect with a sound ++ * ++ * @see #showElderGuardian(boolean) ++ */ ++ default void showElderGuardian() { ++ showElderGuardian(false); ++ } ++ ++ /** ++ * Displays elder guardian effect and optionally plays a sound ++ * ++ * @param silent whether sound should be silenced ++ */ ++ void showElderGuardian(boolean silent); ++ // Paper end ++ + @NotNull + @Override + Spigot spigot(); diff --git a/patches/api/0374-Allow-changing-bed-s-occupied-property.patch b/patches/api/0374-Allow-changing-bed-s-occupied-property.patch new file mode 100644 index 0000000000..8dfafd6d33 --- /dev/null +++ b/patches/api/0374-Allow-changing-bed-s-occupied-property.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Wed, 12 Oct 2022 00:36:55 +0300 +Subject: [PATCH] Allow changing bed's 'occupied' property + + +diff --git a/src/main/java/org/bukkit/block/data/type/Bed.java b/src/main/java/org/bukkit/block/data/type/Bed.java +index ed519bfebe5b921f60867a3900edfce9859058b6..6e7a456dc5e9bfc28a19029a3381e53fa6453d30 100644 +--- a/src/main/java/org/bukkit/block/data/type/Bed.java ++++ b/src/main/java/org/bukkit/block/data/type/Bed.java +@@ -35,6 +35,15 @@ public interface Bed extends Directional { + */ + boolean isOccupied(); + ++ // Paper start ++ /** ++ * Sets the value of the 'occupied' property. ++ * ++ * @param occupied the new 'occupied' value ++ */ ++ void setOccupied(boolean occupied); ++ // Paper end ++ + /** + * Horizontal half of a bed. + */ diff --git a/patches/api/0374-Elder-Guardian-appearance-API.patch b/patches/api/0374-Elder-Guardian-appearance-API.patch deleted file mode 100644 index 3490b6d5db..0000000000 --- a/patches/api/0374-Elder-Guardian-appearance-API.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Tue, 11 Oct 2022 20:38:47 +0300 -Subject: [PATCH] Elder Guardian appearance API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index ac9227472443ecb819cc7480a217cd78a98a9b35..ad61c664af66a15e214c5db14a5c9e172f5309ae 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3532,6 +3532,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); - // Paper end - Teleport API - -+ // Paper start -+ /** -+ * Displays elder guardian effect with a sound -+ * -+ * @see #showElderGuardian(boolean) -+ */ -+ default void showElderGuardian() { -+ showElderGuardian(false); -+ } -+ -+ /** -+ * Displays elder guardian effect and optionally plays a sound -+ * -+ * @param silent whether sound should be silenced -+ */ -+ void showElderGuardian(boolean silent); -+ // Paper end -+ - @NotNull - @Override - Spigot spigot(); diff --git a/patches/api/0375-Add-EquipmentSlot-convenience-methods.patch b/patches/api/0375-Add-EquipmentSlot-convenience-methods.patch new file mode 100644 index 0000000000..f7e2301f31 --- /dev/null +++ b/patches/api/0375-Add-EquipmentSlot-convenience-methods.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Sun, 16 Oct 2022 15:28:49 +0300 +Subject: [PATCH] Add EquipmentSlot convenience methods + + +diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java +index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..c1c69ba4c361740f0ad422a7840a7f0f055c186a 100644 +--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java ++++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java +@@ -33,4 +33,42 @@ public enum EquipmentSlot { + public EquipmentSlotGroup getGroup() { + return group.get(); + } ++ // Paper start ++ /** ++ * Checks whether this equipment slot is a hand: ++ * either {@link #HAND} or {@link #OFF_HAND} ++ * ++ * @return whether this is a hand slot ++ */ ++ public boolean isHand() { ++ return this == HAND || this == OFF_HAND; ++ } ++ ++ /** ++ * Gets the opposite hand ++ * ++ * @return the opposite hand ++ * @throws IllegalArgumentException if this equipment slot is not a hand ++ * @see #isHand() ++ */ ++ public @NotNull EquipmentSlot getOppositeHand() { ++ return switch (this) { ++ case HAND -> OFF_HAND; ++ case OFF_HAND -> HAND; ++ default -> throw new IllegalArgumentException("Unable to determine an opposite hand for equipment slot: " + name()); ++ }; ++ } ++ ++ /** ++ * Checks whether this equipment slot ++ * is one of the armor slots: ++ * {@link #HEAD}, {@link #CHEST}, ++ * {@link #LEGS}, {@link #FEET}, or {@link #BODY} ++ * ++ * @return whether this is an armor slot ++ */ ++ public boolean isArmor() { ++ return this == HEAD || this == CHEST || this == LEGS || this == FEET || this == BODY; ++ } ++ // Paper end + } diff --git a/patches/api/0375-Allow-changing-bed-s-occupied-property.patch b/patches/api/0375-Allow-changing-bed-s-occupied-property.patch deleted file mode 100644 index 8dfafd6d33..0000000000 --- a/patches/api/0375-Allow-changing-bed-s-occupied-property.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Wed, 12 Oct 2022 00:36:55 +0300 -Subject: [PATCH] Allow changing bed's 'occupied' property - - -diff --git a/src/main/java/org/bukkit/block/data/type/Bed.java b/src/main/java/org/bukkit/block/data/type/Bed.java -index ed519bfebe5b921f60867a3900edfce9859058b6..6e7a456dc5e9bfc28a19029a3381e53fa6453d30 100644 ---- a/src/main/java/org/bukkit/block/data/type/Bed.java -+++ b/src/main/java/org/bukkit/block/data/type/Bed.java -@@ -35,6 +35,15 @@ public interface Bed extends Directional { - */ - boolean isOccupied(); - -+ // Paper start -+ /** -+ * Sets the value of the 'occupied' property. -+ * -+ * @param occupied the new 'occupied' value -+ */ -+ void setOccupied(boolean occupied); -+ // Paper end -+ - /** - * Horizontal half of a bed. - */ diff --git a/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch b/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch deleted file mode 100644 index 14a97a21b4..0000000000 --- a/patches/api/0376-Add-EquipmentSlot-convenience-methods.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Sun, 16 Oct 2022 15:28:49 +0300 -Subject: [PATCH] Add EquipmentSlot convenience methods - - -diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java -index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..a10d56b797e58b56bd4cef6de40691f7eac9b5b1 100644 ---- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java -+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java -@@ -33,4 +33,42 @@ public enum EquipmentSlot { - public EquipmentSlotGroup getGroup() { - return group.get(); - } -+ // Paper start -+ /** -+ * Checks whether this equipment slot is a hand: -+ * either {@link #HAND} or {@link #OFF_HAND} -+ * -+ * @return whether this is a hand slot -+ */ -+ public boolean isHand() { -+ return this == HAND || this == OFF_HAND; -+ } -+ -+ /** -+ * Gets the opposite hand -+ * -+ * @return the opposite hand -+ * @throws IllegalArgumentException if this equipment slot is not a hand -+ * @see #isHand() -+ */ -+ public @NotNull EquipmentSlot getOppositeHand() { -+ return switch (this) { -+ case HAND -> OFF_HAND; -+ case OFF_HAND -> HAND; -+ default -> throw new IllegalArgumentException("Unable to determine an opposite hand for equipment slot: " + name()); -+ }; -+ } -+ -+ /** -+ * Checks whether this equipment slot -+ * is one of the armor slots: -+ * {@link #HEAD}, {@link #CHEST}, -+ * {@link #LEGS}, {@link #FEET}, or {@link #BODY} -+ * -+ * @return whether this is an armor slot -+ */ -+ public boolean isArmor() { -+ return this == HEAD || this == CHEST || this == LEGS || this == FEET || this == BODY; -+ } -+ // Paper end - } diff --git a/patches/api/0376-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/0376-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch new file mode 100644 index 0000000000..fc814196e7 --- /dev/null +++ b/patches/api/0376-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SoSeDiK +Date: Tue, 11 Oct 2022 22:35:56 +0300 +Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index f05883886928169600b6309dd12de3bdb633cca1..51d3bc142bcd3b349326ae2553660abcf19a2638 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1331,4 +1331,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + @Deprecated + void setHurtDirection(float hurtDirection); + // Paper end - hurt direction API ++ ++ // Paper start - swing hand API ++ /** ++ * Makes this entity swing their hand. ++ * ++ *

    This method does nothing if this entity does not ++ * have an animation for swinging their hand. ++ * ++ * @param hand hand to be swung, either {@link org.bukkit.inventory.EquipmentSlot#HAND} or {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND} ++ * @throws IllegalArgumentException if invalid hand is passed ++ */ ++ default void swingHand(@NotNull org.bukkit.inventory.EquipmentSlot hand) { ++ com.google.common.base.Preconditions.checkArgument(hand != null && hand.isHand(), String.format("Expected a valid hand, got \"%s\" instead!", hand)); ++ if (hand == org.bukkit.inventory.EquipmentSlot.HAND) { ++ this.swingMainHand(); ++ } else { ++ this.swingOffHand(); ++ } ++ } ++ // Paper end - swing hand API + } diff --git a/patches/api/0377-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/0377-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch deleted file mode 100644 index fc814196e7..0000000000 --- a/patches/api/0377-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK -Date: Tue, 11 Oct 2022 22:35:56 +0300 -Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f05883886928169600b6309dd12de3bdb633cca1..51d3bc142bcd3b349326ae2553660abcf19a2638 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1331,4 +1331,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @Deprecated - void setHurtDirection(float hurtDirection); - // Paper end - hurt direction API -+ -+ // Paper start - swing hand API -+ /** -+ * Makes this entity swing their hand. -+ * -+ *

    This method does nothing if this entity does not -+ * have an animation for swinging their hand. -+ * -+ * @param hand hand to be swung, either {@link org.bukkit.inventory.EquipmentSlot#HAND} or {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND} -+ * @throws IllegalArgumentException if invalid hand is passed -+ */ -+ default void swingHand(@NotNull org.bukkit.inventory.EquipmentSlot hand) { -+ com.google.common.base.Preconditions.checkArgument(hand != null && hand.isHand(), String.format("Expected a valid hand, got \"%s\" instead!", hand)); -+ if (hand == org.bukkit.inventory.EquipmentSlot.HAND) { -+ this.swingMainHand(); -+ } else { -+ this.swingOffHand(); -+ } -+ } -+ // Paper end - swing hand API - } diff --git a/patches/api/0377-Add-entity-knockback-API.patch b/patches/api/0377-Add-entity-knockback-API.patch new file mode 100644 index 0000000000..b8c91440f6 --- /dev/null +++ b/patches/api/0377-Add-entity-knockback-API.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MelnCat +Date: Sun, 16 Oct 2022 12:10:00 -0700 +Subject: [PATCH] Add entity knockback API + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 51d3bc142bcd3b349326ae2553660abcf19a2638..6bfc8a2148f504370df938447f4f6b757f1a516b 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1351,4 +1351,18 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + } + } + // Paper end - swing hand API ++ ++ // Paper start - knockback API ++ /** ++ * Knocks back this entity from a specific direction with a specified strength. Mechanics such ++ * as knockback resistance will be factored in. ++ * ++ * The direction specified in this method will be the direction of the source of the knockback, ++ * so the entity will be pushed in the opposite direction. ++ * @param strength The strength of the knockback. Must be greater than 0. ++ * @param directionX The relative x position of the knockback source direction ++ * @param directionZ The relative z position of the knockback source direction ++ */ ++ void knockback(double strength, double directionX, double directionZ); ++ // Paper end - knockback API + } diff --git a/patches/api/0378-Add-entity-knockback-API.patch b/patches/api/0378-Add-entity-knockback-API.patch deleted file mode 100644 index b8c91440f6..0000000000 --- a/patches/api/0378-Add-entity-knockback-API.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MelnCat -Date: Sun, 16 Oct 2022 12:10:00 -0700 -Subject: [PATCH] Add entity knockback API - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 51d3bc142bcd3b349326ae2553660abcf19a2638..6bfc8a2148f504370df938447f4f6b757f1a516b 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1351,4 +1351,18 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - } - } - // Paper end - swing hand API -+ -+ // Paper start - knockback API -+ /** -+ * Knocks back this entity from a specific direction with a specified strength. Mechanics such -+ * as knockback resistance will be factored in. -+ * -+ * The direction specified in this method will be the direction of the source of the knockback, -+ * so the entity will be pushed in the opposite direction. -+ * @param strength The strength of the knockback. Must be greater than 0. -+ * @param directionX The relative x position of the knockback source direction -+ * @param directionZ The relative z position of the knockback source direction -+ */ -+ void knockback(double strength, double directionX, double directionZ); -+ // Paper end - knockback API - } diff --git a/patches/api/0378-Added-EntityToggleSitEvent.patch b/patches/api/0378-Added-EntityToggleSitEvent.patch new file mode 100644 index 0000000000..d5a8c46dc8 --- /dev/null +++ b/patches/api/0378-Added-EntityToggleSitEvent.patch @@ -0,0 +1,67 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: KyGuy2002 +Date: Fri, 11 Mar 2022 15:33:10 +0000 +Subject: [PATCH] Added EntityToggleSitEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..06222a8c7a19909582a00fd2e1553cc0be9d88e3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java +@@ -0,0 +1,55 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Is called when an entity sits down or stands up. ++ */ ++public class EntityToggleSitEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final boolean isSitting; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityToggleSitEvent(@NotNull Entity entity, boolean isSitting) { ++ super(entity); ++ this.isSitting = isSitting; ++ } ++ ++ /** ++ * Gets the new sitting state that the entity will change to. ++ * ++ * @return If it's going to sit or not. ++ */ ++ public boolean getSittingState() { ++ return this.isSitting; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0379-Add-Moving-Piston-API.patch b/patches/api/0379-Add-Moving-Piston-API.patch new file mode 100644 index 0000000000..8f889f1e3d --- /dev/null +++ b/patches/api/0379-Add-Moving-Piston-API.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sat, 4 Dec 2021 13:29:45 -0500 +Subject: [PATCH] Add Moving Piston API + + +diff --git a/src/main/java/io/papermc/paper/block/MovingPiston.java b/src/main/java/io/papermc/paper/block/MovingPiston.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ee7c85abf66dc11920bb29f9ce3b407121a665ee +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/MovingPiston.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.block; ++ ++import org.bukkit.block.BlockFace; ++import org.bukkit.block.TileState; ++import org.bukkit.block.data.BlockData; ++import org.jetbrains.annotations.NotNull; ++ ++public interface MovingPiston extends TileState { ++ ++ /** ++ * Gets the block that is being pushed ++ * ++ * @return the pushed block ++ */ ++ @NotNull ++ BlockData getMovingBlock(); ++ ++ /** ++ * The direction that the current moving piston ++ * is pushing/pulling a block in. ++ * ++ * @return the direction ++ */ ++ @NotNull ++ BlockFace getDirection(); ++ ++ /** ++ * Gets if the piston is extending or not. ++ * Returns false if the piston is retracting. ++ * ++ * @return is extending or not ++ */ ++ boolean isExtending(); ++ ++ /** ++ * Returns if this moving piston represents the main piston head ++ * from the original piston. ++ * ++ * @return is the piston head or not ++ */ ++ boolean isPistonHead(); ++ ++} diff --git a/patches/api/0379-Added-EntityToggleSitEvent.patch b/patches/api/0379-Added-EntityToggleSitEvent.patch deleted file mode 100644 index d5a8c46dc8..0000000000 --- a/patches/api/0379-Added-EntityToggleSitEvent.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: KyGuy2002 -Date: Fri, 11 Mar 2022 15:33:10 +0000 -Subject: [PATCH] Added EntityToggleSitEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..06222a8c7a19909582a00fd2e1553cc0be9d88e3 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityToggleSitEvent.java -@@ -0,0 +1,55 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Is called when an entity sits down or stands up. -+ */ -+public class EntityToggleSitEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final boolean isSitting; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityToggleSitEvent(@NotNull Entity entity, boolean isSitting) { -+ super(entity); -+ this.isSitting = isSitting; -+ } -+ -+ /** -+ * Gets the new sitting state that the entity will change to. -+ * -+ * @return If it's going to sit or not. -+ */ -+ public boolean getSittingState() { -+ return this.isSitting; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0380-Add-Moving-Piston-API.patch b/patches/api/0380-Add-Moving-Piston-API.patch deleted file mode 100644 index 8f889f1e3d..0000000000 --- a/patches/api/0380-Add-Moving-Piston-API.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sat, 4 Dec 2021 13:29:45 -0500 -Subject: [PATCH] Add Moving Piston API - - -diff --git a/src/main/java/io/papermc/paper/block/MovingPiston.java b/src/main/java/io/papermc/paper/block/MovingPiston.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ee7c85abf66dc11920bb29f9ce3b407121a665ee ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/MovingPiston.java -@@ -0,0 +1,43 @@ -+package io.papermc.paper.block; -+ -+import org.bukkit.block.BlockFace; -+import org.bukkit.block.TileState; -+import org.bukkit.block.data.BlockData; -+import org.jetbrains.annotations.NotNull; -+ -+public interface MovingPiston extends TileState { -+ -+ /** -+ * Gets the block that is being pushed -+ * -+ * @return the pushed block -+ */ -+ @NotNull -+ BlockData getMovingBlock(); -+ -+ /** -+ * The direction that the current moving piston -+ * is pushing/pulling a block in. -+ * -+ * @return the direction -+ */ -+ @NotNull -+ BlockFace getDirection(); -+ -+ /** -+ * Gets if the piston is extending or not. -+ * Returns false if the piston is retracting. -+ * -+ * @return is extending or not -+ */ -+ boolean isExtending(); -+ -+ /** -+ * Returns if this moving piston represents the main piston head -+ * from the original piston. -+ * -+ * @return is the piston head or not -+ */ -+ boolean isPistonHead(); -+ -+} diff --git a/patches/api/0380-Add-PrePlayerAttackEntityEvent.patch b/patches/api/0380-Add-PrePlayerAttackEntityEvent.patch new file mode 100644 index 0000000000..ac0ebedde7 --- /dev/null +++ b/patches/api/0380-Add-PrePlayerAttackEntityEvent.patch @@ -0,0 +1,105 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 18 Sep 2022 13:10:28 -0400 +Subject: [PATCH] Add PrePlayerAttackEntityEvent + + +diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9cad10e11 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java +@@ -0,0 +1,93 @@ ++package io.papermc.paper.event.player; ++ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when the player tries to attack an entity. ++ *

    ++ * This occurs before any of the damage logic, so cancelling this event ++ * will prevent any sort of sounds from being played when attacking. ++ *

    ++ * This event will fire as cancelled for certain entities, with {@link PrePlayerAttackEntityEvent#willAttack()} being false ++ * to indicate that this entity will not actually be attacked. ++ *

    ++ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover ++ */ ++public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull ++ private final Entity attacked; ++ private final boolean willAttack; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PrePlayerAttackEntityEvent(@NotNull Player player, @NotNull Entity attacked, boolean willAttack) { ++ super(player); ++ this.attacked = attacked; ++ this.willAttack = willAttack; ++ this.cancelled = !willAttack; ++ } ++ ++ /** ++ * Gets the entity that was attacked in this event. ++ * ++ * @return entity that was attacked ++ */ ++ @NotNull ++ public Entity getAttacked() { ++ return this.attacked; ++ } ++ ++ /** ++ * Gets if this entity will be attacked normally. ++ * Entities like falling sand will return {@code false} because ++ * their entity type does not allow them to be attacked. ++ *

    ++ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover ++ * ++ * @return if the entity will actually be attacked ++ */ ++ public boolean willAttack() { ++ return this.willAttack; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ /** ++ * Sets if this attack should be cancelled, note if {@link PrePlayerAttackEntityEvent#willAttack()} returns false ++ * this event will always be cancelled. ++ * ++ * @param cancel {@code true} if you wish to cancel this event ++ */ ++ @Override ++ public void setCancelled(boolean cancel) { ++ if (!this.willAttack) { ++ return; ++ } ++ ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0381-Add-Player-Warden-Warning-API.patch b/patches/api/0381-Add-Player-Warden-Warning-API.patch new file mode 100644 index 0000000000..42426a3ae4 --- /dev/null +++ b/patches/api/0381-Add-Player-Warden-Warning-API.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dawon +Date: Sat, 15 Oct 2022 00:46:32 +0200 +Subject: [PATCH] Add Player Warden Warning API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index ad61c664af66a15e214c5db14a5c9e172f5309ae..537ebbad48191741f666aa2a30c8584562dfcb83 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3548,6 +3548,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * @param silent whether sound should be silenced + */ + void showElderGuardian(boolean silent); ++ ++ /** ++ * Returns the player's cooldown in ticks until the next Warden warning can occur. ++ * ++ * @return ticks until next Warden warning can occur. 0 means there is no cooldown left. ++ */ ++ int getWardenWarningCooldown(); ++ ++ /** ++ * Sets the player's cooldown in ticks until next Warden warning can occur. ++ * ++ * @param cooldown ticks until next Warden warning can occur. 0 means there is no cooldown left. Values less than 0 are set to 0. ++ */ ++ void setWardenWarningCooldown(int cooldown); ++ ++ /** ++ * Returns time since last Warden warning in ticks. ++ * ++ * @return ticks since last Warden warning ++ */ ++ int getWardenTimeSinceLastWarning(); ++ ++ /** ++ * Sets time since last Warden warning in ticks. ++ * ++ * @param time ticks since last Warden warning ++ */ ++ void setWardenTimeSinceLastWarning(int time); ++ ++ /** ++ * Returns the player's current Warden warning level. ++ * ++ * @return current Warden warning level ++ */ ++ int getWardenWarningLevel(); ++ ++ /** ++ * Sets the player's Warden warning level. ++ *

    ++ * Note: This will not actually spawn the Warden. ++ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden. ++ * ++ * @param warningLevel player's Warden warning level. The warning level is internally limited to valid values. ++ */ ++ void setWardenWarningLevel(int warningLevel); ++ ++ /** ++ * Increases the player's Warden warning level if possible and not on cooldown. ++ *

    ++ * Note: This will not actually spawn the Warden. ++ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden. ++ */ ++ void increaseWardenWarningLevel(); + // Paper end + + @NotNull diff --git a/patches/api/0381-Add-PrePlayerAttackEntityEvent.patch b/patches/api/0381-Add-PrePlayerAttackEntityEvent.patch deleted file mode 100644 index ac0ebedde7..0000000000 --- a/patches/api/0381-Add-PrePlayerAttackEntityEvent.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 18 Sep 2022 13:10:28 -0400 -Subject: [PATCH] Add PrePlayerAttackEntityEvent - - -diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..148f46f4572a778f090b461808b53cf9cad10e11 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java -@@ -0,0 +1,93 @@ -+package io.papermc.paper.event.player; -+ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when the player tries to attack an entity. -+ *

    -+ * This occurs before any of the damage logic, so cancelling this event -+ * will prevent any sort of sounds from being played when attacking. -+ *

    -+ * This event will fire as cancelled for certain entities, with {@link PrePlayerAttackEntityEvent#willAttack()} being false -+ * to indicate that this entity will not actually be attacked. -+ *

    -+ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover -+ */ -+public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull -+ private final Entity attacked; -+ private final boolean willAttack; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PrePlayerAttackEntityEvent(@NotNull Player player, @NotNull Entity attacked, boolean willAttack) { -+ super(player); -+ this.attacked = attacked; -+ this.willAttack = willAttack; -+ this.cancelled = !willAttack; -+ } -+ -+ /** -+ * Gets the entity that was attacked in this event. -+ * -+ * @return entity that was attacked -+ */ -+ @NotNull -+ public Entity getAttacked() { -+ return this.attacked; -+ } -+ -+ /** -+ * Gets if this entity will be attacked normally. -+ * Entities like falling sand will return {@code false} because -+ * their entity type does not allow them to be attacked. -+ *

    -+ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover -+ * -+ * @return if the entity will actually be attacked -+ */ -+ public boolean willAttack() { -+ return this.willAttack; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ /** -+ * Sets if this attack should be cancelled, note if {@link PrePlayerAttackEntityEvent#willAttack()} returns false -+ * this event will always be cancelled. -+ * -+ * @param cancel {@code true} if you wish to cancel this event -+ */ -+ @Override -+ public void setCancelled(boolean cancel) { -+ if (!this.willAttack) { -+ return; -+ } -+ -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0382-Add-Player-Warden-Warning-API.patch b/patches/api/0382-Add-Player-Warden-Warning-API.patch deleted file mode 100644 index 42426a3ae4..0000000000 --- a/patches/api/0382-Add-Player-Warden-Warning-API.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dawon -Date: Sat, 15 Oct 2022 00:46:32 +0200 -Subject: [PATCH] Add Player Warden Warning API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index ad61c664af66a15e214c5db14a5c9e172f5309ae..537ebbad48191741f666aa2a30c8584562dfcb83 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3548,6 +3548,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @param silent whether sound should be silenced - */ - void showElderGuardian(boolean silent); -+ -+ /** -+ * Returns the player's cooldown in ticks until the next Warden warning can occur. -+ * -+ * @return ticks until next Warden warning can occur. 0 means there is no cooldown left. -+ */ -+ int getWardenWarningCooldown(); -+ -+ /** -+ * Sets the player's cooldown in ticks until next Warden warning can occur. -+ * -+ * @param cooldown ticks until next Warden warning can occur. 0 means there is no cooldown left. Values less than 0 are set to 0. -+ */ -+ void setWardenWarningCooldown(int cooldown); -+ -+ /** -+ * Returns time since last Warden warning in ticks. -+ * -+ * @return ticks since last Warden warning -+ */ -+ int getWardenTimeSinceLastWarning(); -+ -+ /** -+ * Sets time since last Warden warning in ticks. -+ * -+ * @param time ticks since last Warden warning -+ */ -+ void setWardenTimeSinceLastWarning(int time); -+ -+ /** -+ * Returns the player's current Warden warning level. -+ * -+ * @return current Warden warning level -+ */ -+ int getWardenWarningLevel(); -+ -+ /** -+ * Sets the player's Warden warning level. -+ *

    -+ * Note: This will not actually spawn the Warden. -+ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden. -+ * -+ * @param warningLevel player's Warden warning level. The warning level is internally limited to valid values. -+ */ -+ void setWardenWarningLevel(int warningLevel); -+ -+ /** -+ * Increases the player's Warden warning level if possible and not on cooldown. -+ *

    -+ * Note: This will not actually spawn the Warden. -+ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden. -+ */ -+ void increaseWardenWarningLevel(); - // Paper end - - @NotNull diff --git a/patches/api/0382-More-vanilla-friendly-methods-to-update-trades.patch b/patches/api/0382-More-vanilla-friendly-methods-to-update-trades.patch new file mode 100644 index 0000000000..f13fdb5601 --- /dev/null +++ b/patches/api/0382-More-vanilla-friendly-methods-to-update-trades.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Sun, 16 Oct 2022 15:58:38 +0200 +Subject: [PATCH] More vanilla friendly methods to update trades + + +diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java +index 8c8176121cafed0ed09239b6a7b392dc846438e2..3bc24457d143449e6a338d79becf7c39b9f81054 100644 +--- a/src/main/java/org/bukkit/entity/Villager.java ++++ b/src/main/java/org/bukkit/entity/Villager.java +@@ -60,8 +60,11 @@ public interface Villager extends AbstractVillager { + * A villager with a level of 1 and no experience is liable to lose its + * profession. + * ++ * This doesn't update the trades of this villager. ++ * + * @param level the new level + * @throws IllegalArgumentException if level not between [1, 5] ++ * @see #increaseLevel(int) + */ + public void setVillagerLevel(int level); + +@@ -81,6 +84,34 @@ public interface Villager extends AbstractVillager { + public void setVillagerExperience(int experience); + + // Paper start ++ /** ++ * Increases the level of this villager. ++ * The villager will also unlock new recipes unlike the raw ++ * method {@link #setVillagerLevel(int)}. ++ *

    ++ * A villager with a level of 1 and no experience is liable to lose its ++ * profession. ++ *

    ++ * A master villager has a level of 5 in its profession and ++ * will unlock 10 trades (2 per level). ++ * ++ * @param amount The amount of level ++ * @return Whether trades are unlocked ++ * @throws IllegalArgumentException if current level plus the amount ++ * isn't between [1, 5] or the amount isn't positive ++ * @see #setVillagerLevel(int) ++ */ ++ boolean increaseLevel(int amount); ++ ++ /** ++ * Gives to this villager some potential new trades ++ * based to its profession and level. ++ * @param amount The amount of trades to give ++ * @return Whether trades are added ++ * @throws IllegalArgumentException if the amount isn't positive ++ */ ++ boolean addTrades(int amount); ++ + /** + * Gets the amount of times a villager has restocked their trades today + * @return The amount of trade restocks. diff --git a/patches/api/0383-Add-paper-dumplisteners-command.patch b/patches/api/0383-Add-paper-dumplisteners-command.patch new file mode 100644 index 0000000000..a5d858851f --- /dev/null +++ b/patches/api/0383-Add-paper-dumplisteners-command.patch @@ -0,0 +1,177 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Warrior <50800980+Warriorrrr@users.noreply.github.com> +Date: Sat, 19 Nov 2022 19:46:44 +0100 +Subject: [PATCH] Add /paper dumplisteners command + + +diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java +index be275c25664e0c76123371c6c8fac601f87fa492..8f29c1561ba5916cb5634392edd8bd2a5a294a51 100644 +--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java ++++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java +@@ -81,4 +81,10 @@ public class TimedEventExecutor implements EventExecutor { + executor.execute(listener, event); + } + } ++ ++ @Override ++ @NotNull ++ public String toString() { ++ return "TimedEventExecutor['" + this.executor.toString() + "']"; ++ } + } +diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java +index 5b28e9b1daba7834af67dbc193dd656bedd9a994..fbebf649e893cf872be9b27091146a7c2f451aca 100644 +--- a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java ++++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java +@@ -14,10 +14,12 @@ import org.jetbrains.annotations.NotNull; + public class MethodHandleEventExecutor implements EventExecutor { + private final Class eventClass; + private final MethodHandle handle; ++ private final Method method; + + public MethodHandleEventExecutor(@NotNull Class eventClass, @NotNull MethodHandle handle) { + this.eventClass = eventClass; + this.handle = handle; ++ this.method = null; + } + + public MethodHandleEventExecutor(@NotNull Class eventClass, @NotNull Method m) { +@@ -28,6 +30,7 @@ public class MethodHandleEventExecutor implements EventExecutor { + } catch (IllegalAccessException e) { + throw new AssertionError("Unable to set accessible", e); + } ++ this.method = m; + } + + @Override +@@ -39,4 +42,10 @@ public class MethodHandleEventExecutor implements EventExecutor { + SneakyThrow.sneaky(t); + } + } ++ ++ @Override ++ @NotNull ++ public String toString() { ++ return "MethodHandleEventExecutor['" + this.method + "']"; ++ } + } +diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java +index 827f2b27f70a7ec0bc11d039305c3e58c02a4ef4..52da2d040e3b335f9e47bc5dc26e17d9c06d9569 100644 +--- a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java ++++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java +@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull; + public class StaticMethodHandleEventExecutor implements EventExecutor { + private final Class eventClass; + private final MethodHandle handle; ++ private final Method method; + + public StaticMethodHandleEventExecutor(@NotNull Class eventClass, @NotNull Method m) { + Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m); +@@ -28,6 +29,7 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { + } catch (IllegalAccessException e) { + throw new AssertionError("Unable to set accessible", e); + } ++ this.method = m; + } + + @Override +@@ -39,4 +41,10 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { + SneakyThrow.sneaky(throwable); + } + } ++ ++ @Override ++ @NotNull ++ public String toString() { ++ return "StaticMethodHandleEventExecutor['" + this.method + "']"; ++ } + } +diff --git a/src/main/java/org/bukkit/event/HandlerList.java b/src/main/java/org/bukkit/event/HandlerList.java +index ed78cca71f83b296d082d0af147ca8d622c7606a..2292bd460ce2be113beb4ba6b4eb19350060f01c 100644 +--- a/src/main/java/org/bukkit/event/HandlerList.java ++++ b/src/main/java/org/bukkit/event/HandlerList.java +@@ -33,6 +33,13 @@ public class HandlerList { + */ + private static ArrayList allLists = new ArrayList(); + ++ // Paper start ++ /** ++ * Event types which have instantiated a {@link HandlerList}. ++ */ ++ private static final java.util.Set EVENT_TYPES = java.util.concurrent.ConcurrentHashMap.newKeySet(); ++ // Paper end ++ + /** + * Bake all handler lists. Best used just after all normal event + * registration is complete, ie just after all plugins are loaded if +@@ -94,6 +101,12 @@ public class HandlerList { + * The HandlerList is then added to meta-list for use in bakeAll() + */ + public HandlerList() { ++ // Paper start ++ java.lang.StackWalker.getInstance(java.util.EnumSet.of(java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE), 4) ++ .walk(s -> s.filter(f -> Event.class.isAssignableFrom(f.getDeclaringClass())).findFirst()) ++ .map(f -> f.getDeclaringClass().getName()) ++ .ifPresent(EVENT_TYPES::add); ++ // Paper end + handlerslots = new EnumMap>(EventPriority.class); + for (EventPriority o : EventPriority.values()) { + handlerslots.put(o, new ArrayList()); +diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java +index 5fa52419f21d8e8b3d8f9aafd248b05774a28348..60e086be70529e0804280b24a2a3e7ae72d8d363 100644 +--- a/src/main/java/org/bukkit/plugin/EventExecutor.java ++++ b/src/main/java/org/bukkit/plugin/EventExecutor.java +@@ -70,9 +70,18 @@ public interface EventExecutor { + try { + EventExecutor asmExecutor = executorClass.newInstance(); + // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception) +- return (listener, event) -> { +- if (!eventClass.isInstance(event)) return; +- asmExecutor.execute(listener, event); ++ return new EventExecutor() { ++ @Override ++ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { ++ if (!eventClass.isInstance(event)) return; ++ asmExecutor.execute(listener, event); ++ } ++ ++ @Override ++ @NotNull ++ public String toString() { ++ return "ASMEventExecutor['" + m + "']"; ++ } + }; + } catch (InstantiationException | IllegalAccessException e) { + throw new AssertionError("Unable to initialize generated event executor", e); +diff --git a/src/main/java/org/bukkit/plugin/RegisteredListener.java b/src/main/java/org/bukkit/plugin/RegisteredListener.java +index 419aec56b0e3fa8bcec2ea7f340caa3456b57d00..3b3d9642a8d63798dc28f2f8df77f0466451cbff 100644 +--- a/src/main/java/org/bukkit/plugin/RegisteredListener.java ++++ b/src/main/java/org/bukkit/plugin/RegisteredListener.java +@@ -78,4 +78,27 @@ public class RegisteredListener { + public boolean isIgnoringCancelled() { + return ignoreCancelled; + } ++ ++ // Paper start ++ /** ++ * Get the executor for this registration. ++ * ++ * @return executor ++ */ ++ @NotNull ++ public EventExecutor getExecutor() { ++ return this.executor; ++ } ++ ++ @Override ++ public String toString() { ++ return "RegisteredListener{" ++ + "plugin=\"" + this.plugin.getName() ++ + "\", listener=\"" + this.listener ++ + "\", executor=\"" + this.executor ++ + "\", priority=\"" + this.priority.name() + " (" + this.priority.getSlot() + ")" ++ + "\", ignoringCancelled=" + this.ignoreCancelled ++ + "}"; ++ } ++ // Paper end + } diff --git a/patches/api/0383-More-vanilla-friendly-methods-to-update-trades.patch b/patches/api/0383-More-vanilla-friendly-methods-to-update-trades.patch deleted file mode 100644 index f13fdb5601..0000000000 --- a/patches/api/0383-More-vanilla-friendly-methods-to-update-trades.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Sun, 16 Oct 2022 15:58:38 +0200 -Subject: [PATCH] More vanilla friendly methods to update trades - - -diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java -index 8c8176121cafed0ed09239b6a7b392dc846438e2..3bc24457d143449e6a338d79becf7c39b9f81054 100644 ---- a/src/main/java/org/bukkit/entity/Villager.java -+++ b/src/main/java/org/bukkit/entity/Villager.java -@@ -60,8 +60,11 @@ public interface Villager extends AbstractVillager { - * A villager with a level of 1 and no experience is liable to lose its - * profession. - * -+ * This doesn't update the trades of this villager. -+ * - * @param level the new level - * @throws IllegalArgumentException if level not between [1, 5] -+ * @see #increaseLevel(int) - */ - public void setVillagerLevel(int level); - -@@ -81,6 +84,34 @@ public interface Villager extends AbstractVillager { - public void setVillagerExperience(int experience); - - // Paper start -+ /** -+ * Increases the level of this villager. -+ * The villager will also unlock new recipes unlike the raw -+ * method {@link #setVillagerLevel(int)}. -+ *

    -+ * A villager with a level of 1 and no experience is liable to lose its -+ * profession. -+ *

    -+ * A master villager has a level of 5 in its profession and -+ * will unlock 10 trades (2 per level). -+ * -+ * @param amount The amount of level -+ * @return Whether trades are unlocked -+ * @throws IllegalArgumentException if current level plus the amount -+ * isn't between [1, 5] or the amount isn't positive -+ * @see #setVillagerLevel(int) -+ */ -+ boolean increaseLevel(int amount); -+ -+ /** -+ * Gives to this villager some potential new trades -+ * based to its profession and level. -+ * @param amount The amount of trades to give -+ * @return Whether trades are added -+ * @throws IllegalArgumentException if the amount isn't positive -+ */ -+ boolean addTrades(int amount); -+ - /** - * Gets the amount of times a villager has restocked their trades today - * @return The amount of trade restocks. diff --git a/patches/api/0384-Add-paper-dumplisteners-command.patch b/patches/api/0384-Add-paper-dumplisteners-command.patch deleted file mode 100644 index a5d858851f..0000000000 --- a/patches/api/0384-Add-paper-dumplisteners-command.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Warrior <50800980+Warriorrrr@users.noreply.github.com> -Date: Sat, 19 Nov 2022 19:46:44 +0100 -Subject: [PATCH] Add /paper dumplisteners command - - -diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java -index be275c25664e0c76123371c6c8fac601f87fa492..8f29c1561ba5916cb5634392edd8bd2a5a294a51 100644 ---- a/src/main/java/co/aikar/timings/TimedEventExecutor.java -+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java -@@ -81,4 +81,10 @@ public class TimedEventExecutor implements EventExecutor { - executor.execute(listener, event); - } - } -+ -+ @Override -+ @NotNull -+ public String toString() { -+ return "TimedEventExecutor['" + this.executor.toString() + "']"; -+ } - } -diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java -index 5b28e9b1daba7834af67dbc193dd656bedd9a994..fbebf649e893cf872be9b27091146a7c2f451aca 100644 ---- a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java -+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java -@@ -14,10 +14,12 @@ import org.jetbrains.annotations.NotNull; - public class MethodHandleEventExecutor implements EventExecutor { - private final Class eventClass; - private final MethodHandle handle; -+ private final Method method; - - public MethodHandleEventExecutor(@NotNull Class eventClass, @NotNull MethodHandle handle) { - this.eventClass = eventClass; - this.handle = handle; -+ this.method = null; - } - - public MethodHandleEventExecutor(@NotNull Class eventClass, @NotNull Method m) { -@@ -28,6 +30,7 @@ public class MethodHandleEventExecutor implements EventExecutor { - } catch (IllegalAccessException e) { - throw new AssertionError("Unable to set accessible", e); - } -+ this.method = m; - } - - @Override -@@ -39,4 +42,10 @@ public class MethodHandleEventExecutor implements EventExecutor { - SneakyThrow.sneaky(t); - } - } -+ -+ @Override -+ @NotNull -+ public String toString() { -+ return "MethodHandleEventExecutor['" + this.method + "']"; -+ } - } -diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java -index 827f2b27f70a7ec0bc11d039305c3e58c02a4ef4..52da2d040e3b335f9e47bc5dc26e17d9c06d9569 100644 ---- a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java -+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java -@@ -17,6 +17,7 @@ import org.jetbrains.annotations.NotNull; - public class StaticMethodHandleEventExecutor implements EventExecutor { - private final Class eventClass; - private final MethodHandle handle; -+ private final Method method; - - public StaticMethodHandleEventExecutor(@NotNull Class eventClass, @NotNull Method m) { - Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m); -@@ -28,6 +29,7 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { - } catch (IllegalAccessException e) { - throw new AssertionError("Unable to set accessible", e); - } -+ this.method = m; - } - - @Override -@@ -39,4 +41,10 @@ public class StaticMethodHandleEventExecutor implements EventExecutor { - SneakyThrow.sneaky(throwable); - } - } -+ -+ @Override -+ @NotNull -+ public String toString() { -+ return "StaticMethodHandleEventExecutor['" + this.method + "']"; -+ } - } -diff --git a/src/main/java/org/bukkit/event/HandlerList.java b/src/main/java/org/bukkit/event/HandlerList.java -index ed78cca71f83b296d082d0af147ca8d622c7606a..2292bd460ce2be113beb4ba6b4eb19350060f01c 100644 ---- a/src/main/java/org/bukkit/event/HandlerList.java -+++ b/src/main/java/org/bukkit/event/HandlerList.java -@@ -33,6 +33,13 @@ public class HandlerList { - */ - private static ArrayList allLists = new ArrayList(); - -+ // Paper start -+ /** -+ * Event types which have instantiated a {@link HandlerList}. -+ */ -+ private static final java.util.Set EVENT_TYPES = java.util.concurrent.ConcurrentHashMap.newKeySet(); -+ // Paper end -+ - /** - * Bake all handler lists. Best used just after all normal event - * registration is complete, ie just after all plugins are loaded if -@@ -94,6 +101,12 @@ public class HandlerList { - * The HandlerList is then added to meta-list for use in bakeAll() - */ - public HandlerList() { -+ // Paper start -+ java.lang.StackWalker.getInstance(java.util.EnumSet.of(java.lang.StackWalker.Option.RETAIN_CLASS_REFERENCE), 4) -+ .walk(s -> s.filter(f -> Event.class.isAssignableFrom(f.getDeclaringClass())).findFirst()) -+ .map(f -> f.getDeclaringClass().getName()) -+ .ifPresent(EVENT_TYPES::add); -+ // Paper end - handlerslots = new EnumMap>(EventPriority.class); - for (EventPriority o : EventPriority.values()) { - handlerslots.put(o, new ArrayList()); -diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java -index 5fa52419f21d8e8b3d8f9aafd248b05774a28348..60e086be70529e0804280b24a2a3e7ae72d8d363 100644 ---- a/src/main/java/org/bukkit/plugin/EventExecutor.java -+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java -@@ -70,9 +70,18 @@ public interface EventExecutor { - try { - EventExecutor asmExecutor = executorClass.newInstance(); - // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception) -- return (listener, event) -> { -- if (!eventClass.isInstance(event)) return; -- asmExecutor.execute(listener, event); -+ return new EventExecutor() { -+ @Override -+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { -+ if (!eventClass.isInstance(event)) return; -+ asmExecutor.execute(listener, event); -+ } -+ -+ @Override -+ @NotNull -+ public String toString() { -+ return "ASMEventExecutor['" + m + "']"; -+ } - }; - } catch (InstantiationException | IllegalAccessException e) { - throw new AssertionError("Unable to initialize generated event executor", e); -diff --git a/src/main/java/org/bukkit/plugin/RegisteredListener.java b/src/main/java/org/bukkit/plugin/RegisteredListener.java -index 419aec56b0e3fa8bcec2ea7f340caa3456b57d00..3b3d9642a8d63798dc28f2f8df77f0466451cbff 100644 ---- a/src/main/java/org/bukkit/plugin/RegisteredListener.java -+++ b/src/main/java/org/bukkit/plugin/RegisteredListener.java -@@ -78,4 +78,27 @@ public class RegisteredListener { - public boolean isIgnoringCancelled() { - return ignoreCancelled; - } -+ -+ // Paper start -+ /** -+ * Get the executor for this registration. -+ * -+ * @return executor -+ */ -+ @NotNull -+ public EventExecutor getExecutor() { -+ return this.executor; -+ } -+ -+ @Override -+ public String toString() { -+ return "RegisteredListener{" -+ + "plugin=\"" + this.plugin.getName() -+ + "\", listener=\"" + this.listener -+ + "\", executor=\"" + this.executor -+ + "\", priority=\"" + this.priority.name() + " (" + this.priority.getSlot() + ")" -+ + "\", ignoringCancelled=" + this.ignoreCancelled -+ + "}"; -+ } -+ // Paper end - } diff --git a/patches/api/0384-ItemStack-damage-API.patch b/patches/api/0384-ItemStack-damage-API.patch new file mode 100644 index 0000000000..ba61a1c399 --- /dev/null +++ b/patches/api/0384-ItemStack-damage-API.patch @@ -0,0 +1,91 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 8 May 2022 13:35:58 -0700 +Subject: [PATCH] ItemStack damage API + +Adds methods notify clients about item breaks and +to simulate damage done to an itemstack and all +the logic associated with damaging them + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 6bfc8a2148f504370df938447f4f6b757f1a516b..208bab1f5a3200f54141c38ee4272629cfc66da5 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1365,4 +1365,53 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + void knockback(double strength, double directionX, double directionZ); + // Paper end - knockback API ++ ++ // Paper start - ItemStack damage API ++ /** ++ * Notifies all clients tracking this entity that the item in ++ * the slot of this entity broke. ++ *

    ++ * NOTE: this does not mutate any entity state ++ * ++ * @param slot the slot ++ */ ++ void broadcastSlotBreak(org.bukkit.inventory.@NotNull EquipmentSlot slot); ++ ++ /** ++ * Notifies specified players that the item in the slot ++ * of this entity broke. ++ *

    ++ * NOTE: this does not mutate any entity state ++ * ++ * @param slot the slot ++ * @param players the players to notify ++ */ ++ void broadcastSlotBreak(org.bukkit.inventory.@NotNull EquipmentSlot slot, @NotNull Collection players); ++ ++ /** ++ * Damages the itemstack in this slot by the specified amount. ++ *

    ++ * This runs all logic associated with damaging an itemstack like ++ * gamemode and enchantment checks, events, stat changes, and advancement ++ * triggers. ++ * ++ * @param stack the itemstack to damage ++ * @param amount the amount of damage to do ++ * @return the damaged itemstack, or an empty stack if it broke. There are no ++ * guarantees the returned itemstack is the same instance ++ */ ++ @NotNull ItemStack damageItemStack(@NotNull ItemStack stack, int amount); ++ ++ /** ++ * Damages the itemstack in this slot by the specified amount. ++ *

    ++ * This runs all logic associated with damaging an itemstack like ++ * gamemode and enchantment checks, events, stat changes, advancement ++ * triggers, and notifying clients to play break animations. ++ * ++ * @param slot the slot of the stack to damage ++ * @param amount the amount of damage to do ++ */ ++ void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); ++ // Paper end - ItemStack damage API + } +diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java +index 7eb4cf0b2f162d650252d81e9d38393f69a69046..6195ac25e7a46542659a263c85f7adac745c2ce4 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -987,5 +987,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat + public boolean canRepair(@NotNull ItemStack toBeRepaired) { + return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); + } ++ ++ /** ++ * Damages this itemstack by the specified amount. This ++ * runs all logic associated with damaging an itemstack like ++ * events and stat changes. ++ * ++ * @param amount the amount of damage to do ++ * @param livingEntity the entity related to the damage ++ * @return the damaged itemstack or an empty one if it broke. May return the same instance of ItemStack ++ * @see org.bukkit.entity.LivingEntity#damageItemStack(EquipmentSlot, int) to damage itemstacks in equipment slots ++ */ ++ public @NotNull ItemStack damage(int amount, @NotNull org.bukkit.entity.LivingEntity livingEntity) { ++ return livingEntity.damageItemStack(this, amount); ++ } + // Paper end + } diff --git a/patches/api/0385-Add-Tick-TemporalUnit.patch b/patches/api/0385-Add-Tick-TemporalUnit.patch new file mode 100644 index 0000000000..562eb00082 --- /dev/null +++ b/patches/api/0385-Add-Tick-TemporalUnit.patch @@ -0,0 +1,156 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kieran Wallbanks +Date: Fri, 2 Apr 2021 17:28:58 +0100 +Subject: [PATCH] Add Tick TemporalUnit + + +diff --git a/src/main/java/io/papermc/paper/util/Tick.java b/src/main/java/io/papermc/paper/util/Tick.java +new file mode 100644 +index 0000000000000000000000000000000000000000..10430f02e1d1e654383154c04473f07469bc7fee +--- /dev/null ++++ b/src/main/java/io/papermc/paper/util/Tick.java +@@ -0,0 +1,95 @@ ++package io.papermc.paper.util; ++ ++import net.kyori.adventure.util.Ticks; ++import org.jetbrains.annotations.NotNull; ++ ++import java.time.Duration; ++import java.time.temporal.ChronoUnit; ++import java.time.temporal.Temporal; ++import java.time.temporal.TemporalUnit; ++import java.util.Objects; ++ ++/** ++ * A TemporalUnit that represents the target length of one server tick. This is defined ++ * as 50 milliseconds. Note that this class is not for measuring the length that a tick ++ * took, rather it is used for simple conversion between times and ticks. ++ * @see #tick() ++ */ ++public final class Tick implements TemporalUnit { ++ private static final Tick INSTANCE = new Tick(Ticks.SINGLE_TICK_DURATION_MS); ++ ++ private final long milliseconds; ++ ++ /** ++ * Gets the instance of the tick temporal unit. ++ * @return the tick instance ++ */ ++ public static @NotNull Tick tick() { ++ return INSTANCE; ++ } ++ ++ /** ++ * Creates a new tick. ++ * @param length the length of the tick in milliseconds ++ * @see #tick() ++ */ ++ private Tick(long length) { ++ this.milliseconds = length; ++ } ++ ++ /** ++ * Creates a duration from an amount of ticks. This is shorthand for ++ * {@link Duration#of(long, TemporalUnit)} called with the amount of ticks and ++ * {@link #tick()}. ++ * @param ticks the amount of ticks ++ * @return the duration ++ */ ++ public static @NotNull Duration of(long ticks) { ++ return Duration.of(ticks, INSTANCE); ++ } ++ ++ /** ++ * Gets the number of whole ticks that occur in the provided duration. Note that this ++ * method returns an {@code int} as this is the unit that Minecraft stores ticks in. ++ * @param duration the duration ++ * @return the number of whole ticks in this duration ++ * @throws ArithmeticException if the duration is zero or an overflow occurs ++ */ ++ public int fromDuration(@NotNull Duration duration) { ++ Objects.requireNonNull(duration, "duration cannot be null"); ++ return Math.toIntExact(Math.floorDiv(duration.toMillis(), this.milliseconds)); ++ } ++ ++ @Override ++ public @NotNull Duration getDuration() { ++ return Duration.ofMillis(this.milliseconds); ++ } ++ ++ // Note: This is a workaround in order to allow calculations with this duration. ++ // See: Duration#add ++ @Override ++ public boolean isDurationEstimated() { ++ return false; ++ } ++ ++ @Override ++ public boolean isDateBased() { ++ return false; ++ } ++ ++ @Override ++ public boolean isTimeBased() { ++ return true; ++ } ++ ++ @SuppressWarnings("unchecked") // following ChronoUnit#addTo ++ @Override ++ public @NotNull R addTo(@NotNull R temporal, long amount) { ++ return (R) temporal.plus(getDuration().multipliedBy(amount)); ++ } ++ ++ @Override ++ public long between(@NotNull Temporal start, @NotNull Temporal end) { ++ return start.until(end, ChronoUnit.MILLIS) / this.milliseconds; ++ } ++} +diff --git a/src/test/java/io/papermc/paper/util/TickTest.java b/src/test/java/io/papermc/paper/util/TickTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f147d909f2fc710c1d12bac3c7b66c2883139026 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/util/TickTest.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.util; ++ ++import java.time.Duration; ++import java.time.Instant; ++import java.time.temporal.ChronoUnit; ++import org.junit.jupiter.api.Test; ++ ++import static org.junit.jupiter.api.Assertions.assertEquals; ++ ++public class TickTest { ++ ++ @Test ++ public void testTickLength() { ++ assertEquals(50, Duration.of(1, Tick.tick()).toMillis()); ++ assertEquals(100, Duration.of(2, Tick.tick()).toMillis()); ++ } ++ ++ @Test ++ public void testTickFromDuration() { ++ assertEquals(0, Tick.tick().fromDuration(Duration.ofMillis(0))); ++ assertEquals(0, Tick.tick().fromDuration(Duration.ofMillis(10))); ++ assertEquals(1, Tick.tick().fromDuration(Duration.ofMillis(60))); ++ assertEquals(2, Tick.tick().fromDuration(Duration.ofMillis(100))); ++ } ++ ++ @Test ++ public void testAddTickToInstant() { ++ Instant now = Instant.now(); ++ assertEquals(now, now.plus(0, Tick.tick())); ++ assertEquals(now.plus(50, ChronoUnit.MILLIS), now.plus(1, Tick.tick())); ++ assertEquals(now.plus(100, ChronoUnit.MILLIS), now.plus(2, Tick.tick())); ++ assertEquals(now.plus(150, ChronoUnit.MILLIS), now.plus(3, Tick.tick())); ++ } ++ ++ @Test ++ public void testTicksBetweenInstants() { ++ Instant now = Instant.now(); ++ assertEquals(0, now.until(now.plus(20, ChronoUnit.MILLIS), Tick.tick())); ++ assertEquals(1, now.until(now.plus(50, ChronoUnit.MILLIS), Tick.tick())); ++ assertEquals(1, now.until(now.plus(60, ChronoUnit.MILLIS), Tick.tick())); ++ assertEquals(2, now.until(now.plus(100, ChronoUnit.MILLIS), Tick.tick())); ++ } ++} diff --git a/patches/api/0385-ItemStack-damage-API.patch b/patches/api/0385-ItemStack-damage-API.patch deleted file mode 100644 index ba61a1c399..0000000000 --- a/patches/api/0385-ItemStack-damage-API.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 8 May 2022 13:35:58 -0700 -Subject: [PATCH] ItemStack damage API - -Adds methods notify clients about item breaks and -to simulate damage done to an itemstack and all -the logic associated with damaging them - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 6bfc8a2148f504370df938447f4f6b757f1a516b..208bab1f5a3200f54141c38ee4272629cfc66da5 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1365,4 +1365,53 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - void knockback(double strength, double directionX, double directionZ); - // Paper end - knockback API -+ -+ // Paper start - ItemStack damage API -+ /** -+ * Notifies all clients tracking this entity that the item in -+ * the slot of this entity broke. -+ *

    -+ * NOTE: this does not mutate any entity state -+ * -+ * @param slot the slot -+ */ -+ void broadcastSlotBreak(org.bukkit.inventory.@NotNull EquipmentSlot slot); -+ -+ /** -+ * Notifies specified players that the item in the slot -+ * of this entity broke. -+ *

    -+ * NOTE: this does not mutate any entity state -+ * -+ * @param slot the slot -+ * @param players the players to notify -+ */ -+ void broadcastSlotBreak(org.bukkit.inventory.@NotNull EquipmentSlot slot, @NotNull Collection players); -+ -+ /** -+ * Damages the itemstack in this slot by the specified amount. -+ *

    -+ * This runs all logic associated with damaging an itemstack like -+ * gamemode and enchantment checks, events, stat changes, and advancement -+ * triggers. -+ * -+ * @param stack the itemstack to damage -+ * @param amount the amount of damage to do -+ * @return the damaged itemstack, or an empty stack if it broke. There are no -+ * guarantees the returned itemstack is the same instance -+ */ -+ @NotNull ItemStack damageItemStack(@NotNull ItemStack stack, int amount); -+ -+ /** -+ * Damages the itemstack in this slot by the specified amount. -+ *

    -+ * This runs all logic associated with damaging an itemstack like -+ * gamemode and enchantment checks, events, stat changes, advancement -+ * triggers, and notifying clients to play break animations. -+ * -+ * @param slot the slot of the stack to damage -+ * @param amount the amount of damage to do -+ */ -+ void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); -+ // Paper end - ItemStack damage API - } -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index 7eb4cf0b2f162d650252d81e9d38393f69a69046..6195ac25e7a46542659a263c85f7adac745c2ce4 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -987,5 +987,19 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - public boolean canRepair(@NotNull ItemStack toBeRepaired) { - return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this); - } -+ -+ /** -+ * Damages this itemstack by the specified amount. This -+ * runs all logic associated with damaging an itemstack like -+ * events and stat changes. -+ * -+ * @param amount the amount of damage to do -+ * @param livingEntity the entity related to the damage -+ * @return the damaged itemstack or an empty one if it broke. May return the same instance of ItemStack -+ * @see org.bukkit.entity.LivingEntity#damageItemStack(EquipmentSlot, int) to damage itemstacks in equipment slots -+ */ -+ public @NotNull ItemStack damage(int amount, @NotNull org.bukkit.entity.LivingEntity livingEntity) { -+ return livingEntity.damageItemStack(this, amount); -+ } - // Paper end - } diff --git a/patches/api/0386-Add-Tick-TemporalUnit.patch b/patches/api/0386-Add-Tick-TemporalUnit.patch deleted file mode 100644 index 562eb00082..0000000000 --- a/patches/api/0386-Add-Tick-TemporalUnit.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kieran Wallbanks -Date: Fri, 2 Apr 2021 17:28:58 +0100 -Subject: [PATCH] Add Tick TemporalUnit - - -diff --git a/src/main/java/io/papermc/paper/util/Tick.java b/src/main/java/io/papermc/paper/util/Tick.java -new file mode 100644 -index 0000000000000000000000000000000000000000..10430f02e1d1e654383154c04473f07469bc7fee ---- /dev/null -+++ b/src/main/java/io/papermc/paper/util/Tick.java -@@ -0,0 +1,95 @@ -+package io.papermc.paper.util; -+ -+import net.kyori.adventure.util.Ticks; -+import org.jetbrains.annotations.NotNull; -+ -+import java.time.Duration; -+import java.time.temporal.ChronoUnit; -+import java.time.temporal.Temporal; -+import java.time.temporal.TemporalUnit; -+import java.util.Objects; -+ -+/** -+ * A TemporalUnit that represents the target length of one server tick. This is defined -+ * as 50 milliseconds. Note that this class is not for measuring the length that a tick -+ * took, rather it is used for simple conversion between times and ticks. -+ * @see #tick() -+ */ -+public final class Tick implements TemporalUnit { -+ private static final Tick INSTANCE = new Tick(Ticks.SINGLE_TICK_DURATION_MS); -+ -+ private final long milliseconds; -+ -+ /** -+ * Gets the instance of the tick temporal unit. -+ * @return the tick instance -+ */ -+ public static @NotNull Tick tick() { -+ return INSTANCE; -+ } -+ -+ /** -+ * Creates a new tick. -+ * @param length the length of the tick in milliseconds -+ * @see #tick() -+ */ -+ private Tick(long length) { -+ this.milliseconds = length; -+ } -+ -+ /** -+ * Creates a duration from an amount of ticks. This is shorthand for -+ * {@link Duration#of(long, TemporalUnit)} called with the amount of ticks and -+ * {@link #tick()}. -+ * @param ticks the amount of ticks -+ * @return the duration -+ */ -+ public static @NotNull Duration of(long ticks) { -+ return Duration.of(ticks, INSTANCE); -+ } -+ -+ /** -+ * Gets the number of whole ticks that occur in the provided duration. Note that this -+ * method returns an {@code int} as this is the unit that Minecraft stores ticks in. -+ * @param duration the duration -+ * @return the number of whole ticks in this duration -+ * @throws ArithmeticException if the duration is zero or an overflow occurs -+ */ -+ public int fromDuration(@NotNull Duration duration) { -+ Objects.requireNonNull(duration, "duration cannot be null"); -+ return Math.toIntExact(Math.floorDiv(duration.toMillis(), this.milliseconds)); -+ } -+ -+ @Override -+ public @NotNull Duration getDuration() { -+ return Duration.ofMillis(this.milliseconds); -+ } -+ -+ // Note: This is a workaround in order to allow calculations with this duration. -+ // See: Duration#add -+ @Override -+ public boolean isDurationEstimated() { -+ return false; -+ } -+ -+ @Override -+ public boolean isDateBased() { -+ return false; -+ } -+ -+ @Override -+ public boolean isTimeBased() { -+ return true; -+ } -+ -+ @SuppressWarnings("unchecked") // following ChronoUnit#addTo -+ @Override -+ public @NotNull R addTo(@NotNull R temporal, long amount) { -+ return (R) temporal.plus(getDuration().multipliedBy(amount)); -+ } -+ -+ @Override -+ public long between(@NotNull Temporal start, @NotNull Temporal end) { -+ return start.until(end, ChronoUnit.MILLIS) / this.milliseconds; -+ } -+} -diff --git a/src/test/java/io/papermc/paper/util/TickTest.java b/src/test/java/io/papermc/paper/util/TickTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f147d909f2fc710c1d12bac3c7b66c2883139026 ---- /dev/null -+++ b/src/test/java/io/papermc/paper/util/TickTest.java -@@ -0,0 +1,43 @@ -+package io.papermc.paper.util; -+ -+import java.time.Duration; -+import java.time.Instant; -+import java.time.temporal.ChronoUnit; -+import org.junit.jupiter.api.Test; -+ -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ -+public class TickTest { -+ -+ @Test -+ public void testTickLength() { -+ assertEquals(50, Duration.of(1, Tick.tick()).toMillis()); -+ assertEquals(100, Duration.of(2, Tick.tick()).toMillis()); -+ } -+ -+ @Test -+ public void testTickFromDuration() { -+ assertEquals(0, Tick.tick().fromDuration(Duration.ofMillis(0))); -+ assertEquals(0, Tick.tick().fromDuration(Duration.ofMillis(10))); -+ assertEquals(1, Tick.tick().fromDuration(Duration.ofMillis(60))); -+ assertEquals(2, Tick.tick().fromDuration(Duration.ofMillis(100))); -+ } -+ -+ @Test -+ public void testAddTickToInstant() { -+ Instant now = Instant.now(); -+ assertEquals(now, now.plus(0, Tick.tick())); -+ assertEquals(now.plus(50, ChronoUnit.MILLIS), now.plus(1, Tick.tick())); -+ assertEquals(now.plus(100, ChronoUnit.MILLIS), now.plus(2, Tick.tick())); -+ assertEquals(now.plus(150, ChronoUnit.MILLIS), now.plus(3, Tick.tick())); -+ } -+ -+ @Test -+ public void testTicksBetweenInstants() { -+ Instant now = Instant.now(); -+ assertEquals(0, now.until(now.plus(20, ChronoUnit.MILLIS), Tick.tick())); -+ assertEquals(1, now.until(now.plus(50, ChronoUnit.MILLIS), Tick.tick())); -+ assertEquals(1, now.until(now.plus(60, ChronoUnit.MILLIS), Tick.tick())); -+ assertEquals(2, now.until(now.plus(100, ChronoUnit.MILLIS), Tick.tick())); -+ } -+} diff --git a/patches/api/0386-Friction-API.patch b/patches/api/0386-Friction-API.patch new file mode 100644 index 0000000000..4aab88652e --- /dev/null +++ b/patches/api/0386-Friction-API.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Noah van der Aa +Date: Wed, 15 Sep 2021 20:40:51 +0200 +Subject: [PATCH] Friction API + + +diff --git a/src/main/java/io/papermc/paper/entity/Frictional.java b/src/main/java/io/papermc/paper/entity/Frictional.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6eb88c664d873506372ad14075bfcbe42958126f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/Frictional.java +@@ -0,0 +1,35 @@ ++package io.papermc.paper.entity; ++ ++import net.kyori.adventure.util.TriState; ++import org.bukkit.entity.Entity; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents an {@link Entity} that can experience friction with the air and ground. ++ */ ++public interface Frictional { ++ ++ /** ++ * Gets the friction state of this entity. ++ * When set to {@link TriState#TRUE}, the entity will always experience friction. ++ * When set to {@link TriState#FALSE}, the entity will never experience friction. ++ * When set to {@link TriState#NOT_SET}, the entity will fall back to Minecraft's default behaviour. ++ * ++ * @return the entity's friction state ++ */ ++ @NotNull ++ TriState getFrictionState(); ++ ++ /** ++ * Sets the friction state of this entity. ++ * When set to {@link TriState#TRUE}, the entity will always experience friction. ++ * When set to {@link TriState#FALSE}, the entity will never experience friction. ++ * When set to {@link TriState#NOT_SET}, the entity will fall back to Minecraft's default behaviour. ++ *

    ++ * Please note that changing this value will do nothing for a player. ++ * ++ * @param state the new friction state to set for the entity ++ */ ++ void setFrictionState(@NotNull TriState state); ++ ++} +diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java +index ced419f8655bff72f0257b639d5f7d73afe3c2e2..bcc6ba95bd21c7972865838c636a03f50b6c1f1a 100644 +--- a/src/main/java/org/bukkit/entity/Item.java ++++ b/src/main/java/org/bukkit/entity/Item.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a dropped item. + */ +-public interface Item extends Entity { ++public interface Item extends Entity, io.papermc.paper.entity.Frictional { // Paper + + /** + * Gets the item stack associated with this item drop. +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 208bab1f5a3200f54141c38ee4272629cfc66da5..806bf6ca0dc87e1956084c61040a3d6139e8bc29 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a living entity, such as a monster or player + */ +-public interface LivingEntity extends Attributable, Damageable, ProjectileSource { ++public interface LivingEntity extends Attributable, Damageable, ProjectileSource, io.papermc.paper.entity.Frictional { // Paper + + /** + * Gets the height of the living entity's eyes above its Location. diff --git a/patches/api/0387-Friction-API.patch b/patches/api/0387-Friction-API.patch deleted file mode 100644 index 4aab88652e..0000000000 --- a/patches/api/0387-Friction-API.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa -Date: Wed, 15 Sep 2021 20:40:51 +0200 -Subject: [PATCH] Friction API - - -diff --git a/src/main/java/io/papermc/paper/entity/Frictional.java b/src/main/java/io/papermc/paper/entity/Frictional.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6eb88c664d873506372ad14075bfcbe42958126f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/Frictional.java -@@ -0,0 +1,35 @@ -+package io.papermc.paper.entity; -+ -+import net.kyori.adventure.util.TriState; -+import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents an {@link Entity} that can experience friction with the air and ground. -+ */ -+public interface Frictional { -+ -+ /** -+ * Gets the friction state of this entity. -+ * When set to {@link TriState#TRUE}, the entity will always experience friction. -+ * When set to {@link TriState#FALSE}, the entity will never experience friction. -+ * When set to {@link TriState#NOT_SET}, the entity will fall back to Minecraft's default behaviour. -+ * -+ * @return the entity's friction state -+ */ -+ @NotNull -+ TriState getFrictionState(); -+ -+ /** -+ * Sets the friction state of this entity. -+ * When set to {@link TriState#TRUE}, the entity will always experience friction. -+ * When set to {@link TriState#FALSE}, the entity will never experience friction. -+ * When set to {@link TriState#NOT_SET}, the entity will fall back to Minecraft's default behaviour. -+ *

    -+ * Please note that changing this value will do nothing for a player. -+ * -+ * @param state the new friction state to set for the entity -+ */ -+ void setFrictionState(@NotNull TriState state); -+ -+} -diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java -index ced419f8655bff72f0257b639d5f7d73afe3c2e2..bcc6ba95bd21c7972865838c636a03f50b6c1f1a 100644 ---- a/src/main/java/org/bukkit/entity/Item.java -+++ b/src/main/java/org/bukkit/entity/Item.java -@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a dropped item. - */ --public interface Item extends Entity { -+public interface Item extends Entity, io.papermc.paper.entity.Frictional { // Paper - - /** - * Gets the item stack associated with this item drop. -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 208bab1f5a3200f54141c38ee4272629cfc66da5..806bf6ca0dc87e1956084c61040a3d6139e8bc29 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a living entity, such as a monster or player - */ --public interface LivingEntity extends Attributable, Damageable, ProjectileSource { -+public interface LivingEntity extends Attributable, Damageable, ProjectileSource, io.papermc.paper.entity.Frictional { // Paper - - /** - * Gets the height of the living entity's eyes above its Location. diff --git a/patches/api/0387-Player-Entity-Tracking-Events.patch b/patches/api/0387-Player-Entity-Tracking-Events.patch new file mode 100644 index 0000000000..3dfa72c922 --- /dev/null +++ b/patches/api/0387-Player-Entity-Tracking-Events.patch @@ -0,0 +1,128 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Yannick Lamprecht +Date: Wed, 30 Mar 2022 18:16:37 +0200 +Subject: [PATCH] Player Entity Tracking Events + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTrackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTrackEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..356f8933a7715b4fc123e3a4879bb2cd085835c5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerTrackEntityEvent.java +@@ -0,0 +1,62 @@ ++package io.papermc.paper.event.player; ++ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Is called when a {@link Player} tracks an {@link Entity}. ++ *

    ++ * If cancelled entity is not shown to the player and interaction in both directions is not possible. ++ *

    ++ * Adding or removing entities from the world at the point in time this event is called is completely ++ * unsupported and should be avoided. ++ */ ++public class PlayerTrackEntityEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Entity entity; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerTrackEntityEvent(@NotNull Player player, @NotNull Entity entity) { ++ super(player); ++ this.entity = entity; ++ } ++ ++ /** ++ * Gets the entity that will be tracked ++ * ++ * @return the entity tracked ++ */ ++ @NotNull ++ public Entity getEntity() { ++ return this.entity; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerUntrackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerUntrackEntityEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c573eeaeb599ca717b09f9fd3f106a4800e9c386 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerUntrackEntityEvent.java +@@ -0,0 +1,48 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Is called when a {@link Player} untracks an {@link Entity}. ++ *

    ++ * Adding or removing entities from the world at the point in time this event is called is completely ++ * unsupported and should be avoided. ++ */ ++public class PlayerUntrackEntityEvent extends PlayerEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Entity entity; ++ ++ @ApiStatus.Internal ++ public PlayerUntrackEntityEvent(@NotNull Player player, @NotNull Entity entity) { ++ super(player); ++ this.entity = entity; ++ } ++ ++ /** ++ * Gets the entity that will be untracked ++ * ++ * @return the entity untracked ++ */ ++ @NotNull ++ public Entity getEntity() { ++ return this.entity; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0388-Add-missing-Fluid-type.patch b/patches/api/0388-Add-missing-Fluid-type.patch new file mode 100644 index 0000000000..c260bf8497 --- /dev/null +++ b/patches/api/0388-Add-missing-Fluid-type.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 4 Dec 2022 10:07:16 -0800 +Subject: [PATCH] Add missing Fluid type + + +diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java +index 4cc974689a229e73ddbf2c353ac0fe23da03a5b2..7202b44a65e8699cf64329e441e83d4dd1779c19 100644 +--- a/src/main/java/org/bukkit/Fluid.java ++++ b/src/main/java/org/bukkit/Fluid.java +@@ -8,6 +8,12 @@ import org.jetbrains.annotations.NotNull; + */ + public enum Fluid implements Keyed { + ++ // Paper start ++ /** ++ * No fluid. ++ */ ++ EMPTY, ++ // Paper end + /** + * Stationary water. + */ diff --git a/patches/api/0388-Player-Entity-Tracking-Events.patch b/patches/api/0388-Player-Entity-Tracking-Events.patch deleted file mode 100644 index 3dfa72c922..0000000000 --- a/patches/api/0388-Player-Entity-Tracking-Events.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yannick Lamprecht -Date: Wed, 30 Mar 2022 18:16:37 +0200 -Subject: [PATCH] Player Entity Tracking Events - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerTrackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerTrackEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..356f8933a7715b4fc123e3a4879bb2cd085835c5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerTrackEntityEvent.java -@@ -0,0 +1,62 @@ -+package io.papermc.paper.event.player; -+ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Is called when a {@link Player} tracks an {@link Entity}. -+ *

    -+ * If cancelled entity is not shown to the player and interaction in both directions is not possible. -+ *

    -+ * Adding or removing entities from the world at the point in time this event is called is completely -+ * unsupported and should be avoided. -+ */ -+public class PlayerTrackEntityEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity entity; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerTrackEntityEvent(@NotNull Player player, @NotNull Entity entity) { -+ super(player); -+ this.entity = entity; -+ } -+ -+ /** -+ * Gets the entity that will be tracked -+ * -+ * @return the entity tracked -+ */ -+ @NotNull -+ public Entity getEntity() { -+ return this.entity; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerUntrackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerUntrackEntityEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c573eeaeb599ca717b09f9fd3f106a4800e9c386 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerUntrackEntityEvent.java -@@ -0,0 +1,48 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.entity.Entity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.player.PlayerEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Is called when a {@link Player} untracks an {@link Entity}. -+ *

    -+ * Adding or removing entities from the world at the point in time this event is called is completely -+ * unsupported and should be avoided. -+ */ -+public class PlayerUntrackEntityEvent extends PlayerEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Entity entity; -+ -+ @ApiStatus.Internal -+ public PlayerUntrackEntityEvent(@NotNull Player player, @NotNull Entity entity) { -+ super(player); -+ this.entity = entity; -+ } -+ -+ /** -+ * Gets the entity that will be untracked -+ * -+ * @return the entity untracked -+ */ -+ @NotNull -+ public Entity getEntity() { -+ return this.entity; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0389-Add-missing-Fluid-type.patch b/patches/api/0389-Add-missing-Fluid-type.patch deleted file mode 100644 index c260bf8497..0000000000 --- a/patches/api/0389-Add-missing-Fluid-type.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 4 Dec 2022 10:07:16 -0800 -Subject: [PATCH] Add missing Fluid type - - -diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java -index 4cc974689a229e73ddbf2c353ac0fe23da03a5b2..7202b44a65e8699cf64329e441e83d4dd1779c19 100644 ---- a/src/main/java/org/bukkit/Fluid.java -+++ b/src/main/java/org/bukkit/Fluid.java -@@ -8,6 +8,12 @@ import org.jetbrains.annotations.NotNull; - */ - public enum Fluid implements Keyed { - -+ // Paper start -+ /** -+ * No fluid. -+ */ -+ EMPTY, -+ // Paper end - /** - * Stationary water. - */ diff --git a/patches/api/0389-fix-Instruments.patch b/patches/api/0389-fix-Instruments.patch new file mode 100644 index 0000000000..468dc80a34 --- /dev/null +++ b/patches/api/0389-fix-Instruments.patch @@ -0,0 +1,115 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 9 Dec 2022 01:34:03 -0800 +Subject: [PATCH] fix Instruments + +Add missing instrument enums +fix some wrong javadocs + +diff --git a/src/main/java/org/bukkit/Instrument.java b/src/main/java/org/bukkit/Instrument.java +index 032d7b812ddc0a85e316882c8f7de0c5a0a4fd30..8df26e0d7bea77bb257cddbc2ab9e969fa160681 100644 +--- a/src/main/java/org/bukkit/Instrument.java ++++ b/src/main/java/org/bukkit/Instrument.java +@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable; + public enum Instrument { + + /** +- * Piano is the standard instrument for a note block. ++ * Piano (Harp) is the standard instrument for a note block. + */ + PIANO(0x0, Sound.BLOCK_NOTE_BLOCK_HARP), + /** +@@ -21,7 +21,7 @@ public enum Instrument { + */ + SNARE_DRUM(0x2, Sound.BLOCK_NOTE_BLOCK_SNARE), + /** +- * Sticks are normally played when a note block is on top of a glass ++ * Sticks (Hat) are normally played when a note block is on top of a glass + * block. + */ + STICKS(0x3, Sound.BLOCK_NOTE_BLOCK_HAT), +@@ -78,39 +78,37 @@ public enum Instrument { + /** + * Zombie is normally played when a Zombie Head is on top of the note block. + */ +- ZOMBIE(Sound.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE), ++ ZOMBIE(0x10, Sound.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE), // Paper + /** + * Skeleton is normally played when a Skeleton Head is on top of the note block. + */ +- SKELETON(Sound.BLOCK_NOTE_BLOCK_IMITATE_SKELETON), ++ SKELETON(0x11, Sound.BLOCK_NOTE_BLOCK_IMITATE_SKELETON), // Paper + /** + * Creeper is normally played when a Creeper Head is on top of the note block. + */ +- CREEPER(Sound.BLOCK_NOTE_BLOCK_IMITATE_CREEPER), ++ CREEPER(0x12, Sound.BLOCK_NOTE_BLOCK_IMITATE_CREEPER), // Paper + /** + * Dragon is normally played when a Dragon Head is on top of the note block. + */ +- DRAGON(Sound.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON), ++ DRAGON(0x13, Sound.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON), // Paper + /** + * Wither Skeleton is normally played when a Wither Skeleton Head is on top of the note block. + */ +- WITHER_SKELETON(Sound.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON), ++ WITHER_SKELETON(0x14, Sound.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON), // Paper + /** + * Piglin is normally played when a Piglin Head is on top of the note block. + */ +- PIGLIN(Sound.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN), ++ PIGLIN(0x15, Sound.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN), // Paper + /** + * Custom Sound is normally played when a Player Head with the required data is on top of the note block. + */ +- CUSTOM_HEAD(null); ++ CUSTOM_HEAD(0x16, null); // Paper + + private final byte type; + private final Sound sound; + private static final Map BY_DATA = Maps.newHashMap(); + +- private Instrument(final Sound sound) { +- this(-1, sound); +- } ++ // Paper - remove ctor (the server still uses the byte magic value) + + private Instrument(final int type, final Sound sound) { + this.type = (byte) type; +@@ -130,9 +128,8 @@ public enum Instrument { + + /** + * @return The type ID of this instrument. +- * @deprecated Magic value + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getType() { + return this.type; + } +@@ -142,9 +139,8 @@ public enum Instrument { + * + * @param type The type ID + * @return The instrument +- * @deprecated Magic value + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Instrument getByType(final byte type) { + return BY_DATA.get(type); +diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java +index 8c1d88885de7d56c1b7c78d2e6e059b0648c982a..b177a47a5bda05bfe3598ec5e6771b92a73f0edf 100644 +--- a/src/test/java/org/bukkit/InstrumentTest.java ++++ b/src/test/java/org/bukkit/InstrumentTest.java +@@ -8,9 +8,7 @@ public class InstrumentTest { + @Test + public void getByType() { + for (Instrument instrument : Instrument.values()) { +- if (instrument.getType() < 0) { +- continue; +- } ++ // Paper - byte magic values are still used + + assertThat(Instrument.getByType(instrument.getType()), is(instrument)); + } diff --git a/patches/api/0390-Add-BlockLockCheckEvent.patch b/patches/api/0390-Add-BlockLockCheckEvent.patch new file mode 100644 index 0000000000..c5d560192c --- /dev/null +++ b/patches/api/0390-Add-BlockLockCheckEvent.patch @@ -0,0 +1,241 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 21 May 2022 20:59:56 -0700 +Subject: [PATCH] Add BlockLockCheckEvent + + +diff --git a/src/main/java/io/papermc/paper/block/LockableTileState.java b/src/main/java/io/papermc/paper/block/LockableTileState.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f309961e0e96b6baacc4fe6d80dabd6c7c5d2e1d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/LockableTileState.java +@@ -0,0 +1,11 @@ ++package io.papermc.paper.block; ++ ++import org.bukkit.Nameable; ++import org.bukkit.block.Lockable; ++import org.bukkit.block.TileState; ++ ++/** ++ * Interface for tile entities that are lockable. ++ */ ++public interface LockableTileState extends TileState, Lockable, Nameable { ++} +diff --git a/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0974c0572 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java +@@ -0,0 +1,186 @@ ++package io.papermc.paper.event.block; ++ ++import com.google.common.base.Preconditions; ++import io.papermc.paper.block.LockableTileState; ++import net.kyori.adventure.sound.Sound; ++import net.kyori.adventure.text.Component; ++import org.bukkit.block.Block; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.Objects; ++ ++/** ++ * Called when the server tries to check the lock on a lockable block entity. ++ *
    ++ * See {@link #setResult(Result)} to change behavior ++ */ ++public class BlockLockCheckEvent extends BlockEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final LockableTileState state; ++ private final Player player; ++ private Component lockedMessage; ++ private Sound lockedSound; ++ private ItemStack itemStack; ++ private Result result = Result.DEFAULT; ++ ++ @ApiStatus.Internal ++ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull LockableTileState state, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) { ++ super(block); ++ this.state = state; ++ this.player = player; ++ this.lockedMessage = lockedMessage; ++ this.lockedSound = lockedSound; ++ } ++ ++ /** ++ * Gets the snapshot {@link LockableTileState} of the block entity ++ * whose lock is being checked. ++ * ++ * @return the snapshot block state. ++ */ ++ public @NotNull LockableTileState getBlockState() { ++ return this.state; ++ } ++ ++ /** ++ * Get the player involved this lock check. ++ * ++ * @return the player ++ */ ++ public @NotNull Player getPlayer() { ++ return this.player; ++ } ++ ++ /** ++ * Gets the itemstack that will be used as the key itemstack. Initially ++ * this will be the item in the player's main hand but an override can be set ++ * with {@link #setKeyItem(ItemStack)}. Use {@link #isUsingCustomKeyItemStack()} ++ * to check if a custom key stack has been set. ++ * ++ * @return the item being used as the key item ++ * @see #isUsingCustomKeyItemStack() ++ */ ++ public @NotNull ItemStack getKeyItem() { ++ return Objects.requireNonNullElseGet(this.itemStack, this.player.getInventory()::getItemInMainHand); ++ } ++ ++ /** ++ * Sets the itemstack that will be used as the key item. ++ * ++ * @param stack the stack to use as a key ++ * @see #resetKeyItem() to clear a custom key item ++ */ ++ public void setKeyItem(@NotNull ItemStack stack) { ++ Preconditions.checkArgument(stack != null, "stack cannot be null"); ++ this.itemStack = stack; ++ } ++ ++ /** ++ * Reset the key stack to the default (the player's main hand). ++ */ ++ public void resetKeyItem() { ++ this.itemStack = null; ++ } ++ ++ /** ++ * Checks if a custom key stack has been set. ++ * ++ * @return {@code true} if a custom key itemstack has been set ++ */ ++ public boolean isUsingCustomKeyItemStack() { ++ return this.itemStack != null; ++ } ++ ++ /** ++ * Gets the result of this event. ++ * ++ * @return the result ++ * @see #setResult(Result) ++ */ ++ public @NotNull Result getResult() { ++ return this.result; ++ } ++ ++ /** ++ * Gets the result of this event. {@link Result#DEFAULT} is the default ++ * allowing the vanilla logic to check the lock of this block. Set to {@link Result#ALLOW} ++ * or {@link Result#DENY} to override that behavior. ++ *

    ++ * Setting this to {@link Result#ALLOW} bypasses the spectator check. ++ * ++ * @param result the result of this event ++ */ ++ public void setResult(@NotNull Result result) { ++ this.result = result; ++ } ++ ++ /** ++ * Shorthand method to set the {@link #getResult()} to {@link Result#DENY}, ++ * the locked message and locked sound. ++ * ++ * @param lockedMessage the message to show if locked (or {@code null} for none) ++ * @param lockedSound the sound to play if locked (or {@code null} for none) ++ */ ++ public void denyWithMessageAndSound(@Nullable Component lockedMessage, @Nullable Sound lockedSound) { ++ this.result = Result.DENY; ++ this.lockedMessage = lockedMessage; ++ this.lockedSound = lockedSound; ++ } ++ ++ /** ++ * Gets the locked message that will be sent if the ++ * player cannot open the block. ++ * ++ * @return the locked message (or {@code null} if none) ++ */ ++ public @Nullable Component getLockedMessage() { ++ return this.lockedMessage; ++ } ++ ++ /** ++ * Sets the locked message that will be sent if the ++ * player cannot open the block. ++ * ++ * @param lockedMessage the locked message (or {@code null} for none) ++ */ ++ public void setLockedMessage(@Nullable Component lockedMessage) { ++ this.lockedMessage = lockedMessage; ++ } ++ ++ /** ++ * Gets the locked sound that will play if the ++ * player cannot open the block. ++ * ++ * @return the locked sound (or {@code null} if none) ++ */ ++ public @Nullable Sound getLockedSound() { ++ return this.lockedSound; ++ } ++ ++ /** ++ * Sets the locked sound that will play if the ++ * player cannot open the block. ++ * ++ * @param lockedSound the locked sound (or {@code null} for none) ++ */ ++ public void setLockedSound(@Nullable Sound lockedSound) { ++ this.lockedSound = lockedSound; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} +diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java +index 7d212c409035ccb8b22d4ffc322b4a1aea367627..79c04b840adb768f7a38e95a82f79287f42681f5 100644 +--- a/src/main/java/org/bukkit/block/Beacon.java ++++ b/src/main/java/org/bukkit/block/Beacon.java +@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a captured state of a beacon. + */ +-public interface Beacon extends TileState, Lockable, Nameable { ++public interface Beacon extends io.papermc.paper.block.LockableTileState { // Paper + + /** + * Returns the list of players within the beacon's range of effect. +diff --git a/src/main/java/org/bukkit/block/Container.java b/src/main/java/org/bukkit/block/Container.java +index bc06199f0a1cc43e0bdfd5b11fa170badd46e180..a67ee0cb0cd2cbab8dab375e2fe44168c250bcb7 100644 +--- a/src/main/java/org/bukkit/block/Container.java ++++ b/src/main/java/org/bukkit/block/Container.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a captured state of a container block. + */ +-public interface Container extends TileState, BlockInventoryHolder, Lockable, Nameable { ++public interface Container extends io.papermc.paper.block.LockableTileState, BlockInventoryHolder { // Paper + + /** + * Gets the inventory of the block represented by this block state. diff --git a/patches/api/0390-fix-Instruments.patch b/patches/api/0390-fix-Instruments.patch deleted file mode 100644 index 468dc80a34..0000000000 --- a/patches/api/0390-fix-Instruments.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 9 Dec 2022 01:34:03 -0800 -Subject: [PATCH] fix Instruments - -Add missing instrument enums -fix some wrong javadocs - -diff --git a/src/main/java/org/bukkit/Instrument.java b/src/main/java/org/bukkit/Instrument.java -index 032d7b812ddc0a85e316882c8f7de0c5a0a4fd30..8df26e0d7bea77bb257cddbc2ab9e969fa160681 100644 ---- a/src/main/java/org/bukkit/Instrument.java -+++ b/src/main/java/org/bukkit/Instrument.java -@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable; - public enum Instrument { - - /** -- * Piano is the standard instrument for a note block. -+ * Piano (Harp) is the standard instrument for a note block. - */ - PIANO(0x0, Sound.BLOCK_NOTE_BLOCK_HARP), - /** -@@ -21,7 +21,7 @@ public enum Instrument { - */ - SNARE_DRUM(0x2, Sound.BLOCK_NOTE_BLOCK_SNARE), - /** -- * Sticks are normally played when a note block is on top of a glass -+ * Sticks (Hat) are normally played when a note block is on top of a glass - * block. - */ - STICKS(0x3, Sound.BLOCK_NOTE_BLOCK_HAT), -@@ -78,39 +78,37 @@ public enum Instrument { - /** - * Zombie is normally played when a Zombie Head is on top of the note block. - */ -- ZOMBIE(Sound.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE), -+ ZOMBIE(0x10, Sound.BLOCK_NOTE_BLOCK_IMITATE_ZOMBIE), // Paper - /** - * Skeleton is normally played when a Skeleton Head is on top of the note block. - */ -- SKELETON(Sound.BLOCK_NOTE_BLOCK_IMITATE_SKELETON), -+ SKELETON(0x11, Sound.BLOCK_NOTE_BLOCK_IMITATE_SKELETON), // Paper - /** - * Creeper is normally played when a Creeper Head is on top of the note block. - */ -- CREEPER(Sound.BLOCK_NOTE_BLOCK_IMITATE_CREEPER), -+ CREEPER(0x12, Sound.BLOCK_NOTE_BLOCK_IMITATE_CREEPER), // Paper - /** - * Dragon is normally played when a Dragon Head is on top of the note block. - */ -- DRAGON(Sound.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON), -+ DRAGON(0x13, Sound.BLOCK_NOTE_BLOCK_IMITATE_ENDER_DRAGON), // Paper - /** - * Wither Skeleton is normally played when a Wither Skeleton Head is on top of the note block. - */ -- WITHER_SKELETON(Sound.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON), -+ WITHER_SKELETON(0x14, Sound.BLOCK_NOTE_BLOCK_IMITATE_WITHER_SKELETON), // Paper - /** - * Piglin is normally played when a Piglin Head is on top of the note block. - */ -- PIGLIN(Sound.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN), -+ PIGLIN(0x15, Sound.BLOCK_NOTE_BLOCK_IMITATE_PIGLIN), // Paper - /** - * Custom Sound is normally played when a Player Head with the required data is on top of the note block. - */ -- CUSTOM_HEAD(null); -+ CUSTOM_HEAD(0x16, null); // Paper - - private final byte type; - private final Sound sound; - private static final Map BY_DATA = Maps.newHashMap(); - -- private Instrument(final Sound sound) { -- this(-1, sound); -- } -+ // Paper - remove ctor (the server still uses the byte magic value) - - private Instrument(final int type, final Sound sound) { - this.type = (byte) type; -@@ -130,9 +128,8 @@ public enum Instrument { - - /** - * @return The type ID of this instrument. -- * @deprecated Magic value - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - public byte getType() { - return this.type; - } -@@ -142,9 +139,8 @@ public enum Instrument { - * - * @param type The type ID - * @return The instrument -- * @deprecated Magic value - */ -- @Deprecated -+ @org.jetbrains.annotations.ApiStatus.Internal // Paper - @Nullable - public static Instrument getByType(final byte type) { - return BY_DATA.get(type); -diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java -index 8c1d88885de7d56c1b7c78d2e6e059b0648c982a..b177a47a5bda05bfe3598ec5e6771b92a73f0edf 100644 ---- a/src/test/java/org/bukkit/InstrumentTest.java -+++ b/src/test/java/org/bukkit/InstrumentTest.java -@@ -8,9 +8,7 @@ public class InstrumentTest { - @Test - public void getByType() { - for (Instrument instrument : Instrument.values()) { -- if (instrument.getType() < 0) { -- continue; -- } -+ // Paper - byte magic values are still used - - assertThat(Instrument.getByType(instrument.getType()), is(instrument)); - } diff --git a/patches/api/0391-Add-BlockLockCheckEvent.patch b/patches/api/0391-Add-BlockLockCheckEvent.patch deleted file mode 100644 index c5d560192c..0000000000 --- a/patches/api/0391-Add-BlockLockCheckEvent.patch +++ /dev/null @@ -1,241 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 21 May 2022 20:59:56 -0700 -Subject: [PATCH] Add BlockLockCheckEvent - - -diff --git a/src/main/java/io/papermc/paper/block/LockableTileState.java b/src/main/java/io/papermc/paper/block/LockableTileState.java -new file mode 100644 -index 0000000000000000000000000000000000000000..f309961e0e96b6baacc4fe6d80dabd6c7c5d2e1d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/LockableTileState.java -@@ -0,0 +1,11 @@ -+package io.papermc.paper.block; -+ -+import org.bukkit.Nameable; -+import org.bukkit.block.Lockable; -+import org.bukkit.block.TileState; -+ -+/** -+ * Interface for tile entities that are lockable. -+ */ -+public interface LockableTileState extends TileState, Lockable, Nameable { -+} -diff --git a/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0974c0572 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java -@@ -0,0 +1,186 @@ -+package io.papermc.paper.event.block; -+ -+import com.google.common.base.Preconditions; -+import io.papermc.paper.block.LockableTileState; -+import net.kyori.adventure.sound.Sound; -+import net.kyori.adventure.text.Component; -+import org.bukkit.block.Block; -+import org.bukkit.entity.Player; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.util.Objects; -+ -+/** -+ * Called when the server tries to check the lock on a lockable block entity. -+ *
    -+ * See {@link #setResult(Result)} to change behavior -+ */ -+public class BlockLockCheckEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final LockableTileState state; -+ private final Player player; -+ private Component lockedMessage; -+ private Sound lockedSound; -+ private ItemStack itemStack; -+ private Result result = Result.DEFAULT; -+ -+ @ApiStatus.Internal -+ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull LockableTileState state, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) { -+ super(block); -+ this.state = state; -+ this.player = player; -+ this.lockedMessage = lockedMessage; -+ this.lockedSound = lockedSound; -+ } -+ -+ /** -+ * Gets the snapshot {@link LockableTileState} of the block entity -+ * whose lock is being checked. -+ * -+ * @return the snapshot block state. -+ */ -+ public @NotNull LockableTileState getBlockState() { -+ return this.state; -+ } -+ -+ /** -+ * Get the player involved this lock check. -+ * -+ * @return the player -+ */ -+ public @NotNull Player getPlayer() { -+ return this.player; -+ } -+ -+ /** -+ * Gets the itemstack that will be used as the key itemstack. Initially -+ * this will be the item in the player's main hand but an override can be set -+ * with {@link #setKeyItem(ItemStack)}. Use {@link #isUsingCustomKeyItemStack()} -+ * to check if a custom key stack has been set. -+ * -+ * @return the item being used as the key item -+ * @see #isUsingCustomKeyItemStack() -+ */ -+ public @NotNull ItemStack getKeyItem() { -+ return Objects.requireNonNullElseGet(this.itemStack, this.player.getInventory()::getItemInMainHand); -+ } -+ -+ /** -+ * Sets the itemstack that will be used as the key item. -+ * -+ * @param stack the stack to use as a key -+ * @see #resetKeyItem() to clear a custom key item -+ */ -+ public void setKeyItem(@NotNull ItemStack stack) { -+ Preconditions.checkArgument(stack != null, "stack cannot be null"); -+ this.itemStack = stack; -+ } -+ -+ /** -+ * Reset the key stack to the default (the player's main hand). -+ */ -+ public void resetKeyItem() { -+ this.itemStack = null; -+ } -+ -+ /** -+ * Checks if a custom key stack has been set. -+ * -+ * @return {@code true} if a custom key itemstack has been set -+ */ -+ public boolean isUsingCustomKeyItemStack() { -+ return this.itemStack != null; -+ } -+ -+ /** -+ * Gets the result of this event. -+ * -+ * @return the result -+ * @see #setResult(Result) -+ */ -+ public @NotNull Result getResult() { -+ return this.result; -+ } -+ -+ /** -+ * Gets the result of this event. {@link Result#DEFAULT} is the default -+ * allowing the vanilla logic to check the lock of this block. Set to {@link Result#ALLOW} -+ * or {@link Result#DENY} to override that behavior. -+ *

    -+ * Setting this to {@link Result#ALLOW} bypasses the spectator check. -+ * -+ * @param result the result of this event -+ */ -+ public void setResult(@NotNull Result result) { -+ this.result = result; -+ } -+ -+ /** -+ * Shorthand method to set the {@link #getResult()} to {@link Result#DENY}, -+ * the locked message and locked sound. -+ * -+ * @param lockedMessage the message to show if locked (or {@code null} for none) -+ * @param lockedSound the sound to play if locked (or {@code null} for none) -+ */ -+ public void denyWithMessageAndSound(@Nullable Component lockedMessage, @Nullable Sound lockedSound) { -+ this.result = Result.DENY; -+ this.lockedMessage = lockedMessage; -+ this.lockedSound = lockedSound; -+ } -+ -+ /** -+ * Gets the locked message that will be sent if the -+ * player cannot open the block. -+ * -+ * @return the locked message (or {@code null} if none) -+ */ -+ public @Nullable Component getLockedMessage() { -+ return this.lockedMessage; -+ } -+ -+ /** -+ * Sets the locked message that will be sent if the -+ * player cannot open the block. -+ * -+ * @param lockedMessage the locked message (or {@code null} for none) -+ */ -+ public void setLockedMessage(@Nullable Component lockedMessage) { -+ this.lockedMessage = lockedMessage; -+ } -+ -+ /** -+ * Gets the locked sound that will play if the -+ * player cannot open the block. -+ * -+ * @return the locked sound (or {@code null} if none) -+ */ -+ public @Nullable Sound getLockedSound() { -+ return this.lockedSound; -+ } -+ -+ /** -+ * Sets the locked sound that will play if the -+ * player cannot open the block. -+ * -+ * @param lockedSound the locked sound (or {@code null} for none) -+ */ -+ public void setLockedSound(@Nullable Sound lockedSound) { -+ this.lockedSound = lockedSound; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} -diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java -index 7d212c409035ccb8b22d4ffc322b4a1aea367627..79c04b840adb768f7a38e95a82f79287f42681f5 100644 ---- a/src/main/java/org/bukkit/block/Beacon.java -+++ b/src/main/java/org/bukkit/block/Beacon.java -@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; - /** - * Represents a captured state of a beacon. - */ --public interface Beacon extends TileState, Lockable, Nameable { -+public interface Beacon extends io.papermc.paper.block.LockableTileState { // Paper - - /** - * Returns the list of players within the beacon's range of effect. -diff --git a/src/main/java/org/bukkit/block/Container.java b/src/main/java/org/bukkit/block/Container.java -index bc06199f0a1cc43e0bdfd5b11fa170badd46e180..a67ee0cb0cd2cbab8dab375e2fe44168c250bcb7 100644 ---- a/src/main/java/org/bukkit/block/Container.java -+++ b/src/main/java/org/bukkit/block/Container.java -@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a captured state of a container block. - */ --public interface Container extends TileState, BlockInventoryHolder, Lockable, Nameable { -+public interface Container extends io.papermc.paper.block.LockableTileState, BlockInventoryHolder { // Paper - - /** - * Gets the inventory of the block represented by this block state. diff --git a/patches/api/0391-Add-Sneaking-API-for-Entities.patch b/patches/api/0391-Add-Sneaking-API-for-Entities.patch new file mode 100644 index 0000000000..3f8d4c724f --- /dev/null +++ b/patches/api/0391-Add-Sneaking-API-for-Entities.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dawon +Date: Wed, 19 Oct 2022 23:36:42 +0200 +Subject: [PATCH] Add Sneaking API for Entities + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 11885ef53ed97738d0a50e5f459a9f76c975c085..5a80cf6b16c8fb0457421b7b694a06f43e5e902b 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -819,6 +819,25 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + @NotNull + Pose getPose(); + ++ // Paper start ++ /** ++ * Returns if the entity is in sneak mode ++ * ++ * @return true if the entity is in sneak mode ++ */ ++ boolean isSneaking(); ++ ++ /** ++ * Sets the sneak mode the entity. ++ *

    ++ * Note: For most Entities this does not update Entity's pose ++ * and just makes its name tag less visible. ++ * ++ * @param sneak true if the entity should be sneaking ++ */ ++ void setSneaking(boolean sneak); ++ // Paper end ++ + /** + * Get the category of spawn to which this entity belongs. + * +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 537ebbad48191741f666aa2a30c8584562dfcb83..5e798ea4c66e1a7ce6239b972e6a13810850a438 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -461,6 +461,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * + * @return true if player is in sneak mode + */ ++ @Override // Paper + public boolean isSneaking(); + + /** +@@ -468,6 +469,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * + * @param sneak true if player should appear sneaking + */ ++ @Override // Paper + public void setSneaking(boolean sneak); + + /** diff --git a/patches/api/0392-Add-Sneaking-API-for-Entities.patch b/patches/api/0392-Add-Sneaking-API-for-Entities.patch deleted file mode 100644 index 3f8d4c724f..0000000000 --- a/patches/api/0392-Add-Sneaking-API-for-Entities.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dawon -Date: Wed, 19 Oct 2022 23:36:42 +0200 -Subject: [PATCH] Add Sneaking API for Entities - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 11885ef53ed97738d0a50e5f459a9f76c975c085..5a80cf6b16c8fb0457421b7b694a06f43e5e902b 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -819,6 +819,25 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - @NotNull - Pose getPose(); - -+ // Paper start -+ /** -+ * Returns if the entity is in sneak mode -+ * -+ * @return true if the entity is in sneak mode -+ */ -+ boolean isSneaking(); -+ -+ /** -+ * Sets the sneak mode the entity. -+ *

    -+ * Note: For most Entities this does not update Entity's pose -+ * and just makes its name tag less visible. -+ * -+ * @param sneak true if the entity should be sneaking -+ */ -+ void setSneaking(boolean sneak); -+ // Paper end -+ - /** - * Get the category of spawn to which this entity belongs. - * -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 537ebbad48191741f666aa2a30c8584562dfcb83..5e798ea4c66e1a7ce6239b972e6a13810850a438 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -461,6 +461,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * - * @return true if player is in sneak mode - */ -+ @Override // Paper - public boolean isSneaking(); - - /** -@@ -468,6 +469,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * - * @param sneak true if player should appear sneaking - */ -+ @Override // Paper - public void setSneaking(boolean sneak); - - /** diff --git a/patches/api/0392-Improve-PortalEvents.patch b/patches/api/0392-Improve-PortalEvents.patch new file mode 100644 index 0000000000..f7f53b19fc --- /dev/null +++ b/patches/api/0392-Improve-PortalEvents.patch @@ -0,0 +1,128 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 15 Dec 2022 10:33:34 -0800 +Subject: [PATCH] Improve PortalEvents + + +diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java +index 67fb9d93e808e907fa980f3004d415ae5d0a53fc..97e36c7f6e09276fbae20eaeee0965566332ca46 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java +@@ -15,15 +15,58 @@ import org.jetbrains.annotations.Nullable; + public class EntityPortalEvent extends EntityTeleportEvent { + private static final HandlerList handlers = new HandlerList(); + private int searchRadius = 128; ++ private final org.bukkit.PortalType type; // Paper + + public EntityPortalEvent(@NotNull final Entity entity, @NotNull final Location from, @Nullable final Location to) { +- super(entity, from, to); ++ this(entity, from, to, 128); // Paper + } + + public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius) { + super(entity, from, to); + this.searchRadius = searchRadius; ++ this.type = org.bukkit.PortalType.CUSTOM; // Paper ++ } ++ ++ // Paper start ++ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, final @NotNull org.bukkit.PortalType portalType) { ++ super(entity, from, to); ++ this.searchRadius = searchRadius; ++ this.type = portalType; ++ } ++ ++ /** ++ * Get the portal type relating to this event. ++ * ++ * @return the portal type ++ */ ++ public @NotNull org.bukkit.PortalType getPortalType() { ++ return this.type; ++ } ++ /** ++ * For {@link org.bukkit.PortalType#NETHER}, this is initially just the starting point ++ * for the search for a portal to teleport to. It will initially just be the {@link #getFrom()} ++ * scaled for dimension scaling and clamped to be inside the world border. ++ *

    ++ * For {@link org.bukkit.PortalType#ENDER}, this will initially be the exact destination ++ * either, the world spawn for end->any world or end spawn for any world->end. ++ * ++ * @return starting point for search or exact destination ++ */ ++ @Override ++ public @Nullable Location getTo() { ++ return super.getTo(); ++ } ++ ++ /** ++ * See the description of {@link #getTo()}. ++ * @param to starting point for search or exact destination ++ * or null to cancel ++ */ ++ @Override ++ public void setTo(@Nullable final Location to) { ++ super.setTo(to); + } ++ // Paper end + + /** + * Set the Block radius to search in for available portals. +diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java +index 57eeeafae84f83a939925820e827769749ff27ec..929a997671de8202efb9da97fbf9b4a0bf7c37e8 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java +@@ -32,6 +32,53 @@ public class PlayerPortalEvent extends PlayerTeleportEvent { + this.canCreatePortal = canCreatePortal; + this.creationRadius = creationRadius; + } ++ // Paper start ++ /** ++ * For {@link TeleportCause#NETHER_PORTAL}, this is initially just the starting point ++ * for the search for a portal to teleport to. It will initially just be the {@link #getFrom()} ++ * scaled for dimension scaling and clamped to be inside the world border. ++ *

    ++ * For {@link TeleportCause#END_PORTAL}, this will initially be the exact destination ++ * either, the world spawn for end->any world or end spawn for any world->end. ++ * ++ * @return starting point for search or exact destination ++ */ ++ @Override ++ public @NotNull Location getTo() { ++ return super.getTo(); ++ } ++ ++ /** ++ * See the description of {@link #getTo()}. ++ * @param to starting point for search or exact destination ++ */ ++ @Override ++ public void setTo(@NotNull final Location to) { ++ super.setTo(to); ++ } ++ ++ /** ++ * No effect ++ * @return no effect ++ * @deprecated No effect ++ */ ++ @Deprecated ++ @Override ++ public boolean willDismountPlayer() { ++ return super.willDismountPlayer(); ++ } ++ ++ /** ++ * No effect ++ * @return no effect ++ * @deprecated No effect ++ */ ++ @Deprecated ++ @Override ++ public @NotNull java.util.Set getRelativeTeleportationFlags() { ++ return super.getRelativeTeleportationFlags(); ++ } ++ // Paper end + + /** + * Set the Block radius to search in for available portals. diff --git a/patches/api/0393-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch b/patches/api/0393-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch new file mode 100644 index 0000000000..88530a6a65 --- /dev/null +++ b/patches/api/0393-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 22 Oct 2021 16:24:17 -0700 +Subject: [PATCH] Add exploded block state to EntityDamageByBlockEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java +index 8309b030c2120f1496d244f3ebc1094def41c869..a7c297364805c58ae16895055d8eae0484384b7d 100644 +--- a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java ++++ b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java +@@ -32,6 +32,7 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable { + this.cancel = false; + } + ++ @io.papermc.paper.annotation.DoNotUse // Paper + @Deprecated(forRemoval = true) + public BlockExplodeEvent(@NotNull final Block what, @NotNull final List blocks, final float yield) { + this(what, what.getState(), blocks, yield); +diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java +index 467a0d6cabc5e860628be3b1e62de773efde5d2e..1fb15e2ade8ff3c4d662eca87b078b4577f786e1 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java +@@ -11,28 +11,35 @@ import org.jetbrains.annotations.Nullable; + + /** + * Called when an entity is damaged by a block ++ *

    ++ * For explosions, the Block returned by {@link #getDamager()} has ++ * already been cleared. See {@link #getDamagerBlockState()} for a snapshot ++ * of the block if it has already been changed. + */ + public class EntityDamageByBlockEvent extends EntityDamageEvent { + private final Block damager; ++ private final org.bukkit.block.BlockState damagerBlockState; // Paper + + @Deprecated(forRemoval = true) + public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) { +- this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), damage); ++ this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), damage, null); // Paper + } + +- public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) { ++ public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage, final @Nullable org.bukkit.block.BlockState damagerBlockState) { // Paper + super(damagee, cause, damageSource, damage); + this.damager = damager; ++ this.damagerBlockState = damagerBlockState; // Paper + } + + @Deprecated(forRemoval = true) + public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { +- this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions); ++ this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions, null); // Paper + } + +- public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { ++ public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions, final @Nullable org.bukkit.block.BlockState damagerBlockState) { // Paper + super(damagee, cause, damageSource, modifiers, modifierFunctions); + this.damager = damager; ++ this.damagerBlockState = damagerBlockState; // Paper + } + + /** +@@ -44,4 +51,20 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent { + public Block getDamager() { + return damager; + } ++ ++ // Paper start ++ /** ++ * Get a capture of the block that directly caused ++ * the damage, like a bed or respawn anchor. This ++ * block state is not placed so {@link org.bukkit.block.BlockState#isPlaced} ++ * will be false. ++ *

    ++ * Can be null if the block wasn't changed before the event ++ * ++ * @return the damager block state or null if not applicable ++ */ ++ public @Nullable org.bukkit.block.BlockState getDamagerBlockState() { ++ return this.damagerBlockState; ++ } ++ // Paper end + } diff --git a/patches/api/0393-Improve-PortalEvents.patch b/patches/api/0393-Improve-PortalEvents.patch deleted file mode 100644 index f7f53b19fc..0000000000 --- a/patches/api/0393-Improve-PortalEvents.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 15 Dec 2022 10:33:34 -0800 -Subject: [PATCH] Improve PortalEvents - - -diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java -index 67fb9d93e808e907fa980f3004d415ae5d0a53fc..97e36c7f6e09276fbae20eaeee0965566332ca46 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEvent.java -@@ -15,15 +15,58 @@ import org.jetbrains.annotations.Nullable; - public class EntityPortalEvent extends EntityTeleportEvent { - private static final HandlerList handlers = new HandlerList(); - private int searchRadius = 128; -+ private final org.bukkit.PortalType type; // Paper - - public EntityPortalEvent(@NotNull final Entity entity, @NotNull final Location from, @Nullable final Location to) { -- super(entity, from, to); -+ this(entity, from, to, 128); // Paper - } - - public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius) { - super(entity, from, to); - this.searchRadius = searchRadius; -+ this.type = org.bukkit.PortalType.CUSTOM; // Paper -+ } -+ -+ // Paper start -+ public EntityPortalEvent(@NotNull Entity entity, @NotNull Location from, @Nullable Location to, int searchRadius, final @NotNull org.bukkit.PortalType portalType) { -+ super(entity, from, to); -+ this.searchRadius = searchRadius; -+ this.type = portalType; -+ } -+ -+ /** -+ * Get the portal type relating to this event. -+ * -+ * @return the portal type -+ */ -+ public @NotNull org.bukkit.PortalType getPortalType() { -+ return this.type; -+ } -+ /** -+ * For {@link org.bukkit.PortalType#NETHER}, this is initially just the starting point -+ * for the search for a portal to teleport to. It will initially just be the {@link #getFrom()} -+ * scaled for dimension scaling and clamped to be inside the world border. -+ *

    -+ * For {@link org.bukkit.PortalType#ENDER}, this will initially be the exact destination -+ * either, the world spawn for end->any world or end spawn for any world->end. -+ * -+ * @return starting point for search or exact destination -+ */ -+ @Override -+ public @Nullable Location getTo() { -+ return super.getTo(); -+ } -+ -+ /** -+ * See the description of {@link #getTo()}. -+ * @param to starting point for search or exact destination -+ * or null to cancel -+ */ -+ @Override -+ public void setTo(@Nullable final Location to) { -+ super.setTo(to); - } -+ // Paper end - - /** - * Set the Block radius to search in for available portals. -diff --git a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java -index 57eeeafae84f83a939925820e827769749ff27ec..929a997671de8202efb9da97fbf9b4a0bf7c37e8 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerPortalEvent.java -@@ -32,6 +32,53 @@ public class PlayerPortalEvent extends PlayerTeleportEvent { - this.canCreatePortal = canCreatePortal; - this.creationRadius = creationRadius; - } -+ // Paper start -+ /** -+ * For {@link TeleportCause#NETHER_PORTAL}, this is initially just the starting point -+ * for the search for a portal to teleport to. It will initially just be the {@link #getFrom()} -+ * scaled for dimension scaling and clamped to be inside the world border. -+ *

    -+ * For {@link TeleportCause#END_PORTAL}, this will initially be the exact destination -+ * either, the world spawn for end->any world or end spawn for any world->end. -+ * -+ * @return starting point for search or exact destination -+ */ -+ @Override -+ public @NotNull Location getTo() { -+ return super.getTo(); -+ } -+ -+ /** -+ * See the description of {@link #getTo()}. -+ * @param to starting point for search or exact destination -+ */ -+ @Override -+ public void setTo(@NotNull final Location to) { -+ super.setTo(to); -+ } -+ -+ /** -+ * No effect -+ * @return no effect -+ * @deprecated No effect -+ */ -+ @Deprecated -+ @Override -+ public boolean willDismountPlayer() { -+ return super.willDismountPlayer(); -+ } -+ -+ /** -+ * No effect -+ * @return no effect -+ * @deprecated No effect -+ */ -+ @Deprecated -+ @Override -+ public @NotNull java.util.Set getRelativeTeleportationFlags() { -+ return super.getRelativeTeleportationFlags(); -+ } -+ // Paper end - - /** - * Set the Block radius to search in for available portals. diff --git a/patches/api/0394-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch b/patches/api/0394-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch deleted file mode 100644 index 88530a6a65..0000000000 --- a/patches/api/0394-Add-exploded-block-state-to-EntityDamageByBlockEvent.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 22 Oct 2021 16:24:17 -0700 -Subject: [PATCH] Add exploded block state to EntityDamageByBlockEvent - - -diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java -index 8309b030c2120f1496d244f3ebc1094def41c869..a7c297364805c58ae16895055d8eae0484384b7d 100644 ---- a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java -+++ b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java -@@ -32,6 +32,7 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable { - this.cancel = false; - } - -+ @io.papermc.paper.annotation.DoNotUse // Paper - @Deprecated(forRemoval = true) - public BlockExplodeEvent(@NotNull final Block what, @NotNull final List blocks, final float yield) { - this(what, what.getState(), blocks, yield); -diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java -index 467a0d6cabc5e860628be3b1e62de773efde5d2e..1fb15e2ade8ff3c4d662eca87b078b4577f786e1 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java -@@ -11,28 +11,35 @@ import org.jetbrains.annotations.Nullable; - - /** - * Called when an entity is damaged by a block -+ *

    -+ * For explosions, the Block returned by {@link #getDamager()} has -+ * already been cleared. See {@link #getDamagerBlockState()} for a snapshot -+ * of the block if it has already been changed. - */ - public class EntityDamageByBlockEvent extends EntityDamageEvent { - private final Block damager; -+ private final org.bukkit.block.BlockState damagerBlockState; // Paper - - @Deprecated(forRemoval = true) - public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) { -- this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), damage); -+ this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), damage, null); // Paper - } - -- public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage) { -+ public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, final double damage, final @Nullable org.bukkit.block.BlockState damagerBlockState) { // Paper - super(damagee, cause, damageSource, damage); - this.damager = damager; -+ this.damagerBlockState = damagerBlockState; // Paper - } - - @Deprecated(forRemoval = true) - public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { -- this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions); -+ this(damager, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions, null); // Paper - } - -- public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions) { -+ public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map modifiers, @NotNull final Map> modifierFunctions, final @Nullable org.bukkit.block.BlockState damagerBlockState) { // Paper - super(damagee, cause, damageSource, modifiers, modifierFunctions); - this.damager = damager; -+ this.damagerBlockState = damagerBlockState; // Paper - } - - /** -@@ -44,4 +51,20 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent { - public Block getDamager() { - return damager; - } -+ -+ // Paper start -+ /** -+ * Get a capture of the block that directly caused -+ * the damage, like a bed or respawn anchor. This -+ * block state is not placed so {@link org.bukkit.block.BlockState#isPlaced} -+ * will be false. -+ *

    -+ * Can be null if the block wasn't changed before the event -+ * -+ * @return the damager block state or null if not applicable -+ */ -+ public @Nullable org.bukkit.block.BlockState getDamagerBlockState() { -+ return this.damagerBlockState; -+ } -+ // Paper end - } diff --git a/patches/api/0394-Flying-Fall-Damage-API.patch b/patches/api/0394-Flying-Fall-Damage-API.patch new file mode 100644 index 0000000000..b38eb93f1c --- /dev/null +++ b/patches/api/0394-Flying-Fall-Damage-API.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TreyRuffy +Date: Fri, 27 May 2022 02:25:38 -0600 +Subject: [PATCH] Flying Fall Damage API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 5e798ea4c66e1a7ce6239b972e6a13810850a438..ce5530c27572fefd732301e07393fab0d9c99afb 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1903,6 +1903,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void setAllowFlight(boolean flight); + ++ // Paper start - flying fall damage ++ /** ++ * Allows you to enable fall damage while {@link #getAllowFlight()} is {@code true} ++ * ++ * @param flyingFallDamage Enables fall damage when {@link #getAllowFlight()} is {@code true} ++ */ ++ public void setFlyingFallDamage(@NotNull net.kyori.adventure.util.TriState flyingFallDamage); ++ ++ /** ++ * Allows you to get if fall damage is enabled while {@link #getAllowFlight()} is {@code true} ++ * ++ * @return A tristate of whether fall damage is enabled, not set, or disabled when {@link #getAllowFlight()} is {@code true} ++ */ ++ @NotNull ++ public net.kyori.adventure.util.TriState hasFlyingFallDamage(); ++ // Paper end ++ + /** + * Hides a player from this player + * diff --git a/patches/api/0395-Flying-Fall-Damage-API.patch b/patches/api/0395-Flying-Fall-Damage-API.patch deleted file mode 100644 index b38eb93f1c..0000000000 --- a/patches/api/0395-Flying-Fall-Damage-API.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TreyRuffy -Date: Fri, 27 May 2022 02:25:38 -0600 -Subject: [PATCH] Flying Fall Damage API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5e798ea4c66e1a7ce6239b972e6a13810850a438..ce5530c27572fefd732301e07393fab0d9c99afb 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1903,6 +1903,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public void setAllowFlight(boolean flight); - -+ // Paper start - flying fall damage -+ /** -+ * Allows you to enable fall damage while {@link #getAllowFlight()} is {@code true} -+ * -+ * @param flyingFallDamage Enables fall damage when {@link #getAllowFlight()} is {@code true} -+ */ -+ public void setFlyingFallDamage(@NotNull net.kyori.adventure.util.TriState flyingFallDamage); -+ -+ /** -+ * Allows you to get if fall damage is enabled while {@link #getAllowFlight()} is {@code true} -+ * -+ * @return A tristate of whether fall damage is enabled, not set, or disabled when {@link #getAllowFlight()} is {@code true} -+ */ -+ @NotNull -+ public net.kyori.adventure.util.TriState hasFlyingFallDamage(); -+ // Paper end -+ - /** - * Hides a player from this player - * diff --git a/patches/api/0395-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch b/patches/api/0395-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch new file mode 100644 index 0000000000..b8287d2850 --- /dev/null +++ b/patches/api/0395-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Thu, 5 Jan 2023 10:45:20 +0100 +Subject: [PATCH] Replace ItemFlag.HIDE_POTION_EFFECTS + + +diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java +index 1b3580d1861af402396121805715e4087b3bc587..a435f6c8947e4ac50b8c04f37b107055970937dd 100644 +--- a/src/main/java/org/bukkit/inventory/ItemFlag.java ++++ b/src/main/java/org/bukkit/inventory/ItemFlag.java +@@ -38,4 +38,27 @@ public enum ItemFlag { + * Setting to show/hide armor trim from armor. + */ + HIDE_ARMOR_TRIM; ++ // Paper start ++ /** ++ * Setting to show/hide item-specific information, including, but not limited to: ++ *

      ++ *
    • Potion effects on potions, tipped arrows, and suspicious stew
    • ++ *
    • Enchanted book enchantments
    • ++ *
    • Book author and generation
    • ++ *
    • Record names
    • ++ *
    • Patterns of banners and shields
    • ++ *
    • Fish bucket variants
    • ++ *
    • Instrument item descriptions (i.e. goat horn sounds)
    • ++ *
    • Map data
    • ++ *
    • Firework data
    • ++ *
    • Crossbow projectile info
    • ++ *
    • Bundle fullness
    • ++ *
    • Shulker box contents
    • ++ *
    • Spawner descriptions
    • ++ *
    ++ * @deprecated use {@link #HIDE_ADDITIONAL_TOOLTIP} ++ */ ++ @Deprecated ++ public static final ItemFlag HIDE_ITEM_SPECIFICS = HIDE_ADDITIONAL_TOOLTIP; ++ // Paper end + } diff --git a/patches/api/0396-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch b/patches/api/0396-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch deleted file mode 100644 index b8287d2850..0000000000 --- a/patches/api/0396-Replace-ItemFlag.HIDE_POTION_EFFECTS.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Thu, 5 Jan 2023 10:45:20 +0100 -Subject: [PATCH] Replace ItemFlag.HIDE_POTION_EFFECTS - - -diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java -index 1b3580d1861af402396121805715e4087b3bc587..a435f6c8947e4ac50b8c04f37b107055970937dd 100644 ---- a/src/main/java/org/bukkit/inventory/ItemFlag.java -+++ b/src/main/java/org/bukkit/inventory/ItemFlag.java -@@ -38,4 +38,27 @@ public enum ItemFlag { - * Setting to show/hide armor trim from armor. - */ - HIDE_ARMOR_TRIM; -+ // Paper start -+ /** -+ * Setting to show/hide item-specific information, including, but not limited to: -+ *
      -+ *
    • Potion effects on potions, tipped arrows, and suspicious stew
    • -+ *
    • Enchanted book enchantments
    • -+ *
    • Book author and generation
    • -+ *
    • Record names
    • -+ *
    • Patterns of banners and shields
    • -+ *
    • Fish bucket variants
    • -+ *
    • Instrument item descriptions (i.e. goat horn sounds)
    • -+ *
    • Map data
    • -+ *
    • Firework data
    • -+ *
    • Crossbow projectile info
    • -+ *
    • Bundle fullness
    • -+ *
    • Shulker box contents
    • -+ *
    • Spawner descriptions
    • -+ *
    -+ * @deprecated use {@link #HIDE_ADDITIONAL_TOOLTIP} -+ */ -+ @Deprecated -+ public static final ItemFlag HIDE_ITEM_SPECIFICS = HIDE_ADDITIONAL_TOOLTIP; -+ // Paper end - } diff --git a/patches/api/0396-Win-Screen-API.patch b/patches/api/0396-Win-Screen-API.patch new file mode 100644 index 0000000000..05fbb589d3 --- /dev/null +++ b/patches/api/0396-Win-Screen-API.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lama06 +Date: Sat, 21 Jan 2023 13:45:22 +0100 +Subject: [PATCH] Win Screen API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index ce5530c27572fefd732301e07393fab0d9c99afb..6dc9a93811d143ed266f0f6235358d58b1e00523 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1249,6 +1249,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + */ + public void sendMap(@NotNull MapView map); + ++ // Paper start ++ /** ++ * Shows the player the win screen that normally is only displayed after one kills the ender dragon ++ * and exits the end for the first time. ++ * In vanilla, the win screen starts with a poem and then continues with the credits but its content can be ++ * changed by using a resource pack. ++ *
    ++ * Calling this method does not change the value of {@link #hasSeenWinScreen()}. ++ * That means that the win screen is still displayed to a player if they leave the end for the first time, even though ++ * they have seen it before because this method was called. ++ * Note this method does not make the player invulnerable, which is normally expected when viewing credits. ++ * ++ * @see #hasSeenWinScreen() ++ * @see #setHasSeenWinScreen(boolean) ++ * @see https://minecraft.wiki/wiki/End_Poem#Technical_details ++ */ ++ public void showWinScreen(); ++ ++ /** ++ * Returns whether this player has seen the win screen before. ++ * When a player leaves the end the win screen is shown to them if they have not seen it before. ++ * ++ * @return Whether this player has seen the win screen before ++ * @see #setHasSeenWinScreen(boolean) ++ * @see #showWinScreen() ++ * @see https://minecraft.wiki/wiki/End_Poem ++ */ ++ public boolean hasSeenWinScreen(); ++ ++ /** ++ * Changes whether this player has seen the win screen before. ++ * When a player leaves the end the win screen is shown to them if they have not seen it before. ++ * ++ * @param hasSeenWinScreen Whether this player has seen the win screen before ++ * @see #hasSeenWinScreen() ++ * @see #showWinScreen() ++ * @see https://minecraft.wiki/wiki/End_Poem ++ */ ++ public void setHasSeenWinScreen(boolean hasSeenWinScreen); ++ // Paper end ++ + // Paper start + /** + * Permanently Bans the Profile and IP address currently used by the player. diff --git a/patches/api/0397-Add-Entity-Body-Yaw-API.patch b/patches/api/0397-Add-Entity-Body-Yaw-API.patch new file mode 100644 index 0000000000..d1d983e166 --- /dev/null +++ b/patches/api/0397-Add-Entity-Body-Yaw-API.patch @@ -0,0 +1,81 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheTuso +Date: Thu, 2 Feb 2023 16:40:11 +0100 +Subject: [PATCH] Add Entity Body Yaw API + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 5a80cf6b16c8fb0457421b7b694a06f43e5e902b..9e7b6ed599759de451429c99bc6876b878c1cca2 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -1037,6 +1037,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * @return true if in powdered snow. + */ + boolean isInPowderedSnow(); ++ ++ /** ++ * Gets the x-coordinate of this entity ++ * ++ * @return x-coordinate ++ */ ++ double getX(); ++ ++ /** ++ * Gets the y-coordinate of this entity ++ * ++ * @return y-coordinate ++ */ ++ double getY(); ++ ++ /** ++ * Gets the z-coordinate of this entity ++ * ++ * @return z-coordinate ++ */ ++ double getZ(); ++ ++ /** ++ * Gets this entity's pitch ++ * ++ * @see Location#getPitch() ++ * @return the entity's pitch ++ */ ++ float getPitch(); ++ ++ /** ++ * Gets this entity's yaw ++ * ++ * @see Location#getYaw() ++ * @return the entity's yaw ++ */ ++ float getYaw(); + // Paper end + + // Paper start - Collision API +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 806bf6ca0dc87e1956084c61040a3d6139e8bc29..166b816f49d9918768f162b0b7134ffd266280f3 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -1414,4 +1414,22 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + */ + void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); + // Paper end - ItemStack damage API ++ ++ // Paper start - body yaw API ++ /** ++ * Gets entity body yaw ++ * ++ * @return entity body yaw ++ * @see Location#getYaw() ++ */ ++ float getBodyYaw(); ++ ++ /** ++ * Sets entity body yaw ++ * ++ * @param bodyYaw new entity body yaw ++ * @see Location#setYaw(float) ++ */ ++ void setBodyYaw(float bodyYaw); ++ // Paper end - body yaw API + } diff --git a/patches/api/0397-Win-Screen-API.patch b/patches/api/0397-Win-Screen-API.patch deleted file mode 100644 index 05fbb589d3..0000000000 --- a/patches/api/0397-Win-Screen-API.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lama06 -Date: Sat, 21 Jan 2023 13:45:22 +0100 -Subject: [PATCH] Win Screen API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index ce5530c27572fefd732301e07393fab0d9c99afb..6dc9a93811d143ed266f0f6235358d58b1e00523 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1249,6 +1249,47 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - */ - public void sendMap(@NotNull MapView map); - -+ // Paper start -+ /** -+ * Shows the player the win screen that normally is only displayed after one kills the ender dragon -+ * and exits the end for the first time. -+ * In vanilla, the win screen starts with a poem and then continues with the credits but its content can be -+ * changed by using a resource pack. -+ *
    -+ * Calling this method does not change the value of {@link #hasSeenWinScreen()}. -+ * That means that the win screen is still displayed to a player if they leave the end for the first time, even though -+ * they have seen it before because this method was called. -+ * Note this method does not make the player invulnerable, which is normally expected when viewing credits. -+ * -+ * @see #hasSeenWinScreen() -+ * @see #setHasSeenWinScreen(boolean) -+ * @see https://minecraft.wiki/wiki/End_Poem#Technical_details -+ */ -+ public void showWinScreen(); -+ -+ /** -+ * Returns whether this player has seen the win screen before. -+ * When a player leaves the end the win screen is shown to them if they have not seen it before. -+ * -+ * @return Whether this player has seen the win screen before -+ * @see #setHasSeenWinScreen(boolean) -+ * @see #showWinScreen() -+ * @see https://minecraft.wiki/wiki/End_Poem -+ */ -+ public boolean hasSeenWinScreen(); -+ -+ /** -+ * Changes whether this player has seen the win screen before. -+ * When a player leaves the end the win screen is shown to them if they have not seen it before. -+ * -+ * @param hasSeenWinScreen Whether this player has seen the win screen before -+ * @see #hasSeenWinScreen() -+ * @see #showWinScreen() -+ * @see https://minecraft.wiki/wiki/End_Poem -+ */ -+ public void setHasSeenWinScreen(boolean hasSeenWinScreen); -+ // Paper end -+ - // Paper start - /** - * Permanently Bans the Profile and IP address currently used by the player. diff --git a/patches/api/0398-Add-Entity-Body-Yaw-API.patch b/patches/api/0398-Add-Entity-Body-Yaw-API.patch deleted file mode 100644 index d1d983e166..0000000000 --- a/patches/api/0398-Add-Entity-Body-Yaw-API.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TheTuso -Date: Thu, 2 Feb 2023 16:40:11 +0100 -Subject: [PATCH] Add Entity Body Yaw API - - -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 5a80cf6b16c8fb0457421b7b694a06f43e5e902b..9e7b6ed599759de451429c99bc6876b878c1cca2 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1037,6 +1037,43 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - * @return true if in powdered snow. - */ - boolean isInPowderedSnow(); -+ -+ /** -+ * Gets the x-coordinate of this entity -+ * -+ * @return x-coordinate -+ */ -+ double getX(); -+ -+ /** -+ * Gets the y-coordinate of this entity -+ * -+ * @return y-coordinate -+ */ -+ double getY(); -+ -+ /** -+ * Gets the z-coordinate of this entity -+ * -+ * @return z-coordinate -+ */ -+ double getZ(); -+ -+ /** -+ * Gets this entity's pitch -+ * -+ * @see Location#getPitch() -+ * @return the entity's pitch -+ */ -+ float getPitch(); -+ -+ /** -+ * Gets this entity's yaw -+ * -+ * @see Location#getYaw() -+ * @return the entity's yaw -+ */ -+ float getYaw(); - // Paper end - - // Paper start - Collision API -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 806bf6ca0dc87e1956084c61040a3d6139e8bc29..166b816f49d9918768f162b0b7134ffd266280f3 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1414,4 +1414,22 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - */ - void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); - // Paper end - ItemStack damage API -+ -+ // Paper start - body yaw API -+ /** -+ * Gets entity body yaw -+ * -+ * @return entity body yaw -+ * @see Location#getYaw() -+ */ -+ float getBodyYaw(); -+ -+ /** -+ * Sets entity body yaw -+ * -+ * @param bodyYaw new entity body yaw -+ * @see Location#setYaw(float) -+ */ -+ void setBodyYaw(float bodyYaw); -+ // Paper end - body yaw API - } diff --git a/patches/api/0398-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch b/patches/api/0398-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch new file mode 100644 index 0000000000..c375206bf7 --- /dev/null +++ b/patches/api/0398-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 7 Feb 2023 08:20:27 -0800 +Subject: [PATCH] Fix HandlerList for InventoryBlockStartEvent subclasses + + +diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +index 37be83184cae203d5e99518b0ff5c708fafb0331..43eac972f45d1cbb6278b048f8e6d7882c0aabeb 100644 +--- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java +@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; + @org.jetbrains.annotations.ApiStatus.Experimental // Paper + public class BrewingStartEvent extends InventoryBlockStartEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private int brewingTime; + + public BrewingStartEvent(@NotNull final Block furnace, @NotNull ItemStack source, int brewingTime) { +@@ -37,14 +37,5 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { + this.brewingTime = brewTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } +diff --git a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +index 2d084214e991fecc51f8e18e3d733e43b1dca248..4b12575107b3f1fa6d0ed7f667bf0d0ae40acae0 100644 +--- a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java +@@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull; + @org.jetbrains.annotations.ApiStatus.Experimental // Paper + public class CampfireStartEvent extends InventoryBlockStartEvent { + +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private int cookingTime; + private CampfireRecipe campfireRecipe; + +@@ -50,14 +50,5 @@ public class CampfireStartEvent extends InventoryBlockStartEvent { + this.cookingTime = cookTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } +diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +index d386ab5dd46cc6706ace61fe6b646713ffd50cb7..abfd0441f1dd485e59ce5a9f7fca88ffa32e87f7 100644 +--- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java ++++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java +@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; + * {@link org.bukkit.block.Smoker}, and {@link org.bukkit.block.BlastFurnace}. + */ + public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { +- private static final HandlerList handlers = new HandlerList(); ++ // Paper - remove HandlerList + private final CookingRecipe recipe; + private int totalCookTime; + +@@ -59,14 +59,5 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { + this.totalCookTime = cookTime; + } + +- @NotNull +- @Override +- public HandlerList getHandlers() { +- return handlers; +- } +- +- @NotNull +- public static HandlerList getHandlerList() { +- return handlers; +- } ++ // Paper - remove HandlerList + } diff --git a/patches/api/0399-Add-EntityFertilizeEggEvent.patch b/patches/api/0399-Add-EntityFertilizeEggEvent.patch new file mode 100644 index 0000000000..4ae6ff9f0f --- /dev/null +++ b/patches/api/0399-Add-EntityFertilizeEggEvent.patch @@ -0,0 +1,151 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Fri, 24 Jun 2022 11:56:32 +0200 +Subject: [PATCH] Add EntityFertilizeEggEvent + + +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9b87d7ae8 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java +@@ -0,0 +1,139 @@ ++package io.papermc.paper.event.entity; ++ ++import org.bukkit.Material; ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.entity.EntityBreedEvent; ++import org.bukkit.event.entity.EntityEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when two entities mate and the mating process results in a fertilization. ++ * Fertilization differs from normal breeding, as represented by the {@link EntityBreedEvent}, as ++ * it does not result in the immediate creation of the child entity in the world. ++ *

    ++ * An example of this would be: ++ *

      ++ *
    • A frog being marked as "is_pregnant" and laying {@link Material#FROGSPAWN} later.
    • ++ *
    • Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.
    • ++ *
    • A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.
    • ++ *
    ++ * ++ * The event hence only exposes the two parent entities in the fertilization process and cannot provide the child entity, as it will only exist at a later point in time. ++ */ ++public class EntityFertilizeEggEvent extends EntityEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final LivingEntity mother; ++ private final LivingEntity father; ++ private final Player breeder; ++ private final ItemStack bredWith; ++ private int experience; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityFertilizeEggEvent(@NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable Player breeder, @Nullable ItemStack bredWith, int experience) { ++ super(mother); ++ this.mother = mother; ++ this.father = father; ++ this.breeder = breeder; ++ this.bredWith = bredWith; ++ this.experience = experience; ++ } ++ ++ @NotNull ++ @Override ++ public LivingEntity getEntity() { ++ return (LivingEntity) super.getEntity(); ++ } ++ ++ /** ++ * Provides the entity in the fertilization process that will eventually be responsible for "creating" offspring, ++ * may that be by setting a block that later hatches or dropping an egg that has to be placed. ++ * ++ * @return The "mother" entity. ++ */ ++ @NotNull ++ public LivingEntity getMother() { ++ return this.mother; ++ } ++ ++ /** ++ * Provides the "father" entity in the fertilization process that is not responsible for initiating the offspring ++ * creation. ++ * ++ * @return the other parent ++ */ ++ @NotNull ++ public LivingEntity getFather() { ++ return this.father; ++ } ++ ++ /** ++ * Gets the Entity responsible for fertilization. Breeder is {@code null} for spontaneous ++ * conception. ++ * ++ * @return The Entity who initiated fertilization. ++ */ ++ @Nullable ++ public Player getBreeder() { ++ return this.breeder; ++ } ++ ++ /** ++ * The ItemStack that was used to initiate fertilization, if present. ++ * ++ * @return ItemStack used to initiate fertilization. ++ */ ++ @Nullable ++ public ItemStack getBredWith() { ++ return this.bredWith; ++ } ++ ++ /** ++ * Get the amount of experience granted by fertilization. ++ * ++ * @return experience amount ++ */ ++ public int getExperience() { ++ return this.experience; ++ } ++ ++ /** ++ * Set the amount of experience granted by fertilization. ++ * If the amount is negative or zero, no experience will be dropped. ++ * ++ * @param experience experience amount ++ */ ++ public void setExperience(int experience) { ++ this.experience = experience; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0399-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch b/patches/api/0399-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch deleted file mode 100644 index c375206bf7..0000000000 --- a/patches/api/0399-Fix-HandlerList-for-InventoryBlockStartEvent-subclas.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 7 Feb 2023 08:20:27 -0800 -Subject: [PATCH] Fix HandlerList for InventoryBlockStartEvent subclasses - - -diff --git a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -index 37be83184cae203d5e99518b0ff5c708fafb0331..43eac972f45d1cbb6278b048f8e6d7882c0aabeb 100644 ---- a/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/BrewingStartEvent.java -@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; - @org.jetbrains.annotations.ApiStatus.Experimental // Paper - public class BrewingStartEvent extends InventoryBlockStartEvent { - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - remove HandlerList - private int brewingTime; - - public BrewingStartEvent(@NotNull final Block furnace, @NotNull ItemStack source, int brewingTime) { -@@ -37,14 +37,5 @@ public class BrewingStartEvent extends InventoryBlockStartEvent { - this.brewingTime = brewTime; - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - remove HandlerList - } -diff --git a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java -index 2d084214e991fecc51f8e18e3d733e43b1dca248..4b12575107b3f1fa6d0ed7f667bf0d0ae40acae0 100644 ---- a/src/main/java/org/bukkit/event/block/CampfireStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/CampfireStartEvent.java -@@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull; - @org.jetbrains.annotations.ApiStatus.Experimental // Paper - public class CampfireStartEvent extends InventoryBlockStartEvent { - -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - remove HandlerList - private int cookingTime; - private CampfireRecipe campfireRecipe; - -@@ -50,14 +50,5 @@ public class CampfireStartEvent extends InventoryBlockStartEvent { - this.cookingTime = cookTime; - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - remove HandlerList - } -diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -index d386ab5dd46cc6706ace61fe6b646713ffd50cb7..abfd0441f1dd485e59ce5a9f7fca88ffa32e87f7 100644 ---- a/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -+++ b/src/main/java/org/bukkit/event/inventory/FurnaceStartSmeltEvent.java -@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; - * {@link org.bukkit.block.Smoker}, and {@link org.bukkit.block.BlastFurnace}. - */ - public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { -- private static final HandlerList handlers = new HandlerList(); -+ // Paper - remove HandlerList - private final CookingRecipe recipe; - private int totalCookTime; - -@@ -59,14 +59,5 @@ public class FurnaceStartSmeltEvent extends InventoryBlockStartEvent { - this.totalCookTime = cookTime; - } - -- @NotNull -- @Override -- public HandlerList getHandlers() { -- return handlers; -- } -- -- @NotNull -- public static HandlerList getHandlerList() { -- return handlers; -- } -+ // Paper - remove HandlerList - } diff --git a/patches/api/0400-Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/api/0400-Add-CompostItemEvent-and-EntityCompostItemEvent.patch new file mode 100644 index 0000000000..9dee250212 --- /dev/null +++ b/patches/api/0400-Add-CompostItemEvent-and-EntityCompostItemEvent.patch @@ -0,0 +1,130 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Noah van der Aa +Date: Sat, 7 Aug 2021 15:11:27 +0200 +Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..29f21c03cc063a279ca4ae0be00e9ef43f45be9a +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.bukkit.event.inventory.InventoryMoveItemEvent; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when an item is about to be composted by a hopper. ++ * To prevent hoppers from moving items into composters, cancel the {@link InventoryMoveItemEvent}. ++ */ ++public class CompostItemEvent extends BlockEvent { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final ItemStack item; ++ private boolean willRaiseLevel; ++ ++ @ApiStatus.Internal ++ public CompostItemEvent(@NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) { ++ super(composter); ++ this.item = item; ++ this.willRaiseLevel = willRaiseLevel; ++ } ++ ++ /** ++ * Gets the item that was used on the composter. ++ * ++ * @return the item ++ */ ++ @NotNull ++ public ItemStack getItem() { ++ return this.item; ++ } ++ ++ /** ++ * Gets whether the composter will rise a level. ++ * ++ * @return {@code true} if successful ++ */ ++ public boolean willRaiseLevel() { ++ return this.willRaiseLevel; ++ } ++ ++ /** ++ * Sets whether the composter will rise a level. ++ * ++ * @param willRaiseLevel {@code true} if the composter should rise a level ++ */ ++ public void setWillRaiseLevel(boolean willRaiseLevel) { ++ this.willRaiseLevel = willRaiseLevel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++} +diff --git a/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..ba8473ec936b1cea8b13b269283c377cb1b6da0b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java +@@ -0,0 +1,45 @@ ++package io.papermc.paper.event.entity; ++ ++import io.papermc.paper.event.block.CompostItemEvent; ++import org.bukkit.block.Block; ++import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.inventory.ItemStack; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Called when an item is about to be composted by an entity. ++ */ ++public class EntityCompostItemEvent extends CompostItemEvent implements Cancellable { ++ ++ private final Entity entity; ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public EntityCompostItemEvent(@NotNull Entity entity, @NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) { ++ super(composter, item, willRaiseLevel); ++ this.entity = entity; ++ } ++ ++ /** ++ * Gets the entity that interacted with the composter. ++ * ++ * @return the entity that composted an item. ++ */ ++ @NotNull ++ public Entity getEntity() { ++ return this.entity; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++} diff --git a/patches/api/0400-Add-EntityFertilizeEggEvent.patch b/patches/api/0400-Add-EntityFertilizeEggEvent.patch deleted file mode 100644 index 4ae6ff9f0f..0000000000 --- a/patches/api/0400-Add-EntityFertilizeEggEvent.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Fri, 24 Jun 2022 11:56:32 +0200 -Subject: [PATCH] Add EntityFertilizeEggEvent - - -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9b87d7ae8 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java -@@ -0,0 +1,139 @@ -+package io.papermc.paper.event.entity; -+ -+import org.bukkit.Material; -+import org.bukkit.entity.LivingEntity; -+import org.bukkit.entity.Player; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.entity.EntityBreedEvent; -+import org.bukkit.event.entity.EntityEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called when two entities mate and the mating process results in a fertilization. -+ * Fertilization differs from normal breeding, as represented by the {@link EntityBreedEvent}, as -+ * it does not result in the immediate creation of the child entity in the world. -+ *

    -+ * An example of this would be: -+ *

      -+ *
    • A frog being marked as "is_pregnant" and laying {@link Material#FROGSPAWN} later.
    • -+ *
    • Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.
    • -+ *
    • A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.
    • -+ *
    -+ * -+ * The event hence only exposes the two parent entities in the fertilization process and cannot provide the child entity, as it will only exist at a later point in time. -+ */ -+public class EntityFertilizeEggEvent extends EntityEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final LivingEntity mother; -+ private final LivingEntity father; -+ private final Player breeder; -+ private final ItemStack bredWith; -+ private int experience; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityFertilizeEggEvent(@NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable Player breeder, @Nullable ItemStack bredWith, int experience) { -+ super(mother); -+ this.mother = mother; -+ this.father = father; -+ this.breeder = breeder; -+ this.bredWith = bredWith; -+ this.experience = experience; -+ } -+ -+ @NotNull -+ @Override -+ public LivingEntity getEntity() { -+ return (LivingEntity) super.getEntity(); -+ } -+ -+ /** -+ * Provides the entity in the fertilization process that will eventually be responsible for "creating" offspring, -+ * may that be by setting a block that later hatches or dropping an egg that has to be placed. -+ * -+ * @return The "mother" entity. -+ */ -+ @NotNull -+ public LivingEntity getMother() { -+ return this.mother; -+ } -+ -+ /** -+ * Provides the "father" entity in the fertilization process that is not responsible for initiating the offspring -+ * creation. -+ * -+ * @return the other parent -+ */ -+ @NotNull -+ public LivingEntity getFather() { -+ return this.father; -+ } -+ -+ /** -+ * Gets the Entity responsible for fertilization. Breeder is {@code null} for spontaneous -+ * conception. -+ * -+ * @return The Entity who initiated fertilization. -+ */ -+ @Nullable -+ public Player getBreeder() { -+ return this.breeder; -+ } -+ -+ /** -+ * The ItemStack that was used to initiate fertilization, if present. -+ * -+ * @return ItemStack used to initiate fertilization. -+ */ -+ @Nullable -+ public ItemStack getBredWith() { -+ return this.bredWith; -+ } -+ -+ /** -+ * Get the amount of experience granted by fertilization. -+ * -+ * @return experience amount -+ */ -+ public int getExperience() { -+ return this.experience; -+ } -+ -+ /** -+ * Set the amount of experience granted by fertilization. -+ * If the amount is negative or zero, no experience will be dropped. -+ * -+ * @param experience experience amount -+ */ -+ public void setExperience(int experience) { -+ this.experience = experience; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0401-Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/api/0401-Add-CompostItemEvent-and-EntityCompostItemEvent.patch deleted file mode 100644 index 9dee250212..0000000000 --- a/patches/api/0401-Add-CompostItemEvent-and-EntityCompostItemEvent.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa -Date: Sat, 7 Aug 2021 15:11:27 +0200 -Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent - - -diff --git a/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..29f21c03cc063a279ca4ae0be00e9ef43f45be9a ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java -@@ -0,0 +1,67 @@ -+package io.papermc.paper.event.block; -+ -+import org.bukkit.block.Block; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.block.BlockEvent; -+import org.bukkit.event.inventory.InventoryMoveItemEvent; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when an item is about to be composted by a hopper. -+ * To prevent hoppers from moving items into composters, cancel the {@link InventoryMoveItemEvent}. -+ */ -+public class CompostItemEvent extends BlockEvent { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final ItemStack item; -+ private boolean willRaiseLevel; -+ -+ @ApiStatus.Internal -+ public CompostItemEvent(@NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) { -+ super(composter); -+ this.item = item; -+ this.willRaiseLevel = willRaiseLevel; -+ } -+ -+ /** -+ * Gets the item that was used on the composter. -+ * -+ * @return the item -+ */ -+ @NotNull -+ public ItemStack getItem() { -+ return this.item; -+ } -+ -+ /** -+ * Gets whether the composter will rise a level. -+ * -+ * @return {@code true} if successful -+ */ -+ public boolean willRaiseLevel() { -+ return this.willRaiseLevel; -+ } -+ -+ /** -+ * Sets whether the composter will rise a level. -+ * -+ * @param willRaiseLevel {@code true} if the composter should rise a level -+ */ -+ public void setWillRaiseLevel(boolean willRaiseLevel) { -+ this.willRaiseLevel = willRaiseLevel; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+} -diff --git a/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ba8473ec936b1cea8b13b269283c377cb1b6da0b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java -@@ -0,0 +1,45 @@ -+package io.papermc.paper.event.entity; -+ -+import io.papermc.paper.event.block.CompostItemEvent; -+import org.bukkit.block.Block; -+import org.bukkit.entity.Entity; -+import org.bukkit.event.Cancellable; -+import org.bukkit.inventory.ItemStack; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Called when an item is about to be composted by an entity. -+ */ -+public class EntityCompostItemEvent extends CompostItemEvent implements Cancellable { -+ -+ private final Entity entity; -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public EntityCompostItemEvent(@NotNull Entity entity, @NotNull Block composter, @NotNull ItemStack item, boolean willRaiseLevel) { -+ super(composter, item, willRaiseLevel); -+ this.entity = entity; -+ } -+ -+ /** -+ * Gets the entity that interacted with the composter. -+ * -+ * @return the entity that composted an item. -+ */ -+ @NotNull -+ public Entity getEntity() { -+ return this.entity; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+} diff --git a/patches/api/0401-Add-Shearable-API.patch b/patches/api/0401-Add-Shearable-API.patch new file mode 100644 index 0000000000..19ef9a4a36 --- /dev/null +++ b/patches/api/0401-Add-Shearable-API.patch @@ -0,0 +1,94 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Sun, 17 Oct 2021 15:39:41 -0400 +Subject: [PATCH] Add Shearable API + + +diff --git a/src/main/java/io/papermc/paper/entity/Shearable.java b/src/main/java/io/papermc/paper/entity/Shearable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0d5793790ab6a47525ad33033517361205756338 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/Shearable.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.entity; ++ ++import net.kyori.adventure.sound.Sound; ++import org.bukkit.entity.Entity; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents an entity that can be sheared. ++ */ ++public interface Shearable extends Entity { ++ ++ /** ++ * Forces the entity to be sheared and then play the effect as if it were sheared by a player. ++ * This will cause the entity to be sheared, even if {@link Shearable#readyToBeSheared()} is false. ++ *

    ++ * Some shearing behavior may cause the entity to no longer be valid ++ * due to it being replaced by a different entity. ++ */ ++ default void shear() { ++ this.shear(Sound.Source.PLAYER); ++ } ++ ++ /** ++ * Forces the entity to be sheared and then play the effect as if it were sheared by the provided source. ++ * This will cause the entity to be sheared, even if {@link Shearable#readyToBeSheared()} is false. ++ *

    ++ * Some shearing behavior may cause the entity to no longer be valid ++ * due to it being replaced by a different entity. ++ *

    ++ * This simulates the behavior of an actual shearing, which may cause events like EntityTransformEvent to be called ++ * for mooshrooms, and EntityDropItemEvent to be called for sheep. ++ * ++ * @param source Sound source to play any sound effects on ++ */ ++ void shear(@NotNull Sound.Source source); ++ ++ /** ++ * Gets if the entity would be able to be sheared or not naturally using shears. ++ * ++ * @return if the entity can be sheared ++ */ ++ boolean readyToBeSheared(); ++} +diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java +index cef1700834643fe28ed5737578d91ecefbe99e2f..86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454 100644 +--- a/src/main/java/org/bukkit/entity/MushroomCow.java ++++ b/src/main/java/org/bukkit/entity/MushroomCow.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a mushroom {@link Cow} + */ +-public interface MushroomCow extends Cow { ++public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // Paper + + /** + * Checks for the presence of custom potion effects to be applied to the +diff --git a/src/main/java/org/bukkit/entity/Sheep.java b/src/main/java/org/bukkit/entity/Sheep.java +index f4ce312ccd927a8b64f4266b35a0a53b85e591f3..97388d46cee225dedc0b61a12e7b60b3424732c8 100644 +--- a/src/main/java/org/bukkit/entity/Sheep.java ++++ b/src/main/java/org/bukkit/entity/Sheep.java +@@ -5,7 +5,7 @@ import org.bukkit.material.Colorable; + /** + * Represents a Sheep. + */ +-public interface Sheep extends Animals, Colorable { ++public interface Sheep extends Animals, Colorable, io.papermc.paper.entity.Shearable { // Paper - Shear API + + /** + * @return Whether the sheep is sheared. +diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java +index 10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29..7fbfdb07585c7b28acea1f0c1f58ada0cc744441 100644 +--- a/src/main/java/org/bukkit/entity/Snowman.java ++++ b/src/main/java/org/bukkit/entity/Snowman.java +@@ -5,7 +5,7 @@ import com.destroystokyo.paper.entity.RangedEntity; + /** + * Represents a snowman entity + */ +-public interface Snowman extends Golem, RangedEntity { // Paper ++public interface Snowman extends Golem, RangedEntity, io.papermc.paper.entity.Shearable { // Paper + + /** + * Gets whether this snowman is in "derp mode", meaning it is not wearing a diff --git a/patches/api/0402-Add-Shearable-API.patch b/patches/api/0402-Add-Shearable-API.patch deleted file mode 100644 index 19ef9a4a36..0000000000 --- a/patches/api/0402-Add-Shearable-API.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Sun, 17 Oct 2021 15:39:41 -0400 -Subject: [PATCH] Add Shearable API - - -diff --git a/src/main/java/io/papermc/paper/entity/Shearable.java b/src/main/java/io/papermc/paper/entity/Shearable.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0d5793790ab6a47525ad33033517361205756338 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/entity/Shearable.java -@@ -0,0 +1,43 @@ -+package io.papermc.paper.entity; -+ -+import net.kyori.adventure.sound.Sound; -+import org.bukkit.entity.Entity; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents an entity that can be sheared. -+ */ -+public interface Shearable extends Entity { -+ -+ /** -+ * Forces the entity to be sheared and then play the effect as if it were sheared by a player. -+ * This will cause the entity to be sheared, even if {@link Shearable#readyToBeSheared()} is false. -+ *

    -+ * Some shearing behavior may cause the entity to no longer be valid -+ * due to it being replaced by a different entity. -+ */ -+ default void shear() { -+ this.shear(Sound.Source.PLAYER); -+ } -+ -+ /** -+ * Forces the entity to be sheared and then play the effect as if it were sheared by the provided source. -+ * This will cause the entity to be sheared, even if {@link Shearable#readyToBeSheared()} is false. -+ *

    -+ * Some shearing behavior may cause the entity to no longer be valid -+ * due to it being replaced by a different entity. -+ *

    -+ * This simulates the behavior of an actual shearing, which may cause events like EntityTransformEvent to be called -+ * for mooshrooms, and EntityDropItemEvent to be called for sheep. -+ * -+ * @param source Sound source to play any sound effects on -+ */ -+ void shear(@NotNull Sound.Source source); -+ -+ /** -+ * Gets if the entity would be able to be sheared or not naturally using shears. -+ * -+ * @return if the entity can be sheared -+ */ -+ boolean readyToBeSheared(); -+} -diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java -index cef1700834643fe28ed5737578d91ecefbe99e2f..86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454 100644 ---- a/src/main/java/org/bukkit/entity/MushroomCow.java -+++ b/src/main/java/org/bukkit/entity/MushroomCow.java -@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; - /** - * Represents a mushroom {@link Cow} - */ --public interface MushroomCow extends Cow { -+public interface MushroomCow extends Cow, io.papermc.paper.entity.Shearable { // Paper - - /** - * Checks for the presence of custom potion effects to be applied to the -diff --git a/src/main/java/org/bukkit/entity/Sheep.java b/src/main/java/org/bukkit/entity/Sheep.java -index f4ce312ccd927a8b64f4266b35a0a53b85e591f3..97388d46cee225dedc0b61a12e7b60b3424732c8 100644 ---- a/src/main/java/org/bukkit/entity/Sheep.java -+++ b/src/main/java/org/bukkit/entity/Sheep.java -@@ -5,7 +5,7 @@ import org.bukkit.material.Colorable; - /** - * Represents a Sheep. - */ --public interface Sheep extends Animals, Colorable { -+public interface Sheep extends Animals, Colorable, io.papermc.paper.entity.Shearable { // Paper - Shear API - - /** - * @return Whether the sheep is sheared. -diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java -index 10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29..7fbfdb07585c7b28acea1f0c1f58ada0cc744441 100644 ---- a/src/main/java/org/bukkit/entity/Snowman.java -+++ b/src/main/java/org/bukkit/entity/Snowman.java -@@ -5,7 +5,7 @@ import com.destroystokyo.paper.entity.RangedEntity; - /** - * Represents a snowman entity - */ --public interface Snowman extends Golem, RangedEntity { // Paper -+public interface Snowman extends Golem, RangedEntity, io.papermc.paper.entity.Shearable { // Paper - - /** - * Gets whether this snowman is in "derp mode", meaning it is not wearing a diff --git a/patches/api/0402-Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/api/0402-Fix-SpawnEggMeta-get-setSpawnedType.patch new file mode 100644 index 0000000000..27abcd1f93 --- /dev/null +++ b/patches/api/0402-Fix-SpawnEggMeta-get-setSpawnedType.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 26 Feb 2023 07:14:19 -0800 +Subject: [PATCH] Fix SpawnEggMeta#get/setSpawnedType + + +diff --git a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java +index b3447e22ab880eef7e84ba3c2f0cd6d5d0323d32..35deb3519f46047009b529d6a80517e25e6cf20a 100644 +--- a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java +@@ -17,7 +17,7 @@ public interface SpawnEggMeta extends ItemMeta { + * @return The entity type. May be null for implementation specific default. + * @deprecated different types are different items + */ +- @Deprecated ++ @Deprecated(forRemoval = true) // Paper + @Contract("-> fail") + EntityType getSpawnedType(); + +@@ -28,7 +28,7 @@ public interface SpawnEggMeta extends ItemMeta { + * default. + * @deprecated different types are different items + */ +- @Deprecated ++ @Deprecated(forRemoval = true) // Paper + @Contract("_ -> fail") + void setSpawnedType(EntityType type); + +@@ -54,6 +54,22 @@ public interface SpawnEggMeta extends ItemMeta { + */ + void setSpawnedEntity(@NotNull EntitySnapshot snapshot); + ++ // Paper start ++ /** ++ * Get the custom type of entity this egg will spawn. ++ * ++ * @return the entity type or null if no custom type is set ++ */ ++ @org.jetbrains.annotations.Nullable EntityType getCustomSpawnedType(); ++ ++ /** ++ * Set the custom type of entity this egg will spawn. ++ * ++ * @param type the entity type or null to clear the custom type ++ */ ++ void setCustomSpawnedType(@org.jetbrains.annotations.Nullable EntityType type); ++ // Paper end ++ + @NotNull + @Override + SpawnEggMeta clone(); diff --git a/patches/api/0403-Add-Mob-Experience-reward-API.patch b/patches/api/0403-Add-Mob-Experience-reward-API.patch new file mode 100644 index 0000000000..2e3a09921e --- /dev/null +++ b/patches/api/0403-Add-Mob-Experience-reward-API.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: GodOfPro <1387ilia@gmail.com> +Date: Tue, 11 Apr 2023 16:30:58 +0430 +Subject: [PATCH] Add Mob Experience reward API + + +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 0c511b64672f9bafb92be3aea6bab8c1c12a7041..30ef0c20df8ff2ed56adb40fea103265dd3e886c 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -212,4 +212,13 @@ public interface Mob extends LivingEntity, Lootable { + */ + public void setLeftHanded(boolean leftHanded); + // Paper end ++ ++ // Paper start ++ /** ++ * Gets the amount of experience the mob will possibly drop. This value is randomized and it can give different results ++ * ++ * @return the amount of experience the mob will possibly drop ++ */ ++ public int getPossibleExperienceReward(); ++ // Paper end + } diff --git a/patches/api/0403-Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/api/0403-Fix-SpawnEggMeta-get-setSpawnedType.patch deleted file mode 100644 index 27abcd1f93..0000000000 --- a/patches/api/0403-Fix-SpawnEggMeta-get-setSpawnedType.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sun, 26 Feb 2023 07:14:19 -0800 -Subject: [PATCH] Fix SpawnEggMeta#get/setSpawnedType - - -diff --git a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java -index b3447e22ab880eef7e84ba3c2f0cd6d5d0323d32..35deb3519f46047009b529d6a80517e25e6cf20a 100644 ---- a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java -@@ -17,7 +17,7 @@ public interface SpawnEggMeta extends ItemMeta { - * @return The entity type. May be null for implementation specific default. - * @deprecated different types are different items - */ -- @Deprecated -+ @Deprecated(forRemoval = true) // Paper - @Contract("-> fail") - EntityType getSpawnedType(); - -@@ -28,7 +28,7 @@ public interface SpawnEggMeta extends ItemMeta { - * default. - * @deprecated different types are different items - */ -- @Deprecated -+ @Deprecated(forRemoval = true) // Paper - @Contract("_ -> fail") - void setSpawnedType(EntityType type); - -@@ -54,6 +54,22 @@ public interface SpawnEggMeta extends ItemMeta { - */ - void setSpawnedEntity(@NotNull EntitySnapshot snapshot); - -+ // Paper start -+ /** -+ * Get the custom type of entity this egg will spawn. -+ * -+ * @return the entity type or null if no custom type is set -+ */ -+ @org.jetbrains.annotations.Nullable EntityType getCustomSpawnedType(); -+ -+ /** -+ * Set the custom type of entity this egg will spawn. -+ * -+ * @param type the entity type or null to clear the custom type -+ */ -+ void setCustomSpawnedType(@org.jetbrains.annotations.Nullable EntityType type); -+ // Paper end -+ - @NotNull - @Override - SpawnEggMeta clone(); diff --git a/patches/api/0404-Add-Mob-Experience-reward-API.patch b/patches/api/0404-Add-Mob-Experience-reward-API.patch deleted file mode 100644 index 2e3a09921e..0000000000 --- a/patches/api/0404-Add-Mob-Experience-reward-API.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: GodOfPro <1387ilia@gmail.com> -Date: Tue, 11 Apr 2023 16:30:58 +0430 -Subject: [PATCH] Add Mob Experience reward API - - -diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java -index 0c511b64672f9bafb92be3aea6bab8c1c12a7041..30ef0c20df8ff2ed56adb40fea103265dd3e886c 100644 ---- a/src/main/java/org/bukkit/entity/Mob.java -+++ b/src/main/java/org/bukkit/entity/Mob.java -@@ -212,4 +212,13 @@ public interface Mob extends LivingEntity, Lootable { - */ - public void setLeftHanded(boolean leftHanded); - // Paper end -+ -+ // Paper start -+ /** -+ * Gets the amount of experience the mob will possibly drop. This value is randomized and it can give different results -+ * -+ * @return the amount of experience the mob will possibly drop -+ */ -+ public int getPossibleExperienceReward(); -+ // Paper end - } diff --git a/patches/api/0404-Expand-PlayerItemMendEvent.patch b/patches/api/0404-Expand-PlayerItemMendEvent.patch new file mode 100644 index 0000000000..223922e05e --- /dev/null +++ b/patches/api/0404-Expand-PlayerItemMendEvent.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 20 Jan 2022 18:11:44 -0800 +Subject: [PATCH] Expand PlayerItemMendEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java +index 5b2415c2c92127947a21dfe8d672d2b88ea457df..533531f69a8d549e184161eefe6e5bf8a9e85c05 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java +@@ -23,14 +23,60 @@ public class PlayerItemMendEvent extends PlayerEvent implements Cancellable { + private final ExperienceOrb experienceOrb; + private int repairAmount; + private boolean cancelled; ++ private java.util.function.IntUnaryOperator durabilityToXpOp; // Paper + ++ @Deprecated // Paper + public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull EquipmentSlot slot, @NotNull ExperienceOrb experienceOrb, int repairAmount) { ++ // Paper start ++ this(who, item, slot, experienceOrb, repairAmount, amount -> amount / 2); ++ } ++ ++ @org.jetbrains.annotations.ApiStatus.Internal ++ public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull EquipmentSlot slot, @NotNull ExperienceOrb experienceOrb, int repairAmount, @NotNull java.util.function.IntUnaryOperator durabilityToXpOp) { ++ // Paper end + super(who); + this.item = item; + this.slot = slot; + this.experienceOrb = experienceOrb; + this.repairAmount = repairAmount; ++ // Paper start ++ this.durabilityToXpOp = durabilityToXpOp; ++ } ++ ++ /** ++ * Get the operation used to calculate xp used based on ++ * the set repair amount. Used to calculate how much of ++ * an XP orb will be consumed by this mend operation. ++ * ++ * @return the durability-to-xp operation ++ */ ++ public @NotNull java.util.function.IntUnaryOperator getDurabilityToXpOperation() { ++ return this.durabilityToXpOp; ++ } ++ ++ /** ++ * Sets the operation used to calculate xp used based on ++ * the set repair amount. Used to calculate how much of ++ * an XP orb will be consumed by this mend operation. ++ * ++ * @param durabilityToXpOp the durability-to-xp operation ++ */ ++ public void setDurabilityToXpOperation(@NotNull java.util.function.IntUnaryOperator durabilityToXpOp) { ++ com.google.common.base.Preconditions.checkNotNull(durabilityToXpOp); ++ this.durabilityToXpOp = durabilityToXpOp; ++ } ++ ++ /** ++ * Helper method to get the amount of experience that will be consumed. ++ * This method just returns the result of inputting {@link #getRepairAmount()} ++ * into the function {@link #getDurabilityToXpOperation()}. ++ * ++ * @return the amount of xp that will be consumed ++ */ ++ public int getConsumedExperience() { ++ return this.durabilityToXpOp.applyAsInt(this.getRepairAmount()); + } ++ // Paper end + + @Deprecated + public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull ExperienceOrb experienceOrb, int repairAmount) { diff --git a/patches/api/0405-Add-transient-modifier-API.patch b/patches/api/0405-Add-transient-modifier-API.patch new file mode 100644 index 0000000000..a32e4c86a9 --- /dev/null +++ b/patches/api/0405-Add-transient-modifier-API.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Malfrador +Date: Wed, 31 May 2023 21:25:01 +0200 +Subject: [PATCH] Add transient modifier API + + +diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java +index f08ee26cc4d479e1bfc5264b8cbe721315de91f2..5513174ea545bb5b4fdc028cbaa4c1bb763e2c6d 100644 +--- a/src/main/java/org/bukkit/attribute/AttributeInstance.java ++++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java +@@ -46,6 +46,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/patches/api/0405-Expand-PlayerItemMendEvent.patch b/patches/api/0405-Expand-PlayerItemMendEvent.patch deleted file mode 100644 index 223922e05e..0000000000 --- a/patches/api/0405-Expand-PlayerItemMendEvent.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 20 Jan 2022 18:11:44 -0800 -Subject: [PATCH] Expand PlayerItemMendEvent - - -diff --git a/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java b/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java -index 5b2415c2c92127947a21dfe8d672d2b88ea457df..533531f69a8d549e184161eefe6e5bf8a9e85c05 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerItemMendEvent.java -@@ -23,14 +23,60 @@ public class PlayerItemMendEvent extends PlayerEvent implements Cancellable { - private final ExperienceOrb experienceOrb; - private int repairAmount; - private boolean cancelled; -+ private java.util.function.IntUnaryOperator durabilityToXpOp; // Paper - -+ @Deprecated // Paper - public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull EquipmentSlot slot, @NotNull ExperienceOrb experienceOrb, int repairAmount) { -+ // Paper start -+ this(who, item, slot, experienceOrb, repairAmount, amount -> amount / 2); -+ } -+ -+ @org.jetbrains.annotations.ApiStatus.Internal -+ public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull EquipmentSlot slot, @NotNull ExperienceOrb experienceOrb, int repairAmount, @NotNull java.util.function.IntUnaryOperator durabilityToXpOp) { -+ // Paper end - super(who); - this.item = item; - this.slot = slot; - this.experienceOrb = experienceOrb; - this.repairAmount = repairAmount; -+ // Paper start -+ this.durabilityToXpOp = durabilityToXpOp; -+ } -+ -+ /** -+ * Get the operation used to calculate xp used based on -+ * the set repair amount. Used to calculate how much of -+ * an XP orb will be consumed by this mend operation. -+ * -+ * @return the durability-to-xp operation -+ */ -+ public @NotNull java.util.function.IntUnaryOperator getDurabilityToXpOperation() { -+ return this.durabilityToXpOp; -+ } -+ -+ /** -+ * Sets the operation used to calculate xp used based on -+ * the set repair amount. Used to calculate how much of -+ * an XP orb will be consumed by this mend operation. -+ * -+ * @param durabilityToXpOp the durability-to-xp operation -+ */ -+ public void setDurabilityToXpOperation(@NotNull java.util.function.IntUnaryOperator durabilityToXpOp) { -+ com.google.common.base.Preconditions.checkNotNull(durabilityToXpOp); -+ this.durabilityToXpOp = durabilityToXpOp; -+ } -+ -+ /** -+ * Helper method to get the amount of experience that will be consumed. -+ * This method just returns the result of inputting {@link #getRepairAmount()} -+ * into the function {@link #getDurabilityToXpOperation()}. -+ * -+ * @return the amount of xp that will be consumed -+ */ -+ public int getConsumedExperience() { -+ return this.durabilityToXpOp.applyAsInt(this.getRepairAmount()); - } -+ // Paper end - - @Deprecated - public PlayerItemMendEvent(@NotNull Player who, @NotNull ItemStack item, @NotNull ExperienceOrb experienceOrb, int repairAmount) { diff --git a/patches/api/0406-Add-transient-modifier-API.patch b/patches/api/0406-Add-transient-modifier-API.patch deleted file mode 100644 index a32e4c86a9..0000000000 --- a/patches/api/0406-Add-transient-modifier-API.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Malfrador -Date: Wed, 31 May 2023 21:25:01 +0200 -Subject: [PATCH] Add transient modifier API - - -diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java -index f08ee26cc4d479e1bfc5264b8cbe721315de91f2..5513174ea545bb5b4fdc028cbaa4c1bb763e2c6d 100644 ---- a/src/main/java/org/bukkit/attribute/AttributeInstance.java -+++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java -@@ -46,6 +46,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/patches/api/0406-Properly-remove-the-experimental-smithing-inventory-.patch b/patches/api/0406-Properly-remove-the-experimental-smithing-inventory-.patch new file mode 100644 index 0000000000..3f9c7d07ec --- /dev/null +++ b/patches/api/0406-Properly-remove-the-experimental-smithing-inventory-.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Thu, 8 Jun 2023 14:45:30 -0700 +Subject: [PATCH] Properly remove the experimental smithing 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 f5bdd6b6df126abfa26ce727c80a5772d2ab1a1b..ccb09660e565bc2f7a653bda95fb38caccf7a060 100644 +--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java ++++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java +@@ -156,7 +156,7 @@ public enum InventoryType { + * + * @deprecated use {@link #SMITHING} + */ +- @Deprecated ++ @Deprecated(forRemoval = true) // Paper + SMITHING_NEW(4, "Upgrade Gear"), + ; + +diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java +index 8d14426eb1ebea27058d5f22ea652f22d00fccb9..ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059 100644 +--- a/src/main/java/org/bukkit/inventory/InventoryView.java ++++ b/src/main/java/org/bukkit/inventory/InventoryView.java +@@ -370,7 +370,6 @@ public abstract class InventoryView { + type = InventoryType.SlotType.CRAFTING; + break; + case ANVIL: +- case SMITHING: + case CARTOGRAPHY: + case GRINDSTONE: + case MERCHANT: +@@ -388,6 +387,7 @@ public abstract class InventoryView { + } + break; + case LOOM: ++ case SMITHING: // Paper + case SMITHING_NEW: + if (slot == 3) { + type = InventoryType.SlotType.RESULT; diff --git a/patches/api/0407-Add-method-to-remove-all-active-potion-effects.patch b/patches/api/0407-Add-method-to-remove-all-active-potion-effects.patch new file mode 100644 index 0000000000..65345ce8c8 --- /dev/null +++ b/patches/api/0407-Add-method-to-remove-all-active-potion-effects.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 17 Jun 2023 13:17:20 -0700 +Subject: [PATCH] Add method to remove all active potion effects + + +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 166b816f49d9918768f162b0b7134ffd266280f3..5f070c7563151c40cf4d691fc2a10d8a2766982a 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -657,6 +657,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + @NotNull + public Collection getActivePotionEffects(); + ++ // Paper start - LivingEntity#clearActivePotionEffects(); ++ /** ++ * Removes all active potion effects for this entity. ++ * ++ * @return true if any were removed ++ */ ++ boolean clearActivePotionEffects(); ++ // Paper end ++ + /** + * Checks whether the living entity has block line of sight to another. + *

    diff --git a/patches/api/0407-Properly-remove-the-experimental-smithing-inventory-.patch b/patches/api/0407-Properly-remove-the-experimental-smithing-inventory-.patch deleted file mode 100644 index 3f9c7d07ec..0000000000 --- a/patches/api/0407-Properly-remove-the-experimental-smithing-inventory-.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Thu, 8 Jun 2023 14:45:30 -0700 -Subject: [PATCH] Properly remove the experimental smithing 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 f5bdd6b6df126abfa26ce727c80a5772d2ab1a1b..ccb09660e565bc2f7a653bda95fb38caccf7a060 100644 ---- a/src/main/java/org/bukkit/event/inventory/InventoryType.java -+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java -@@ -156,7 +156,7 @@ public enum InventoryType { - * - * @deprecated use {@link #SMITHING} - */ -- @Deprecated -+ @Deprecated(forRemoval = true) // Paper - SMITHING_NEW(4, "Upgrade Gear"), - ; - -diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java -index 8d14426eb1ebea27058d5f22ea652f22d00fccb9..ac6c5c7a58c2c88b6cb0f6632fb53e8d67f8a059 100644 ---- a/src/main/java/org/bukkit/inventory/InventoryView.java -+++ b/src/main/java/org/bukkit/inventory/InventoryView.java -@@ -370,7 +370,6 @@ public abstract class InventoryView { - type = InventoryType.SlotType.CRAFTING; - break; - case ANVIL: -- case SMITHING: - case CARTOGRAPHY: - case GRINDSTONE: - case MERCHANT: -@@ -388,6 +387,7 @@ public abstract class InventoryView { - } - break; - case LOOM: -+ case SMITHING: // Paper - case SMITHING_NEW: - if (slot == 3) { - type = InventoryType.SlotType.RESULT; diff --git a/patches/api/0408-Add-method-to-remove-all-active-potion-effects.patch b/patches/api/0408-Add-method-to-remove-all-active-potion-effects.patch deleted file mode 100644 index 65345ce8c8..0000000000 --- a/patches/api/0408-Add-method-to-remove-all-active-potion-effects.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 17 Jun 2023 13:17:20 -0700 -Subject: [PATCH] Add method to remove all active potion effects - - -diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 166b816f49d9918768f162b0b7134ffd266280f3..5f070c7563151c40cf4d691fc2a10d8a2766982a 100644 ---- a/src/main/java/org/bukkit/entity/LivingEntity.java -+++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -657,6 +657,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - @NotNull - public Collection getActivePotionEffects(); - -+ // Paper start - LivingEntity#clearActivePotionEffects(); -+ /** -+ * Removes all active potion effects for this entity. -+ * -+ * @return true if any were removed -+ */ -+ boolean clearActivePotionEffects(); -+ // Paper end -+ - /** - * Checks whether the living entity has block line of sight to another. - *

    diff --git a/patches/api/0408-Folia-scheduler-and-owned-region-API.patch b/patches/api/0408-Folia-scheduler-and-owned-region-API.patch new file mode 100644 index 0000000000..ef56eaab1c --- /dev/null +++ b/patches/api/0408-Folia-scheduler-and-owned-region-API.patch @@ -0,0 +1,790 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sat, 17 Jun 2023 11:52:41 +0200 +Subject: [PATCH] Folia scheduler and owned region API + +Pulling Folia API to Paper is primarily intended for plugins +that want to target both Paper and Folia without unnecessary +compatibility layers. + +Add both a location based scheduler, an entity based scheduler, +and a global region scheduler. + +Owned region API may be useful for plugins which want to perform +operations over large areas outside of the buffer zone provided +by the regionaliser, as it is not guaranteed that anything +outside of the buffer zone is owned. Then, the plugins may use +the schedulers depending on the result of the ownership check. + +diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e6cb733ed +--- /dev/null ++++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java +@@ -0,0 +1,51 @@ ++package io.papermc.paper.threadedregions.scheduler; ++ ++import org.bukkit.plugin.Plugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.concurrent.TimeUnit; ++import java.util.function.Consumer; ++ ++/** ++ * Scheduler that may be used by plugins to schedule tasks to execute asynchronously from the server tick process. ++ */ ++public interface AsyncScheduler { ++ ++ /** ++ * Schedules the specified task to be executed asynchronously immediately. ++ * @param plugin Plugin which owns the specified task. ++ * @param task Specified task. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runNow(@NotNull Plugin plugin, @NotNull Consumer task); ++ ++ /** ++ * Schedules the specified task to be executed asynchronously after the time delay has passed. ++ * @param plugin Plugin which owns the specified task. ++ * @param task Specified task. ++ * @param delay The time delay to pass before the task should be executed. ++ * @param unit The time unit for the time delay. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer task, long delay, ++ @NotNull TimeUnit unit); ++ ++ /** ++ * Schedules the specified task to be executed asynchronously after the initial delay has passed, ++ * and then periodically executed with the specified period. ++ * @param plugin Plugin which owns the specified task. ++ * @param task Specified task. ++ * @param initialDelay The time delay to pass before the first execution of the task. ++ * @param period The time between task executions after the first execution of the task. ++ * @param unit The time unit for the initial delay and period. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer task, ++ long initialDelay, long period, @NotNull TimeUnit unit); ++ ++ /** ++ * Attempts to cancel all tasks scheduled by the specified plugin. ++ * @param plugin Specified plugin. ++ */ ++ void cancelTasks(@NotNull Plugin plugin); ++} +diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d12187ba6c987 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java +@@ -0,0 +1,104 @@ ++package io.papermc.paper.threadedregions.scheduler; ++ ++import org.bukkit.plugin.Plugin; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.function.Consumer; ++ ++/** ++ * An entity can move between worlds with an arbitrary tick delay, be temporarily removed ++ * for players (i.e end credits), be partially removed from world state (i.e inactive but not removed), ++ * teleport between ticking regions, teleport between worlds, and even be removed entirely from the server. ++ * The uncertainty of an entity's state can make it difficult to schedule tasks without worrying about undefined ++ * behaviors resulting from any of the states listed previously. ++ * ++ *

    ++ * This class is designed to eliminate those states by providing an interface to run tasks only when an entity ++ * is contained in a world, on the owning thread for the region, and by providing the current Entity object. ++ * The scheduler also allows a task to provide a callback, the "retired" callback, that will be invoked ++ * if the entity is removed before a task that was scheduled could be executed. The scheduler is also ++ * completely thread-safe, allowing tasks to be scheduled from any thread context. The scheduler also indicates ++ * properly whether a task was scheduled successfully (i.e scheduler not retired), thus the code scheduling any task ++ * knows whether the given callbacks will be invoked eventually or not - which may be critical for off-thread ++ * contexts. ++ *

    ++ */ ++public interface EntityScheduler { ++ ++ /** ++ * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity ++ * removed), then returns {@code false}. Otherwise, either the run callback will be invoked after the specified delay, ++ * or the retired callback will be invoked if the scheduler is retired. ++ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove ++ * other entities, load chunks, load worlds, modify ticket levels, etc. ++ * ++ *

    ++ * It is guaranteed that the run and retired callback are invoked on the region which owns the entity. ++ *

    ++ * @param run The callback to run after the specified delay, may not be null. ++ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. ++ * @param delay The delay in ticks before the run callback is invoked. Any value less-than 1 is treated as 1. ++ * @return {@code true} if the task was scheduled, which means that either the run function or the retired function ++ * will be invoked (but never both), or {@code false} indicating neither the run nor retired function will be invoked ++ * since the scheduler has been retired. ++ */ ++ boolean execute(@NotNull Plugin plugin, @NotNull Runnable run, @Nullable Runnable retired, long delay); ++ ++ /** ++ * Schedules a task to execute on the next tick. If the task failed to schedule because the scheduler is retired (entity ++ * removed), then returns {@code null}. Otherwise, either the task callback will be invoked after the specified delay, ++ * or the retired callback will be invoked if the scheduler is retired. ++ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove ++ * other entities, load chunks, load worlds, modify ticket levels, etc. ++ * ++ *

    ++ * It is guaranteed that the task and retired callback are invoked on the region which owns the entity. ++ *

    ++ * @param plugin The plugin that owns the task ++ * @param task The task to execute ++ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. ++ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. ++ */ ++ @Nullable ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer task, ++ @Nullable Runnable retired); ++ ++ /** ++ * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity ++ * removed), then returns {@code null}. Otherwise, either the task callback will be invoked after the specified delay, ++ * or the retired callback will be invoked if the scheduler is retired. ++ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove ++ * other entities, load chunks, load worlds, modify ticket levels, etc. ++ * ++ *

    ++ * It is guaranteed that the task and retired callback are invoked on the region which owns the entity. ++ *

    ++ * @param plugin The plugin that owns the task ++ * @param task The task to execute ++ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. ++ * @param delayTicks The delay, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. ++ */ ++ @Nullable ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer task, ++ @Nullable Runnable retired, long delayTicks); ++ ++ /** ++ * Schedules a repeating task with the given delay and period. If the task failed to schedule because the scheduler ++ * is retired (entity removed), then returns {@code null}. Otherwise, either the task callback will be invoked after ++ * the specified delay, or the retired callback will be invoked if the scheduler is retired. ++ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove ++ * other entities, load chunks, load worlds, modify ticket levels, etc. ++ * ++ *

    ++ * It is guaranteed that the task and retired callback are invoked on the region which owns the entity. ++ *

    ++ * @param plugin The plugin that owns the task ++ * @param task The task to execute ++ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. ++ * @param initialDelayTicks The initial delay, in ticks. ++ * @param periodTicks The period, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. ++ */ ++ @Nullable ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer task, ++ @Nullable Runnable retired, long initialDelayTicks, long periodTicks); ++} +diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..365b53fea8dee09cdc11f4399dea5f00c6ee70e2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java +@@ -0,0 +1,58 @@ ++package io.papermc.paper.threadedregions.scheduler; ++ ++import org.bukkit.plugin.Plugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++/** ++ * The global region task scheduler may be used to schedule tasks that will execute on the global region. ++ *

    ++ * The global region is responsible for maintaining world day time, world game time, weather cycle, ++ * sleep night skipping, executing commands for console, and other misc. tasks that do not belong to any specific region. ++ *

    ++ */ ++public interface GlobalRegionScheduler { ++ ++ /** ++ * Schedules a task to be executed on the global region. ++ * @param plugin The plugin that owns the task ++ * @param run The task to execute ++ */ ++ void execute(@NotNull Plugin plugin, @NotNull Runnable run); ++ ++ /** ++ * Schedules a task to be executed on the global region on the next tick. ++ * @param plugin The plugin that owns the task ++ * @param task The task to execute ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer task); ++ ++ /** ++ * Schedules a task to be executed on the global region after the specified delay in ticks. ++ * @param plugin The plugin that owns the task ++ * @param task The task to execute ++ * @param delayTicks The delay, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer task, long delayTicks); ++ ++ /** ++ * Schedules a repeating task to be executed on the global region after the initial delay with the ++ * specified period. ++ * @param plugin The plugin that owns the task ++ * @param task The task to execute ++ * @param initialDelayTicks The initial delay, in ticks. ++ * @param periodTicks The period, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer task, ++ long initialDelayTicks, long periodTicks); ++ ++ /** ++ * Attempts to cancel all tasks scheduled by the specified plugin. ++ * @param plugin Specified plugin. ++ */ ++ void cancelTasks(@NotNull Plugin plugin); ++} +diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/RegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/RegionScheduler.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7557e170f84cde7292869fbd92b44b0e6eb43b4f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/RegionScheduler.java +@@ -0,0 +1,127 @@ ++package io.papermc.paper.threadedregions.scheduler; ++ ++import org.bukkit.Location; ++import org.bukkit.World; ++import org.bukkit.entity.Entity; ++import org.bukkit.plugin.Plugin; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++/** ++ * The region task scheduler can be used to schedule tasks by location to be executed on the region which owns the location. ++ *

    ++ * Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities. ++ * If you wish to schedule tasks to perform actions on entities, you should be using {@link Entity#getScheduler()} ++ * as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler ++ * will not. ++ *

    ++ */ ++public interface RegionScheduler { ++ ++ /** ++ * Schedules a task to be executed on the region which owns the location. ++ * ++ * @param plugin The plugin that owns the task ++ * @param world The world of the region that owns the task ++ * @param chunkX The chunk X coordinate of the region that owns the task ++ * @param chunkZ The chunk Z coordinate of the region that owns the task ++ * @param run The task to execute ++ */ ++ void execute(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Runnable run); ++ ++ /** ++ * Schedules a task to be executed on the region which owns the location. ++ * ++ * @param plugin The plugin that owns the task ++ * @param location The location at which the region executing should own ++ * @param run The task to execute ++ */ ++ default void execute(@NotNull Plugin plugin, @NotNull Location location, @NotNull Runnable run) { ++ this.execute(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, run); ++ } ++ ++ /** ++ * Schedules a task to be executed on the region which owns the location on the next tick. ++ * ++ * @param plugin The plugin that owns the task ++ * @param world The world of the region that owns the task ++ * @param chunkX The chunk X coordinate of the region that owns the task ++ * @param chunkZ The chunk Z coordinate of the region that owns the task ++ * @param task The task to execute ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask run(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer task); ++ ++ /** ++ * Schedules a task to be executed on the region which owns the location on the next tick. ++ * ++ * @param plugin The plugin that owns the task ++ * @param location The location at which the region executing should own ++ * @param task The task to execute ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ default @NotNull ScheduledTask run(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer task) { ++ return this.run(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, task); ++ } ++ ++ /** ++ * Schedules a task to be executed on the region which owns the location after the specified delay in ticks. ++ * ++ * @param plugin The plugin that owns the task ++ * @param world The world of the region that owns the task ++ * @param chunkX The chunk X coordinate of the region that owns the task ++ * @param chunkZ The chunk Z coordinate of the region that owns the task ++ * @param task The task to execute ++ * @param delayTicks The delay, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer task, ++ long delayTicks); ++ ++ /** ++ * Schedules a task to be executed on the region which owns the location after the specified delay in ticks. ++ * ++ * @param plugin The plugin that owns the task ++ * @param location The location at which the region executing should own ++ * @param task The task to execute ++ * @param delayTicks The delay, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ default @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer task, ++ long delayTicks) { ++ return this.runDelayed(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, task, delayTicks); ++ } ++ ++ /** ++ * Schedules a repeating task to be executed on the region which owns the location after the initial delay with the ++ * specified period. ++ * ++ * @param plugin The plugin that owns the task ++ * @param world The world of the region that owns the task ++ * @param chunkX The chunk X coordinate of the region that owns the task ++ * @param chunkZ The chunk Z coordinate of the region that owns the task ++ * @param task The task to execute ++ * @param initialDelayTicks The initial delay, in ticks. ++ * @param periodTicks The period, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer task, ++ long initialDelayTicks, long periodTicks); ++ ++ /** ++ * Schedules a repeating task to be executed on the region which owns the location after the initial delay with the ++ * specified period. ++ * ++ * @param plugin The plugin that owns the task ++ * @param location The location at which the region executing should own ++ * @param task The task to execute ++ * @param initialDelayTicks The initial delay, in ticks. ++ * @param periodTicks The period, in ticks. ++ * @return The {@link ScheduledTask} that represents the scheduled task. ++ */ ++ default @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer task, ++ long initialDelayTicks, long periodTicks) { ++ return this.runAtFixedRate(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, task, initialDelayTicks, periodTicks); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/ScheduledTask.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/ScheduledTask.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045216c249c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/ScheduledTask.java +@@ -0,0 +1,112 @@ ++package io.papermc.paper.threadedregions.scheduler; ++ ++import org.bukkit.plugin.Plugin; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents a task scheduled to a scheduler. ++ */ ++public interface ScheduledTask { ++ ++ /** ++ * Returns the plugin that scheduled this task. ++ * @return the plugin that scheduled this task. ++ */ ++ @NotNull Plugin getOwningPlugin(); ++ ++ /** ++ * Returns whether this task executes on a fixed period, as opposed to executing only once. ++ * @return whether this task executes on a fixed period, as opposed to executing only once. ++ */ ++ boolean isRepeatingTask(); ++ ++ /** ++ * Attempts to cancel this task, returning the result of the attempt. In all cases, if the task is currently ++ * being executed no attempt is made to halt the task, however any executions in the future are halted. ++ * @return the result of the cancellation attempt. ++ */ ++ @NotNull CancelledState cancel(); ++ ++ /** ++ * Returns the current execution state of this task. ++ * @return the current execution state of this task. ++ */ ++ @NotNull ExecutionState getExecutionState(); ++ ++ /** ++ * Returns whether the current execution state is {@link ExecutionState#CANCELLED} or {@link ExecutionState#CANCELLED_RUNNING}. ++ * @return whether the current execution state is {@link ExecutionState#CANCELLED} or {@link ExecutionState#CANCELLED_RUNNING}. ++ */ ++ default boolean isCancelled() { ++ final ExecutionState state = this.getExecutionState(); ++ return state == ExecutionState.CANCELLED || state == ExecutionState.CANCELLED_RUNNING; ++ } ++ ++ /** ++ * Represents the result of attempting to cancel a task. ++ */ ++ enum CancelledState { ++ /** ++ * The task (repeating or not) has been successfully cancelled by the caller thread. The task is not executing ++ * currently, and it will not begin execution in the future. ++ */ ++ CANCELLED_BY_CALLER, ++ /** ++ * The task (repeating or not) is already cancelled. The task is not executing currently, and it will not ++ * begin execution in the future. ++ */ ++ CANCELLED_ALREADY, ++ ++ /** ++ * The task is not a repeating task, and could not be cancelled because the task is being executed. ++ */ ++ RUNNING, ++ /** ++ * The task is not a repeating task, and could not be cancelled because the task has already finished execution. ++ */ ++ ALREADY_EXECUTED, ++ ++ /** ++ * The caller thread successfully stopped future executions of a repeating task, but the task is currently ++ * being executed. ++ */ ++ NEXT_RUNS_CANCELLED, ++ ++ /** ++ * The repeating task's future executions are cancelled already, but the task is currently ++ * being executed. ++ */ ++ NEXT_RUNS_CANCELLED_ALREADY, ++ } ++ ++ /** ++ * Represents the current execution state of the task. ++ */ ++ enum ExecutionState { ++ /** ++ * The task is currently not executing, but may begin execution in the future. ++ */ ++ IDLE, ++ ++ /** ++ * The task is currently executing. ++ */ ++ RUNNING, ++ ++ /** ++ * The task is not repeating, and the task finished executing. ++ */ ++ FINISHED, ++ ++ /** ++ * The task is not executing and will not begin execution in the future. If this task is not repeating, then ++ * this task was never executed. ++ */ ++ CANCELLED, ++ ++ /** ++ * The task is repeating and currently executing, but future executions are cancelled and will not occur. ++ */ ++ CANCELLED_RUNNING; ++ } ++} +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index a1d9663730d5a63685d337f5eba40532b47ffbfc..91476b9e5238caf49492cb23b549c9df6a45ed3e 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -2661,6 +2661,141 @@ public final class Bukkit { + } + // Paper end + ++ // Paper start - Folia region threading API ++ /** ++ * Returns the region task scheduler. The region task scheduler can be used to schedule ++ * tasks by location to be executed on the region which owns the location. ++ *

    ++ * Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities. ++ * If you wish to schedule tasks to perform actions on entities, you should be using {@link Entity#getScheduler()} ++ * as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler ++ * will not. ++ *

    ++ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    ++ * @return the region task scheduler ++ */ ++ public static @NotNull io.papermc.paper.threadedregions.scheduler.RegionScheduler getRegionScheduler() { ++ return server.getRegionScheduler(); ++ } ++ ++ /** ++ * Returns the async task scheduler. The async task scheduler can be used to schedule tasks ++ * that execute asynchronously from the server tick process. ++ * @return the async task scheduler ++ */ ++ public static @NotNull io.papermc.paper.threadedregions.scheduler.AsyncScheduler getAsyncScheduler() { ++ return server.getAsyncScheduler(); ++ } ++ ++ /** ++ * Returns the global region task scheduler. The global task scheduler can be used to schedule ++ * tasks to execute on the global region. ++ *

    ++ * The global region is responsible for maintaining world day time, world game time, weather cycle, ++ * sleep night skipping, executing commands for console, and other misc. tasks that do not belong to any specific region. ++ *

    ++ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    ++ * @return the global region scheduler ++ */ ++ public static @NotNull io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler getGlobalRegionScheduler() { ++ return server.getGlobalRegionScheduler(); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified world and block position. ++ * @param world Specified world. ++ * @param position Specified block position. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position) { ++ return server.isOwnedByCurrentRegion(world, position); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunks centered at the specified block position within the specified square radius. ++ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and ++ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. ++ * @param world Specified world. ++ * @param position Specified block position. ++ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared ++ * radius, but rather a Chebyshev Distance. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position, int squareRadiusChunks) { ++ return server.isOwnedByCurrentRegion(world, position, squareRadiusChunks); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified world and block position as included in the specified location. ++ * @param location Specified location, must have a non-null world. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull Location location) { ++ return server.isOwnedByCurrentRegion(location); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunks centered at the specified world and block position as included in the specified location ++ * within the specified square radius. ++ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and ++ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. ++ * @param location Specified location, must have a non-null world. ++ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared ++ * radius, but rather a Chebyshev Distance. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull Location location, int squareRadiusChunks) { ++ return server.isOwnedByCurrentRegion(location, squareRadiusChunks); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified block position. ++ * @param block Specified block position. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull org.bukkit.block.Block block) { ++ return server.isOwnedByCurrentRegion(block.getLocation()); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified world and chunk position. ++ * @param world Specified world. ++ * @param chunkX Specified x-coordinate of the chunk position. ++ * @param chunkZ Specified z-coordinate of the chunk position. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ) { ++ return server.isOwnedByCurrentRegion(world, chunkX, chunkZ); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunks centered at the specified world and chunk position within the specified ++ * square radius. ++ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and ++ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. ++ * @param world Specified world. ++ * @param chunkX Specified x-coordinate of the chunk position. ++ * @param chunkZ Specified z-coordinate of the chunk position. ++ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared ++ * radius, but rather a Chebyshev Distance. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ, int squareRadiusChunks) { ++ return server.isOwnedByCurrentRegion(world, chunkX, chunkZ, squareRadiusChunks); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the specified entity. Note that this function is the only appropriate method of checking ++ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned ++ * by the current region. ++ * @param entity Specified entity. ++ */ ++ public static boolean isOwnedByCurrentRegion(@NotNull Entity entity) { ++ return server.isOwnedByCurrentRegion(entity); ++ } ++ // Paper end - Folia region threading API ++ + @NotNull + public static Server.Spigot spigot() { + return server.spigot(); +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index d9acfac02a151e084789fb607f49ad511fe4e9de..e0f42b67f41bbba6807fd4ca3a6a546ccdc4b68f 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -2319,4 +2319,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi + */ + @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); + // Paper end ++ ++ // Paper start - Folia region threading API ++ /** ++ * Returns the Folia region task scheduler. The region task scheduler can be used to schedule ++ * tasks by location to be executed on the region which owns the location. ++ *

    ++ * Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities. ++ * If you wish to schedule tasks to perform actions on entities, you should be using {@link Entity#getScheduler()} ++ * as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler ++ * will not. ++ *

    ++ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    ++ * @return the region task scheduler ++ */ ++ @NotNull io.papermc.paper.threadedregions.scheduler.RegionScheduler getRegionScheduler(); ++ ++ /** ++ * Returns the Folia async task scheduler. The async task scheduler can be used to schedule tasks ++ * that execute asynchronously from the server tick process. ++ * @return the async task scheduler ++ */ ++ @NotNull io.papermc.paper.threadedregions.scheduler.AsyncScheduler getAsyncScheduler(); ++ ++ /** ++ * Returns the Folia global region task scheduler. The global task scheduler can be used to schedule ++ * tasks to execute on the global region. ++ *

    ++ * The global region is responsible for maintaining world day time, world game time, weather cycle, ++ * sleep night skipping, executing commands for console, and other misc. tasks that do not belong to any specific region. ++ *

    ++ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    ++ * @return the global region scheduler ++ */ ++ @NotNull io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler getGlobalRegionScheduler(); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified world and block position. ++ * @param world Specified world. ++ * @param position Specified block position. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunks centered at the specified block position within the specified square radius. ++ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and ++ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. ++ * @param world Specified world. ++ * @param position Specified block position. ++ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared ++ * radius, but rather a Chebyshev Distance. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position, int squareRadiusChunks); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified world and block position as included in the specified location. ++ * @param location Specified location, must have a non-null world. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull Location location); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunks centered at the specified world and block position as included in the specified location ++ * within the specified square radius. ++ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and ++ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. ++ * @param location Specified location, must have a non-null world. ++ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared ++ * radius, but rather a Chebyshev Distance. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull Location location, int squareRadiusChunks); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified block position. ++ * @param block Specified block position. ++ */ ++ default boolean isOwnedByCurrentRegion(@NotNull org.bukkit.block.Block block) { ++ return isOwnedByCurrentRegion(block.getLocation()); ++ } ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunk at the specified world and chunk position. ++ * @param world Specified world. ++ * @param chunkX Specified x-coordinate of the chunk position. ++ * @param chunkZ Specified z-coordinate of the chunk position. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the chunks centered at the specified world and chunk position within the specified ++ * square radius. ++ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and ++ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. ++ * @param world Specified world. ++ * @param chunkX Specified x-coordinate of the chunk position. ++ * @param chunkZ Specified z-coordinate of the chunk position. ++ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared ++ * radius, but rather a Chebyshev Distance. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ, int squareRadiusChunks); ++ ++ /** ++ * Returns whether the current thread is ticking a region and that the region being ticked ++ * owns the specified entity. Note that this function is the only appropriate method of checking ++ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned ++ * by the current region. ++ * @param entity Specified entity. ++ */ ++ boolean isOwnedByCurrentRegion(@NotNull Entity entity); ++ // Paper end - Folia region threading API + } +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 9e7b6ed599759de451429c99bc6876b878c1cca2..9a0022f9e77b7e532c0cad9f85620901064e436d 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -1097,4 +1097,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + */ + boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); + // Paper end - Collision API ++ ++ // Paper start - Folia schedulers ++ /** ++ * Returns the task scheduler for this entity. The entity scheduler can be used to schedule tasks ++ * that are guaranteed to always execute on the tick thread that owns the entity. ++ *

    If you do not need/want to make your plugin run on Folia, use {@link org.bukkit.Server#getScheduler()} instead.

    ++ * @return the task scheduler for this entity. ++ * @see io.papermc.paper.threadedregions.scheduler.EntityScheduler ++ */ ++ @NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler(); ++ // Paper end - Folia schedulers + } diff --git a/patches/api/0409-Add-event-for-player-editing-sign.patch b/patches/api/0409-Add-event-for-player-editing-sign.patch new file mode 100644 index 0000000000..b534aebde9 --- /dev/null +++ b/patches/api/0409-Add-event-for-player-editing-sign.patch @@ -0,0 +1,136 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: by77er +Date: Sat, 10 Jun 2023 19:06:24 -0400 +Subject: [PATCH] Add event for player editing sign + + +diff --git a/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c38c32ae349e094ffef84386607f4b9d5fe361f5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java +@@ -0,0 +1,108 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.block.Sign; ++import org.bukkit.block.sign.Side; ++import org.bukkit.entity.HumanEntity; ++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.NotNull; ++ ++/** ++ * Called when a player begins editing a sign's text. ++ *

    ++ * Cancelling this event stops the sign editing menu from opening. ++ */ ++public class PlayerOpenSignEvent extends PlayerEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Sign sign; ++ private final Side side; ++ private final Cause cause; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public PlayerOpenSignEvent(final @NotNull Player editor, final @NotNull Sign sign, final @NotNull Side side, final @NotNull Cause cause) { ++ super(editor); ++ this.sign = sign; ++ this.side = side; ++ this.cause = cause; ++ } ++ ++ /** ++ * Gets the sign that was clicked. ++ * ++ * @return {@link Sign} that was clicked ++ */ ++ @NotNull ++ public Sign getSign() { ++ return this.sign; ++ } ++ ++ /** ++ * Gets which side of the sign was clicked. ++ * ++ * @return {@link Side} that was clicked ++ * @see Sign#getSide(Side) ++ */ ++ @NotNull ++ public Side getSide() { ++ return this.side; ++ } ++ ++ /** ++ * The cause of this sign open. ++ * ++ * @return the cause ++ */ ++ public @NotNull Cause getCause() { ++ return this.cause; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ /** ++ * The cause of the {@link PlayerOpenSignEvent}. ++ */ ++ public enum Cause { ++ /** ++ * The event was triggered by the placement of a sign. ++ */ ++ PLACE, ++ /** ++ * The event was triggered by an interaction with a sign. ++ */ ++ INTERACT, ++ /** ++ * The event was triggered via a plugin with {@link HumanEntity#openSign(Sign, Side)} ++ */ ++ PLUGIN, ++ /** ++ * Fallback cause for any unknown cause. ++ */ ++ UNKNOWN, ++ } ++} +diff --git a/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java b/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java +index ea197b1bc0a41355f8cdda3026f16c55f2d4fac9..62f41dbdf93e1912f4ee1376f000ffdc9073043d 100644 +--- a/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java ++++ b/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java +@@ -10,8 +10,11 @@ import org.jetbrains.annotations.NotNull; + + /** + * This event is fired when a sign is opened by the player. ++ * @deprecated use {@link io.papermc.paper.event.player.PlayerOpenSignEvent} + */ + @ApiStatus.Experimental ++@Deprecated(forRemoval = true) // Paper ++@org.bukkit.Warning(false) // Paper + public class PlayerSignOpenEvent extends PlayerEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0409-Folia-scheduler-and-owned-region-API.patch b/patches/api/0409-Folia-scheduler-and-owned-region-API.patch deleted file mode 100644 index 0cb828dfbf..0000000000 --- a/patches/api/0409-Folia-scheduler-and-owned-region-API.patch +++ /dev/null @@ -1,790 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sat, 17 Jun 2023 11:52:41 +0200 -Subject: [PATCH] Folia scheduler and owned region API - -Pulling Folia API to Paper is primarily intended for plugins -that want to target both Paper and Folia without unnecessary -compatibility layers. - -Add both a location based scheduler, an entity based scheduler, -and a global region scheduler. - -Owned region API may be useful for plugins which want to perform -operations over large areas outside of the buffer zone provided -by the regionaliser, as it is not guaranteed that anything -outside of the buffer zone is owned. Then, the plugins may use -the schedulers depending on the result of the ownership check. - -diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java -new file mode 100644 -index 0000000000000000000000000000000000000000..d9cdd04660c5e60e494a8fed91ae437e6cb733ed ---- /dev/null -+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/AsyncScheduler.java -@@ -0,0 +1,51 @@ -+package io.papermc.paper.threadedregions.scheduler; -+ -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.concurrent.TimeUnit; -+import java.util.function.Consumer; -+ -+/** -+ * Scheduler that may be used by plugins to schedule tasks to execute asynchronously from the server tick process. -+ */ -+public interface AsyncScheduler { -+ -+ /** -+ * Schedules the specified task to be executed asynchronously immediately. -+ * @param plugin Plugin which owns the specified task. -+ * @param task Specified task. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runNow(@NotNull Plugin plugin, @NotNull Consumer task); -+ -+ /** -+ * Schedules the specified task to be executed asynchronously after the time delay has passed. -+ * @param plugin Plugin which owns the specified task. -+ * @param task Specified task. -+ * @param delay The time delay to pass before the task should be executed. -+ * @param unit The time unit for the time delay. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer task, long delay, -+ @NotNull TimeUnit unit); -+ -+ /** -+ * Schedules the specified task to be executed asynchronously after the initial delay has passed, -+ * and then periodically executed with the specified period. -+ * @param plugin Plugin which owns the specified task. -+ * @param task Specified task. -+ * @param initialDelay The time delay to pass before the first execution of the task. -+ * @param period The time between task executions after the first execution of the task. -+ * @param unit The time unit for the initial delay and period. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer task, -+ long initialDelay, long period, @NotNull TimeUnit unit); -+ -+ /** -+ * Attempts to cancel all tasks scheduled by the specified plugin. -+ * @param plugin Specified plugin. -+ */ -+ void cancelTasks(@NotNull Plugin plugin); -+} -diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java -new file mode 100644 -index 0000000000000000000000000000000000000000..9f69e189be8202a0ab1450540f5d12187ba6c987 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/EntityScheduler.java -@@ -0,0 +1,104 @@ -+package io.papermc.paper.threadedregions.scheduler; -+ -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.util.function.Consumer; -+ -+/** -+ * An entity can move between worlds with an arbitrary tick delay, be temporarily removed -+ * for players (i.e end credits), be partially removed from world state (i.e inactive but not removed), -+ * teleport between ticking regions, teleport between worlds, and even be removed entirely from the server. -+ * The uncertainty of an entity's state can make it difficult to schedule tasks without worrying about undefined -+ * behaviors resulting from any of the states listed previously. -+ * -+ *

    -+ * This class is designed to eliminate those states by providing an interface to run tasks only when an entity -+ * is contained in a world, on the owning thread for the region, and by providing the current Entity object. -+ * The scheduler also allows a task to provide a callback, the "retired" callback, that will be invoked -+ * if the entity is removed before a task that was scheduled could be executed. The scheduler is also -+ * completely thread-safe, allowing tasks to be scheduled from any thread context. The scheduler also indicates -+ * properly whether a task was scheduled successfully (i.e scheduler not retired), thus the code scheduling any task -+ * knows whether the given callbacks will be invoked eventually or not - which may be critical for off-thread -+ * contexts. -+ *

    -+ */ -+public interface EntityScheduler { -+ -+ /** -+ * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity -+ * removed), then returns {@code false}. Otherwise, either the run callback will be invoked after the specified delay, -+ * or the retired callback will be invoked if the scheduler is retired. -+ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove -+ * other entities, load chunks, load worlds, modify ticket levels, etc. -+ * -+ *

    -+ * It is guaranteed that the run and retired callback are invoked on the region which owns the entity. -+ *

    -+ * @param run The callback to run after the specified delay, may not be null. -+ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. -+ * @param delay The delay in ticks before the run callback is invoked. Any value less-than 1 is treated as 1. -+ * @return {@code true} if the task was scheduled, which means that either the run function or the retired function -+ * will be invoked (but never both), or {@code false} indicating neither the run nor retired function will be invoked -+ * since the scheduler has been retired. -+ */ -+ boolean execute(@NotNull Plugin plugin, @NotNull Runnable run, @Nullable Runnable retired, long delay); -+ -+ /** -+ * Schedules a task to execute on the next tick. If the task failed to schedule because the scheduler is retired (entity -+ * removed), then returns {@code null}. Otherwise, either the task callback will be invoked after the specified delay, -+ * or the retired callback will be invoked if the scheduler is retired. -+ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove -+ * other entities, load chunks, load worlds, modify ticket levels, etc. -+ * -+ *

    -+ * It is guaranteed that the task and retired callback are invoked on the region which owns the entity. -+ *

    -+ * @param plugin The plugin that owns the task -+ * @param task The task to execute -+ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. -+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. -+ */ -+ @Nullable ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer task, -+ @Nullable Runnable retired); -+ -+ /** -+ * Schedules a task with the given delay. If the task failed to schedule because the scheduler is retired (entity -+ * removed), then returns {@code null}. Otherwise, either the task callback will be invoked after the specified delay, -+ * or the retired callback will be invoked if the scheduler is retired. -+ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove -+ * other entities, load chunks, load worlds, modify ticket levels, etc. -+ * -+ *

    -+ * It is guaranteed that the task and retired callback are invoked on the region which owns the entity. -+ *

    -+ * @param plugin The plugin that owns the task -+ * @param task The task to execute -+ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. -+ * @param delayTicks The delay, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. -+ */ -+ @Nullable ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer task, -+ @Nullable Runnable retired, long delayTicks); -+ -+ /** -+ * Schedules a repeating task with the given delay and period. If the task failed to schedule because the scheduler -+ * is retired (entity removed), then returns {@code null}. Otherwise, either the task callback will be invoked after -+ * the specified delay, or the retired callback will be invoked if the scheduler is retired. -+ * Note that the retired callback is invoked in critical code, so it should not attempt to remove the entity, remove -+ * other entities, load chunks, load worlds, modify ticket levels, etc. -+ * -+ *

    -+ * It is guaranteed that the task and retired callback are invoked on the region which owns the entity. -+ *

    -+ * @param plugin The plugin that owns the task -+ * @param task The task to execute -+ * @param retired Retire callback to run if the entity is retired before the run callback can be invoked, may be null. -+ * @param initialDelayTicks The initial delay, in ticks. -+ * @param periodTicks The period, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task, or {@code null} if the entity has been removed. -+ */ -+ @Nullable ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer task, -+ @Nullable Runnable retired, long initialDelayTicks, long periodTicks); -+} -diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java -new file mode 100644 -index 0000000000000000000000000000000000000000..365b53fea8dee09cdc11f4399dea5f00c6ee70e2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/GlobalRegionScheduler.java -@@ -0,0 +1,58 @@ -+package io.papermc.paper.threadedregions.scheduler; -+ -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.function.Consumer; -+ -+/** -+ * The global region task scheduler may be used to schedule tasks that will execute on the global region. -+ *

    -+ * The global region is responsible for maintaining world day time, world game time, weather cycle, -+ * sleep night skipping, executing commands for console, and other misc. tasks that do not belong to any specific region. -+ *

    -+ */ -+public interface GlobalRegionScheduler { -+ -+ /** -+ * Schedules a task to be executed on the global region. -+ * @param plugin The plugin that owns the task -+ * @param run The task to execute -+ */ -+ void execute(@NotNull Plugin plugin, @NotNull Runnable run); -+ -+ /** -+ * Schedules a task to be executed on the global region on the next tick. -+ * @param plugin The plugin that owns the task -+ * @param task The task to execute -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask run(@NotNull Plugin plugin, @NotNull Consumer task); -+ -+ /** -+ * Schedules a task to be executed on the global region after the specified delay in ticks. -+ * @param plugin The plugin that owns the task -+ * @param task The task to execute -+ * @param delayTicks The delay, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Consumer task, long delayTicks); -+ -+ /** -+ * Schedules a repeating task to be executed on the global region after the initial delay with the -+ * specified period. -+ * @param plugin The plugin that owns the task -+ * @param task The task to execute -+ * @param initialDelayTicks The initial delay, in ticks. -+ * @param periodTicks The period, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Consumer task, -+ long initialDelayTicks, long periodTicks); -+ -+ /** -+ * Attempts to cancel all tasks scheduled by the specified plugin. -+ * @param plugin Specified plugin. -+ */ -+ void cancelTasks(@NotNull Plugin plugin); -+} -diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/RegionScheduler.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/RegionScheduler.java -new file mode 100644 -index 0000000000000000000000000000000000000000..7557e170f84cde7292869fbd92b44b0e6eb43b4f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/RegionScheduler.java -@@ -0,0 +1,127 @@ -+package io.papermc.paper.threadedregions.scheduler; -+ -+import org.bukkit.Location; -+import org.bukkit.World; -+import org.bukkit.entity.Entity; -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.NotNull; -+ -+import java.util.function.Consumer; -+ -+/** -+ * The region task scheduler can be used to schedule tasks by location to be executed on the region which owns the location. -+ *

    -+ * Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities. -+ * If you wish to schedule tasks to perform actions on entities, you should be using {@link Entity#getScheduler()} -+ * as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler -+ * will not. -+ *

    -+ */ -+public interface RegionScheduler { -+ -+ /** -+ * Schedules a task to be executed on the region which owns the location. -+ * -+ * @param plugin The plugin that owns the task -+ * @param world The world of the region that owns the task -+ * @param chunkX The chunk X coordinate of the region that owns the task -+ * @param chunkZ The chunk Z coordinate of the region that owns the task -+ * @param run The task to execute -+ */ -+ void execute(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Runnable run); -+ -+ /** -+ * Schedules a task to be executed on the region which owns the location. -+ * -+ * @param plugin The plugin that owns the task -+ * @param location The location at which the region executing should own -+ * @param run The task to execute -+ */ -+ default void execute(@NotNull Plugin plugin, @NotNull Location location, @NotNull Runnable run) { -+ this.execute(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, run); -+ } -+ -+ /** -+ * Schedules a task to be executed on the region which owns the location on the next tick. -+ * -+ * @param plugin The plugin that owns the task -+ * @param world The world of the region that owns the task -+ * @param chunkX The chunk X coordinate of the region that owns the task -+ * @param chunkZ The chunk Z coordinate of the region that owns the task -+ * @param task The task to execute -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask run(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer task); -+ -+ /** -+ * Schedules a task to be executed on the region which owns the location on the next tick. -+ * -+ * @param plugin The plugin that owns the task -+ * @param location The location at which the region executing should own -+ * @param task The task to execute -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ default @NotNull ScheduledTask run(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer task) { -+ return this.run(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, task); -+ } -+ -+ /** -+ * Schedules a task to be executed on the region which owns the location after the specified delay in ticks. -+ * -+ * @param plugin The plugin that owns the task -+ * @param world The world of the region that owns the task -+ * @param chunkX The chunk X coordinate of the region that owns the task -+ * @param chunkZ The chunk Z coordinate of the region that owns the task -+ * @param task The task to execute -+ * @param delayTicks The delay, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer task, -+ long delayTicks); -+ -+ /** -+ * Schedules a task to be executed on the region which owns the location after the specified delay in ticks. -+ * -+ * @param plugin The plugin that owns the task -+ * @param location The location at which the region executing should own -+ * @param task The task to execute -+ * @param delayTicks The delay, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ default @NotNull ScheduledTask runDelayed(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer task, -+ long delayTicks) { -+ return this.runDelayed(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, task, delayTicks); -+ } -+ -+ /** -+ * Schedules a repeating task to be executed on the region which owns the location after the initial delay with the -+ * specified period. -+ * -+ * @param plugin The plugin that owns the task -+ * @param world The world of the region that owns the task -+ * @param chunkX The chunk X coordinate of the region that owns the task -+ * @param chunkZ The chunk Z coordinate of the region that owns the task -+ * @param task The task to execute -+ * @param initialDelayTicks The initial delay, in ticks. -+ * @param periodTicks The period, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull World world, int chunkX, int chunkZ, @NotNull Consumer task, -+ long initialDelayTicks, long periodTicks); -+ -+ /** -+ * Schedules a repeating task to be executed on the region which owns the location after the initial delay with the -+ * specified period. -+ * -+ * @param plugin The plugin that owns the task -+ * @param location The location at which the region executing should own -+ * @param task The task to execute -+ * @param initialDelayTicks The initial delay, in ticks. -+ * @param periodTicks The period, in ticks. -+ * @return The {@link ScheduledTask} that represents the scheduled task. -+ */ -+ default @NotNull ScheduledTask runAtFixedRate(@NotNull Plugin plugin, @NotNull Location location, @NotNull Consumer task, -+ long initialDelayTicks, long periodTicks) { -+ return this.runAtFixedRate(plugin, location.getWorld(), location.getBlockX() >> 4, location.getBlockZ() >> 4, task, initialDelayTicks, periodTicks); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/threadedregions/scheduler/ScheduledTask.java b/src/main/java/io/papermc/paper/threadedregions/scheduler/ScheduledTask.java -new file mode 100644 -index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045216c249c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/threadedregions/scheduler/ScheduledTask.java -@@ -0,0 +1,112 @@ -+package io.papermc.paper.threadedregions.scheduler; -+ -+import org.bukkit.plugin.Plugin; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents a task scheduled to a scheduler. -+ */ -+public interface ScheduledTask { -+ -+ /** -+ * Returns the plugin that scheduled this task. -+ * @return the plugin that scheduled this task. -+ */ -+ @NotNull Plugin getOwningPlugin(); -+ -+ /** -+ * Returns whether this task executes on a fixed period, as opposed to executing only once. -+ * @return whether this task executes on a fixed period, as opposed to executing only once. -+ */ -+ boolean isRepeatingTask(); -+ -+ /** -+ * Attempts to cancel this task, returning the result of the attempt. In all cases, if the task is currently -+ * being executed no attempt is made to halt the task, however any executions in the future are halted. -+ * @return the result of the cancellation attempt. -+ */ -+ @NotNull CancelledState cancel(); -+ -+ /** -+ * Returns the current execution state of this task. -+ * @return the current execution state of this task. -+ */ -+ @NotNull ExecutionState getExecutionState(); -+ -+ /** -+ * Returns whether the current execution state is {@link ExecutionState#CANCELLED} or {@link ExecutionState#CANCELLED_RUNNING}. -+ * @return whether the current execution state is {@link ExecutionState#CANCELLED} or {@link ExecutionState#CANCELLED_RUNNING}. -+ */ -+ default boolean isCancelled() { -+ final ExecutionState state = this.getExecutionState(); -+ return state == ExecutionState.CANCELLED || state == ExecutionState.CANCELLED_RUNNING; -+ } -+ -+ /** -+ * Represents the result of attempting to cancel a task. -+ */ -+ enum CancelledState { -+ /** -+ * The task (repeating or not) has been successfully cancelled by the caller thread. The task is not executing -+ * currently, and it will not begin execution in the future. -+ */ -+ CANCELLED_BY_CALLER, -+ /** -+ * The task (repeating or not) is already cancelled. The task is not executing currently, and it will not -+ * begin execution in the future. -+ */ -+ CANCELLED_ALREADY, -+ -+ /** -+ * The task is not a repeating task, and could not be cancelled because the task is being executed. -+ */ -+ RUNNING, -+ /** -+ * The task is not a repeating task, and could not be cancelled because the task has already finished execution. -+ */ -+ ALREADY_EXECUTED, -+ -+ /** -+ * The caller thread successfully stopped future executions of a repeating task, but the task is currently -+ * being executed. -+ */ -+ NEXT_RUNS_CANCELLED, -+ -+ /** -+ * The repeating task's future executions are cancelled already, but the task is currently -+ * being executed. -+ */ -+ NEXT_RUNS_CANCELLED_ALREADY, -+ } -+ -+ /** -+ * Represents the current execution state of the task. -+ */ -+ enum ExecutionState { -+ /** -+ * The task is currently not executing, but may begin execution in the future. -+ */ -+ IDLE, -+ -+ /** -+ * The task is currently executing. -+ */ -+ RUNNING, -+ -+ /** -+ * The task is not repeating, and the task finished executing. -+ */ -+ FINISHED, -+ -+ /** -+ * The task is not executing and will not begin execution in the future. If this task is not repeating, then -+ * this task was never executed. -+ */ -+ CANCELLED, -+ -+ /** -+ * The task is repeating and currently executing, but future executions are cancelled and will not occur. -+ */ -+ CANCELLED_RUNNING; -+ } -+} -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 00b855a22b5b838db46126ff5bd6797ffff97da2..6545c5879706f4e527e4f742cc553c6e852cd6f8 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2661,6 +2661,141 @@ public final class Bukkit { - } - // Paper end - -+ // Paper start - Folia region threading API -+ /** -+ * Returns the region task scheduler. The region task scheduler can be used to schedule -+ * tasks by location to be executed on the region which owns the location. -+ *

    -+ * Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities. -+ * If you wish to schedule tasks to perform actions on entities, you should be using {@link Entity#getScheduler()} -+ * as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler -+ * will not. -+ *

    -+ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    -+ * @return the region task scheduler -+ */ -+ public static @NotNull io.papermc.paper.threadedregions.scheduler.RegionScheduler getRegionScheduler() { -+ return server.getRegionScheduler(); -+ } -+ -+ /** -+ * Returns the async task scheduler. The async task scheduler can be used to schedule tasks -+ * that execute asynchronously from the server tick process. -+ * @return the async task scheduler -+ */ -+ public static @NotNull io.papermc.paper.threadedregions.scheduler.AsyncScheduler getAsyncScheduler() { -+ return server.getAsyncScheduler(); -+ } -+ -+ /** -+ * Returns the global region task scheduler. The global task scheduler can be used to schedule -+ * tasks to execute on the global region. -+ *

    -+ * The global region is responsible for maintaining world day time, world game time, weather cycle, -+ * sleep night skipping, executing commands for console, and other misc. tasks that do not belong to any specific region. -+ *

    -+ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    -+ * @return the global region scheduler -+ */ -+ public static @NotNull io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler getGlobalRegionScheduler() { -+ return server.getGlobalRegionScheduler(); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified world and block position. -+ * @param world Specified world. -+ * @param position Specified block position. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position) { -+ return server.isOwnedByCurrentRegion(world, position); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunks centered at the specified block position within the specified square radius. -+ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and -+ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. -+ * @param world Specified world. -+ * @param position Specified block position. -+ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared -+ * radius, but rather a Chebyshev Distance. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position, int squareRadiusChunks) { -+ return server.isOwnedByCurrentRegion(world, position, squareRadiusChunks); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified world and block position as included in the specified location. -+ * @param location Specified location, must have a non-null world. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull Location location) { -+ return server.isOwnedByCurrentRegion(location); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunks centered at the specified world and block position as included in the specified location -+ * within the specified square radius. -+ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and -+ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. -+ * @param location Specified location, must have a non-null world. -+ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared -+ * radius, but rather a Chebyshev Distance. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull Location location, int squareRadiusChunks) { -+ return server.isOwnedByCurrentRegion(location, squareRadiusChunks); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified block position. -+ * @param block Specified block position. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull org.bukkit.block.Block block) { -+ return server.isOwnedByCurrentRegion(block.getLocation()); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified world and chunk position. -+ * @param world Specified world. -+ * @param chunkX Specified x-coordinate of the chunk position. -+ * @param chunkZ Specified z-coordinate of the chunk position. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ) { -+ return server.isOwnedByCurrentRegion(world, chunkX, chunkZ); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunks centered at the specified world and chunk position within the specified -+ * square radius. -+ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and -+ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. -+ * @param world Specified world. -+ * @param chunkX Specified x-coordinate of the chunk position. -+ * @param chunkZ Specified z-coordinate of the chunk position. -+ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared -+ * radius, but rather a Chebyshev Distance. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ, int squareRadiusChunks) { -+ return server.isOwnedByCurrentRegion(world, chunkX, chunkZ, squareRadiusChunks); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the specified entity. Note that this function is the only appropriate method of checking -+ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned -+ * by the current region. -+ * @param entity Specified entity. -+ */ -+ public static boolean isOwnedByCurrentRegion(@NotNull Entity entity) { -+ return server.isOwnedByCurrentRegion(entity); -+ } -+ // Paper end - Folia region threading API -+ - @NotNull - public static Server.Spigot spigot() { - return server.spigot(); -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index b3b82405440c236f035e49d0edf6fda12e2db4bb..fb31f2a668b2d6a1115123e34adea67ed4dbfd22 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -2319,4 +2319,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi - */ - @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); - // Paper end -+ -+ // Paper start - Folia region threading API -+ /** -+ * Returns the Folia region task scheduler. The region task scheduler can be used to schedule -+ * tasks by location to be executed on the region which owns the location. -+ *

    -+ * Note: It is entirely inappropriate to use the region scheduler to schedule tasks for entities. -+ * If you wish to schedule tasks to perform actions on entities, you should be using {@link Entity#getScheduler()} -+ * as the entity scheduler will "follow" an entity if it is teleported, whereas the region task scheduler -+ * will not. -+ *

    -+ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    -+ * @return the region task scheduler -+ */ -+ @NotNull io.papermc.paper.threadedregions.scheduler.RegionScheduler getRegionScheduler(); -+ -+ /** -+ * Returns the Folia async task scheduler. The async task scheduler can be used to schedule tasks -+ * that execute asynchronously from the server tick process. -+ * @return the async task scheduler -+ */ -+ @NotNull io.papermc.paper.threadedregions.scheduler.AsyncScheduler getAsyncScheduler(); -+ -+ /** -+ * Returns the Folia global region task scheduler. The global task scheduler can be used to schedule -+ * tasks to execute on the global region. -+ *

    -+ * The global region is responsible for maintaining world day time, world game time, weather cycle, -+ * sleep night skipping, executing commands for console, and other misc. tasks that do not belong to any specific region. -+ *

    -+ *

    If you do not need/want to make your plugin run on Folia, use {@link #getScheduler()} instead.

    -+ * @return the global region scheduler -+ */ -+ @NotNull io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler getGlobalRegionScheduler(); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified world and block position. -+ * @param world Specified world. -+ * @param position Specified block position. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunks centered at the specified block position within the specified square radius. -+ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and -+ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. -+ * @param world Specified world. -+ * @param position Specified block position. -+ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared -+ * radius, but rather a Chebyshev Distance. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull World world, @NotNull io.papermc.paper.math.Position position, int squareRadiusChunks); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified world and block position as included in the specified location. -+ * @param location Specified location, must have a non-null world. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull Location location); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunks centered at the specified world and block position as included in the specified location -+ * within the specified square radius. -+ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and -+ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. -+ * @param location Specified location, must have a non-null world. -+ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared -+ * radius, but rather a Chebyshev Distance. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull Location location, int squareRadiusChunks); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified block position. -+ * @param block Specified block position. -+ */ -+ default boolean isOwnedByCurrentRegion(@NotNull org.bukkit.block.Block block) { -+ return isOwnedByCurrentRegion(block.getLocation()); -+ } -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunk at the specified world and chunk position. -+ * @param world Specified world. -+ * @param chunkX Specified x-coordinate of the chunk position. -+ * @param chunkZ Specified z-coordinate of the chunk position. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the chunks centered at the specified world and chunk position within the specified -+ * square radius. -+ * Specifically, this function checks that every chunk with position x in [centerX - radius, centerX + radius] and -+ * position z in [centerZ - radius, centerZ + radius] is owned by the current ticking region. -+ * @param world Specified world. -+ * @param chunkX Specified x-coordinate of the chunk position. -+ * @param chunkZ Specified z-coordinate of the chunk position. -+ * @param squareRadiusChunks Specified square radius. Must be >= 0. Note that this parameter is not a squared -+ * radius, but rather a Chebyshev Distance. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull World world, int chunkX, int chunkZ, int squareRadiusChunks); -+ -+ /** -+ * Returns whether the current thread is ticking a region and that the region being ticked -+ * owns the specified entity. Note that this function is the only appropriate method of checking -+ * for ownership of an entity, as retrieving the entity's location is undefined unless the entity is owned -+ * by the current region. -+ * @param entity Specified entity. -+ */ -+ boolean isOwnedByCurrentRegion(@NotNull Entity entity); -+ // Paper end - Folia region threading API - } -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 9e7b6ed599759de451429c99bc6876b878c1cca2..9a0022f9e77b7e532c0cad9f85620901064e436d 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1097,4 +1097,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent - */ - boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); - // Paper end - Collision API -+ -+ // Paper start - Folia schedulers -+ /** -+ * Returns the task scheduler for this entity. The entity scheduler can be used to schedule tasks -+ * that are guaranteed to always execute on the tick thread that owns the entity. -+ *

    If you do not need/want to make your plugin run on Folia, use {@link org.bukkit.Server#getScheduler()} instead.

    -+ * @return the task scheduler for this entity. -+ * @see io.papermc.paper.threadedregions.scheduler.EntityScheduler -+ */ -+ @NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler(); -+ // Paper end - Folia schedulers - } diff --git a/patches/api/0410-Add-Sign-getInteractableSideFor.patch b/patches/api/0410-Add-Sign-getInteractableSideFor.patch new file mode 100644 index 0000000000..1e085323ca --- /dev/null +++ b/patches/api/0410-Add-Sign-getInteractableSideFor.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 23 Jun 2023 12:16:35 -0700 +Subject: [PATCH] Add Sign#getInteractableSideFor + + +diff --git a/src/main/java/org/bukkit/block/Sign.java b/src/main/java/org/bukkit/block/Sign.java +index 1fdb1144949adc3a2b5cbc3aca94d2f8e0c6d9ee..7983ccb54f5f358dea1ffb530b9cc5bd716fb9b1 100644 +--- a/src/main/java/org/bukkit/block/Sign.java ++++ b/src/main/java/org/bukkit/block/Sign.java +@@ -187,4 +187,34 @@ public interface Sign extends TileState, Colorable { + */ + @Nullable + public Player getAllowedEditor(); ++ // Paper start - get side for player ++ /** ++ * Compute the side facing the specified entity. ++ * ++ * @param entity the entity ++ * @return the side it is facing ++ */ ++ default @NotNull Side getInteractableSideFor(org.bukkit.entity.@NotNull Entity entity) { ++ return this.getInteractableSideFor(entity.getLocation()); ++ } ++ ++ /** ++ * Compute the side facing the specific position. ++ * ++ * @param position the position ++ * @return the side the position is facing ++ */ ++ default @NotNull Side getInteractableSideFor(io.papermc.paper.math.@NotNull Position position) { ++ return this.getInteractableSideFor(position.x(), position.z()); ++ } ++ ++ /** ++ * Compute the side facing the specific x and z coordinates. ++ * ++ * @param x the x coord ++ * @param z the z coord ++ * @return the side the coordinates are facing ++ */ ++ @NotNull Side getInteractableSideFor(double x, double z); ++ // Paper end + } diff --git a/patches/api/0410-Add-event-for-player-editing-sign.patch b/patches/api/0410-Add-event-for-player-editing-sign.patch deleted file mode 100644 index b534aebde9..0000000000 --- a/patches/api/0410-Add-event-for-player-editing-sign.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: by77er -Date: Sat, 10 Jun 2023 19:06:24 -0400 -Subject: [PATCH] Add event for player editing sign - - -diff --git a/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..c38c32ae349e094ffef84386607f4b9d5fe361f5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerOpenSignEvent.java -@@ -0,0 +1,108 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.block.Sign; -+import org.bukkit.block.sign.Side; -+import org.bukkit.entity.HumanEntity; -+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.NotNull; -+ -+/** -+ * Called when a player begins editing a sign's text. -+ *

    -+ * Cancelling this event stops the sign editing menu from opening. -+ */ -+public class PlayerOpenSignEvent extends PlayerEvent implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ private final Sign sign; -+ private final Side side; -+ private final Cause cause; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public PlayerOpenSignEvent(final @NotNull Player editor, final @NotNull Sign sign, final @NotNull Side side, final @NotNull Cause cause) { -+ super(editor); -+ this.sign = sign; -+ this.side = side; -+ this.cause = cause; -+ } -+ -+ /** -+ * Gets the sign that was clicked. -+ * -+ * @return {@link Sign} that was clicked -+ */ -+ @NotNull -+ public Sign getSign() { -+ return this.sign; -+ } -+ -+ /** -+ * Gets which side of the sign was clicked. -+ * -+ * @return {@link Side} that was clicked -+ * @see Sign#getSide(Side) -+ */ -+ @NotNull -+ public Side getSide() { -+ return this.side; -+ } -+ -+ /** -+ * The cause of this sign open. -+ * -+ * @return the cause -+ */ -+ public @NotNull Cause getCause() { -+ return this.cause; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * The cause of the {@link PlayerOpenSignEvent}. -+ */ -+ public enum Cause { -+ /** -+ * The event was triggered by the placement of a sign. -+ */ -+ PLACE, -+ /** -+ * The event was triggered by an interaction with a sign. -+ */ -+ INTERACT, -+ /** -+ * The event was triggered via a plugin with {@link HumanEntity#openSign(Sign, Side)} -+ */ -+ PLUGIN, -+ /** -+ * Fallback cause for any unknown cause. -+ */ -+ UNKNOWN, -+ } -+} -diff --git a/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java b/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java -index ea197b1bc0a41355f8cdda3026f16c55f2d4fac9..62f41dbdf93e1912f4ee1376f000ffdc9073043d 100644 ---- a/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java -+++ b/src/main/java/org/bukkit/event/player/PlayerSignOpenEvent.java -@@ -10,8 +10,11 @@ import org.jetbrains.annotations.NotNull; - - /** - * This event is fired when a sign is opened by the player. -+ * @deprecated use {@link io.papermc.paper.event.player.PlayerOpenSignEvent} - */ - @ApiStatus.Experimental -+@Deprecated(forRemoval = true) // Paper -+@org.bukkit.Warning(false) // Paper - public class PlayerSignOpenEvent extends PlayerEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); diff --git a/patches/api/0411-Add-Sign-getInteractableSideFor.patch b/patches/api/0411-Add-Sign-getInteractableSideFor.patch deleted file mode 100644 index 1e085323ca..0000000000 --- a/patches/api/0411-Add-Sign-getInteractableSideFor.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 23 Jun 2023 12:16:35 -0700 -Subject: [PATCH] Add Sign#getInteractableSideFor - - -diff --git a/src/main/java/org/bukkit/block/Sign.java b/src/main/java/org/bukkit/block/Sign.java -index 1fdb1144949adc3a2b5cbc3aca94d2f8e0c6d9ee..7983ccb54f5f358dea1ffb530b9cc5bd716fb9b1 100644 ---- a/src/main/java/org/bukkit/block/Sign.java -+++ b/src/main/java/org/bukkit/block/Sign.java -@@ -187,4 +187,34 @@ public interface Sign extends TileState, Colorable { - */ - @Nullable - public Player getAllowedEditor(); -+ // Paper start - get side for player -+ /** -+ * Compute the side facing the specified entity. -+ * -+ * @param entity the entity -+ * @return the side it is facing -+ */ -+ default @NotNull Side getInteractableSideFor(org.bukkit.entity.@NotNull Entity entity) { -+ return this.getInteractableSideFor(entity.getLocation()); -+ } -+ -+ /** -+ * Compute the side facing the specific position. -+ * -+ * @param position the position -+ * @return the side the position is facing -+ */ -+ default @NotNull Side getInteractableSideFor(io.papermc.paper.math.@NotNull Position position) { -+ return this.getInteractableSideFor(position.x(), position.z()); -+ } -+ -+ /** -+ * Compute the side facing the specific x and z coordinates. -+ * -+ * @param x the x coord -+ * @param z the z coord -+ * @return the side the coordinates are facing -+ */ -+ @NotNull Side getInteractableSideFor(double x, double z); -+ // Paper end - } diff --git a/patches/api/0411-Fix-BanList-API.patch b/patches/api/0411-Fix-BanList-API.patch new file mode 100644 index 0000000000..911f301327 --- /dev/null +++ b/patches/api/0411-Fix-BanList-API.patch @@ -0,0 +1,162 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 4 Jul 2023 11:27:18 -0700 +Subject: [PATCH] Fix BanList API + + +diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java +index 548f6d28c28d74bed8b58ee82875909354afe132..a77c0411a68a9bad33ddfb335b7a996a843e478c 100644 +--- a/src/main/java/org/bukkit/BanList.java ++++ b/src/main/java/org/bukkit/BanList.java +@@ -48,7 +48,7 @@ public interface BanList { + */ + @Deprecated + @Nullable +- public BanEntry getBanEntry(@NotNull String target); ++ public > E getBanEntry(@NotNull String target); // Paper + + /** + * Gets a {@link BanEntry} by target. +@@ -77,7 +77,7 @@ public interface BanList { + */ + @Deprecated + @Nullable +- public BanEntry addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source); ++ public > E addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper + + /** + * Adds a ban to this list. If a previous ban exists, this will +@@ -140,7 +140,7 @@ public interface BanList { + * @return an immutable set containing every entry tracked by this list + */ + @NotNull +- public Set> getEntries(); ++ public > Set getEntries(); // Paper + + /** + * Gets if a {@link BanEntry} exists for the target, indicating an active +diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java +index f5d3e5c5d79910580b6202e7aee01341d09f6225..6a84c3d0d15251694bb7a05393b9ff7a4d8e0617 100644 +--- a/src/main/java/org/bukkit/OfflinePlayer.java ++++ b/src/main/java/org/bukkit/OfflinePlayer.java +@@ -147,7 +147,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio + * (updated) previous ban + */ + @Nullable +- public BanEntry ban(@Nullable String reason, @Nullable Date expires, @Nullable String source); ++ public > E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper - fix ban list API + + /** + * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will +@@ -161,7 +161,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio + * (updated) previous ban + */ + @Nullable +- public BanEntry ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source); ++ public > E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source); // Paper - fix ban list API + + /** + * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will +@@ -175,7 +175,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio + * (updated) previous ban + */ + @Nullable +- public BanEntry ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source); ++ public > E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source); // Paper - fix ban list API + + /** + * Checks if this player is whitelisted or not +diff --git a/src/main/java/org/bukkit/ban/ProfileBanList.java b/src/main/java/org/bukkit/ban/ProfileBanList.java +index e805e629cede1c4c0674282c930cb67852718c3e..5248cf08ef83c7304dd76c42a2f646bb81e0efae 100644 +--- a/src/main/java/org/bukkit/ban/ProfileBanList.java ++++ b/src/main/java/org/bukkit/ban/ProfileBanList.java +@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable; + /** + * A {@link BanList} targeting player profile bans. + */ +-public interface ProfileBanList extends BanList { ++public interface ProfileBanList extends BanList { // Paper + + /** + * {@inheritDoc} +@@ -23,8 +23,48 @@ public interface ProfileBanList extends BanList { + * @return the entry for the newly created ban, or the entry for the + * (updated) previous ban + * @throws IllegalArgumentException if ProfilePlayer has an invalid UUID ++ * @deprecated use {@link #addBan(com.destroystokyo.paper.profile.PlayerProfile, String, Date, String)} + */ + @Nullable +- public BanEntry addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source); ++ // Paper start ++ @Deprecated ++ public > E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source); + ++ /** ++ * @throws IllegalArgumentException if ProfilePlayer has an invalid UUID ++ */ ++ @Nullable BanEntry addBan(com.destroystokyo.paper.profile.@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source); ++ ++ // the 5 methods below are added to maintain compat for the bukkit.PlayerProfile parameter type ++ /** ++ * @deprecated use {@link #getBanEntry(Object)} ++ */ ++ @Deprecated ++ @Nullable > E getBanEntry(@NotNull PlayerProfile target); ++ ++ /** ++ * @deprecated use {@link #isBanned(Object)} ++ */ ++ @Deprecated ++ boolean isBanned(@NotNull PlayerProfile target); ++ ++ /** ++ * @deprecated use {@link #pardon(Object)} ++ */ ++ @Deprecated ++ void pardon(@NotNull PlayerProfile target); ++ ++ /** ++ * @deprecated use {@link #addBan(Object, String, java.time.Instant, String)} ++ */ ++ @Deprecated ++ @Nullable > E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable java.time.Instant expires, @Nullable String source); ++ ++ /** ++ * @deprecated use {@link #addBan(Object, String, java.time.Duration, String)} ++ */ ++ @Deprecated ++ @Nullable > E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable java.time.Duration duration, @Nullable String source); ++ ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 6dc9a93811d143ed266f0f6235358d58b1e00523..463521dc80254cab673c5203ee263948081219e9 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -345,7 +345,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * (updated) previous ban + */ + @Nullable +- public BanEntry ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer); ++ public > E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API + + /** + * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will +@@ -361,7 +361,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * (updated) previous ban + */ + @Nullable +- public BanEntry ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer); ++ public > E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API + + /** + * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will +@@ -377,7 +377,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * (updated) previous ban + */ + @Nullable +- public BanEntry ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer); ++ public > E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API + + /** + * Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will diff --git a/patches/api/0412-Add-whitelist-events.patch b/patches/api/0412-Add-whitelist-events.patch new file mode 100644 index 0000000000..75458e78df --- /dev/null +++ b/patches/api/0412-Add-whitelist-events.patch @@ -0,0 +1,99 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: SageSphinx63920 +Date: Sun, 14 May 2023 12:56:15 +0200 +Subject: [PATCH] Add whitelist events + + +diff --git a/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73ccc8779f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java +@@ -0,0 +1,87 @@ ++package io.papermc.paper.event.server; ++ ++import com.destroystokyo.paper.profile.PlayerProfile; ++import org.bukkit.Bukkit; ++import org.bukkit.OfflinePlayer; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * This event gets called when the whitelist status of a player is changed ++ */ ++public class WhitelistStateUpdateEvent extends Event implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ @NotNull private final PlayerProfile playerProfile; ++ @NotNull private final WhitelistStatus status; ++ ++ private boolean cancelled; ++ ++ @ApiStatus.Internal ++ public WhitelistStateUpdateEvent(@NotNull PlayerProfile playerProfile, @NotNull WhitelistStatus status) { ++ this.playerProfile = playerProfile; ++ this.status = status; ++ } ++ ++ /** ++ * Gets the player whose whitelist status is being changed ++ * ++ * @return the player whose status is being changed ++ */ ++ @NotNull ++ public OfflinePlayer getPlayer() { ++ return Bukkit.getOfflinePlayer(this.playerProfile.getId()); ++ } ++ ++ /** ++ * Gets the player profile whose whitelist status is being changed ++ * ++ * @return the player profile whose status is being changed ++ */ ++ @NotNull ++ public PlayerProfile getPlayerProfile() { ++ return this.playerProfile; ++ } ++ ++ /** ++ * Gets the status change of the player profile ++ * ++ * @return the whitelist status ++ */ ++ @NotNull ++ public WhitelistStatus getStatus() { ++ return this.status; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ /** ++ * Enum for the whitelist status changes ++ */ ++ public enum WhitelistStatus { ++ ADDED, REMOVED ++ } ++} diff --git a/patches/api/0412-Fix-BanList-API.patch b/patches/api/0412-Fix-BanList-API.patch deleted file mode 100644 index 911f301327..0000000000 --- a/patches/api/0412-Fix-BanList-API.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 4 Jul 2023 11:27:18 -0700 -Subject: [PATCH] Fix BanList API - - -diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java -index 548f6d28c28d74bed8b58ee82875909354afe132..a77c0411a68a9bad33ddfb335b7a996a843e478c 100644 ---- a/src/main/java/org/bukkit/BanList.java -+++ b/src/main/java/org/bukkit/BanList.java -@@ -48,7 +48,7 @@ public interface BanList { - */ - @Deprecated - @Nullable -- public BanEntry getBanEntry(@NotNull String target); -+ public > E getBanEntry(@NotNull String target); // Paper - - /** - * Gets a {@link BanEntry} by target. -@@ -77,7 +77,7 @@ public interface BanList { - */ - @Deprecated - @Nullable -- public BanEntry addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source); -+ public > E addBan(@NotNull String target, @Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper - - /** - * Adds a ban to this list. If a previous ban exists, this will -@@ -140,7 +140,7 @@ public interface BanList { - * @return an immutable set containing every entry tracked by this list - */ - @NotNull -- public Set> getEntries(); -+ public > Set getEntries(); // Paper - - /** - * Gets if a {@link BanEntry} exists for the target, indicating an active -diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index f5d3e5c5d79910580b6202e7aee01341d09f6225..6a84c3d0d15251694bb7a05393b9ff7a4d8e0617 100644 ---- a/src/main/java/org/bukkit/OfflinePlayer.java -+++ b/src/main/java/org/bukkit/OfflinePlayer.java -@@ -147,7 +147,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - * (updated) previous ban - */ - @Nullable -- public BanEntry ban(@Nullable String reason, @Nullable Date expires, @Nullable String source); -+ public > E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source); // Paper - fix ban list API - - /** - * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will -@@ -161,7 +161,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - * (updated) previous ban - */ - @Nullable -- public BanEntry ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source); -+ public > E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source); // Paper - fix ban list API - - /** - * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will -@@ -175,7 +175,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio - * (updated) previous ban - */ - @Nullable -- public BanEntry ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source); -+ public > E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source); // Paper - fix ban list API - - /** - * Checks if this player is whitelisted or not -diff --git a/src/main/java/org/bukkit/ban/ProfileBanList.java b/src/main/java/org/bukkit/ban/ProfileBanList.java -index e805e629cede1c4c0674282c930cb67852718c3e..5248cf08ef83c7304dd76c42a2f646bb81e0efae 100644 ---- a/src/main/java/org/bukkit/ban/ProfileBanList.java -+++ b/src/main/java/org/bukkit/ban/ProfileBanList.java -@@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable; - /** - * A {@link BanList} targeting player profile bans. - */ --public interface ProfileBanList extends BanList { -+public interface ProfileBanList extends BanList { // Paper - - /** - * {@inheritDoc} -@@ -23,8 +23,48 @@ public interface ProfileBanList extends BanList { - * @return the entry for the newly created ban, or the entry for the - * (updated) previous ban - * @throws IllegalArgumentException if ProfilePlayer has an invalid UUID -+ * @deprecated use {@link #addBan(com.destroystokyo.paper.profile.PlayerProfile, String, Date, String)} - */ - @Nullable -- public BanEntry addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source); -+ // Paper start -+ @Deprecated -+ public > E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source); - -+ /** -+ * @throws IllegalArgumentException if ProfilePlayer has an invalid UUID -+ */ -+ @Nullable BanEntry addBan(com.destroystokyo.paper.profile.@NotNull PlayerProfile target, @Nullable String reason, @Nullable Date expires, @Nullable String source); -+ -+ // the 5 methods below are added to maintain compat for the bukkit.PlayerProfile parameter type -+ /** -+ * @deprecated use {@link #getBanEntry(Object)} -+ */ -+ @Deprecated -+ @Nullable > E getBanEntry(@NotNull PlayerProfile target); -+ -+ /** -+ * @deprecated use {@link #isBanned(Object)} -+ */ -+ @Deprecated -+ boolean isBanned(@NotNull PlayerProfile target); -+ -+ /** -+ * @deprecated use {@link #pardon(Object)} -+ */ -+ @Deprecated -+ void pardon(@NotNull PlayerProfile target); -+ -+ /** -+ * @deprecated use {@link #addBan(Object, String, java.time.Instant, String)} -+ */ -+ @Deprecated -+ @Nullable > E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable java.time.Instant expires, @Nullable String source); -+ -+ /** -+ * @deprecated use {@link #addBan(Object, String, java.time.Duration, String)} -+ */ -+ @Deprecated -+ @Nullable > E addBan(@NotNull PlayerProfile target, @Nullable String reason, @Nullable java.time.Duration duration, @Nullable String source); -+ -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 6dc9a93811d143ed266f0f6235358d58b1e00523..463521dc80254cab673c5203ee263948081219e9 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -345,7 +345,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * (updated) previous ban - */ - @Nullable -- public BanEntry ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer); -+ public > E ban(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API - - /** - * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will -@@ -361,7 +361,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * (updated) previous ban - */ - @Nullable -- public BanEntry ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer); -+ public > E ban(@Nullable String reason, @Nullable Instant expires, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API - - /** - * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will -@@ -377,7 +377,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * (updated) previous ban - */ - @Nullable -- public BanEntry ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer); -+ public > E ban(@Nullable String reason, @Nullable Duration duration, @Nullable String source, boolean kickPlayer); // Paper - fix ban list API - - /** - * Adds this user's current IP address to the {@link IpBanList}. If a previous ban exists, this will diff --git a/patches/api/0413-API-for-updating-recipes-on-clients.patch b/patches/api/0413-API-for-updating-recipes-on-clients.patch new file mode 100644 index 0000000000..99f5d3023a --- /dev/null +++ b/patches/api/0413-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 91476b9e5238caf49492cb23b549c9df6a45ed3e..d6be967c2fd480547bf9eb3938ca147382f835da 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -992,6 +992,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. + * +@@ -1052,6 +1072,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. +@@ -1243,6 +1277,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 e0f42b67f41bbba6807fd4ca3a6a546ccdc4b68f..b8866e8c79f347c87a86713060d81a082ff3f8e3 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -838,6 +838,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. + * +@@ -879,15 +895,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. +@@ -1056,6 +1091,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/0413-Add-whitelist-events.patch b/patches/api/0413-Add-whitelist-events.patch deleted file mode 100644 index 75458e78df..0000000000 --- a/patches/api/0413-Add-whitelist-events.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SageSphinx63920 -Date: Sun, 14 May 2023 12:56:15 +0200 -Subject: [PATCH] Add whitelist events - - -diff --git a/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2f4273d694278517e2613f0da5e89c73ccc8779f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/server/WhitelistStateUpdateEvent.java -@@ -0,0 +1,87 @@ -+package io.papermc.paper.event.server; -+ -+import com.destroystokyo.paper.profile.PlayerProfile; -+import org.bukkit.Bukkit; -+import org.bukkit.OfflinePlayer; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * This event gets called when the whitelist status of a player is changed -+ */ -+public class WhitelistStateUpdateEvent extends Event implements Cancellable { -+ -+ private static final HandlerList HANDLER_LIST = new HandlerList(); -+ -+ @NotNull private final PlayerProfile playerProfile; -+ @NotNull private final WhitelistStatus status; -+ -+ private boolean cancelled; -+ -+ @ApiStatus.Internal -+ public WhitelistStateUpdateEvent(@NotNull PlayerProfile playerProfile, @NotNull WhitelistStatus status) { -+ this.playerProfile = playerProfile; -+ this.status = status; -+ } -+ -+ /** -+ * Gets the player whose whitelist status is being changed -+ * -+ * @return the player whose status is being changed -+ */ -+ @NotNull -+ public OfflinePlayer getPlayer() { -+ return Bukkit.getOfflinePlayer(this.playerProfile.getId()); -+ } -+ -+ /** -+ * Gets the player profile whose whitelist status is being changed -+ * -+ * @return the player profile whose status is being changed -+ */ -+ @NotNull -+ public PlayerProfile getPlayerProfile() { -+ return this.playerProfile; -+ } -+ -+ /** -+ * Gets the status change of the player profile -+ * -+ * @return the whitelist status -+ */ -+ @NotNull -+ public WhitelistStatus getStatus() { -+ return this.status; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+ -+ /** -+ * Enum for the whitelist status changes -+ */ -+ public enum WhitelistStatus { -+ ADDED, REMOVED -+ } -+} diff --git a/patches/api/0414-API-for-updating-recipes-on-clients.patch b/patches/api/0414-API-for-updating-recipes-on-clients.patch deleted file mode 100644 index 60f206a340..0000000000 --- a/patches/api/0414-API-for-updating-recipes-on-clients.patch +++ /dev/null @@ -1,169 +0,0 @@ -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 e4f3f621c4c6d2653770c149db71587fc04e0991..b5455d03761ced30c94719deeee6788d7c6a8fb7 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -992,6 +992,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. - * -@@ -1052,6 +1072,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. -@@ -1243,6 +1277,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 63cbc38217865be8f79890a0d8d6143461d344f3..c0ebbca69775775af22cf2c31b1516e5bf18df4a 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -838,6 +838,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. - * -@@ -879,15 +895,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. -@@ -1056,6 +1091,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/0414-Add-PlayerFailMoveEvent.patch b/patches/api/0414-Add-PlayerFailMoveEvent.patch new file mode 100644 index 0000000000..c0687e2ae0 --- /dev/null +++ b/patches/api/0414-Add-PlayerFailMoveEvent.patch @@ -0,0 +1,130 @@ +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..c848fa029bac07f80eef870c98eebc2596b90aed +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java +@@ -0,0 +1,118 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Runs when a player attempts to move, but is prevented from doing so by the server ++ */ ++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(@NotNull Player player, @NotNull FailReason failReason, boolean allowed, ++ boolean logWarning, @NotNull Location from, @NotNull 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 ++ */ ++ @NotNull ++ public FailReason getFailReason() { ++ return this.failReason; ++ } ++ ++ /** ++ * Gets the location this player moved from ++ * ++ * @return Location the player moved from ++ */ ++ @NotNull ++ public Location getFrom() { ++ return this.from.clone(); ++ } ++ ++ /** ++ * Gets the location this player tried to move to ++ * ++ * @return Location the player tried to move to ++ */ ++ @NotNull ++ 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(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(boolean logWarning) { ++ this.logWarning = logWarning; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ 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/0415-Add-PlayerFailMoveEvent.patch b/patches/api/0415-Add-PlayerFailMoveEvent.patch deleted file mode 100644 index c0687e2ae0..0000000000 --- a/patches/api/0415-Add-PlayerFailMoveEvent.patch +++ /dev/null @@ -1,130 +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..c848fa029bac07f80eef870c98eebc2596b90aed ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java -@@ -0,0 +1,118 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Runs when a player attempts to move, but is prevented from doing so by the server -+ */ -+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(@NotNull Player player, @NotNull FailReason failReason, boolean allowed, -+ boolean logWarning, @NotNull Location from, @NotNull 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 -+ */ -+ @NotNull -+ public FailReason getFailReason() { -+ return this.failReason; -+ } -+ -+ /** -+ * Gets the location this player moved from -+ * -+ * @return Location the player moved from -+ */ -+ @NotNull -+ public Location getFrom() { -+ return this.from.clone(); -+ } -+ -+ /** -+ * Gets the location this player tried to move to -+ * -+ * @return Location the player tried to move to -+ */ -+ @NotNull -+ 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(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(boolean logWarning) { -+ this.logWarning = logWarning; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ 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/0415-Fix-custom-statistic-criteria-creation.patch b/patches/api/0415-Fix-custom-statistic-criteria-creation.patch new file mode 100644 index 0000000000..9b19d71a00 --- /dev/null +++ b/patches/api/0415-Fix-custom-statistic-criteria-creation.patch @@ -0,0 +1,31 @@ +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 c16e03d0676b46b3b74e706309d34e66b5e7a4b3..ce6832ef635c0e4388313f86e250ea8c47ff4294 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -248,5 +248,7 @@ public interface UnsafeValues { + * @throws IllegalStateException if no biome by the given key is registered. + */ + void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); ++ ++ String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); + // Paper end + } +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/0416-Fix-custom-statistic-criteria-creation.patch b/patches/api/0416-Fix-custom-statistic-criteria-creation.patch deleted file mode 100644 index f8da658f51..0000000000 --- a/patches/api/0416-Fix-custom-statistic-criteria-creation.patch +++ /dev/null @@ -1,31 +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 5d862c9221d1ce6d577295a5181f951c2f71a631..e19434a0f5065987be087b6bd531c88be33d2917 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -247,5 +247,7 @@ public interface UnsafeValues { - * @throws IllegalStateException if no biome by the given key is registered. - */ - void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); -+ -+ String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); - // Paper end - } -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/0416-SculkCatalyst-bloom-API.patch b/patches/api/0416-SculkCatalyst-bloom-API.patch new file mode 100644 index 0000000000..49d8c8c2bd --- /dev/null +++ b/patches/api/0416-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/0417-API-for-an-entity-s-scoreboard-name.patch b/patches/api/0417-API-for-an-entity-s-scoreboard-name.patch new file mode 100644 index 0000000000..9820a1a54f --- /dev/null +++ b/patches/api/0417-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 9a0022f9e77b7e532c0cad9f85620901064e436d..8dcb9f17046ac5dc0301b5d4984b016514e19109 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -1108,4 +1108,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/0417-SculkCatalyst-bloom-API.patch b/patches/api/0417-SculkCatalyst-bloom-API.patch deleted file mode 100644 index 49d8c8c2bd..0000000000 --- a/patches/api/0417-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/0418-API-for-an-entity-s-scoreboard-name.patch b/patches/api/0418-API-for-an-entity-s-scoreboard-name.patch deleted file mode 100644 index 9820a1a54f..0000000000 --- a/patches/api/0418-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 9a0022f9e77b7e532c0cad9f85620901064e436d..8dcb9f17046ac5dc0301b5d4984b016514e19109 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1108,4 +1108,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/0418-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/api/0418-Deprecate-and-replace-methods-with-old-StructureType.patch new file mode 100644 index 0000000000..56f67c813a --- /dev/null +++ b/patches/api/0418-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 d6be967c2fd480547bf9eb3938ca147382f835da..81203ad1460f3b64413a8426fb58a051b7d78f03 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -937,9 +937,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 +@@ -948,7 +945,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); +@@ -971,11 +970,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 b8866e8c79f347c87a86713060d81a082ff3f8e3..cab1959a1917e008337c23b73b9170cd455ba4f9 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -802,16 +802,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 +@@ -823,9 +822,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/0419-Add-Listing-API-for-Player.patch b/patches/api/0419-Add-Listing-API-for-Player.patch new file mode 100644 index 0000000000..94d5892bd0 --- /dev/null +++ b/patches/api/0419-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 463521dc80254cab673c5203ee263948081219e9..5753d6d6ae791e2b086c861ddeb6522e46f2571c 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -2033,6 +2033,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/0419-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/api/0419-Deprecate-and-replace-methods-with-old-StructureType.patch deleted file mode 100644 index 77b0ffe0a4..0000000000 --- a/patches/api/0419-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 b5455d03761ced30c94719deeee6788d7c6a8fb7..c9fbbf0287cd663080fc09ac83b439780cbfae85 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -937,9 +937,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 -@@ -948,7 +945,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); -@@ -971,11 +970,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 c0ebbca69775775af22cf2c31b1516e5bf18df4a..c8395c8707e696f1e6fc8b0fd03f07203e01c157 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -802,16 +802,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 -@@ -823,9 +822,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/0420-Add-Listing-API-for-Player.patch b/patches/api/0420-Add-Listing-API-for-Player.patch deleted file mode 100644 index 94d5892bd0..0000000000 --- a/patches/api/0420-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 463521dc80254cab673c5203ee263948081219e9..5753d6d6ae791e2b086c861ddeb6522e46f2571c 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -2033,6 +2033,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/0420-Expose-clicked-BlockFace-during-BlockDamageEvent.patch b/patches/api/0420-Expose-clicked-BlockFace-during-BlockDamageEvent.patch new file mode 100644 index 0000000000..34d1940866 --- /dev/null +++ b/patches/api/0420-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/0421-Expose-clicked-BlockFace-during-BlockDamageEvent.patch b/patches/api/0421-Expose-clicked-BlockFace-during-BlockDamageEvent.patch deleted file mode 100644 index 34d1940866..0000000000 --- a/patches/api/0421-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/0421-Fix-NPE-on-Boat-getStatus.patch b/patches/api/0421-Fix-NPE-on-Boat-getStatus.patch new file mode 100644 index 0000000000..1cf6096a92 --- /dev/null +++ b/patches/api/0421-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 f7548098bcdd033d9c530fdc584fc5538c635ca1..2ac685fb1817f3ce06ebe6391cc863712d68367c 100644 +--- a/src/main/java/org/bukkit/entity/Boat.java ++++ b/src/main/java/org/bukkit/entity/Boat.java +@@ -169,6 +169,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/0422-Expand-Pose-API.patch b/patches/api/0422-Expand-Pose-API.patch new file mode 100644 index 0000000000..b6d907acb4 --- /dev/null +++ b/patches/api/0422-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 8dcb9f17046ac5dc0301b5d4984b016514e19109..62e3793903905b94eb1a120345015149abb33713 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -836,6 +836,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/0422-Fix-NPE-on-Boat-getStatus.patch b/patches/api/0422-Fix-NPE-on-Boat-getStatus.patch deleted file mode 100644 index 1cf6096a92..0000000000 --- a/patches/api/0422-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 f7548098bcdd033d9c530fdc584fc5538c635ca1..2ac685fb1817f3ce06ebe6391cc863712d68367c 100644 ---- a/src/main/java/org/bukkit/entity/Boat.java -+++ b/src/main/java/org/bukkit/entity/Boat.java -@@ -169,6 +169,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/0423-Expand-Pose-API.patch b/patches/api/0423-Expand-Pose-API.patch deleted file mode 100644 index b6d907acb4..0000000000 --- a/patches/api/0423-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 8dcb9f17046ac5dc0301b5d4984b016514e19109..62e3793903905b94eb1a120345015149abb33713 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -836,6 +836,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/0423-MerchantRecipe-add-copy-constructor.patch b/patches/api/0423-MerchantRecipe-add-copy-constructor.patch new file mode 100644 index 0000000000..1c5ba2803c --- /dev/null +++ b/patches/api/0423-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/0424-MerchantRecipe-add-copy-constructor.patch b/patches/api/0424-MerchantRecipe-add-copy-constructor.patch deleted file mode 100644 index 1c5ba2803c..0000000000 --- a/patches/api/0424-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/0424-More-DragonBattle-API.patch b/patches/api/0424-More-DragonBattle-API.patch new file mode 100644 index 0000000000..e25208ec19 --- /dev/null +++ b/patches/api/0424-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/0425-Add-PlayerPickItemEvent.patch b/patches/api/0425-Add-PlayerPickItemEvent.patch new file mode 100644 index 0000000000..6dd0be80a8 --- /dev/null +++ b/patches/api/0425-Add-PlayerPickItemEvent.patch @@ -0,0 +1,108 @@ +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..c5987ebea49e4b99c9ff7fa967aad1533b7b0ca6 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java +@@ -0,0 +1,96 @@ ++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.NotNull; ++import org.jetbrains.annotations.Range; ++ ++/** ++ * 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. ++ */ ++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(@NotNull Player player, int targetSlot, 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) ++ */ ++ @Range(from = 0, to = 8) ++ public 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(@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) ++ */ ++ @Range(from = 0, to = 35) ++ public 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(@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(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0425-More-DragonBattle-API.patch b/patches/api/0425-More-DragonBattle-API.patch deleted file mode 100644 index e25208ec19..0000000000 --- a/patches/api/0425-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/0426-Add-PlayerPickItemEvent.patch b/patches/api/0426-Add-PlayerPickItemEvent.patch deleted file mode 100644 index 6dd0be80a8..0000000000 --- a/patches/api/0426-Add-PlayerPickItemEvent.patch +++ /dev/null @@ -1,108 +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..c5987ebea49e4b99c9ff7fa967aad1533b7b0ca6 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java -@@ -0,0 +1,96 @@ -+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.NotNull; -+import org.jetbrains.annotations.Range; -+ -+/** -+ * 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. -+ */ -+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(@NotNull Player player, int targetSlot, 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) -+ */ -+ @Range(from = 0, to = 8) -+ public 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(@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) -+ */ -+ @Range(from = 0, to = 35) -+ public 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(@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(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0426-Allow-trident-custom-damage.patch b/patches/api/0426-Allow-trident-custom-damage.patch new file mode 100644 index 0000000000..870b735548 --- /dev/null +++ b/patches/api/0426-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/0427-Allow-trident-custom-damage.patch b/patches/api/0427-Allow-trident-custom-damage.patch deleted file mode 100644 index 870b735548..0000000000 --- a/patches/api/0427-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/0427-Expose-hand-during-BlockCanBuildEvent.patch b/patches/api/0427-Expose-hand-during-BlockCanBuildEvent.patch new file mode 100644 index 0000000000..97d99a40d2 --- /dev/null +++ b/patches/api/0427-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/0428-Expose-hand-during-BlockCanBuildEvent.patch b/patches/api/0428-Expose-hand-during-BlockCanBuildEvent.patch deleted file mode 100644 index 97d99a40d2..0000000000 --- a/patches/api/0428-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/0428-Limit-setBurnTime-to-valid-short-values.patch b/patches/api/0428-Limit-setBurnTime-to-valid-short-values.patch new file mode 100644 index 0000000000..2faac56fd8 --- /dev/null +++ b/patches/api/0428-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/0429-Add-OfflinePlayer-isConnected.patch b/patches/api/0429-Add-OfflinePlayer-isConnected.patch new file mode 100644 index 0000000000..fad59b6a54 --- /dev/null +++ b/patches/api/0429-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 6a84c3d0d15251694bb7a05393b9ff7a4d8e0617..30298a629b39bd43ce14b414fc697b2dfcbea89c 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/0429-Limit-setBurnTime-to-valid-short-values.patch b/patches/api/0429-Limit-setBurnTime-to-valid-short-values.patch deleted file mode 100644 index 2faac56fd8..0000000000 --- a/patches/api/0429-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/0430-Add-OfflinePlayer-isConnected.patch b/patches/api/0430-Add-OfflinePlayer-isConnected.patch deleted file mode 100644 index fad59b6a54..0000000000 --- a/patches/api/0430-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 6a84c3d0d15251694bb7a05393b9ff7a4d8e0617..30298a629b39bd43ce14b414fc697b2dfcbea89c 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/0430-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/api/0430-Add-titleOverride-to-InventoryOpenEvent.patch new file mode 100644 index 0000000000..68e755f010 --- /dev/null +++ b/patches/api/0430-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/0431-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/api/0431-Add-titleOverride-to-InventoryOpenEvent.patch deleted file mode 100644 index 68e755f010..0000000000 --- a/patches/api/0431-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/0431-Allow-proper-checking-of-empty-item-stacks.patch b/patches/api/0431-Allow-proper-checking-of-empty-item-stacks.patch new file mode 100644 index 0000000000..4b2d49be32 --- /dev/null +++ b/patches/api/0431-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 6195ac25e7a46542659a263c85f7adac745c2ce4..7cecb04de7d55dcdec1fa3dd255c844e92b1abdb 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -1001,5 +1001,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/0432-Allow-proper-checking-of-empty-item-stacks.patch b/patches/api/0432-Allow-proper-checking-of-empty-item-stacks.patch deleted file mode 100644 index 4b2d49be32..0000000000 --- a/patches/api/0432-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 6195ac25e7a46542659a263c85f7adac745c2ce4..7cecb04de7d55dcdec1fa3dd255c844e92b1abdb 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -1001,5 +1001,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/0432-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch b/patches/api/0432-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch new file mode 100644 index 0000000000..e72f86be5d --- /dev/null +++ b/patches/api/0432-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/0433-Add-player-idle-duration-API.patch b/patches/api/0433-Add-player-idle-duration-API.patch new file mode 100644 index 0000000000..41b55311ed --- /dev/null +++ b/patches/api/0433-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 5753d6d6ae791e2b086c861ddeb6522e46f2571c..9261f06e332f8db94b2ef7bc01f5b0e61422bcb2 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3689,6 +3689,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/0433-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch b/patches/api/0433-Fix-PlayerSwapHandItemsEvent-throwing-exception-when.patch deleted file mode 100644 index e72f86be5d..0000000000 --- a/patches/api/0433-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/0434-Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/api/0434-Add-API-to-get-the-collision-shape-of-a-block-before.patch new file mode 100644 index 0000000000..0481690ad4 --- /dev/null +++ b/patches/api/0434-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 64188a78211195fe792eac427e483e1984f52318..fb4c7cf0f67f3e4227d17f6702ae7b7bf1c110ab 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/0434-Add-player-idle-duration-API.patch b/patches/api/0434-Add-player-idle-duration-API.patch deleted file mode 100644 index 41b55311ed..0000000000 --- a/patches/api/0434-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 5753d6d6ae791e2b086c861ddeb6522e46f2571c..9261f06e332f8db94b2ef7bc01f5b0e61422bcb2 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3689,6 +3689,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/0435-Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/api/0435-Add-API-to-get-the-collision-shape-of-a-block-before.patch deleted file mode 100644 index 0481690ad4..0000000000 --- a/patches/api/0435-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 64188a78211195fe792eac427e483e1984f52318..fb4c7cf0f67f3e4227d17f6702ae7b7bf1c110ab 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/0435-Add-predicate-for-blocks-when-raytracing.patch b/patches/api/0435-Add-predicate-for-blocks-when-raytracing.patch new file mode 100644 index 0000000000..c212167a42 --- /dev/null +++ b/patches/api/0435-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 00fbc02a1751902edda327236e51a6991f5366f8..3abd62dc08e1edaeec6773819c8726671221074a 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -1703,6 +1703,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. +@@ -1766,6 +1787,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. + *

    +@@ -1799,6 +1848,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/0436-Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/api/0436-Add-hand-to-fish-event-for-all-player-interactions.patch new file mode 100644 index 0000000000..b431332b9a --- /dev/null +++ b/patches/api/0436-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/0436-Add-predicate-for-blocks-when-raytracing.patch b/patches/api/0436-Add-predicate-for-blocks-when-raytracing.patch deleted file mode 100644 index c212167a42..0000000000 --- a/patches/api/0436-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 00fbc02a1751902edda327236e51a6991f5366f8..3abd62dc08e1edaeec6773819c8726671221074a 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -1703,6 +1703,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. -@@ -1766,6 +1787,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. - *

    -@@ -1799,6 +1848,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/0437-Add-UUID-attribute-modifier-API.patch b/patches/api/0437-Add-UUID-attribute-modifier-API.patch new file mode 100644 index 0000000000..251ae6e425 --- /dev/null +++ b/patches/api/0437-Add-UUID-attribute-modifier-API.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TonytheMacaroni +Date: Thu, 9 Nov 2023 20:35:35 -0500 +Subject: [PATCH] Add UUID attribute modifier API + + +diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java +index 5513174ea545bb5b4fdc028cbaa4c1bb763e2c6d..3cffffe8106387847b10ac39f96687bb075ef686 100644 +--- a/src/main/java/org/bukkit/attribute/AttributeInstance.java ++++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java +@@ -39,6 +39,23 @@ public interface AttributeInstance { + @NotNull + Collection getModifiers(); + ++ // Paper start ++ /** ++ * Gets the modifier with the corresponding UUID. ++ * ++ * @param uuid the UUID of the modifier ++ * @return the modifier, if it exists ++ */ ++ @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 ++ */ ++ void removeModifier(@NotNull java.util.UUID uuid); ++ // Paper end ++ + /** + * Add a modifier to this instance. + * diff --git a/patches/api/0437-Add-hand-to-fish-event-for-all-player-interactions.patch b/patches/api/0437-Add-hand-to-fish-event-for-all-player-interactions.patch deleted file mode 100644 index b431332b9a..0000000000 --- a/patches/api/0437-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/0438-Add-UUID-attribute-modifier-API.patch b/patches/api/0438-Add-UUID-attribute-modifier-API.patch deleted file mode 100644 index 251ae6e425..0000000000 --- a/patches/api/0438-Add-UUID-attribute-modifier-API.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TonytheMacaroni -Date: Thu, 9 Nov 2023 20:35:35 -0500 -Subject: [PATCH] Add UUID attribute modifier API - - -diff --git a/src/main/java/org/bukkit/attribute/AttributeInstance.java b/src/main/java/org/bukkit/attribute/AttributeInstance.java -index 5513174ea545bb5b4fdc028cbaa4c1bb763e2c6d..3cffffe8106387847b10ac39f96687bb075ef686 100644 ---- a/src/main/java/org/bukkit/attribute/AttributeInstance.java -+++ b/src/main/java/org/bukkit/attribute/AttributeInstance.java -@@ -39,6 +39,23 @@ public interface AttributeInstance { - @NotNull - Collection getModifiers(); - -+ // Paper start -+ /** -+ * Gets the modifier with the corresponding UUID. -+ * -+ * @param uuid the UUID of the modifier -+ * @return the modifier, if it exists -+ */ -+ @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 -+ */ -+ void removeModifier(@NotNull java.util.UUID uuid); -+ // Paper end -+ - /** - * Add a modifier to this instance. - * diff --git a/patches/api/0438-Expand-LingeringPotion-API.patch b/patches/api/0438-Expand-LingeringPotion-API.patch new file mode 100644 index 0000000000..40b5a5f547 --- /dev/null +++ b/patches/api/0438-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/0439-Expand-LingeringPotion-API.patch b/patches/api/0439-Expand-LingeringPotion-API.patch deleted file mode 100644 index 40b5a5f547..0000000000 --- a/patches/api/0439-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/0439-Remove-unnecessary-durability-check-in-ItemStack-isS.patch b/patches/api/0439-Remove-unnecessary-durability-check-in-ItemStack-isS.patch new file mode 100644 index 0000000000..4974a88a57 --- /dev/null +++ b/patches/api/0439-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 7cecb04de7d55dcdec1fa3dd255c844e92b1abdb..a1d0e479b9f28378f858f86ba8b0e9b7ddf71446 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -298,7 +298,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/0440-Add-Structure-check-API.patch b/patches/api/0440-Add-Structure-check-API.patch new file mode 100644 index 0000000000..4c0756c86e --- /dev/null +++ b/patches/api/0440-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 3abd62dc08e1edaeec6773819c8726671221074a..0e3c7de14be8dc01199fd68b6bf41783c5c43ec3 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/0440-Remove-unnecessary-durability-check-in-ItemStack-isS.patch b/patches/api/0440-Remove-unnecessary-durability-check-in-ItemStack-isS.patch deleted file mode 100644 index 4974a88a57..0000000000 --- a/patches/api/0440-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 7cecb04de7d55dcdec1fa3dd255c844e92b1abdb..a1d0e479b9f28378f858f86ba8b0e9b7ddf71446 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -298,7 +298,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/0441-Add-Structure-check-API.patch b/patches/api/0441-Add-Structure-check-API.patch deleted file mode 100644 index 4c0756c86e..0000000000 --- a/patches/api/0441-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 3abd62dc08e1edaeec6773819c8726671221074a..0e3c7de14be8dc01199fd68b6bf41783c5c43ec3 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/0441-add-missing-Experimental-annotations.patch b/patches/api/0441-add-missing-Experimental-annotations.patch new file mode 100644 index 0000000000..4a204eb8b0 --- /dev/null +++ b/patches/api/0441-add-missing-Experimental-annotations.patch @@ -0,0 +1,1152 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 9 Dec 2023 11:47:53 -0800 +Subject: [PATCH] add missing Experimental annotations + + +diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java +index 6b68c92ec894451d99ded3e3df5965cb31d68ed2..fd5e433f930963c102c9c977523a0036eabc0477 100644 +--- a/src/main/java/org/bukkit/FeatureFlag.java ++++ b/src/main/java/org/bukkit/FeatureFlag.java +@@ -13,6 +13,7 @@ public interface FeatureFlag extends Keyed { + + public static final FeatureFlag VANILLA = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("vanilla")); + ++ @ApiStatus.Experimental // Paper - add missing annotation + public static final FeatureFlag BUNDLE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("bundle")); + + /** +@@ -23,7 +24,9 @@ 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")); + ++ @ApiStatus.Experimental // Paper - add missing annotation + public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21")); + } +diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java +index 1ca448c9e3a3178663a033617d9414ec085c246a..7a337fe908915f8ea487a0b9236c511cb07d5e66 100644 +--- a/src/main/java/org/bukkit/Material.java ++++ b/src/main/java/org/bukkit/Material.java +@@ -148,54 +148,67 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * BlockData: {@link Slab} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_SLAB(19305, Slab.class), + /** + * BlockData: {@link Stairs} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_STAIRS(11268, Stairs.class), + /** + * BlockData: {@link Wall} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_WALL(24395, Wall.class), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + CHISELED_TUFF(15831), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + POLISHED_TUFF(17801), + /** + * BlockData: {@link Slab} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + POLISHED_TUFF_SLAB(31096, Slab.class), + /** + * BlockData: {@link Stairs} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + POLISHED_TUFF_STAIRS(7964, Stairs.class), + /** + * BlockData: {@link Wall} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + POLISHED_TUFF_WALL(28886, Wall.class), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_BRICKS(26276), + /** + * BlockData: {@link Slab} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_BRICK_SLAB(11843, Slab.class), + /** + * BlockData: {@link Stairs} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_BRICK_STAIRS(30753, Stairs.class), + /** + * BlockData: {@link Wall} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TUFF_BRICK_WALL(11761, Wall.class), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + CHISELED_TUFF_BRICKS(8601), + DRIPSTONE_BLOCK(26227), + /** +@@ -302,6 +315,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + HEAVY_CORE(15788, Waterlogged.class), + AMETHYST_BLOCK(18919), + BUDDING_AMETHYST(13963), +@@ -314,12 +328,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + WEATHERED_COPPER(19699), + OXIDIZED_COPPER(19490), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + CHISELED_COPPER(12143), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EXPOSED_CHISELED_COPPER(4570), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WEATHERED_CHISELED_COPPER(30876), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OXIDIZED_CHISELED_COPPER(27719), + CUT_COPPER(32519), + EXPOSED_CUT_COPPER(18000), +@@ -362,12 +380,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + WAXED_WEATHERED_COPPER(5960), + WAXED_OXIDIZED_COPPER(25626), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_CHISELED_COPPER(7500), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_EXPOSED_CHISELED_COPPER(30658), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_WEATHERED_CHISELED_COPPER(5970), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_OXIDIZED_CHISELED_COPPER(7735), + WAXED_CUT_COPPER(11030), + WAXED_EXPOSED_CUT_COPPER(30043), +@@ -2109,41 +2131,49 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + COPPER_DOOR(26809, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EXPOSED_COPPER_DOOR(13236, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WEATHERED_COPPER_DOOR(10208, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OXIDIZED_COPPER_DOOR(5348, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_COPPER_DOOR(9954, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_EXPOSED_COPPER_DOOR(20748, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_WEATHERED_COPPER_DOOR(25073, Door.class), + /** + * BlockData: {@link Door} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_OXIDIZED_COPPER_DOOR(23888, Door.class), + /** + * BlockData: {@link TrapDoor} +@@ -2197,41 +2227,49 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + COPPER_TRAPDOOR(12110, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EXPOSED_COPPER_TRAPDOOR(19219, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WEATHERED_COPPER_TRAPDOOR(28254, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OXIDIZED_COPPER_TRAPDOOR(26518, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_COPPER_TRAPDOOR(12626, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_EXPOSED_COPPER_TRAPDOOR(11010, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_WEATHERED_COPPER_TRAPDOOR(30709, TrapDoor.class), + /** + * BlockData: {@link TrapDoor} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_OXIDIZED_COPPER_TRAPDOOR(21450, TrapDoor.class), + /** + * BlockData: {@link Gate} +@@ -2533,6 +2571,8 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + EGG(21603, 16), + COMPASS(24139), + RECOVERY_COMPASS(12710), ++ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BUNDLE(16835, 1), + FISHING_ROD(4167, 1, 64), + CLOCK(14980), +@@ -2639,6 +2679,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * BlockData: {@link Crafter} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + CRAFTER(25243, Crafter.class), + FILLED_MAP(23504), + SHEARS(27971, 1, 238), +@@ -2679,8 +2720,10 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + BEE_SPAWN_EGG(22924), + BLAZE_SPAWN_EGG(4759), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BOGGED_SPAWN_EGG(12042), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BREEZE_SPAWN_EGG(7580), + CAT_SPAWN_EGG(29583), + CAMEL_SPAWN_EGG(14760), +@@ -2757,10 +2800,12 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + EXPERIENCE_BOTTLE(12858), + FIRE_CHARGE(4842), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WIND_CHARGE(23928), + WRITABLE_BOOK(13393, 1), + WRITTEN_BOOK(24164, 16), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + MACE(4771, 1, 250), + ITEM_FRAME(27318), + GLOW_ITEM_FRAME(26473), +@@ -2938,7 +2983,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + MOJANG_BANNER_PATTERN(11903, 1), + GLOBE_BANNER_PATTERN(27753, 1), + PIGLIN_BANNER_PATTERN(22028, 1), ++ @MinecraftExperimental(Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + FLOW_BANNER_PATTERN(32683, 1), ++ @MinecraftExperimental(Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + GUSTER_BANNER_PATTERN(27267, 1), + GOAT_HORN(28237, 1), + /** +@@ -3159,8 +3208,10 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + RAISER_ARMOR_TRIM_SMITHING_TEMPLATE(29116), + HOST_ARMOR_TRIM_SMITHING_TEMPLATE(12165), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + FLOW_ARMOR_TRIM_SMITHING_TEMPLATE(29175), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BOLT_ARMOR_TRIM_SMITHING_TEMPLATE(9698), + ANGLER_POTTERY_SHERD(9952), + ARCHER_POTTERY_SHERD(21629), +@@ -3171,9 +3222,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + DANGER_POTTERY_SHERD(30506), + EXPLORER_POTTERY_SHERD(5124), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + FLOW_POTTERY_SHERD(4896), + FRIEND_POTTERY_SHERD(18221), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + GUSTER_POTTERY_SHERD(28193), + HEART_POTTERY_SHERD(17607), + HEARTBREAK_POTTERY_SHERD(21108), +@@ -3183,6 +3236,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + PLENTY_POTTERY_SHERD(28236), + PRIZE_POTTERY_SHERD(4341), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + SCRAPE_POTTERY_SHERD(30034), + SHEAF_POTTERY_SHERD(23652), + SHELTER_POTTERY_SHERD(28390), +@@ -3192,99 +3246,121 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + COPPER_GRATE(16221, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EXPOSED_COPPER_GRATE(7783, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WEATHERED_COPPER_GRATE(24954, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OXIDIZED_COPPER_GRATE(14122, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_COPPER_GRATE(11230, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_EXPOSED_COPPER_GRATE(20520, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_WEATHERED_COPPER_GRATE(16533, Waterlogged.class), + /** + * BlockData: {@link Waterlogged} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_OXIDIZED_COPPER_GRATE(32010, Waterlogged.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + COPPER_BULB(21370, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EXPOSED_COPPER_BULB(11944, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WEATHERED_COPPER_BULB(10800, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OXIDIZED_COPPER_BULB(22421, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_COPPER_BULB(23756, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_EXPOSED_COPPER_BULB(5530, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_WEATHERED_COPPER_BULB(13239, CopperBulb.class), + /** + * BlockData: {@link CopperBulb} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WAXED_OXIDIZED_COPPER_BULB(26892, CopperBulb.class), + /** + * BlockData: {@link TrialSpawner} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_SPAWNER(19902, TrialSpawner.class), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_KEY(12725), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OMINOUS_TRIAL_KEY(4986), + /** + * BlockData: {@link Vault} + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + VAULT(6288, Vault.class), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OMINOUS_BOTTLE(26321), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BREEZE_ROD(14281), + /** + * BlockData: {@link Levelled} +diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java +index c5e3a8143a166d426d87fa3d0f0b3d4f3d4bff1a..50cc7a920bab32264d77f30d3af986b02229c749 100644 +--- a/src/main/java/org/bukkit/Particle.java ++++ b/src/main/java/org/bukkit/Particle.java +@@ -130,33 +130,46 @@ public enum Particle implements Keyed { + DUST_PLUME("dust_plume"), + WHITE_SMOKE("white_smoke"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + GUST("gust"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + SMALL_GUST("small_gust"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + GUST_EMITTER_LARGE("gust_emitter_large"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + GUST_EMITTER_SMALL("gust_emitter_small"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_SPAWNER_DETECTION("trial_spawner_detection"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_SPAWNER_DETECTION_OMINOUS("trial_spawner_detection_ominous"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + VAULT_CONNECTION("vault_connection"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + INFESTED("infested"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_COBWEB("item_cobweb"), + /** + * Uses {@link BlockData} as DataType + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + DUST_PILLAR("dust_pillar", BlockData.class), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OMINOUS_SPAWNING("ominous_spawning"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + RAID_OMEN("raid_omen"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_OMEN("trial_omen"), + /** + * Uses {@link BlockData} as DataType +diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java +index 375172e05a78611deb3003f780867516cb6cd1a4..e31e7b6624ff9da7bec5d3b0548a4fa38812daca 100644 +--- a/src/main/java/org/bukkit/Sound.java ++++ b/src/main/java/org/bukkit/Sound.java +@@ -221,40 +221,56 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + BLOCK_CONDUIT_DEACTIVATE("block.conduit.deactivate"), + BLOCK_COPPER_BREAK("block.copper.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_BREAK("block.copper_bulb.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_FALL("block.copper_bulb.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_HIT("block.copper_bulb.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_PLACE("block.copper_bulb.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_STEP("block.copper_bulb.step"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_TURN_OFF("block.copper_bulb.turn_off"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_BULB_TURN_ON("block.copper_bulb.turn_on"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_DOOR_CLOSE("block.copper_door.close"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_DOOR_OPEN("block.copper_door.open"), + BLOCK_COPPER_FALL("block.copper.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_GRATE_BREAK("block.copper_grate.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_GRATE_FALL("block.copper_grate.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_GRATE_HIT("block.copper_grate.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_GRATE_PLACE("block.copper_grate.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_GRATE_STEP("block.copper_grate.step"), + BLOCK_COPPER_HIT("block.copper.hit"), + BLOCK_COPPER_PLACE("block.copper.place"), + BLOCK_COPPER_STEP("block.copper.step"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_TRAPDOOR_CLOSE("block.copper_trapdoor.close"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_COPPER_TRAPDOOR_OPEN("block.copper_trapdoor.open"), + BLOCK_CORAL_BLOCK_BREAK("block.coral_block.break"), + BLOCK_CORAL_BLOCK_FALL("block.coral_block.fall"), +@@ -361,14 +377,19 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + BLOCK_HANGING_SIGN_STEP("block.hanging_sign.step"), + BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL("block.hanging_sign.waxed_interact_fail"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_HEAVY_CORE_BREAK("block.heavy_core.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_HEAVY_CORE_FALL("block.heavy_core.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_HEAVY_CORE_HIT("block.heavy_core.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_HEAVY_CORE_PLACE("block.heavy_core.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_HEAVY_CORE_STEP("block.heavy_core.step"), + BLOCK_HONEY_BLOCK_BREAK("block.honey_block.break"), + BLOCK_HONEY_BLOCK_FALL("block.honey_block.fall"), +@@ -547,14 +568,19 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + BLOCK_POLISHED_DEEPSLATE_PLACE("block.polished_deepslate.place"), + BLOCK_POLISHED_DEEPSLATE_STEP("block.polished_deepslate.step"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_POLISHED_TUFF_BREAK("block.polished_tuff.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_POLISHED_TUFF_FALL("block.polished_tuff.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_POLISHED_TUFF_HIT("block.polished_tuff.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_POLISHED_TUFF_PLACE("block.polished_tuff.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_POLISHED_TUFF_STEP("block.polished_tuff.step"), + BLOCK_PORTAL_AMBIENT("block.portal.ambient"), + BLOCK_PORTAL_TRAVEL("block.portal.travel"), +@@ -700,36 +726,52 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES("block.sweet_berry_bush.pick_berries"), + BLOCK_SWEET_BERRY_BUSH_PLACE("block.sweet_berry_bush.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM("block.trial_spawner.about_to_spawn_item"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_AMBIENT("block.trial_spawner.ambient"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_AMBIENT_CHARGED("block.trial_spawner.ambient_charged"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_BREAK("block.trial_spawner.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_CHARGE_ACTIVATE("block.trial_spawner.charge_activate"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER("block.trial_spawner.close_shutter"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_DETECT_PLAYER("block.trial_spawner.detect_player"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_EJECT_ITEM("block.trial_spawner.eject_item"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_FALL("block.trial_spawner.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_HIT("block.trial_spawner.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER("block.trial_spawner.open_shutter"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_PLACE("block.trial_spawner.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_SPAWN_ITEM("block.trial_spawner.spawn_item"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN("block.trial_spawner.spawn_item_begin"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_SPAWN_MOB("block.trial_spawner.spawn_mob"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TRIAL_SPAWNER_STEP("block.trial_spawner.step"), + BLOCK_TRIPWIRE_ATTACH("block.tripwire.attach"), + BLOCK_TRIPWIRE_CLICK_OFF("block.tripwire.click_off"), +@@ -737,44 +779,62 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + BLOCK_TRIPWIRE_DETACH("block.tripwire.detach"), + BLOCK_TUFF_BREAK("block.tuff.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TUFF_BRICKS_BREAK("block.tuff_bricks.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TUFF_BRICKS_FALL("block.tuff_bricks.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TUFF_BRICKS_HIT("block.tuff_bricks.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TUFF_BRICKS_PLACE("block.tuff_bricks.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_TUFF_BRICKS_STEP("block.tuff_bricks.step"), + BLOCK_TUFF_FALL("block.tuff.fall"), + BLOCK_TUFF_HIT("block.tuff.hit"), + BLOCK_TUFF_PLACE("block.tuff.place"), + BLOCK_TUFF_STEP("block.tuff.step"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_ACTIVATE("block.vault.activate"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_AMBIENT("block.vault.ambient"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_BREAK("block.vault.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_CLOSE_SHUTTER("block.vault.close_shutter"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_DEACTIVATE("block.vault.deactivate"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_EJECT_ITEM("block.vault.eject_item"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_FALL("block.vault.fall"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_HIT("block.vault.hit"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_INSERT_ITEM("block.vault.insert_item"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_INSERT_ITEM_FAIL("block.vault.insert_item_fail"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_OPEN_SHUTTER("block.vault.open_shutter"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_PLACE("block.vault.place"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + BLOCK_VAULT_STEP("block.vault.step"), + BLOCK_VINE_BREAK("block.vine.break"), + BLOCK_VINE_FALL("block.vine.fall"), +@@ -875,40 +935,58 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ENTITY_BOAT_PADDLE_LAND("entity.boat.paddle_land"), + ENTITY_BOAT_PADDLE_WATER("entity.boat.paddle_water"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BOGGED_AMBIENT("entity.bogged.ambient"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BOGGED_DEATH("entity.bogged.death"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BOGGED_HURT("entity.bogged.hurt"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BOGGED_SHEAR("entity.bogged.shear"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BOGGED_STEP("entity.bogged.step"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_CHARGE("entity.breeze.charge"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_DEATH("entity.breeze.death"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_DEFLECT("entity.breeze.deflect"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_HURT("entity.breeze.hurt"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_IDLE_AIR("entity.breeze.idle_air"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_IDLE_GROUND("entity.breeze.idle_ground"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_INHALE("entity.breeze.inhale"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_JUMP("entity.breeze.jump"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_LAND("entity.breeze.land"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_SHOOT("entity.breeze.shoot"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_SLIDE("entity.breeze.slide"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_WHIRL("entity.breeze.whirl"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_BREEZE_WIND_BURST("entity.breeze.wind_burst"), + ENTITY_CAMEL_AMBIENT("entity.camel.ambient"), + ENTITY_CAMEL_DASH("entity.camel.dash"), +@@ -1208,8 +1286,10 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ENTITY_PARROT_HURT("entity.parrot.hurt"), + ENTITY_PARROT_IMITATE_BLAZE("entity.parrot.imitate.blaze"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_PARROT_IMITATE_BOGGED("entity.parrot.imitate.bogged"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_PARROT_IMITATE_BREEZE("entity.parrot.imitate.breeze"), + ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"), + ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"), +@@ -1489,8 +1569,10 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ENTITY_WARDEN_STEP("entity.warden.step"), + ENTITY_WARDEN_TENDRIL_CLICKS("entity.warden.tendril_clicks"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_WIND_CHARGE_THROW("entity.wind_charge.throw"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ENTITY_WIND_CHARGE_WIND_BURST("entity.wind_charge.wind_burst"), + ENTITY_WITCH_AMBIENT("entity.witch.ambient"), + ENTITY_WITCH_CELEBRATE("entity.witch.celebrate"), +@@ -1546,11 +1628,12 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ENTITY_ZOMBIFIED_PIGLIN_ANGRY("entity.zombified_piglin.angry"), + ENTITY_ZOMBIFIED_PIGLIN_DEATH("entity.zombified_piglin.death"), + ENTITY_ZOMBIFIED_PIGLIN_HURT("entity.zombified_piglin.hurt"), +- @MinecraftExperimental(Requires.UPDATE_1_21) + EVENT_MOB_EFFECT_BAD_OMEN("event.mob_effect.bad_omen"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EVENT_MOB_EFFECT_RAID_OMEN("event.mob_effect.raid_omen"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EVENT_MOB_EFFECT_TRIAL_OMEN("event.mob_effect.trial_omen"), + EVENT_RAID_HORN("event.raid.horn"), + INTENTIONALLY_EMPTY("intentionally_empty"), +@@ -1591,8 +1674,14 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ITEM_BUCKET_FILL_LAVA("item.bucket.fill_lava"), + ITEM_BUCKET_FILL_POWDER_SNOW("item.bucket.fill_powder_snow"), + ITEM_BUCKET_FILL_TADPOLE("item.bucket.fill_tadpole"), ++ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_BUNDLE_DROP_CONTENTS("item.bundle.drop_contents"), ++ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_BUNDLE_INSERT("item.bundle.insert"), ++ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_BUNDLE_REMOVE_ONE("item.bundle.remove_one"), + ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"), + ITEM_CROP_PLANT("item.crop.plant"), +@@ -1624,13 +1713,17 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ITEM_INK_SAC_USE("item.ink_sac.use"), + ITEM_LODESTONE_COMPASS_LOCK("item.lodestone_compass.lock"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_MACE_SMASH_AIR("item.mace.smash_air"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_MACE_SMASH_GROUND("item.mace.smash_ground"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_MACE_SMASH_GROUND_HEAVY("item.mace.smash_ground_heavy"), + ITEM_NETHER_WART_PLANT("item.nether_wart.plant"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_OMINOUS_BOTTLE_DISPOSE("item.ominous_bottle.dispose"), + ITEM_SHIELD_BLOCK("item.shield.block"), + ITEM_SHIELD_BREAK("item.shield.break"), +@@ -1647,12 +1740,16 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + ITEM_TRIDENT_THROW("item.trident.throw"), + ITEM_TRIDENT_THUNDER("item.trident.thunder"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_WOLF_ARMOR_BREAK("item.wolf_armor.break"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_WOLF_ARMOR_CRACK("item.wolf_armor.crack"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_WOLF_ARMOR_DAMAGE("item.wolf_armor.damage"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + ITEM_WOLF_ARMOR_REPAIR("item.wolf_armor.repair"), + MUSIC_CREATIVE("music.creative"), + MUSIC_CREDITS("music.credits"), +diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java +index cb5890e0e7bccfee2ba32dd4776f1ae1fdd539e8..5ec7f1cae36189989db0a66ee05c22035e7daf7c 100644 +--- a/src/main/java/org/bukkit/Tag.java ++++ b/src/main/java/org/bukkit/Tag.java +@@ -770,6 +770,8 @@ public interface Tag extends Keyed { + /** + * Vanilla block tag representing all blocks which block wind charge explosions. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag BLOCKS_WIND_CHARGE_EXPLOSIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("blocks_wind_charge_explosions"), Material.class); + /** + * Vanilla block tag representing solid blocks which do not block hopper operation. +@@ -1141,6 +1143,8 @@ public interface Tag extends Keyed { + /** + * Vanilla item tag representing all items enchantable with mace enchantments. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag ITEMS_ENCHANTABLE_MACE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mace"), Material.class); + /** + * Vanilla item tag representing all items that confer freeze immunity on +@@ -1234,6 +1238,8 @@ public interface Tag extends Keyed { + /** + * Vanilla tag representing entities which deflect projectiles. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag ENTITY_TYPES_DEFLECTS_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_projectiles"), EntityType.class); + /** + * Vanilla tag representing entities which deflect arrows. +@@ -1244,6 +1250,8 @@ public interface Tag extends Keyed { + /** + * Vanilla tag representing entities which can turn in boats. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class); + /** + * Vanilla tag representing all entities sensitive to illager enchantments. +@@ -1292,14 +1300,20 @@ public interface Tag extends Keyed { + /** + * Vanilla tag representing all entities which do not receive anger from wind charges. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag ENTITY_TYPES_NO_ANGER_FROM_WIND_CHARGE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("no_anger_from_wind_charge"), EntityType.class); + /** + * Vanilla tag representing all entities which are immune from the oozing effect. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag ENTITY_TYPES_IMMUNE_TO_OOZING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_oozing"), EntityType.class); + /** + * Vanilla tag representing all entities which are immune from the infested effect. + */ ++ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + Tag ENTITY_TYPES_IMMUNE_TO_INFESTED = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_infested"), EntityType.class); + /** + * Vanilla tag representing all projectiles which can be punched back. +diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java +index db7723e2907525850f8dbd2bd7150c1e47ebf1c8..9951cf6780ae47649625b8fe0ed72d87ad0417b2 100644 +--- a/src/main/java/org/bukkit/block/banner/PatternType.java ++++ b/src/main/java/org/bukkit/block/banner/PatternType.java +@@ -54,8 +54,10 @@ public enum PatternType implements Keyed { + GLOBE("glb", "globe"), + PIGLIN("pig", "piglin"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + FLOW("flw", "flow"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + GUSTER("gus", "guster"); + + private final String identifier; +diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java +index de616cecaeb45018d96685c916532188e369bdd4..48a01a1eb80475adf9b181e9bd81535e9faec233 100644 +--- a/src/main/java/org/bukkit/enchantments/Enchantment.java ++++ b/src/main/java/org/bukkit/enchantments/Enchantment.java +@@ -198,18 +198,21 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve + * Increases fall damage of maces + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final Enchantment DENSITY = getEnchantment("density"); + + /** + * Reduces armor effectiveness against maces + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final Enchantment BREACH = getEnchantment("breach"); + + /** + * Emits wind burst upon hitting enemy + */ + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final Enchantment WIND_BURST = getEnchantment("wind_burst"); + + /** +diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java +index b670ff8b2bfcaa59c2292211cb9fc2bf4c5b2642..94092a5882180cca7905388184de1f91633f0df1 100644 +--- a/src/main/java/org/bukkit/generator/structure/Structure.java ++++ b/src/main/java/org/bukkit/generator/structure/Structure.java +@@ -50,6 +50,7 @@ public abstract class Structure implements Keyed { + public static final Structure ANCIENT_CITY = getStructure("ancient_city"); + public static final Structure TRAIL_RUINS = getStructure("trail_ruins"); + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final Structure TRIAL_CHAMBERS = getStructure("trial_chambers"); + + private static Structure getStructure(String name) { +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 f2242ddc4085f7e7cdd748d860857822e3d9b007..9133a889c1936b4cf7dbf17f744ee926d57362a3 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +@@ -78,10 +78,14 @@ public interface TrimPattern extends Keyed, Translatable { + /** + * {@link Material#FLOW_ARMOR_TRIM_SMITHING_TEMPLATE}. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final TrimPattern FLOW = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("flow")); + /** + * {@link Material#BOLT_ARMOR_TRIM_SMITHING_TEMPLATE}. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final TrimPattern BOLT = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("bolt")); + + // Paper start - adventure +diff --git a/src/main/java/org/bukkit/loot/LootTables.java b/src/main/java/org/bukkit/loot/LootTables.java +index 0fc30514375c1700c282d1e92342f7b48ca1cb27..bd625de1103741e592b4111412e4094f4c454f9b 100644 +--- a/src/main/java/org/bukkit/loot/LootTables.java ++++ b/src/main/java/org/bukkit/loot/LootTables.java +@@ -36,44 +36,64 @@ public enum LootTables implements Keyed { + ANCIENT_CITY_ICE_BOX("chests/ancient_city_ice_box"), + RUINED_PORTAL("chests/ruined_portal"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD("chests/trial_chambers/reward"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_COMMON("chests/trial_chambers/reward_common"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_RARE("chests/trial_chambers/reward_rare"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_UNIQUE("chests/trial_chambers/reward_unique"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_OMINOUS("chests/trial_chambers/reward_ominous"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_OMINOUS_COMMON("chests/trial_chambers/reward_ominous_common"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_OMINOUS_RARE("chests/trial_chambers/reward_ominous_rare"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_REWARD_OMINOUS_UNIQUE("chests/trial_chambers/reward_ominous_unique"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_SUPPLY("chests/trial_chambers/supply"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_CORRIDOR("chests/trial_chambers/corridor"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_INTERSECTION("chests/trial_chambers/intersection"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_INTERSECTION_BARREL("chests/trial_chambers/intersection_barrel"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_ENTRANCE("chests/trial_chambers/entrance"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_CORRIDOR_DISPENSER("dispensers/trial_chambers/corridor"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_CHAMBER_DISPENSER("dispensers/trial_chambers/chamber"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_WATER_DISPENSER("dispensers/trial_chambers/water"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBERS_CORRIDOR_POT("pots/trial_chambers/corridor"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EQUIPMENT_TRIAL_CHAMBER("equipment/trial_chamber"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EQUIPMENT_TRIAL_CHAMBER_RANGED("equipment/trial_chamber_ranged"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + EQUIPMENT_TRIAL_CHAMBER_MELEE("equipment/trial_chamber_melee"), + SHIPWRECK_MAP("chests/shipwreck_map"), + SHIPWRECK_SUPPLY("chests/shipwreck_supply"), +@@ -202,14 +222,19 @@ public enum LootTables implements Keyed { + PIGLIN_BARTERING("gameplay/piglin_bartering"), + // Spawners + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBER_KEY("spawners/trial_chamber/key"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBER_CONSUMABLES("spawners/trial_chamber/consumables"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OMINOUS_TRIAL_CHAMBER_KEY("spawners/ominous/trial_chamber/key"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OMINOUS_TRIAL_CHAMBER_CONSUMABLES("spawners/ominous/trial_chamber/consumables"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + TRIAL_CHAMBER_ITEMS_TO_DROP_WHEN_OMINOUS("spawners/trial_chamber/items_to_drop_when_ominous"), + // Shearing + SHEARING_BOGGED("shearing/bogged"), +diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java +index e77cf365cefafbeba09123187e70fd5274f10d53..7a7b98d40a031b09d6bc62df32d2ddeb25a9d41e 100644 +--- a/src/main/java/org/bukkit/potion/PotionEffectType.java ++++ b/src/main/java/org/bukkit/potion/PotionEffectType.java +@@ -192,31 +192,43 @@ public abstract class PotionEffectType implements Keyed, Translatable, net.kyori + /** + * Causes trial spawners to become ominous. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final PotionEffectType TRIAL_OMEN = getPotionEffectType(34, "trial_omen"); + + /** + * Triggers a raid when a player enters a village. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final PotionEffectType RAID_OMEN = getPotionEffectType(35, "raid_omen"); + + /** + * Emits a wind burst upon death. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final PotionEffectType WIND_CHARGED = getPotionEffectType(36, "wind_charged"); + + /** + * Creates cobwebs upon death. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final PotionEffectType WEAVING = getPotionEffectType(37, "weaving"); + + /** + * Causes slimes to spawn upon death. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final PotionEffectType OOZING = getPotionEffectType(38, "oozing"); + + /** + * Chance of spawning silverfish when hurt. + */ ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + public static final PotionEffectType INFESTED = getPotionEffectType(39, "infested"); + + @NotNull +diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java +index dabaa58432b91ed120cc5a3a43a8e94110fa84a3..1fdd56450e8a0763833742c805847a723c43bf6c 100644 +--- a/src/main/java/org/bukkit/potion/PotionType.java ++++ b/src/main/java/org/bukkit/potion/PotionType.java +@@ -60,12 +60,16 @@ public enum PotionType implements Keyed { + SLOW_FALLING("slow_falling"), + LONG_SLOW_FALLING("long_slow_falling"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WIND_CHARGED("wind_charged"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + WEAVING("weaving"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + OOZING("oozing"), + @MinecraftExperimental(Requires.UPDATE_1_21) ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation + INFESTED("infested"), + ; + diff --git a/patches/api/0442-Add-more-scoreboard-API.patch b/patches/api/0442-Add-more-scoreboard-API.patch new file mode 100644 index 0000000000..201af36b0c --- /dev/null +++ b/patches/api/0442-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/0442-add-missing-Experimental-annotations.patch b/patches/api/0442-add-missing-Experimental-annotations.patch deleted file mode 100644 index 0f29e5ede8..0000000000 --- a/patches/api/0442-add-missing-Experimental-annotations.patch +++ /dev/null @@ -1,1152 +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] add missing Experimental annotations - - -diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java -index 6b68c92ec894451d99ded3e3df5965cb31d68ed2..fd5e433f930963c102c9c977523a0036eabc0477 100644 ---- a/src/main/java/org/bukkit/FeatureFlag.java -+++ b/src/main/java/org/bukkit/FeatureFlag.java -@@ -13,6 +13,7 @@ public interface FeatureFlag extends Keyed { - - public static final FeatureFlag VANILLA = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("vanilla")); - -+ @ApiStatus.Experimental // Paper - add missing annotation - public static final FeatureFlag BUNDLE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("bundle")); - - /** -@@ -23,7 +24,9 @@ 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")); - -+ @ApiStatus.Experimental // Paper - add missing annotation - public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21")); - } -diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 1ca448c9e3a3178663a033617d9414ec085c246a..7a337fe908915f8ea487a0b9236c511cb07d5e66 100644 ---- a/src/main/java/org/bukkit/Material.java -+++ b/src/main/java/org/bukkit/Material.java -@@ -148,54 +148,67 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * BlockData: {@link Slab} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_SLAB(19305, Slab.class), - /** - * BlockData: {@link Stairs} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_STAIRS(11268, Stairs.class), - /** - * BlockData: {@link Wall} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_WALL(24395, Wall.class), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - CHISELED_TUFF(15831), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - POLISHED_TUFF(17801), - /** - * BlockData: {@link Slab} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - POLISHED_TUFF_SLAB(31096, Slab.class), - /** - * BlockData: {@link Stairs} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - POLISHED_TUFF_STAIRS(7964, Stairs.class), - /** - * BlockData: {@link Wall} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - POLISHED_TUFF_WALL(28886, Wall.class), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_BRICKS(26276), - /** - * BlockData: {@link Slab} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_BRICK_SLAB(11843, Slab.class), - /** - * BlockData: {@link Stairs} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_BRICK_STAIRS(30753, Stairs.class), - /** - * BlockData: {@link Wall} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TUFF_BRICK_WALL(11761, Wall.class), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - CHISELED_TUFF_BRICKS(8601), - DRIPSTONE_BLOCK(26227), - /** -@@ -302,6 +315,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - HEAVY_CORE(15788, Waterlogged.class), - AMETHYST_BLOCK(18919), - BUDDING_AMETHYST(13963), -@@ -314,12 +328,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - WEATHERED_COPPER(19699), - OXIDIZED_COPPER(19490), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - CHISELED_COPPER(12143), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EXPOSED_CHISELED_COPPER(4570), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WEATHERED_CHISELED_COPPER(30876), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OXIDIZED_CHISELED_COPPER(27719), - CUT_COPPER(32519), - EXPOSED_CUT_COPPER(18000), -@@ -362,12 +380,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - WAXED_WEATHERED_COPPER(5960), - WAXED_OXIDIZED_COPPER(25626), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_CHISELED_COPPER(7500), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_EXPOSED_CHISELED_COPPER(30658), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_WEATHERED_CHISELED_COPPER(5970), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_OXIDIZED_CHISELED_COPPER(7735), - WAXED_CUT_COPPER(11030), - WAXED_EXPOSED_CUT_COPPER(30043), -@@ -2109,41 +2131,49 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - COPPER_DOOR(26809, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EXPOSED_COPPER_DOOR(13236, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WEATHERED_COPPER_DOOR(10208, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OXIDIZED_COPPER_DOOR(5348, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_COPPER_DOOR(9954, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_EXPOSED_COPPER_DOOR(20748, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_WEATHERED_COPPER_DOOR(25073, Door.class), - /** - * BlockData: {@link Door} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_OXIDIZED_COPPER_DOOR(23888, Door.class), - /** - * BlockData: {@link TrapDoor} -@@ -2197,41 +2227,49 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - COPPER_TRAPDOOR(12110, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EXPOSED_COPPER_TRAPDOOR(19219, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WEATHERED_COPPER_TRAPDOOR(28254, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OXIDIZED_COPPER_TRAPDOOR(26518, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_COPPER_TRAPDOOR(12626, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_EXPOSED_COPPER_TRAPDOOR(11010, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_WEATHERED_COPPER_TRAPDOOR(30709, TrapDoor.class), - /** - * BlockData: {@link TrapDoor} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_OXIDIZED_COPPER_TRAPDOOR(21450, TrapDoor.class), - /** - * BlockData: {@link Gate} -@@ -2533,6 +2571,8 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - EGG(21603, 16), - COMPASS(24139), - RECOVERY_COMPASS(12710), -+ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BUNDLE(16835, 1), - FISHING_ROD(4167, 1, 64), - CLOCK(14980), -@@ -2639,6 +2679,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * BlockData: {@link Crafter} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - CRAFTER(25243, Crafter.class), - FILLED_MAP(23504), - SHEARS(27971, 1, 238), -@@ -2679,8 +2720,10 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - BEE_SPAWN_EGG(22924), - BLAZE_SPAWN_EGG(4759), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BOGGED_SPAWN_EGG(12042), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BREEZE_SPAWN_EGG(7580), - CAT_SPAWN_EGG(29583), - CAMEL_SPAWN_EGG(14760), -@@ -2757,10 +2800,12 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - EXPERIENCE_BOTTLE(12858), - FIRE_CHARGE(4842), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WIND_CHARGE(23928), - WRITABLE_BOOK(13393, 1), - WRITTEN_BOOK(24164, 16), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - MACE(4771, 1, 250), - ITEM_FRAME(27318), - GLOW_ITEM_FRAME(26473), -@@ -2938,7 +2983,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - MOJANG_BANNER_PATTERN(11903, 1), - GLOBE_BANNER_PATTERN(27753, 1), - PIGLIN_BANNER_PATTERN(22028, 1), -+ @MinecraftExperimental(Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - FLOW_BANNER_PATTERN(32683, 1), -+ @MinecraftExperimental(Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - GUSTER_BANNER_PATTERN(27267, 1), - GOAT_HORN(28237, 1), - /** -@@ -3159,8 +3208,10 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - RAISER_ARMOR_TRIM_SMITHING_TEMPLATE(29116), - HOST_ARMOR_TRIM_SMITHING_TEMPLATE(12165), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - FLOW_ARMOR_TRIM_SMITHING_TEMPLATE(29175), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BOLT_ARMOR_TRIM_SMITHING_TEMPLATE(9698), - ANGLER_POTTERY_SHERD(9952), - ARCHER_POTTERY_SHERD(21629), -@@ -3171,9 +3222,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - DANGER_POTTERY_SHERD(30506), - EXPLORER_POTTERY_SHERD(5124), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - FLOW_POTTERY_SHERD(4896), - FRIEND_POTTERY_SHERD(18221), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - GUSTER_POTTERY_SHERD(28193), - HEART_POTTERY_SHERD(17607), - HEARTBREAK_POTTERY_SHERD(21108), -@@ -3183,6 +3236,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - PLENTY_POTTERY_SHERD(28236), - PRIZE_POTTERY_SHERD(4341), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - SCRAPE_POTTERY_SHERD(30034), - SHEAF_POTTERY_SHERD(23652), - SHELTER_POTTERY_SHERD(28390), -@@ -3192,99 +3246,121 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - COPPER_GRATE(16221, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EXPOSED_COPPER_GRATE(7783, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WEATHERED_COPPER_GRATE(24954, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OXIDIZED_COPPER_GRATE(14122, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_COPPER_GRATE(11230, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_EXPOSED_COPPER_GRATE(20520, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_WEATHERED_COPPER_GRATE(16533, Waterlogged.class), - /** - * BlockData: {@link Waterlogged} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_OXIDIZED_COPPER_GRATE(32010, Waterlogged.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - COPPER_BULB(21370, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EXPOSED_COPPER_BULB(11944, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WEATHERED_COPPER_BULB(10800, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OXIDIZED_COPPER_BULB(22421, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_COPPER_BULB(23756, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_EXPOSED_COPPER_BULB(5530, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_WEATHERED_COPPER_BULB(13239, CopperBulb.class), - /** - * BlockData: {@link CopperBulb} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WAXED_OXIDIZED_COPPER_BULB(26892, CopperBulb.class), - /** - * BlockData: {@link TrialSpawner} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_SPAWNER(19902, TrialSpawner.class), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_KEY(12725), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OMINOUS_TRIAL_KEY(4986), - /** - * BlockData: {@link Vault} - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VAULT(6288, Vault.class), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OMINOUS_BOTTLE(26321), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BREEZE_ROD(14281), - /** - * BlockData: {@link Levelled} -diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java -index b0ccd263cabe911d43cc13261011b64cacaeb7bb..82d75010cc86bbbbb9c094c2bac5e570c98582c9 100644 ---- a/src/main/java/org/bukkit/Particle.java -+++ b/src/main/java/org/bukkit/Particle.java -@@ -130,33 +130,46 @@ public enum Particle implements Keyed { - DUST_PLUME("dust_plume"), - WHITE_SMOKE("white_smoke"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - GUST("gust"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - SMALL_GUST("small_gust"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - GUST_EMITTER_LARGE("gust_emitter_large"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - GUST_EMITTER_SMALL("gust_emitter_small"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_SPAWNER_DETECTION("trial_spawner_detection"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_SPAWNER_DETECTION_OMINOUS("trial_spawner_detection_ominous"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - VAULT_CONNECTION("vault_connection"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - INFESTED("infested"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_COBWEB("item_cobweb"), - /** - * Uses {@link BlockData} as DataType - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - DUST_PILLAR("dust_pillar", BlockData.class), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OMINOUS_SPAWNING("ominous_spawning"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - RAID_OMEN("raid_omen"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_OMEN("trial_omen"), - /** - * Uses {@link BlockData} as DataType -diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java -index 375172e05a78611deb3003f780867516cb6cd1a4..e31e7b6624ff9da7bec5d3b0548a4fa38812daca 100644 ---- a/src/main/java/org/bukkit/Sound.java -+++ b/src/main/java/org/bukkit/Sound.java -@@ -221,40 +221,56 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - BLOCK_CONDUIT_DEACTIVATE("block.conduit.deactivate"), - BLOCK_COPPER_BREAK("block.copper.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_BREAK("block.copper_bulb.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_FALL("block.copper_bulb.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_HIT("block.copper_bulb.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_PLACE("block.copper_bulb.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_STEP("block.copper_bulb.step"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_TURN_OFF("block.copper_bulb.turn_off"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_BULB_TURN_ON("block.copper_bulb.turn_on"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_DOOR_CLOSE("block.copper_door.close"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_DOOR_OPEN("block.copper_door.open"), - BLOCK_COPPER_FALL("block.copper.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_GRATE_BREAK("block.copper_grate.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_GRATE_FALL("block.copper_grate.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_GRATE_HIT("block.copper_grate.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_GRATE_PLACE("block.copper_grate.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_GRATE_STEP("block.copper_grate.step"), - BLOCK_COPPER_HIT("block.copper.hit"), - BLOCK_COPPER_PLACE("block.copper.place"), - BLOCK_COPPER_STEP("block.copper.step"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_TRAPDOOR_CLOSE("block.copper_trapdoor.close"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_COPPER_TRAPDOOR_OPEN("block.copper_trapdoor.open"), - BLOCK_CORAL_BLOCK_BREAK("block.coral_block.break"), - BLOCK_CORAL_BLOCK_FALL("block.coral_block.fall"), -@@ -361,14 +377,19 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - BLOCK_HANGING_SIGN_STEP("block.hanging_sign.step"), - BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL("block.hanging_sign.waxed_interact_fail"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_HEAVY_CORE_BREAK("block.heavy_core.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_HEAVY_CORE_FALL("block.heavy_core.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_HEAVY_CORE_HIT("block.heavy_core.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_HEAVY_CORE_PLACE("block.heavy_core.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_HEAVY_CORE_STEP("block.heavy_core.step"), - BLOCK_HONEY_BLOCK_BREAK("block.honey_block.break"), - BLOCK_HONEY_BLOCK_FALL("block.honey_block.fall"), -@@ -547,14 +568,19 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - BLOCK_POLISHED_DEEPSLATE_PLACE("block.polished_deepslate.place"), - BLOCK_POLISHED_DEEPSLATE_STEP("block.polished_deepslate.step"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_POLISHED_TUFF_BREAK("block.polished_tuff.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_POLISHED_TUFF_FALL("block.polished_tuff.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_POLISHED_TUFF_HIT("block.polished_tuff.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_POLISHED_TUFF_PLACE("block.polished_tuff.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_POLISHED_TUFF_STEP("block.polished_tuff.step"), - BLOCK_PORTAL_AMBIENT("block.portal.ambient"), - BLOCK_PORTAL_TRAVEL("block.portal.travel"), -@@ -700,36 +726,52 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES("block.sweet_berry_bush.pick_berries"), - BLOCK_SWEET_BERRY_BUSH_PLACE("block.sweet_berry_bush.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM("block.trial_spawner.about_to_spawn_item"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_AMBIENT("block.trial_spawner.ambient"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_AMBIENT_CHARGED("block.trial_spawner.ambient_charged"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_BREAK("block.trial_spawner.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_CHARGE_ACTIVATE("block.trial_spawner.charge_activate"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER("block.trial_spawner.close_shutter"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_DETECT_PLAYER("block.trial_spawner.detect_player"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_EJECT_ITEM("block.trial_spawner.eject_item"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_FALL("block.trial_spawner.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_HIT("block.trial_spawner.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_OPEN_SHUTTER("block.trial_spawner.open_shutter"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_PLACE("block.trial_spawner.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_SPAWN_ITEM("block.trial_spawner.spawn_item"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN("block.trial_spawner.spawn_item_begin"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_SPAWN_MOB("block.trial_spawner.spawn_mob"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TRIAL_SPAWNER_STEP("block.trial_spawner.step"), - BLOCK_TRIPWIRE_ATTACH("block.tripwire.attach"), - BLOCK_TRIPWIRE_CLICK_OFF("block.tripwire.click_off"), -@@ -737,44 +779,62 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - BLOCK_TRIPWIRE_DETACH("block.tripwire.detach"), - BLOCK_TUFF_BREAK("block.tuff.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TUFF_BRICKS_BREAK("block.tuff_bricks.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TUFF_BRICKS_FALL("block.tuff_bricks.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TUFF_BRICKS_HIT("block.tuff_bricks.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TUFF_BRICKS_PLACE("block.tuff_bricks.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_TUFF_BRICKS_STEP("block.tuff_bricks.step"), - BLOCK_TUFF_FALL("block.tuff.fall"), - BLOCK_TUFF_HIT("block.tuff.hit"), - BLOCK_TUFF_PLACE("block.tuff.place"), - BLOCK_TUFF_STEP("block.tuff.step"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_ACTIVATE("block.vault.activate"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_AMBIENT("block.vault.ambient"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_BREAK("block.vault.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_CLOSE_SHUTTER("block.vault.close_shutter"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_DEACTIVATE("block.vault.deactivate"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_EJECT_ITEM("block.vault.eject_item"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_FALL("block.vault.fall"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_HIT("block.vault.hit"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_INSERT_ITEM("block.vault.insert_item"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_INSERT_ITEM_FAIL("block.vault.insert_item_fail"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_OPEN_SHUTTER("block.vault.open_shutter"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_PLACE("block.vault.place"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - BLOCK_VAULT_STEP("block.vault.step"), - BLOCK_VINE_BREAK("block.vine.break"), - BLOCK_VINE_FALL("block.vine.fall"), -@@ -875,40 +935,58 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ENTITY_BOAT_PADDLE_LAND("entity.boat.paddle_land"), - ENTITY_BOAT_PADDLE_WATER("entity.boat.paddle_water"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BOGGED_AMBIENT("entity.bogged.ambient"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BOGGED_DEATH("entity.bogged.death"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BOGGED_HURT("entity.bogged.hurt"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BOGGED_SHEAR("entity.bogged.shear"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BOGGED_STEP("entity.bogged.step"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_CHARGE("entity.breeze.charge"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_DEATH("entity.breeze.death"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_DEFLECT("entity.breeze.deflect"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_HURT("entity.breeze.hurt"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_IDLE_AIR("entity.breeze.idle_air"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_IDLE_GROUND("entity.breeze.idle_ground"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_INHALE("entity.breeze.inhale"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_JUMP("entity.breeze.jump"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_LAND("entity.breeze.land"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_SHOOT("entity.breeze.shoot"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_SLIDE("entity.breeze.slide"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_WHIRL("entity.breeze.whirl"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_BREEZE_WIND_BURST("entity.breeze.wind_burst"), - ENTITY_CAMEL_AMBIENT("entity.camel.ambient"), - ENTITY_CAMEL_DASH("entity.camel.dash"), -@@ -1208,8 +1286,10 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ENTITY_PARROT_HURT("entity.parrot.hurt"), - ENTITY_PARROT_IMITATE_BLAZE("entity.parrot.imitate.blaze"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_PARROT_IMITATE_BOGGED("entity.parrot.imitate.bogged"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_PARROT_IMITATE_BREEZE("entity.parrot.imitate.breeze"), - ENTITY_PARROT_IMITATE_CREEPER("entity.parrot.imitate.creeper"), - ENTITY_PARROT_IMITATE_DROWNED("entity.parrot.imitate.drowned"), -@@ -1489,8 +1569,10 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ENTITY_WARDEN_STEP("entity.warden.step"), - ENTITY_WARDEN_TENDRIL_CLICKS("entity.warden.tendril_clicks"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_WIND_CHARGE_THROW("entity.wind_charge.throw"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ENTITY_WIND_CHARGE_WIND_BURST("entity.wind_charge.wind_burst"), - ENTITY_WITCH_AMBIENT("entity.witch.ambient"), - ENTITY_WITCH_CELEBRATE("entity.witch.celebrate"), -@@ -1546,11 +1628,12 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ENTITY_ZOMBIFIED_PIGLIN_ANGRY("entity.zombified_piglin.angry"), - ENTITY_ZOMBIFIED_PIGLIN_DEATH("entity.zombified_piglin.death"), - ENTITY_ZOMBIFIED_PIGLIN_HURT("entity.zombified_piglin.hurt"), -- @MinecraftExperimental(Requires.UPDATE_1_21) - EVENT_MOB_EFFECT_BAD_OMEN("event.mob_effect.bad_omen"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EVENT_MOB_EFFECT_RAID_OMEN("event.mob_effect.raid_omen"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EVENT_MOB_EFFECT_TRIAL_OMEN("event.mob_effect.trial_omen"), - EVENT_RAID_HORN("event.raid.horn"), - INTENTIONALLY_EMPTY("intentionally_empty"), -@@ -1591,8 +1674,14 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ITEM_BUCKET_FILL_LAVA("item.bucket.fill_lava"), - ITEM_BUCKET_FILL_POWDER_SNOW("item.bucket.fill_powder_snow"), - ITEM_BUCKET_FILL_TADPOLE("item.bucket.fill_tadpole"), -+ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_BUNDLE_DROP_CONTENTS("item.bundle.drop_contents"), -+ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_BUNDLE_INSERT("item.bundle.insert"), -+ @MinecraftExperimental(Requires.BUNDLE) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_BUNDLE_REMOVE_ONE("item.bundle.remove_one"), - ITEM_CHORUS_FRUIT_TELEPORT("item.chorus_fruit.teleport"), - ITEM_CROP_PLANT("item.crop.plant"), -@@ -1624,13 +1713,17 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ITEM_INK_SAC_USE("item.ink_sac.use"), - ITEM_LODESTONE_COMPASS_LOCK("item.lodestone_compass.lock"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_MACE_SMASH_AIR("item.mace.smash_air"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_MACE_SMASH_GROUND("item.mace.smash_ground"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_MACE_SMASH_GROUND_HEAVY("item.mace.smash_ground_heavy"), - ITEM_NETHER_WART_PLANT("item.nether_wart.plant"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_OMINOUS_BOTTLE_DISPOSE("item.ominous_bottle.dispose"), - ITEM_SHIELD_BLOCK("item.shield.block"), - ITEM_SHIELD_BREAK("item.shield.break"), -@@ -1647,12 +1740,16 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa - ITEM_TRIDENT_THROW("item.trident.throw"), - ITEM_TRIDENT_THUNDER("item.trident.thunder"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_WOLF_ARMOR_BREAK("item.wolf_armor.break"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_WOLF_ARMOR_CRACK("item.wolf_armor.crack"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_WOLF_ARMOR_DAMAGE("item.wolf_armor.damage"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - ITEM_WOLF_ARMOR_REPAIR("item.wolf_armor.repair"), - MUSIC_CREATIVE("music.creative"), - MUSIC_CREDITS("music.credits"), -diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java -index cb5890e0e7bccfee2ba32dd4776f1ae1fdd539e8..5ec7f1cae36189989db0a66ee05c22035e7daf7c 100644 ---- a/src/main/java/org/bukkit/Tag.java -+++ b/src/main/java/org/bukkit/Tag.java -@@ -770,6 +770,8 @@ public interface Tag extends Keyed { - /** - * Vanilla block tag representing all blocks which block wind charge explosions. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag BLOCKS_WIND_CHARGE_EXPLOSIONS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("blocks_wind_charge_explosions"), Material.class); - /** - * Vanilla block tag representing solid blocks which do not block hopper operation. -@@ -1141,6 +1143,8 @@ public interface Tag extends Keyed { - /** - * Vanilla item tag representing all items enchantable with mace enchantments. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ITEMS_ENCHANTABLE_MACE = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("enchantable/mace"), Material.class); - /** - * Vanilla item tag representing all items that confer freeze immunity on -@@ -1234,6 +1238,8 @@ public interface Tag extends Keyed { - /** - * Vanilla tag representing entities which deflect projectiles. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_DEFLECTS_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("deflects_projectiles"), EntityType.class); - /** - * Vanilla tag representing entities which deflect arrows. -@@ -1244,6 +1250,8 @@ public interface Tag extends Keyed { - /** - * Vanilla tag representing entities which can turn in boats. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_CAN_TURN_IN_BOATS = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("can_turn_in_boats"), EntityType.class); - /** - * Vanilla tag representing all entities sensitive to illager enchantments. -@@ -1292,14 +1300,20 @@ public interface Tag extends Keyed { - /** - * Vanilla tag representing all entities which do not receive anger from wind charges. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_NO_ANGER_FROM_WIND_CHARGE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("no_anger_from_wind_charge"), EntityType.class); - /** - * Vanilla tag representing all entities which are immune from the oozing effect. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_IMMUNE_TO_OOZING = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_oozing"), EntityType.class); - /** - * Vanilla tag representing all entities which are immune from the infested effect. - */ -+ @MinecraftExperimental(MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - Tag ENTITY_TYPES_IMMUNE_TO_INFESTED = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("immune_to_infested"), EntityType.class); - /** - * Vanilla tag representing all projectiles which can be punched back. -diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java -index db7723e2907525850f8dbd2bd7150c1e47ebf1c8..9951cf6780ae47649625b8fe0ed72d87ad0417b2 100644 ---- a/src/main/java/org/bukkit/block/banner/PatternType.java -+++ b/src/main/java/org/bukkit/block/banner/PatternType.java -@@ -54,8 +54,10 @@ public enum PatternType implements Keyed { - GLOBE("glb", "globe"), - PIGLIN("pig", "piglin"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - FLOW("flw", "flow"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - GUSTER("gus", "guster"); - - private final String identifier; -diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index de616cecaeb45018d96685c916532188e369bdd4..48a01a1eb80475adf9b181e9bd81535e9faec233 100644 ---- a/src/main/java/org/bukkit/enchantments/Enchantment.java -+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java -@@ -198,18 +198,21 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve - * Increases fall damage of maces - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final Enchantment DENSITY = getEnchantment("density"); - - /** - * Reduces armor effectiveness against maces - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final Enchantment BREACH = getEnchantment("breach"); - - /** - * Emits wind burst upon hitting enemy - */ - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final Enchantment WIND_BURST = getEnchantment("wind_burst"); - - /** -diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java -index b670ff8b2bfcaa59c2292211cb9fc2bf4c5b2642..94092a5882180cca7905388184de1f91633f0df1 100644 ---- a/src/main/java/org/bukkit/generator/structure/Structure.java -+++ b/src/main/java/org/bukkit/generator/structure/Structure.java -@@ -50,6 +50,7 @@ public abstract class Structure implements Keyed { - public static final Structure ANCIENT_CITY = getStructure("ancient_city"); - public static final Structure TRAIL_RUINS = getStructure("trail_ruins"); - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final Structure TRIAL_CHAMBERS = getStructure("trial_chambers"); - - private static Structure getStructure(String name) { -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 f2242ddc4085f7e7cdd748d860857822e3d9b007..9133a889c1936b4cf7dbf17f744ee926d57362a3 100644 ---- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -@@ -78,10 +78,14 @@ public interface TrimPattern extends Keyed, Translatable { - /** - * {@link Material#FLOW_ARMOR_TRIM_SMITHING_TEMPLATE}. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final TrimPattern FLOW = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("flow")); - /** - * {@link Material#BOLT_ARMOR_TRIM_SMITHING_TEMPLATE}. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final TrimPattern BOLT = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("bolt")); - - // Paper start - adventure -diff --git a/src/main/java/org/bukkit/loot/LootTables.java b/src/main/java/org/bukkit/loot/LootTables.java -index 0fc30514375c1700c282d1e92342f7b48ca1cb27..bd625de1103741e592b4111412e4094f4c454f9b 100644 ---- a/src/main/java/org/bukkit/loot/LootTables.java -+++ b/src/main/java/org/bukkit/loot/LootTables.java -@@ -36,44 +36,64 @@ public enum LootTables implements Keyed { - ANCIENT_CITY_ICE_BOX("chests/ancient_city_ice_box"), - RUINED_PORTAL("chests/ruined_portal"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD("chests/trial_chambers/reward"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_COMMON("chests/trial_chambers/reward_common"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_RARE("chests/trial_chambers/reward_rare"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_UNIQUE("chests/trial_chambers/reward_unique"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_OMINOUS("chests/trial_chambers/reward_ominous"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_OMINOUS_COMMON("chests/trial_chambers/reward_ominous_common"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_OMINOUS_RARE("chests/trial_chambers/reward_ominous_rare"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_REWARD_OMINOUS_UNIQUE("chests/trial_chambers/reward_ominous_unique"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_SUPPLY("chests/trial_chambers/supply"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_CORRIDOR("chests/trial_chambers/corridor"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_INTERSECTION("chests/trial_chambers/intersection"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_INTERSECTION_BARREL("chests/trial_chambers/intersection_barrel"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_ENTRANCE("chests/trial_chambers/entrance"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_CORRIDOR_DISPENSER("dispensers/trial_chambers/corridor"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_CHAMBER_DISPENSER("dispensers/trial_chambers/chamber"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_WATER_DISPENSER("dispensers/trial_chambers/water"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBERS_CORRIDOR_POT("pots/trial_chambers/corridor"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EQUIPMENT_TRIAL_CHAMBER("equipment/trial_chamber"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EQUIPMENT_TRIAL_CHAMBER_RANGED("equipment/trial_chamber_ranged"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - EQUIPMENT_TRIAL_CHAMBER_MELEE("equipment/trial_chamber_melee"), - SHIPWRECK_MAP("chests/shipwreck_map"), - SHIPWRECK_SUPPLY("chests/shipwreck_supply"), -@@ -202,14 +222,19 @@ public enum LootTables implements Keyed { - PIGLIN_BARTERING("gameplay/piglin_bartering"), - // Spawners - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBER_KEY("spawners/trial_chamber/key"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBER_CONSUMABLES("spawners/trial_chamber/consumables"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OMINOUS_TRIAL_CHAMBER_KEY("spawners/ominous/trial_chamber/key"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OMINOUS_TRIAL_CHAMBER_CONSUMABLES("spawners/ominous/trial_chamber/consumables"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - TRIAL_CHAMBER_ITEMS_TO_DROP_WHEN_OMINOUS("spawners/trial_chamber/items_to_drop_when_ominous"), - // Shearing - SHEARING_BOGGED("shearing/bogged"), -diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java -index e77cf365cefafbeba09123187e70fd5274f10d53..7a7b98d40a031b09d6bc62df32d2ddeb25a9d41e 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffectType.java -+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java -@@ -192,31 +192,43 @@ public abstract class PotionEffectType implements Keyed, Translatable, net.kyori - /** - * Causes trial spawners to become ominous. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType TRIAL_OMEN = getPotionEffectType(34, "trial_omen"); - - /** - * Triggers a raid when a player enters a village. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType RAID_OMEN = getPotionEffectType(35, "raid_omen"); - - /** - * Emits a wind burst upon death. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType WIND_CHARGED = getPotionEffectType(36, "wind_charged"); - - /** - * Creates cobwebs upon death. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType WEAVING = getPotionEffectType(37, "weaving"); - - /** - * Causes slimes to spawn upon death. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType OOZING = getPotionEffectType(38, "oozing"); - - /** - * Chance of spawning silverfish when hurt. - */ -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) // Paper - add missing annotation -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - public static final PotionEffectType INFESTED = getPotionEffectType(39, "infested"); - - @NotNull -diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java -index dabaa58432b91ed120cc5a3a43a8e94110fa84a3..1fdd56450e8a0763833742c805847a723c43bf6c 100644 ---- a/src/main/java/org/bukkit/potion/PotionType.java -+++ b/src/main/java/org/bukkit/potion/PotionType.java -@@ -60,12 +60,16 @@ public enum PotionType implements Keyed { - SLOW_FALLING("slow_falling"), - LONG_SLOW_FALLING("long_slow_falling"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WIND_CHARGED("wind_charged"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - WEAVING("weaving"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - OOZING("oozing"), - @MinecraftExperimental(Requires.UPDATE_1_21) -+ @org.jetbrains.annotations.ApiStatus.Experimental // Paper - add missing annotation - INFESTED("infested"), - ; - diff --git a/patches/api/0443-Add-more-scoreboard-API.patch b/patches/api/0443-Add-more-scoreboard-API.patch deleted file mode 100644 index 201af36b0c..0000000000 --- a/patches/api/0443-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/0443-Improve-Registry.patch b/patches/api/0443-Improve-Registry.patch new file mode 100644 index 0000000000..9e484fcf71 --- /dev/null +++ b/patches/api/0443-Improve-Registry.patch @@ -0,0 +1,173 @@ +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/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java +index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf305960e1 100644 +--- a/src/main/java/org/bukkit/MusicInstrument.java ++++ b/src/main/java/org/bukkit/MusicInstrument.java +@@ -53,6 +53,16 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran + return instrument; + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments ++ * can exist without a key. ++ */ ++ @Deprecated ++ @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 90ab3bef4c5b6b6e215e9c759c886ed6d0f3302b..d2eaf28999d437bf23ba5c7408124ad69d71fc79 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -335,6 +335,49 @@ public interface Registry extends Iterable { + @Nullable + T get(@NotNull NamespacedKey key); + ++ // Paper start - improve Registry ++ /** ++ * 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 ++ + /** + * Returns a new stream, which contains all registry items, which are registered to the registry. + * +@@ -401,5 +444,12 @@ public interface Registry extends Iterable { + public Iterator iterator() { + return map.values().iterator(); + } ++ ++ // 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/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java +index 9951cf6780ae47649625b8fe0ed72d87ad0417b2..2a245735ac902d55681880dc80b12ddef65c0124 100644 +--- a/src/main/java/org/bukkit/block/banner/PatternType.java ++++ b/src/main/java/org/bukkit/block/banner/PatternType.java +@@ -75,6 +75,13 @@ public enum PatternType implements Keyed { + this.key = NamespacedKey.minecraft(key); + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#BANNER_PATTERN}. PatternTypes ++ * can exist without a key. ++ */ ++ @Deprecated ++ // 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 94092a5882180cca7905388184de1f91633f0df1..46e510e67b156b469d1413e616a5ff6a6487fdbf 100644 +--- a/src/main/java/org/bukkit/generator/structure/Structure.java ++++ b/src/main/java/org/bukkit/generator/structure/Structure.java +@@ -64,4 +64,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 ++ 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 941fac4eee338870d8c30cb1f64cab572cf54548..74816d6da4d7c8d2fa8a7b93fdc4bf29c8d12803 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java +@@ -68,4 +68,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)} and {@link Registry#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 9133a889c1936b4cf7dbf17f744ee926d57362a3..6079bd05a056153c9d66f37396c96dbad9dca7a1 100644 +--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java ++++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java +@@ -104,4 +104,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)} and {@link Registry#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/0444-Add-experience-points-API.patch b/patches/api/0444-Add-experience-points-API.patch new file mode 100644 index 0000000000..a0add5e837 --- /dev/null +++ b/patches/api/0444-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 9261f06e332f8db94b2ef7bc01f5b0e61422bcb2..f08b1a2ec8815efcaaf1371e20eb1461a5f2d359 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1902,6 +1902,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/0444-Improve-Registry.patch b/patches/api/0444-Improve-Registry.patch deleted file mode 100644 index 61744f44e9..0000000000 --- a/patches/api/0444-Improve-Registry.patch +++ /dev/null @@ -1,173 +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/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java -index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf305960e1 100644 ---- a/src/main/java/org/bukkit/MusicInstrument.java -+++ b/src/main/java/org/bukkit/MusicInstrument.java -@@ -53,6 +53,16 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran - return instrument; - } - -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments -+ * can exist without a key. -+ */ -+ @Deprecated -+ @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 9a8be5c730802e5750de1fc31e65f254f5894e63..0f7f23738c57ebe37846714159bb49e5b61e9f3d 100644 ---- a/src/main/java/org/bukkit/Registry.java -+++ b/src/main/java/org/bukkit/Registry.java -@@ -335,6 +335,49 @@ public interface Registry extends Iterable { - @Nullable - T get(@NotNull NamespacedKey key); - -+ // Paper start - improve Registry -+ /** -+ * 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 -+ - /** - * Returns a new stream, which contains all registry items, which are registered to the registry. - * -@@ -401,5 +444,12 @@ public interface Registry extends Iterable { - public Iterator iterator() { - return map.values().iterator(); - } -+ -+ // 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/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java -index 9951cf6780ae47649625b8fe0ed72d87ad0417b2..2a245735ac902d55681880dc80b12ddef65c0124 100644 ---- a/src/main/java/org/bukkit/block/banner/PatternType.java -+++ b/src/main/java/org/bukkit/block/banner/PatternType.java -@@ -75,6 +75,13 @@ public enum PatternType implements Keyed { - this.key = NamespacedKey.minecraft(key); - } - -+ // Paper start - deprecate getKey -+ /** -+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#BANNER_PATTERN}. PatternTypes -+ * can exist without a key. -+ */ -+ @Deprecated -+ // 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 94092a5882180cca7905388184de1f91633f0df1..46e510e67b156b469d1413e616a5ff6a6487fdbf 100644 ---- a/src/main/java/org/bukkit/generator/structure/Structure.java -+++ b/src/main/java/org/bukkit/generator/structure/Structure.java -@@ -64,4 +64,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 -+ 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 941fac4eee338870d8c30cb1f64cab572cf54548..74816d6da4d7c8d2fa8a7b93fdc4bf29c8d12803 100644 ---- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java -+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java -@@ -68,4 +68,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)} and {@link Registry#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 9133a889c1936b4cf7dbf17f744ee926d57362a3..6079bd05a056153c9d66f37396c96dbad9dca7a1 100644 ---- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java -@@ -104,4 +104,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)} and {@link Registry#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/0445-Add-experience-points-API.patch b/patches/api/0445-Add-experience-points-API.patch deleted file mode 100644 index a0add5e837..0000000000 --- a/patches/api/0445-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 9261f06e332f8db94b2ef7bc01f5b0e61422bcb2..f08b1a2ec8815efcaaf1371e20eb1461a5f2d359 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1902,6 +1902,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/0445-Add-missing-InventoryType.patch b/patches/api/0445-Add-missing-InventoryType.patch new file mode 100644 index 0000000000..9c578e05a4 --- /dev/null +++ b/patches/api/0445-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 ccb09660e565bc2f7a653bda95fb38caccf7a060..59b375569a75cb1e1f7c610f96078e102ec0d3ed 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", false), ++ // Paper start - add missing type ++ /** ++ * Pseudo decorated pot with 1 slot of undefined type. ++ */ ++ DECORATED_POT(1, "Decorated Pot", false), ++ // Paper end - add missing type + /** + * A crafter inventory, with 9 CRAFTING slots. + */ diff --git a/patches/api/0446-Add-drops-to-shear-events.patch b/patches/api/0446-Add-drops-to-shear-events.patch new file mode 100644 index 0000000000..c87460e48d --- /dev/null +++ b/patches/api/0446-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/0446-Add-missing-InventoryType.patch b/patches/api/0446-Add-missing-InventoryType.patch deleted file mode 100644 index 9c578e05a4..0000000000 --- a/patches/api/0446-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 ccb09660e565bc2f7a653bda95fb38caccf7a060..59b375569a75cb1e1f7c610f96078e102ec0d3ed 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", false), -+ // Paper start - add missing type -+ /** -+ * Pseudo decorated pot with 1 slot of undefined type. -+ */ -+ DECORATED_POT(1, "Decorated Pot", false), -+ // Paper end - add missing type - /** - * A crafter inventory, with 9 CRAFTING slots. - */ diff --git a/patches/api/0447-Add-HiddenPotionEffect-API.patch b/patches/api/0447-Add-HiddenPotionEffect-API.patch new file mode 100644 index 0000000000..30a7bc6c0e --- /dev/null +++ b/patches/api/0447-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 5f070c7563151c40cf4d691fc2a10d8a2766982a..b777e530122549455dcce6fac8d4a151c1c0af42 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 037af5fd6d71a526c0e6620f2db0cd6df9625261..c8ab330ef171795d08fa201cf8320703c7f1c66b 100644 +--- a/src/main/java/org/bukkit/potion/PotionEffect.java ++++ b/src/main/java/org/bukkit/potion/PotionEffect.java +@@ -26,6 +26,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"; +@@ -38,6 +39,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. +@@ -48,8 +50,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; +@@ -57,6 +62,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 + } + + /** +@@ -104,7 +126,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 +@@ -132,6 +154,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 +@@ -169,19 +204,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 +@@ -200,7 +243,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 + } + + /** +@@ -305,11 +348,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/0447-Add-drops-to-shear-events.patch b/patches/api/0447-Add-drops-to-shear-events.patch deleted file mode 100644 index c87460e48d..0000000000 --- a/patches/api/0447-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/0448-Add-HiddenPotionEffect-API.patch b/patches/api/0448-Add-HiddenPotionEffect-API.patch deleted file mode 100644 index 30a7bc6c0e..0000000000 --- a/patches/api/0448-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 5f070c7563151c40cf4d691fc2a10d8a2766982a..b777e530122549455dcce6fac8d4a151c1c0af42 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 037af5fd6d71a526c0e6620f2db0cd6df9625261..c8ab330ef171795d08fa201cf8320703c7f1c66b 100644 ---- a/src/main/java/org/bukkit/potion/PotionEffect.java -+++ b/src/main/java/org/bukkit/potion/PotionEffect.java -@@ -26,6 +26,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"; -@@ -38,6 +39,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. -@@ -48,8 +50,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; -@@ -57,6 +62,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 - } - - /** -@@ -104,7 +126,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 -@@ -132,6 +154,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 -@@ -169,19 +204,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 -@@ -200,7 +243,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 - } - - /** -@@ -305,11 +348,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/0448-Add-PlayerShieldDisableEvent.patch b/patches/api/0448-Add-PlayerShieldDisableEvent.patch new file mode 100644 index 0000000000..29c7daa0e3 --- /dev/null +++ b/patches/api/0448-Add-PlayerShieldDisableEvent.patch @@ -0,0 +1,115 @@ +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..25c13b01c5630a6de30058532458d779763e4e42 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java +@@ -0,0 +1,92 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * 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. ++ */ ++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(@NotNull final Player player, @NotNull 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. ++ */ ++ @NotNull ++ 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(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; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0449-Add-PlayerShieldDisableEvent.patch b/patches/api/0449-Add-PlayerShieldDisableEvent.patch deleted file mode 100644 index 29c7daa0e3..0000000000 --- a/patches/api/0449-Add-PlayerShieldDisableEvent.patch +++ /dev/null @@ -1,115 +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..25c13b01c5630a6de30058532458d779763e4e42 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java -@@ -0,0 +1,92 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * 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. -+ */ -+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(@NotNull final Player player, @NotNull 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. -+ */ -+ @NotNull -+ 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(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; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0449-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch b/patches/api/0449-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch new file mode 100644 index 0000000000..93ba48c77c --- /dev/null +++ b/patches/api/0449-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/0450-Add-BlockStateMeta-clearBlockState.patch b/patches/api/0450-Add-BlockStateMeta-clearBlockState.patch new file mode 100644 index 0000000000..7e8c47a8e2 --- /dev/null +++ b/patches/api/0450-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/0450-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch b/patches/api/0450-Return-null-for-empty-String-in-NamespacedKey.fromSt.patch deleted file mode 100644 index 93ba48c77c..0000000000 --- a/patches/api/0450-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/0451-Add-BlockStateMeta-clearBlockState.patch b/patches/api/0451-Add-BlockStateMeta-clearBlockState.patch deleted file mode 100644 index 1a81132aa8..0000000000 --- a/patches/api/0451-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 e7d905b1146b2bdd2da5bdeb6bf3541fb181d59e..9f08ce5e89ecb4e335f7459a4e600e638e71f963 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/0451-Expose-LootTable-of-DecoratedPot.patch b/patches/api/0451-Expose-LootTable-of-DecoratedPot.patch new file mode 100644 index 0000000000..42a8de4123 --- /dev/null +++ b/patches/api/0451-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/0452-Add-ShulkerDuplicateEvent.patch b/patches/api/0452-Add-ShulkerDuplicateEvent.patch new file mode 100644 index 0000000000..a0a81094ce --- /dev/null +++ b/patches/api/0452-Add-ShulkerDuplicateEvent.patch @@ -0,0 +1,83 @@ +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..88d8278e49f1bb32e97ee551d8ad31d4a59534e2 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java +@@ -0,0 +1,71 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * 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. ++ */ ++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(@NotNull Shulker child, @NotNull 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 ++ @NotNull ++ 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. ++ */ ++ @NotNull ++ public Shulker getParent() { ++ return this.parent; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0452-Expose-LootTable-of-DecoratedPot.patch b/patches/api/0452-Expose-LootTable-of-DecoratedPot.patch deleted file mode 100644 index 42a8de4123..0000000000 --- a/patches/api/0452-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/0453-Add-ShulkerDuplicateEvent.patch b/patches/api/0453-Add-ShulkerDuplicateEvent.patch deleted file mode 100644 index a0a81094ce..0000000000 --- a/patches/api/0453-Add-ShulkerDuplicateEvent.patch +++ /dev/null @@ -1,83 +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..88d8278e49f1bb32e97ee551d8ad31d4a59534e2 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/entity/ShulkerDuplicateEvent.java -@@ -0,0 +1,71 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * 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. -+ */ -+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(@NotNull Shulker child, @NotNull 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 -+ @NotNull -+ 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. -+ */ -+ @NotNull -+ public Shulker getParent() { -+ return this.parent; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return this.cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0453-Add-api-for-spawn-egg-texture-colors.patch b/patches/api/0453-Add-api-for-spawn-egg-texture-colors.patch new file mode 100644 index 0000000000..acb4bdb6b5 --- /dev/null +++ b/patches/api/0453-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 ce6832ef635c0e4388313f86e250ea8c47ff4294..1e06458edc7e8d2ebec8c4d83f5877aadf729aa1 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -251,4 +251,17 @@ public interface UnsafeValues { + + String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); + // Paper end ++ ++ // 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/0454-Add-Lifecycle-Event-system.patch b/patches/api/0454-Add-Lifecycle-Event-system.patch new file mode 100644 index 0000000000..be1104b0d4 --- /dev/null +++ b/patches/api/0454-Add-Lifecycle-Event-system.patch @@ -0,0 +1,628 @@ +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 08f2050356acaf74e3210416760e3873c2dafd2c..37dfdcfcbd14947e0550e7528aca68f452e53eb6 100644 +--- a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java ++++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java +@@ -1,6 +1,9 @@ + 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.jetbrains.annotations.NotNull; + + /** + * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin +@@ -10,5 +13,13 @@ import org.jetbrains.annotations.ApiStatus; + */ + @ApiStatus.Experimental + @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 ++ */ ++ @NotNull 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..3626ce3da17f20ec44f0c15baa13f40e1dc2bc9c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java +@@ -0,0 +1,52 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * 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 ++@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 @NotNull LifecycleEventType eventType, final @NotNull 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(@NotNull 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..1160474f94476b580426cec29756c4699e163bf7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java +@@ -0,0 +1,24 @@ ++package io.papermc.paper.plugin.lifecycle.event; ++ ++import io.papermc.paper.plugin.configuration.PluginMeta; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * 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 ++@ApiStatus.NonExtendable ++public interface LifecycleEventOwner { ++ ++ /** ++ * Get the plugin meta for this plugin. ++ * ++ * @return the plugin meta ++ */ ++ @NotNull 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..8239ba3c0147c0e8e8d28987d3f543a67641892a +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java +@@ -0,0 +1,18 @@ ++package io.papermc.paper.plugin.lifecycle.event.handler; ++ ++import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A handler for a specific event. Can be implemented ++ * in a concrete class or as a lambda. ++ * ++ * @param the event ++ */ ++@ApiStatus.Experimental ++@FunctionalInterface ++public interface LifecycleEventHandler { ++ ++ void run(@NotNull 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..0831794fad1f6eb8960225909d40f4a3b20a2a3b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java +@@ -0,0 +1,18 @@ ++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; ++ ++/** ++ * 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 ++@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..d307ede51a66279f2eeef4e5b41c71779503f0d4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java +@@ -0,0 +1,25 @@ ++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; ++ ++/** ++ * Handler configuration for event types that allow "monitor" handlers. ++ * ++ * @param the required owner type ++ */ ++@ApiStatus.Experimental ++@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..1c404df0be359ceac7fb52fec03027c771395e07 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java +@@ -0,0 +1,39 @@ ++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; ++ ++/** ++ * Handler configuration that allows both "monitor" and prioritized handlers. ++ * The default priority is 0. ++ * ++ * @param the required owner type ++ */ ++@ApiStatus.Experimental ++@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..2e5758d1af6215f33f89b12984a5594df592147f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java +@@ -0,0 +1,27 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * 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 ++@ApiStatus.NonExtendable ++public interface RegistrarEvent extends LifecycleEvent { ++ ++ /** ++ * Get the registrar related to this event. ++ * ++ * @return the registrar ++ */ ++ @Contract(pure = true) ++ @NotNull 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..b8b439bdad2e47c7c715fe30e0c1e69aa25374dd +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java +@@ -0,0 +1,38 @@ ++package io.papermc.paper.plugin.lifecycle.event.registrar; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A lifecycle event that exposes a {@link Registrar} that is ++ * reloadable. ++ * ++ * @param the registrar type ++ * @see RegistrarEvent ++ */ ++@ApiStatus.Experimental ++@ApiStatus.NonExtendable ++public interface ReloadableRegistrarEvent extends RegistrarEvent { ++ ++ /** ++ * Get the cause of this reload. ++ * ++ * @return the cause ++ */ ++ @Contract(pure = true) ++ @NotNull 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..92ea0374079a228ccc59c00fcf58abff2f6c46fe +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java +@@ -0,0 +1,73 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * 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 ++@ApiStatus.NonExtendable ++public interface LifecycleEventType> { ++ ++ /** ++ * Gets the name of the lifecycle event. ++ * ++ * @return the name ++ */ ++ @Contract(pure = true) ++ @NotNull 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") ++ @NotNull C newHandler(@NotNull 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..1588f6943a909bed053a952e650e043c44028c2d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java +@@ -0,0 +1,18 @@ ++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.ServiceLoader; ++import org.jetbrains.annotations.ApiStatus; ++ ++@ApiStatus.Internal ++interface LifecycleEventTypeProvider { ++ ++ LifecycleEventTypeProvider PROVIDER = ServiceLoader.load(LifecycleEventTypeProvider.class) ++ .findFirst() ++ .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..304f978e40e1759bb19704cc5cec399500905195 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java +@@ -0,0 +1,52 @@ ++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; ++ ++/** ++ * Holds various types of lifecycle events for ++ * use when creating event handler configurations ++ * in {@link LifecycleEventManager}. ++ */ ++@ApiStatus.Experimental ++public final class LifecycleEvents { ++ ++ // ++ @ApiStatus.Internal ++ private static LifecycleEventType.Monitorable plugin(final String name) { ++ return monitor(name, Plugin.class); ++ } ++ ++ @ApiStatus.Internal ++ private static LifecycleEventType.Prioritizable pluginPrioritized(final String name) { ++ return prioritized(name, Plugin.class); ++ } ++ ++ @ApiStatus.Internal ++ private static LifecycleEventType.Monitorable bootstrap(final String name) { ++ return monitor(name, BootstrapContext.class); ++ } ++ ++ @ApiStatus.Internal ++ private static LifecycleEventType.Prioritizable bootstrapPrioritized(final String name) { ++ return prioritized(name, BootstrapContext.class); ++ } ++ ++ @ApiStatus.Internal ++ private static LifecycleEventType.Monitorable monitor(final String name, final Class ownerType) { ++ return LifecycleEventTypeProvider.PROVIDER.monitor(name, ownerType); ++ } ++ ++ @ApiStatus.Internal ++ private 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 1e06458edc7e8d2ebec8c4d83f5877aadf729aa1..563798fda1236e2df39d8908f386c91b3f190d58 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -264,4 +264,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 4eb639fbb46a0848be207149ea433455550fae1c..ef431219fd2bce48bad63b6b92c99d54348d480e 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's 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 5cd236965de12392d8c7aa81307c0ff1cc8673b1..34037d3da2c536bac088e0ff629ee8f1daccc65b 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +@@ -47,6 +47,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 +@@ -278,7 +283,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(); + } +@@ -456,4 +463,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/0454-Add-api-for-spawn-egg-texture-colors.patch b/patches/api/0454-Add-api-for-spawn-egg-texture-colors.patch deleted file mode 100644 index 6e3d91aff4..0000000000 --- a/patches/api/0454-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 e19434a0f5065987be087b6bd531c88be33d2917..80947c6862a906dec9c039b5dff993461d4d831b 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -250,4 +250,17 @@ public interface UnsafeValues { - - String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); - // Paper end -+ -+ // 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/0455-Add-Lifecycle-Event-system.patch b/patches/api/0455-Add-Lifecycle-Event-system.patch deleted file mode 100644 index 4b36ba4885..0000000000 --- a/patches/api/0455-Add-Lifecycle-Event-system.patch +++ /dev/null @@ -1,628 +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 08f2050356acaf74e3210416760e3873c2dafd2c..37dfdcfcbd14947e0550e7528aca68f452e53eb6 100644 ---- a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java -@@ -1,6 +1,9 @@ - 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.jetbrains.annotations.NotNull; - - /** - * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin -@@ -10,5 +13,13 @@ import org.jetbrains.annotations.ApiStatus; - */ - @ApiStatus.Experimental - @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 -+ */ -+ @NotNull 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..3626ce3da17f20ec44f0c15baa13f40e1dc2bc9c ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java -@@ -0,0 +1,52 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * 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 -+@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 @NotNull LifecycleEventType eventType, final @NotNull 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(@NotNull 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..1160474f94476b580426cec29756c4699e163bf7 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java -@@ -0,0 +1,24 @@ -+package io.papermc.paper.plugin.lifecycle.event; -+ -+import io.papermc.paper.plugin.configuration.PluginMeta; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * 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 -+@ApiStatus.NonExtendable -+public interface LifecycleEventOwner { -+ -+ /** -+ * Get the plugin meta for this plugin. -+ * -+ * @return the plugin meta -+ */ -+ @NotNull 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..8239ba3c0147c0e8e8d28987d3f543a67641892a ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java -@@ -0,0 +1,18 @@ -+package io.papermc.paper.plugin.lifecycle.event.handler; -+ -+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent; -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * A handler for a specific event. Can be implemented -+ * in a concrete class or as a lambda. -+ * -+ * @param the event -+ */ -+@ApiStatus.Experimental -+@FunctionalInterface -+public interface LifecycleEventHandler { -+ -+ void run(@NotNull 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..0831794fad1f6eb8960225909d40f4a3b20a2a3b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java -@@ -0,0 +1,18 @@ -+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; -+ -+/** -+ * 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 -+@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..d307ede51a66279f2eeef4e5b41c71779503f0d4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java -@@ -0,0 +1,25 @@ -+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; -+ -+/** -+ * Handler configuration for event types that allow "monitor" handlers. -+ * -+ * @param the required owner type -+ */ -+@ApiStatus.Experimental -+@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..1c404df0be359ceac7fb52fec03027c771395e07 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java -@@ -0,0 +1,39 @@ -+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; -+ -+/** -+ * Handler configuration that allows both "monitor" and prioritized handlers. -+ * The default priority is 0. -+ * -+ * @param the required owner type -+ */ -+@ApiStatus.Experimental -+@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..2e5758d1af6215f33f89b12984a5594df592147f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java -@@ -0,0 +1,27 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * 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 -+@ApiStatus.NonExtendable -+public interface RegistrarEvent extends LifecycleEvent { -+ -+ /** -+ * Get the registrar related to this event. -+ * -+ * @return the registrar -+ */ -+ @Contract(pure = true) -+ @NotNull 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..b8b439bdad2e47c7c715fe30e0c1e69aa25374dd ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java -@@ -0,0 +1,38 @@ -+package io.papermc.paper.plugin.lifecycle.event.registrar; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.Contract; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * A lifecycle event that exposes a {@link Registrar} that is -+ * reloadable. -+ * -+ * @param the registrar type -+ * @see RegistrarEvent -+ */ -+@ApiStatus.Experimental -+@ApiStatus.NonExtendable -+public interface ReloadableRegistrarEvent extends RegistrarEvent { -+ -+ /** -+ * Get the cause of this reload. -+ * -+ * @return the cause -+ */ -+ @Contract(pure = true) -+ @NotNull 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..92ea0374079a228ccc59c00fcf58abff2f6c46fe ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java -@@ -0,0 +1,73 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * 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 -+@ApiStatus.NonExtendable -+public interface LifecycleEventType> { -+ -+ /** -+ * Gets the name of the lifecycle event. -+ * -+ * @return the name -+ */ -+ @Contract(pure = true) -+ @NotNull 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") -+ @NotNull C newHandler(@NotNull 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..1588f6943a909bed053a952e650e043c44028c2d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java -@@ -0,0 +1,18 @@ -+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.ServiceLoader; -+import org.jetbrains.annotations.ApiStatus; -+ -+@ApiStatus.Internal -+interface LifecycleEventTypeProvider { -+ -+ LifecycleEventTypeProvider PROVIDER = ServiceLoader.load(LifecycleEventTypeProvider.class) -+ .findFirst() -+ .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..304f978e40e1759bb19704cc5cec399500905195 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java -@@ -0,0 +1,52 @@ -+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; -+ -+/** -+ * Holds various types of lifecycle events for -+ * use when creating event handler configurations -+ * in {@link LifecycleEventManager}. -+ */ -+@ApiStatus.Experimental -+public final class LifecycleEvents { -+ -+ // -+ @ApiStatus.Internal -+ private static LifecycleEventType.Monitorable plugin(final String name) { -+ return monitor(name, Plugin.class); -+ } -+ -+ @ApiStatus.Internal -+ private static LifecycleEventType.Prioritizable pluginPrioritized(final String name) { -+ return prioritized(name, Plugin.class); -+ } -+ -+ @ApiStatus.Internal -+ private static LifecycleEventType.Monitorable bootstrap(final String name) { -+ return monitor(name, BootstrapContext.class); -+ } -+ -+ @ApiStatus.Internal -+ private static LifecycleEventType.Prioritizable bootstrapPrioritized(final String name) { -+ return prioritized(name, BootstrapContext.class); -+ } -+ -+ @ApiStatus.Internal -+ private static LifecycleEventType.Monitorable monitor(final String name, final Class ownerType) { -+ return LifecycleEventTypeProvider.PROVIDER.monitor(name, ownerType); -+ } -+ -+ @ApiStatus.Internal -+ private 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 80947c6862a906dec9c039b5dff993461d4d831b..7e6bdf3333537491b3421d196779a4eb502f7314 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -263,4 +263,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 4eb639fbb46a0848be207149ea433455550fae1c..ef431219fd2bce48bad63b6b92c99d54348d480e 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's 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 5cd236965de12392d8c7aa81307c0ff1cc8673b1..34037d3da2c536bac088e0ff629ee8f1daccc65b 100644 ---- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java -@@ -47,6 +47,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 -@@ -278,7 +283,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(); - } -@@ -456,4 +463,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/0455-ItemStack-Tooltip-API.patch b/patches/api/0455-ItemStack-Tooltip-API.patch new file mode 100644 index 0000000000..f3bddbb6d0 --- /dev/null +++ b/patches/api/0455-ItemStack-Tooltip-API.patch @@ -0,0 +1,146 @@ +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..39ac768b3c5148544cb1aaf2c817e661f6856f64 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java +@@ -0,0 +1,75 @@ ++package io.papermc.paper.inventory.tooltip; ++ ++import org.bukkit.entity.Player; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Context for computing itemstack tooltips via ++ * {@link org.bukkit.inventory.ItemStack#computeTooltipLines(TooltipContext, Player)} ++ */ ++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 @NotNull 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 @NotNull 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") ++ @NotNull TooltipContext asAdvanced(); ++ ++ /** ++ * Returns a new context with {@link #isCreative()} ++ * set to true. ++ * ++ * @return a new context ++ */ ++ @Contract("-> new") ++ @NotNull 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..1d9bed6691f581529c53b577b26f1d0f902ccb0d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java +@@ -0,0 +1,16 @@ ++package io.papermc.paper.inventory.tooltip; ++ ++import org.jetbrains.annotations.NotNull; ++ ++record TooltipContextImpl(boolean isCreative, boolean isAdvanced) implements TooltipContext { ++ ++ @Override ++ public @NotNull TooltipContext asCreative() { ++ return new TooltipContextImpl(true, this.isAdvanced); ++ } ++ ++ @Override ++ public @NotNull TooltipContext asAdvanced() { ++ return new TooltipContextImpl(this.isCreative, true); ++ } ++} +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index 563798fda1236e2df39d8908f386c91b3f190d58..521b9e1e5614597ae0220934a96bd6c51bda050b 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -272,4 +272,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 a1d0e479b9f28378f858f86ba8b0e9b7ddf71446..b669df4bd1ff0ecba575d42415973e81bccddbbe 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -1021,4 +1021,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 @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/0456-Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/api/0456-Add-getChunkSnapshot-includeLightData-parameter.patch new file mode 100644 index 0000000000..0437924b94 --- /dev/null +++ b/patches/api/0456-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 546888898d9d6827079fe041c7bc6eb4e1e4605c..d547ae2b20c58bc703de4532b3b591dd34ddb1c6 100644 +--- a/src/main/java/org/bukkit/Chunk.java ++++ b/src/main/java/org/bukkit/Chunk.java +@@ -102,6 +102,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/0456-ItemStack-Tooltip-API.patch b/patches/api/0456-ItemStack-Tooltip-API.patch deleted file mode 100644 index aa6b6ddd15..0000000000 --- a/patches/api/0456-ItemStack-Tooltip-API.patch +++ /dev/null @@ -1,146 +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..39ac768b3c5148544cb1aaf2c817e661f6856f64 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContext.java -@@ -0,0 +1,75 @@ -+package io.papermc.paper.inventory.tooltip; -+ -+import org.bukkit.entity.Player; -+import org.jetbrains.annotations.Contract; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Context for computing itemstack tooltips via -+ * {@link org.bukkit.inventory.ItemStack#computeTooltipLines(TooltipContext, Player)} -+ */ -+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 @NotNull 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 @NotNull 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") -+ @NotNull TooltipContext asAdvanced(); -+ -+ /** -+ * Returns a new context with {@link #isCreative()} -+ * set to true. -+ * -+ * @return a new context -+ */ -+ @Contract("-> new") -+ @NotNull 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..1d9bed6691f581529c53b577b26f1d0f902ccb0d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/inventory/tooltip/TooltipContextImpl.java -@@ -0,0 +1,16 @@ -+package io.papermc.paper.inventory.tooltip; -+ -+import org.jetbrains.annotations.NotNull; -+ -+record TooltipContextImpl(boolean isCreative, boolean isAdvanced) implements TooltipContext { -+ -+ @Override -+ public @NotNull TooltipContext asCreative() { -+ return new TooltipContextImpl(true, this.isAdvanced); -+ } -+ -+ @Override -+ public @NotNull TooltipContext asAdvanced() { -+ return new TooltipContextImpl(this.isCreative, true); -+ } -+} -diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 7e6bdf3333537491b3421d196779a4eb502f7314..a3ba9249e636d1fb8dad98fab413436009fe04df 100644 ---- a/src/main/java/org/bukkit/UnsafeValues.java -+++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -271,4 +271,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 a1d0e479b9f28378f858f86ba8b0e9b7ddf71446..b669df4bd1ff0ecba575d42415973e81bccddbbe 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -1021,4 +1021,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 @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/0457-Add-FluidState-API.patch b/patches/api/0457-Add-FluidState-API.patch new file mode 100644 index 0000000000..3235c393f5 --- /dev/null +++ b/patches/api/0457-Add-FluidState-API.patch @@ -0,0 +1,164 @@ +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..913acd58547d97cafc1466f6e2b3b4d22cf0b02d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java +@@ -0,0 +1,68 @@ ++package io.papermc.paper.block.fluid; ++ ++import org.bukkit.Fluid; ++import org.bukkit.Location; ++import org.bukkit.util.Vector; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Range; ++ ++/** ++ * 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}. ++ */ ++public interface FluidData extends Cloneable { ++ ++ /** ++ * Gets the fluid type of this fluid data. ++ * ++ * @return the fluid type ++ */ ++ @NotNull Fluid getFluidType(); ++ ++ /** ++ * Returns a copy of this FluidData. ++ * ++ * @return a copy of the fluid data ++ */ ++ @NotNull 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 ++ */ ++ @NotNull Vector computeFlowDirection(@NotNull 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(@NotNull 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/0457-Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/api/0457-Add-getChunkSnapshot-includeLightData-parameter.patch deleted file mode 100644 index 0437924b94..0000000000 --- a/patches/api/0457-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 546888898d9d6827079fe041c7bc6eb4e1e4605c..d547ae2b20c58bc703de4532b3b591dd34ddb1c6 100644 ---- a/src/main/java/org/bukkit/Chunk.java -+++ b/src/main/java/org/bukkit/Chunk.java -@@ -102,6 +102,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/0458-Add-FluidState-API.patch b/patches/api/0458-Add-FluidState-API.patch deleted file mode 100644 index 3235c393f5..0000000000 --- a/patches/api/0458-Add-FluidState-API.patch +++ /dev/null @@ -1,164 +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..913acd58547d97cafc1466f6e2b3b4d22cf0b02d ---- /dev/null -+++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java -@@ -0,0 +1,68 @@ -+package io.papermc.paper.block.fluid; -+ -+import org.bukkit.Fluid; -+import org.bukkit.Location; -+import org.bukkit.util.Vector; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Range; -+ -+/** -+ * 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}. -+ */ -+public interface FluidData extends Cloneable { -+ -+ /** -+ * Gets the fluid type of this fluid data. -+ * -+ * @return the fluid type -+ */ -+ @NotNull Fluid getFluidType(); -+ -+ /** -+ * Returns a copy of this FluidData. -+ * -+ * @return a copy of the fluid data -+ */ -+ @NotNull 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 -+ */ -+ @NotNull Vector computeFlowDirection(@NotNull 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(@NotNull 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/0458-add-number-format-api.patch b/patches/api/0458-add-number-format-api.patch new file mode 100644 index 0000000000..6d32302ad0 --- /dev/null +++ b/patches/api/0458-add-number-format-api.patch @@ -0,0 +1,229 @@ +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..66e0569789d523076cb571fb32be78ecff74305b +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.ComponentLike; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A scoreboard number format that replaces the score number with a chat component. ++ */ ++public interface FixedFormat extends NumberFormat, ComponentLike { ++ ++ /** ++ * The component shown instead of the number for a score ++ * ++ * @return the chat component ++ */ ++ @NotNull 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..969bbfcdb68ffb5a207207e20e4d79621900c0f5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java +@@ -0,0 +1,12 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.Component; ++import org.jetbrains.annotations.NotNull; ++ ++record FixedFormatImpl(@NotNull Component component) implements FixedFormat { ++ ++ @Override ++ public @NotNull 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..eadf637f5fc582a2af5db71274ac1f01b2a28913 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java +@@ -0,0 +1,60 @@ ++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.jetbrains.annotations.NotNull; ++ ++/** ++ * Describes a scoreboard number format that applies custom formatting to scoreboard scores. ++ */ ++public interface NumberFormat { ++ ++ /** ++ * Creates a blank scoreboard number format that removes the score number entirely. ++ * ++ * @return a blank number format ++ */ ++ static @NotNull NumberFormat blank() { ++ return BlankFormatImpl.INSTANCE; ++ } ++ ++ /** ++ * Gets an un-styled number format. ++ * ++ * @return an un-styled number format ++ */ ++ static @NotNull 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 @NotNull StyledFormat styled(final @NotNull 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 @NotNull StyledFormat styled(final @NotNull StyleBuilderApplicable @NotNull... 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 @NotNull FixedFormat fixed(final @NotNull 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..fe844677d689c3afe5ff2b706d562724e4121137 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java +@@ -0,0 +1,19 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.format.Style; ++import net.kyori.adventure.text.format.StyleBuilderApplicable; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * A scoreboard number format that applies a custom formatting to the score number. ++ */ ++public interface StyledFormat extends NumberFormat, StyleBuilderApplicable { ++ ++ /** ++ * The style that is being applied to the number in the score ++ * ++ * @return the style to apply ++ */ ++ @NotNull 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..0421e6c7cb32a912cf4aa281623c4311d5d1a34f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java +@@ -0,0 +1,13 @@ ++package io.papermc.paper.scoreboard.numbers; ++ ++import net.kyori.adventure.text.format.Style; ++import org.jetbrains.annotations.NotNull; ++ ++record StyledFormatImpl(@NotNull Style style) implements StyledFormat { ++ static final StyledFormat NO_STYLE = new StyledFormatImpl(Style.empty()); ++ ++ @Override ++ public void styleApply(final Style.@NotNull 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/0459-add-number-format-api.patch b/patches/api/0459-add-number-format-api.patch deleted file mode 100644 index 6d32302ad0..0000000000 --- a/patches/api/0459-add-number-format-api.patch +++ /dev/null @@ -1,229 +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..66e0569789d523076cb571fb32be78ecff74305b ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java -@@ -0,0 +1,19 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.ComponentLike; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * A scoreboard number format that replaces the score number with a chat component. -+ */ -+public interface FixedFormat extends NumberFormat, ComponentLike { -+ -+ /** -+ * The component shown instead of the number for a score -+ * -+ * @return the chat component -+ */ -+ @NotNull 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..969bbfcdb68ffb5a207207e20e4d79621900c0f5 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java -@@ -0,0 +1,12 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.Component; -+import org.jetbrains.annotations.NotNull; -+ -+record FixedFormatImpl(@NotNull Component component) implements FixedFormat { -+ -+ @Override -+ public @NotNull 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..eadf637f5fc582a2af5db71274ac1f01b2a28913 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java -@@ -0,0 +1,60 @@ -+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.jetbrains.annotations.NotNull; -+ -+/** -+ * Describes a scoreboard number format that applies custom formatting to scoreboard scores. -+ */ -+public interface NumberFormat { -+ -+ /** -+ * Creates a blank scoreboard number format that removes the score number entirely. -+ * -+ * @return a blank number format -+ */ -+ static @NotNull NumberFormat blank() { -+ return BlankFormatImpl.INSTANCE; -+ } -+ -+ /** -+ * Gets an un-styled number format. -+ * -+ * @return an un-styled number format -+ */ -+ static @NotNull 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 @NotNull StyledFormat styled(final @NotNull 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 @NotNull StyledFormat styled(final @NotNull StyleBuilderApplicable @NotNull... 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 @NotNull FixedFormat fixed(final @NotNull 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..fe844677d689c3afe5ff2b706d562724e4121137 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java -@@ -0,0 +1,19 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.format.Style; -+import net.kyori.adventure.text.format.StyleBuilderApplicable; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * A scoreboard number format that applies a custom formatting to the score number. -+ */ -+public interface StyledFormat extends NumberFormat, StyleBuilderApplicable { -+ -+ /** -+ * The style that is being applied to the number in the score -+ * -+ * @return the style to apply -+ */ -+ @NotNull 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..0421e6c7cb32a912cf4aa281623c4311d5d1a34f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java -@@ -0,0 +1,13 @@ -+package io.papermc.paper.scoreboard.numbers; -+ -+import net.kyori.adventure.text.format.Style; -+import org.jetbrains.annotations.NotNull; -+ -+record StyledFormatImpl(@NotNull Style style) implements StyledFormat { -+ static final StyledFormat NO_STYLE = new StyledFormatImpl(Style.empty()); -+ -+ @Override -+ public void styleApply(final Style.@NotNull 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/0459-improve-BanList-types.patch b/patches/api/0459-improve-BanList-types.patch new file mode 100644 index 0000000000..7b97e414a1 --- /dev/null +++ b/patches/api/0459-improve-BanList-types.patch @@ -0,0 +1,131 @@ +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..2980abf2f41cb14f0ee5c829c365f8e304130618 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/ban/BanListType.java +@@ -0,0 +1,29 @@ ++package io.papermc.paper.ban; ++ ++import org.bukkit.BanList; ++import org.bukkit.ban.IpBanList; ++import org.bukkit.ban.ProfileBanList; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents a ban-type that a {@link BanList} may track. ++ * It enforces the correct return value at compile time. ++ */ ++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 ++ */ ++ @NotNull 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..1159e7cd29fbf11f3fa1448fcf9d0768e1bcb0a3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java +@@ -0,0 +1,8 @@ ++package io.papermc.paper.ban; ++ ++import org.jetbrains.annotations.ApiStatus; ++import org.jetbrains.annotations.NotNull; ++ ++@ApiStatus.Internal ++record BanListTypeImpl(@NotNull Class typeClass) implements BanListType { ++} +diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java +index a77c0411a68a9bad33ddfb335b7a996a843e478c..0e0baadde9e34d28db56dc68e66aaf66c60d12df 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 // 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 81203ad1460f3b64413a8426fb58a051b7d78f03..5d1b55fdbcbe63f6b42b694d05211a3cc691a09d 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1651,11 +1651,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 // 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 cab1959a1917e008337c23b73b9170cd455ba4f9..30cbe3bdc7142769019765b03cc4fe1f9ba1ddb4 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1410,10 +1410,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/0460-Suspicious-Effect-Entry-API.patch b/patches/api/0460-Suspicious-Effect-Entry-API.patch new file mode 100644 index 0000000000..7c9548be79 --- /dev/null +++ b/patches/api/0460-Suspicious-Effect-Entry-API.patch @@ -0,0 +1,216 @@ +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..6a96e339ff1466df5743b5d42a31ce6a67e48f16 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java +@@ -0,0 +1,38 @@ ++package io.papermc.paper.potion; ++ ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.Contract; ++import org.jetbrains.annotations.NotNull; ++ ++/** ++ * Represents a {@link PotionEffectType} paired with a duration. ++ */ ++public sealed interface SuspiciousEffectEntry permits SuspiciousEffectEntryImpl { ++ ++ /** ++ * Gets the effect type. ++ * ++ * @return effect type ++ */ ++ @NotNull 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 @NotNull SuspiciousEffectEntry create(final @NotNull 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..e5002ccaef9ea7a9db94296ad0d66cdae050cdd1 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java +@@ -0,0 +1,7 @@ ++package io.papermc.paper.potion; ++ ++import org.bukkit.potion.PotionEffectType; ++import org.jetbrains.annotations.NotNull; ++ ++record SuspiciousEffectEntryImpl(@NotNull 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..21503b85e1e309e3e8b90517e98572fa6a29fc6f 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) // 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) ++ @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) ++ @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) ++ @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) ++ @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/0460-improve-BanList-types.patch b/patches/api/0460-improve-BanList-types.patch deleted file mode 100644 index 2236f8bf3e..0000000000 --- a/patches/api/0460-improve-BanList-types.patch +++ /dev/null @@ -1,131 +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..2980abf2f41cb14f0ee5c829c365f8e304130618 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/ban/BanListType.java -@@ -0,0 +1,29 @@ -+package io.papermc.paper.ban; -+ -+import org.bukkit.BanList; -+import org.bukkit.ban.IpBanList; -+import org.bukkit.ban.ProfileBanList; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents a ban-type that a {@link BanList} may track. -+ * It enforces the correct return value at compile time. -+ */ -+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 -+ */ -+ @NotNull 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..1159e7cd29fbf11f3fa1448fcf9d0768e1bcb0a3 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/ban/BanListTypeImpl.java -@@ -0,0 +1,8 @@ -+package io.papermc.paper.ban; -+ -+import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+ -+@ApiStatus.Internal -+record BanListTypeImpl(@NotNull Class typeClass) implements BanListType { -+} -diff --git a/src/main/java/org/bukkit/BanList.java b/src/main/java/org/bukkit/BanList.java -index a77c0411a68a9bad33ddfb335b7a996a843e478c..0e0baadde9e34d28db56dc68e66aaf66c60d12df 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 // 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 c9fbbf0287cd663080fc09ac83b439780cbfae85..687bd8f54c9bfb5f5ab1f7ad9d232daf2433cc76 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1651,11 +1651,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 // 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 c8395c8707e696f1e6fc8b0fd03f07203e01c157..27084402cf0e46dcd171074629b7c4156e48aa44 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -1410,10 +1410,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/0461-Fix-DamageSource-API.patch b/patches/api/0461-Fix-DamageSource-API.patch new file mode 100644 index 0000000000..efe4403e2c --- /dev/null +++ b/patches/api/0461-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/0461-Suspicious-Effect-Entry-API.patch b/patches/api/0461-Suspicious-Effect-Entry-API.patch deleted file mode 100644 index 7c9548be79..0000000000 --- a/patches/api/0461-Suspicious-Effect-Entry-API.patch +++ /dev/null @@ -1,216 +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..6a96e339ff1466df5743b5d42a31ce6a67e48f16 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java -@@ -0,0 +1,38 @@ -+package io.papermc.paper.potion; -+ -+import org.bukkit.potion.PotionEffect; -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.Contract; -+import org.jetbrains.annotations.NotNull; -+ -+/** -+ * Represents a {@link PotionEffectType} paired with a duration. -+ */ -+public sealed interface SuspiciousEffectEntry permits SuspiciousEffectEntryImpl { -+ -+ /** -+ * Gets the effect type. -+ * -+ * @return effect type -+ */ -+ @NotNull 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 @NotNull SuspiciousEffectEntry create(final @NotNull 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..e5002ccaef9ea7a9db94296ad0d66cdae050cdd1 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java -@@ -0,0 +1,7 @@ -+package io.papermc.paper.potion; -+ -+import org.bukkit.potion.PotionEffectType; -+import org.jetbrains.annotations.NotNull; -+ -+record SuspiciousEffectEntryImpl(@NotNull 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..21503b85e1e309e3e8b90517e98572fa6a29fc6f 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) // 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) -+ @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) -+ @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) -+ @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) -+ @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/0462-Expanded-Hopper-API.patch b/patches/api/0462-Expanded-Hopper-API.patch new file mode 100644 index 0000000000..51cb6dfee2 --- /dev/null +++ b/patches/api/0462-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/0462-Fix-DamageSource-API.patch b/patches/api/0462-Fix-DamageSource-API.patch deleted file mode 100644 index efe4403e2c..0000000000 --- a/patches/api/0462-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/0463-Clone-mutables-to-prevent-unexpected-issues.patch b/patches/api/0463-Clone-mutables-to-prevent-unexpected-issues.patch new file mode 100644 index 0000000000..e84ea7d3aa --- /dev/null +++ b/patches/api/0463-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 099efafa14c10910e4ed04abb1823f0c1a96b6a6..8506fa03293c575c35b55b052224807470fdbd98 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java +@@ -59,7 +59,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 6818e9f0ba32ca1a1e612703f7526b29f5a6438f..e4e3d2e22c28ef251d76c48ade267b4eb3749e7d 100644 +--- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java ++++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java +@@ -24,7 +24,7 @@ public class EntityPortalEnterEvent extends EntityEvent { + */ + @NotNull + public Location getLocation() { +- return location; ++ return location.clone(); // Paper - clone to avoid changes + } + + @NotNull +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/0463-Expanded-Hopper-API.patch b/patches/api/0463-Expanded-Hopper-API.patch deleted file mode 100644 index 51cb6dfee2..0000000000 --- a/patches/api/0463-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/0464-Add-BlockBreakProgressUpdateEvent.patch b/patches/api/0464-Add-BlockBreakProgressUpdateEvent.patch new file mode 100644 index 0000000000..a2b5a83baf --- /dev/null +++ b/patches/api/0464-Add-BlockBreakProgressUpdateEvent.patch @@ -0,0 +1,68 @@ +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..0cd1ab085222eae1a8df8ad85b26b49b6dd93a09 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java +@@ -0,0 +1,56 @@ ++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.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Range; ++ ++/** ++ * Called when the progress of a block break is updated. ++ */ ++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(@NotNull final Block block, final float progress, @NotNull 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 progress; ++ } ++ ++ /** ++ * The entity breaking the block. ++ * ++ * @return The entity breaking the block ++ */ ++ @NotNull ++ public Entity getEntity() { ++ return entity; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++} diff --git a/patches/api/0464-Clone-mutables-to-prevent-unexpected-issues.patch b/patches/api/0464-Clone-mutables-to-prevent-unexpected-issues.patch deleted file mode 100644 index e84ea7d3aa..0000000000 --- a/patches/api/0464-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 099efafa14c10910e4ed04abb1823f0c1a96b6a6..8506fa03293c575c35b55b052224807470fdbd98 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java -@@ -59,7 +59,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 6818e9f0ba32ca1a1e612703f7526b29f5a6438f..e4e3d2e22c28ef251d76c48ade267b4eb3749e7d 100644 ---- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java -+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java -@@ -24,7 +24,7 @@ public class EntityPortalEnterEvent extends EntityEvent { - */ - @NotNull - public Location getLocation() { -- return location; -+ return location.clone(); // Paper - clone to avoid changes - } - - @NotNull -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/0465-Add-BlockBreakProgressUpdateEvent.patch b/patches/api/0465-Add-BlockBreakProgressUpdateEvent.patch deleted file mode 100644 index a2b5a83baf..0000000000 --- a/patches/api/0465-Add-BlockBreakProgressUpdateEvent.patch +++ /dev/null @@ -1,68 +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..0cd1ab085222eae1a8df8ad85b26b49b6dd93a09 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java -@@ -0,0 +1,56 @@ -+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.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Range; -+ -+/** -+ * Called when the progress of a block break is updated. -+ */ -+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(@NotNull final Block block, final float progress, @NotNull 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 progress; -+ } -+ -+ /** -+ * The entity breaking the block. -+ * -+ * @return The entity breaking the block -+ */ -+ @NotNull -+ public Entity getEntity() { -+ return entity; -+ } -+ -+ @Override -+ public @NotNull HandlerList getHandlers() { -+ return HANDLER_LIST; -+ } -+ public static @NotNull HandlerList getHandlerList() { -+ return HANDLER_LIST; -+ } -+} diff --git a/patches/api/0465-Deprecate-ItemStack-setType.patch b/patches/api/0465-Deprecate-ItemStack-setType.patch new file mode 100644 index 0000000000..9f21ce5142 --- /dev/null +++ b/patches/api/0465-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 b669df4bd1ff0ecba575d42415973e81bccddbbe..1294f7ce50977dfe72daf535b611386844c205e0 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -134,8 +134,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; +@@ -148,6 +158,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/0466-Deprecate-ItemStack-setType.patch b/patches/api/0466-Deprecate-ItemStack-setType.patch deleted file mode 100644 index 9f21ce5142..0000000000 --- a/patches/api/0466-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 b669df4bd1ff0ecba575d42415973e81bccddbbe..1294f7ce50977dfe72daf535b611386844c205e0 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -134,8 +134,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; -@@ -148,6 +158,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/0466-Item-Mutation-Fixes.patch b/patches/api/0466-Item-Mutation-Fixes.patch new file mode 100644 index 0000000000..c1c3508b78 --- /dev/null +++ b/patches/api/0466-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 f30ed841864f426c59143f392f39c96f864ba924..16fd600c25991e641a1be6fb78238256a6ce3d3f 100644 +--- a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java ++++ b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java +@@ -21,7 +21,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/0467-API-for-checking-sent-chunks.patch b/patches/api/0467-API-for-checking-sent-chunks.patch new file mode 100644 index 0000000000..8d97e181b0 --- /dev/null +++ b/patches/api/0467-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 f08b1a2ec8815efcaaf1371e20eb1461a5f2d359..8a1e39474af88188f2e1765731b57d349f0ee645 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -3751,6 +3751,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/0467-Item-Mutation-Fixes.patch b/patches/api/0467-Item-Mutation-Fixes.patch deleted file mode 100644 index c1c3508b78..0000000000 --- a/patches/api/0467-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 f30ed841864f426c59143f392f39c96f864ba924..16fd600c25991e641a1be6fb78238256a6ce3d3f 100644 ---- a/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java -+++ b/src/main/java/org/bukkit/event/block/InventoryBlockStartEvent.java -@@ -21,7 +21,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/0468-API-for-checking-sent-chunks.patch b/patches/api/0468-API-for-checking-sent-chunks.patch deleted file mode 100644 index 8d97e181b0..0000000000 --- a/patches/api/0468-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 f08b1a2ec8815efcaaf1371e20eb1461a5f2d359..8a1e39474af88188f2e1765731b57d349f0ee645 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -3751,6 +3751,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/0468-Add-CartographyItemEvent.patch b/patches/api/0468-Add-CartographyItemEvent.patch new file mode 100644 index 0000000000..1f19663c9f --- /dev/null +++ b/patches/api/0468-Add-CartographyItemEvent.patch @@ -0,0 +1,44 @@ +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..659b620696e5cc0784ed707c70876e4348897c7f +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.event.player; ++ ++import org.bukkit.inventory.InventoryView; ++import org.bukkit.inventory.CartographyInventory; ++import org.bukkit.event.inventory.ClickType; ++import org.bukkit.event.inventory.InventoryType; ++import org.bukkit.event.inventory.InventoryAction; ++import org.bukkit.event.inventory.InventoryClickEvent; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * Called when the recipe of an Item is completed inside a cartography table. ++ */ ++public class CartographyItemEvent extends InventoryClickEvent { ++ @ApiStatus.Internal ++ public CartographyItemEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action) { ++ super(view, type, slot, click, action); ++ } ++ ++ @ApiStatus.Internal ++ public CartographyItemEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action, int key) { ++ super(view, type, slot, click, action, key); ++ } ++ ++ @NotNull ++ @Override ++ public CartographyInventory getInventory() { ++ return (CartographyInventory) super.getInventory(); ++ } ++} diff --git a/patches/api/0469-Add-CartographyItemEvent.patch b/patches/api/0469-Add-CartographyItemEvent.patch deleted file mode 100644 index 1f19663c9f..0000000000 --- a/patches/api/0469-Add-CartographyItemEvent.patch +++ /dev/null @@ -1,44 +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..659b620696e5cc0784ed707c70876e4348897c7f ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java -@@ -0,0 +1,31 @@ -+package io.papermc.paper.event.player; -+ -+import org.bukkit.inventory.InventoryView; -+import org.bukkit.inventory.CartographyInventory; -+import org.bukkit.event.inventory.ClickType; -+import org.bukkit.event.inventory.InventoryType; -+import org.bukkit.event.inventory.InventoryAction; -+import org.bukkit.event.inventory.InventoryClickEvent; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.ApiStatus; -+ -+/** -+ * Called when the recipe of an Item is completed inside a cartography table. -+ */ -+public class CartographyItemEvent extends InventoryClickEvent { -+ @ApiStatus.Internal -+ public CartographyItemEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action) { -+ super(view, type, slot, click, action); -+ } -+ -+ @ApiStatus.Internal -+ public CartographyItemEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action, int key) { -+ super(view, type, slot, click, action, key); -+ } -+ -+ @NotNull -+ @Override -+ public CartographyInventory getInventory() { -+ return (CartographyInventory) super.getInventory(); -+ } -+} diff --git a/patches/api/0469-More-Raid-API.patch b/patches/api/0469-More-Raid-API.patch new file mode 100644 index 0000000000..921bc9c6fb --- /dev/null +++ b/patches/api/0469-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 0e3c7de14be8dc01199fd68b6bf41783c5c43ec3..97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -4215,6 +4215,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/0470-Fix-SpawnerEntry-Equipment-API.patch b/patches/api/0470-Fix-SpawnerEntry-Equipment-API.patch new file mode 100644 index 0000000000..0a16b34cd5 --- /dev/null +++ b/patches/api/0470-Fix-SpawnerEntry-Equipment-API.patch @@ -0,0 +1,46 @@ +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 02b3471774ff1fd4ad15c2f04064fd485ef8f3e5..0fc5f04b8bb475e8afce61c6187a390cd36c3d9f 100644 +--- a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java ++++ b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java +@@ -121,28 +121,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. Do not use {@link LootTables#EMPTY} +- * to clear a LootTable. ++ * To remove a loot table use {@link LootTables#EMPTY}. + * + * @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/0470-More-Raid-API.patch b/patches/api/0470-More-Raid-API.patch deleted file mode 100644 index 921bc9c6fb..0000000000 --- a/patches/api/0470-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 0e3c7de14be8dc01199fd68b6bf41783c5c43ec3..97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -4215,6 +4215,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/0471-Fix-ItemFlags.patch b/patches/api/0471-Fix-ItemFlags.patch new file mode 100644 index 0000000000..007e003bc3 --- /dev/null +++ b/patches/api/0471-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 a435f6c8947e4ac50b8c04f37b107055970937dd..92e30c281eab4801298b280bd388a0399212a0c1 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 1294f7ce50977dfe72daf535b611386844c205e0..84a7bf0936d35bf42b5ed038d295d5c31740f472 100644 +--- a/src/main/java/org/bukkit/inventory/ItemStack.java ++++ b/src/main/java/org/bukkit/inventory/ItemStack.java +@@ -575,6 +575,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/0471-Fix-SpawnerEntry-Equipment-API.patch b/patches/api/0471-Fix-SpawnerEntry-Equipment-API.patch deleted file mode 100644 index 0a16b34cd5..0000000000 --- a/patches/api/0471-Fix-SpawnerEntry-Equipment-API.patch +++ /dev/null @@ -1,46 +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 02b3471774ff1fd4ad15c2f04064fd485ef8f3e5..0fc5f04b8bb475e8afce61c6187a390cd36c3d9f 100644 ---- a/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java -+++ b/src/main/java/org/bukkit/block/spawner/SpawnerEntry.java -@@ -121,28 +121,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. Do not use {@link LootTables#EMPTY} -- * to clear a LootTable. -+ * To remove a loot table use {@link LootTables#EMPTY}. - * - * @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/0472-Allow-modifying-library-loader-jars-bytecode.patch b/patches/api/0472-Allow-modifying-library-loader-jars-bytecode.patch new file mode 100644 index 0000000000..0c0311e790 --- /dev/null +++ b/patches/api/0472-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/0472-Fix-ItemFlags.patch b/patches/api/0472-Fix-ItemFlags.patch deleted file mode 100644 index 007e003bc3..0000000000 --- a/patches/api/0472-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 a435f6c8947e4ac50b8c04f37b107055970937dd..92e30c281eab4801298b280bd388a0399212a0c1 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 1294f7ce50977dfe72daf535b611386844c205e0..84a7bf0936d35bf42b5ed038d295d5c31740f472 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -575,6 +575,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/0473-Add-hook-to-remap-library-jars.patch b/patches/api/0473-Add-hook-to-remap-library-jars.patch new file mode 100644 index 0000000000..fe1609629e --- /dev/null +++ b/patches/api/0473-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/0473-Allow-modifying-library-loader-jars-bytecode.patch b/patches/api/0473-Allow-modifying-library-loader-jars-bytecode.patch deleted file mode 100644 index 0c0311e790..0000000000 --- a/patches/api/0473-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/0474-Add-GameMode-isInvulnerable.patch b/patches/api/0474-Add-GameMode-isInvulnerable.patch new file mode 100644 index 0000000000..b4b81c5f52 --- /dev/null +++ b/patches/api/0474-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/0474-Add-hook-to-remap-library-jars.patch b/patches/api/0474-Add-hook-to-remap-library-jars.patch deleted file mode 100644 index fe1609629e..0000000000 --- a/patches/api/0474-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/0475-Add-GameMode-isInvulnerable.patch b/patches/api/0475-Add-GameMode-isInvulnerable.patch deleted file mode 100644 index b4b81c5f52..0000000000 --- a/patches/api/0475-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/0475-Expose-hasColor-to-leather-armor.patch b/patches/api/0475-Expose-hasColor-to-leather-armor.patch new file mode 100644 index 0000000000..df21a83f91 --- /dev/null +++ b/patches/api/0475-Expose-hasColor-to-leather-armor.patch @@ -0,0 +1,25 @@ +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 7f9eabcaa4d803ee524a9cc8717379fe6a93a5af..496f4b256406a4f38f36471f57d8529b3f29b6a1 100644 +--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java +@@ -33,4 +33,14 @@ public interface LeatherArmorMeta extends ItemMeta { + @Override + @NotNull + LeatherArmorMeta clone(); ++ ++ // Paper start - Expose #hasColor to leather armor ++ /** ++ * Checks whether this leather armor is dyed ++ * (i.e. has a color different from {@link ItemFactory#getDefaultLeatherColor()}) ++ * ++ * @return whether this leather armor is dyed ++ */ ++ boolean isDyed(); ++ // Paper end - Expose #hasColor to leather armor + } diff --git a/patches/api/0476-Add-missing-wind-charge-damage-type.patch b/patches/api/0476-Add-missing-wind-charge-damage-type.patch new file mode 100644 index 0000000000..8a77bddf2a --- /dev/null +++ b/patches/api/0476-Add-missing-wind-charge-damage-type.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Fri, 3 May 2024 22:56:12 +0200 +Subject: [PATCH] Add missing wind charge damage type + + +diff --git a/src/main/java/org/bukkit/damage/DamageType.java b/src/main/java/org/bukkit/damage/DamageType.java +index 9f2d80a91e12f09407d737668f4178e81811fe14..e1367e86c21a1c733c8db45b357e9a95e093644a 100644 +--- a/src/main/java/org/bukkit/damage/DamageType.java ++++ b/src/main/java/org/bukkit/damage/DamageType.java +@@ -65,6 +65,12 @@ public interface DamageType extends Keyed, Translatable { + public static final DamageType BAD_RESPAWN_POINT = getDamageType("bad_respawn_point"); + public static final DamageType OUTSIDE_BORDER = getDamageType("outside_border"); + public static final DamageType GENERIC_KILL = getDamageType("generic_kill"); ++ // Paper start ++ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) ++ @ApiStatus.Experimental ++ @org.jetbrains.annotations.Nullable ++ DamageType WIND_CHARGE = getExperimentalDamageType("wind_charge"); ++ // Paper end + + @NotNull + private static DamageType getDamageType(@NotNull String key) { +@@ -72,6 +78,12 @@ public interface DamageType extends Keyed, Translatable { + return Preconditions.checkNotNull(Registry.DAMAGE_TYPE.get(namespacedKey), "No DamageType found for %s. This is a bug.", namespacedKey); + } + ++ // Paper start ++ private static @org.jetbrains.annotations.Nullable DamageType getExperimentalDamageType(@NotNull String key) { ++ return Registry.DAMAGE_TYPE.get(NamespacedKey.minecraft(key)); ++ } ++ // Paper end ++ + /** + * {@inheritDoc} + *

    diff --git a/patches/api/0476-Expose-hasColor-to-leather-armor.patch b/patches/api/0476-Expose-hasColor-to-leather-armor.patch deleted file mode 100644 index df21a83f91..0000000000 --- a/patches/api/0476-Expose-hasColor-to-leather-armor.patch +++ /dev/null @@ -1,25 +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 7f9eabcaa4d803ee524a9cc8717379fe6a93a5af..496f4b256406a4f38f36471f57d8529b3f29b6a1 100644 ---- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java -@@ -33,4 +33,14 @@ public interface LeatherArmorMeta extends ItemMeta { - @Override - @NotNull - LeatherArmorMeta clone(); -+ -+ // Paper start - Expose #hasColor to leather armor -+ /** -+ * Checks whether this leather armor is dyed -+ * (i.e. has a color different from {@link ItemFactory#getDefaultLeatherColor()}) -+ * -+ * @return whether this leather armor is dyed -+ */ -+ boolean isDyed(); -+ // Paper end - Expose #hasColor to leather armor - } diff --git a/patches/api/0477-Add-missing-wind-charge-damage-type.patch b/patches/api/0477-Add-missing-wind-charge-damage-type.patch deleted file mode 100644 index 8a77bddf2a..0000000000 --- a/patches/api/0477-Add-missing-wind-charge-damage-type.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> -Date: Fri, 3 May 2024 22:56:12 +0200 -Subject: [PATCH] Add missing wind charge damage type - - -diff --git a/src/main/java/org/bukkit/damage/DamageType.java b/src/main/java/org/bukkit/damage/DamageType.java -index 9f2d80a91e12f09407d737668f4178e81811fe14..e1367e86c21a1c733c8db45b357e9a95e093644a 100644 ---- a/src/main/java/org/bukkit/damage/DamageType.java -+++ b/src/main/java/org/bukkit/damage/DamageType.java -@@ -65,6 +65,12 @@ public interface DamageType extends Keyed, Translatable { - public static final DamageType BAD_RESPAWN_POINT = getDamageType("bad_respawn_point"); - public static final DamageType OUTSIDE_BORDER = getDamageType("outside_border"); - public static final DamageType GENERIC_KILL = getDamageType("generic_kill"); -+ // Paper start -+ @org.bukkit.MinecraftExperimental(org.bukkit.MinecraftExperimental.Requires.UPDATE_1_21) -+ @ApiStatus.Experimental -+ @org.jetbrains.annotations.Nullable -+ DamageType WIND_CHARGE = getExperimentalDamageType("wind_charge"); -+ // Paper end - - @NotNull - private static DamageType getDamageType(@NotNull String key) { -@@ -72,6 +78,12 @@ public interface DamageType extends Keyed, Translatable { - return Preconditions.checkNotNull(Registry.DAMAGE_TYPE.get(namespacedKey), "No DamageType found for %s. This is a bug.", namespacedKey); - } - -+ // Paper start -+ private static @org.jetbrains.annotations.Nullable DamageType getExperimentalDamageType(@NotNull String key) { -+ return Registry.DAMAGE_TYPE.get(NamespacedKey.minecraft(key)); -+ } -+ // Paper end -+ - /** - * {@inheritDoc} - *

    diff --git a/patches/api/0477-Added-API-to-get-player-ha-proxy-address.patch b/patches/api/0477-Added-API-to-get-player-ha-proxy-address.patch new file mode 100644 index 0000000000..66f3365768 --- /dev/null +++ b/patches/api/0477-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 8a1e39474af88188f2e1765731b57d349f0ee645..6c327a07bf8a6aa11a2d7dad12b2830acc539484 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -250,6 +250,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/0478-Added-API-to-get-player-ha-proxy-address.patch b/patches/api/0478-Added-API-to-get-player-ha-proxy-address.patch deleted file mode 100644 index 66f3365768..0000000000 --- a/patches/api/0478-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 8a1e39474af88188f2e1765731b57d349f0ee645..6c327a07bf8a6aa11a2d7dad12b2830acc539484 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -250,6 +250,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/0478-More-Chest-Block-API.patch b/patches/api/0478-More-Chest-Block-API.patch new file mode 100644 index 0000000000..1fc3614c74 --- /dev/null +++ b/patches/api/0478-More-Chest-Block-API.patch @@ -0,0 +1,44 @@ +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/0479-More-Chest-Block-API.patch b/patches/api/0479-More-Chest-Block-API.patch deleted file mode 100644 index 1fc3614c74..0000000000 --- a/patches/api/0479-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/server/0023-Timings-v2.patch b/patches/server/0023-Timings-v2.patch index 4e498beadf..2c4e8421cc 100644 --- a/patches/server/0023-Timings-v2.patch +++ b/patches/server/0023-Timings-v2.patch @@ -573,6 +573,119 @@ index 0000000000000000000000000000000000000000..49028463ba47e760281545c2f7597e3d + } + } +} +diff --git a/src/main/java/co/aikar/timings/TimingsWorldHistoryExtractor.java b/src/main/java/co/aikar/timings/TimingsWorldHistoryExtractor.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e6870a32eadc6dcfd6b52ffe14e7dd9d0591ef1d +--- /dev/null ++++ b/src/main/java/co/aikar/timings/TimingsWorldHistoryExtractor.java +@@ -0,0 +1,107 @@ ++package co.aikar.timings; ++ ++import co.aikar.util.JSONUtil; ++import co.aikar.util.LoadingMap; ++import com.google.common.base.Function; ++import io.papermc.paper.chunk.system.ChunkSystem; ++import net.minecraft.server.level.ChunkHolder; ++import net.minecraft.server.level.ServerLevel; ++import net.minecraft.world.level.chunk.LevelChunk; ++import org.bukkit.Bukkit; ++import org.bukkit.Material; ++import org.bukkit.World; ++import org.bukkit.craftbukkit.CraftWorld; ++import org.bukkit.craftbukkit.block.CraftBlockType; ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.EntityType; ++import org.jetbrains.annotations.NotNull; ++import java.util.List; ++import java.util.Map; ++ ++import static co.aikar.timings.TimingHistory.worldMap; ++import static co.aikar.util.JSONUtil.pair; ++import static co.aikar.util.JSONUtil.toArray; ++import static co.aikar.util.JSONUtil.toArrayMapper; ++import static co.aikar.util.JSONUtil.toObjectMapper; ++ ++/** ++ * Internal class for extracting information about the world ++ * without having to rely on generally slower/broken spigot API ++ */ ++@SuppressWarnings("removal") ++public class TimingsWorldHistoryExtractor implements Function { ++ ++ private final TimingHistory timingHistory; ++ ++ public TimingsWorldHistoryExtractor(TimingHistory timingHistory) { ++ this.timingHistory = timingHistory; ++ } ++ ++ @NotNull ++ @Override ++ public JSONUtil.JSONPair apply(World world) { ++ final ServerLevel level = ((CraftWorld) world).getHandle(); ++ final Map regions = LoadingMap.newHashMap(TimingHistory.RegionData.LOADER); ++ ++ final List visibleChunkHolders = ChunkSystem.getVisibleChunkHolders(level); ++ for (ChunkHolder chunkHolder : visibleChunkHolders) { ++ final LevelChunk fullChunkNow = chunkHolder.getFullChunkNow(); ++ if (fullChunkNow == null) continue; ++ ++ TimingHistory.RegionData data = regions.get(new TimingHistory.RegionData.RegionId(chunkHolder.pos.x, chunkHolder.pos.z)); ++ ++ for (final Entity entity : level.getChunkEntities(chunkHolder.pos.x, chunkHolder.pos.z)) { ++ if (entity == null) { ++ Bukkit.getLogger().warning("Null entity detected in chunk at position x: " + chunkHolder.pos.x + ", z: " + chunkHolder.pos.z); ++ continue; ++ } ++ data.entityCounts.get(entity.getType()).increment(); ++ } ++ ++ fullChunkNow.getBlockEntities().forEach(((blockPos, blockEntity) -> { ++ final Material material = CraftBlockType.minecraftToBukkit(blockEntity.getBlockState().getBlock()); ++ data.tileEntityCounts.get(material).increment(); ++ })); ++ ++ } ++ return pair( ++ worldMap.get(world.getName()), ++ toArrayMapper(regions.values(), new Function() { ++ @NotNull ++ @Override ++ public Object apply(TimingHistory.RegionData input) { ++ return toArray( ++ input.regionId.x, ++ input.regionId.z, ++ toObjectMapper(input.entityCounts.entrySet(), ++ new Function, JSONUtil.JSONPair>() { ++ @NotNull ++ @Override ++ public JSONUtil.JSONPair apply(Map.Entry entry) { ++ timingHistory.entityTypeSet.add(entry.getKey()); ++ return pair( ++ String.valueOf(entry.getKey().ordinal()), ++ entry.getValue().count() ++ ); ++ } ++ } ++ ), ++ toObjectMapper(input.tileEntityCounts.entrySet(), ++ new Function, JSONUtil.JSONPair>() { ++ @NotNull ++ @Override ++ public JSONUtil.JSONPair apply(Map.Entry entry) { ++ timingHistory.tileEntityTypeSet.add(entry.getKey()); ++ return pair( ++ String.valueOf(entry.getKey().ordinal()), ++ entry.getValue().count() ++ ); ++ } ++ } ++ ) ++ ); ++ } ++ }) ++ ); ++ } ++} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..2f0d9b953802dee821cfde82d22b0567cce8ee91 @@ -1527,7 +1640,7 @@ index 991ebf07bc0608df0a12f1f26e581cc93255ae01..946001c57c326f2d2f0677bca954e855 private String descriptionId; @Nullable diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 099f85ec8b427392947e815e0b85d7ec49369bc3..fb495fcbf42be3825bfb785a9887148c54f5b00b 100644 +index f0b4b9828ec237e93d5a6bdf5cbea8b469ebff02..7fa49fcf5469276e25c40af4cd27943f665d8721 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -34,10 +34,12 @@ import org.bukkit.inventory.InventoryHolder; @@ -2005,7 +2118,7 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222 + } // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index beffeedee0afdb885558c832f8801cd713d741a3..beae45fb45eb0629ba36f8daabaf7d9cb9716b71 100644 +index beffeedee0afdb885558c832f8801cd713d741a3..ec8d64ff77367d28c1b9e2b8745e76588ed9e375 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -212,6 +212,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -2021,7 +2134,7 @@ index beffeedee0afdb885558c832f8801cd713d741a3..beae45fb45eb0629ba36f8daabaf7d9c public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -462,6 +468,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -462,6 +468,18 @@ public final class CraftMagicNumbers implements UnsafeValues { public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) { return new CraftDamageSourceBuilder(damageType); } @@ -2030,6 +2143,12 @@ index beffeedee0afdb885558c832f8801cd713d741a3..beae45fb45eb0629ba36f8daabaf7d9c + public String getTimingsServerName() { + return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; + } ++ ++ @Override ++ public com.google.common.base.Function getWorldTimingExtractor(final co.aikar.timings.TimingHistory timingHistory) { ++ return new co.aikar.timings.TimingsWorldHistoryExtractor(timingHistory); ++ } ++ + // Paper end /** diff --git a/patches/server/0035-Implement-Paper-VersionChecker.patch b/patches/server/0035-Implement-Paper-VersionChecker.patch index 120f00fa55..4042ba7507 100644 --- a/patches/server/0035-Implement-Paper-VersionChecker.patch +++ b/patches/server/0035-Implement-Paper-VersionChecker.patch @@ -140,15 +140,13 @@ index 0000000000000000000000000000000000000000..22a55be34fde453fedd987173d95b8b3 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index beae45fb45eb0629ba36f8daabaf7d9cb9716b71..d568c3c85c44efc0fd0a43e7758fcd6899a60000 100644 +index ec8d64ff77367d28c1b9e2b8745e76588ed9e375..1d6998272b8df9144e545bdb73a1bdf4427e59c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -473,6 +473,11 @@ public final class CraftMagicNumbers implements UnsafeValues { - public String getTimingsServerName() { - return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; +@@ -479,6 +479,9 @@ public final class CraftMagicNumbers implements UnsafeValues { + return new co.aikar.timings.TimingsWorldHistoryExtractor(timingHistory); } -+ -+ @Override + + public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { + return new com.destroystokyo.paper.PaperVersionFetcher(); + } diff --git a/patches/server/0335-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/0335-Add-Raw-Byte-ItemStack-Serialization.patch index f1d09d375b..eeb32f04d0 100644 --- a/patches/server/0335-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/0335-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d568c3c85c44efc0fd0a43e7758fcd6899a60000..54e5d76e5ec40912a5c09123d879cd5bef8da4b1 100644 +index 1d6998272b8df9144e545bdb73a1bdf4427e59c8..2740638fbc9bc5bfa7b6bd511d0361cde561ed6f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -478,6 +478,53 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -482,6 +482,53 @@ public final class CraftMagicNumbers implements UnsafeValues { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.PaperVersionFetcher(); } diff --git a/patches/server/0424-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0424-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index bb48638f5f..7f2ac875d1 100644 --- a/patches/server/0424-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0424-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -21,10 +21,10 @@ index c8e4e37b706bd8cb9698ac2d13d0d8668e2d1d14..909575a02bf5f7040eb9c8edb034e7b6 + // Paper end - Expose entity id counter } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 54e5d76e5ec40912a5c09123d879cd5bef8da4b1..9b199fffb86cb04b9ad0013316a911ccf59d4051 100644 +index 2740638fbc9bc5bfa7b6bd511d0361cde561ed6f..a81c2cc04ccc7b814ef5e0401d7aa2be4000eaa6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -525,6 +525,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -529,6 +529,11 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); return compound; } diff --git a/patches/server/0515-Expand-world-key-API.patch b/patches/server/0515-Expand-world-key-API.patch index 10d9e10a3c..81e8612485 100644 --- a/patches/server/0515-Expand-world-key-API.patch +++ b/patches/server/0515-Expand-world-key-API.patch @@ -20,7 +20,7 @@ index 9801f78f1d44fd5a72fbdb319681b683e8fb85c4..1e720b96f0367652db6924b8654deaa9 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1460060f2ff42ebaa7b2418b375ce661c73bd17f..b9180b7552796331d09c3aef1e863a253180721d 100644 +index 2c89ba2b518618640064ebea22d3d9595407bad7..6efdfa77a98a98a2d8f9c68a8c9010c0115cb715 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1149,9 +1149,15 @@ public final class CraftServer implements Server { @@ -67,10 +67,10 @@ index 1460060f2ff42ebaa7b2418b375ce661c73bd17f..b9180b7552796331d09c3aef1e863a25 // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a5e9000034444fb36864020453acb0b183272922..a847717c0da236ee9743773eed3f2a3f1a8b10a6 100644 +index 72cd74e656a297bb1522f7b763b4454fe36ab97e..744aff70ade2656db08c6d825a867a3c9a6f1492 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -536,6 +536,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -540,6 +540,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public int nextEntityId() { return net.minecraft.world.entity.Entity.nextEntityId(); } diff --git a/patches/server/0520-Expose-protocol-version.patch b/patches/server/0520-Expose-protocol-version.patch index d61ca6ccaf..5aad62a622 100644 --- a/patches/server/0520-Expose-protocol-version.patch +++ b/patches/server/0520-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a847717c0da236ee9743773eed3f2a3f1a8b10a6..dd28ead9b0d7cea53e7cf952ec1e2ca594efe0bb 100644 +index 744aff70ade2656db08c6d825a867a3c9a6f1492..d9a9322c25a59d7fdae11781c8dc5408bc4dd222 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -541,6 +541,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -545,6 +545,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getMainLevelName() { return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName; } diff --git a/patches/server/0547-ItemStack-repair-check-API.patch b/patches/server/0547-ItemStack-repair-check-API.patch index 0fe2b8aae3..62e8980d66 100644 --- a/patches/server/0547-ItemStack-repair-check-API.patch +++ b/patches/server/0547-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index dd28ead9b0d7cea53e7cf952ec1e2ca594efe0bb..18d46779f56f97aae264325a5202568d8a06a747 100644 +index d9a9322c25a59d7fdae11781c8dc5408bc4dd222..bbc86c9a939fd50308b2e416087144253447be7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -546,6 +546,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -550,6 +550,14 @@ public final class CraftMagicNumbers implements UnsafeValues { public int getProtocolVersion() { return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion(); } diff --git a/patches/server/0602-Get-entity-default-attributes.patch b/patches/server/0602-Get-entity-default-attributes.patch index cce23d94f7..00078ada40 100644 --- a/patches/server/0602-Get-entity-default-attributes.patch +++ b/patches/server/0602-Get-entity-default-attributes.patch @@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index abc5f221e90fb39fe2fa192bcbd0a3bb75444d64..29661c484414e98c036045459dedf675aa661d85 100644 +index 7098e874f7ff35b0ef057d4a5f996c9a177d3c22..7e503f54619d587c6ace31fdf7debe4cb59d62ab 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -559,6 +559,18 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -563,6 +563,18 @@ public final class CraftMagicNumbers implements UnsafeValues { } return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); } diff --git a/patches/server/0608-Add-isCollidable-methods-to-various-places.patch b/patches/server/0608-Add-isCollidable-methods-to-various-places.patch index 400b9e4171..55d3755e44 100644 --- a/patches/server/0608-Add-isCollidable-methods-to-various-places.patch +++ b/patches/server/0608-Add-isCollidable-methods-to-various-places.patch @@ -39,10 +39,10 @@ index 1002123cd0c6f57cecc4e80f5f21cc6ff5886d37..e96023b71845526383288917e8d7c575 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 29661c484414e98c036045459dedf675aa661d85..03ac06c4bd89e6da2272c3ff109a1b2d3454efd2 100644 +index 7e503f54619d587c6ace31fdf7debe4cb59d62ab..07c65e1f3bfbbbf0c736257f25866db0af08458c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -571,6 +571,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -575,6 +575,12 @@ public final class CraftMagicNumbers implements UnsafeValues { var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); } diff --git a/patches/server/0611-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0611-Add-Raw-Byte-Entity-Serialization.patch index c003880b86..93df39395c 100644 --- a/patches/server/0611-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0611-Add-Raw-Byte-Entity-Serialization.patch @@ -50,10 +50,10 @@ index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0c @Override public boolean isInvisible() { // Paper - moved up from LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 03ac06c4bd89e6da2272c3ff109a1b2d3454efd2..64327d5dd0e1ec3f5ad411ee692923a340d6174f 100644 +index 07c65e1f3bfbbbf0c736257f25866db0af08458c..a1016d0d3c5896ea6b44547fc572ba0eb5d7d466 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -509,7 +509,33 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -513,7 +513,33 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } diff --git a/patches/server/0753-Add-NamespacedKey-biome-methods.patch b/patches/server/0753-Add-NamespacedKey-biome-methods.patch index cd1f237abf..0f9fb8883a 100644 --- a/patches/server/0753-Add-NamespacedKey-biome-methods.patch +++ b/patches/server/0753-Add-NamespacedKey-biome-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 64327d5dd0e1ec3f5ad411ee692923a340d6174f..76802c72fa2da7e8e16a7d611ac860d6d9ec7cff 100644 +index a1016d0d3c5896ea6b44547fc572ba0eb5d7d466..a645a53a6b20a27e72a2026a0d1acc8c3df39a87 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -603,6 +603,19 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -607,6 +607,19 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(material.isBlock(), material + " is not a block"); return getBlock(material).hasCollision; } diff --git a/patches/server/0880-Fix-custom-statistic-criteria-creation.patch b/patches/server/0880-Fix-custom-statistic-criteria-creation.patch index b409b07e4c..f76aaba962 100644 --- a/patches/server/0880-Fix-custom-statistic-criteria-creation.patch +++ b/patches/server/0880-Fix-custom-statistic-criteria-creation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix custom statistic criteria creation diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 76802c72fa2da7e8e16a7d611ac860d6d9ec7cff..4a978ebf1b5796833d83939a9502934d18ebb549 100644 +index a645a53a6b20a27e72a2026a0d1acc8c3df39a87..a6ef99fb8b3a80df43d460c7b0bf01951ca22c45 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -616,6 +616,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -620,6 +620,12 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.core.Holder biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey))); cra.setBiome(x, y, z, biomeBase); } diff --git a/patches/server/0952-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/0952-Add-api-for-spawn-egg-texture-colors.patch index cff7fe211e..8a85791917 100644 --- a/patches/server/0952-Add-api-for-spawn-egg-texture-colors.patch +++ b/patches/server/0952-Add-api-for-spawn-egg-texture-colors.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a7a1c9962a57fc9ed99f1523b2f5230a55b2afd1..cf29c541b74ab37592997c31adb7b240d92b2bea 100644 +index 7f880871142b5c768a0893be2f01af9ec781572d..ac362a8a231d1d954b73e1651e0d8a938db631e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -644,6 +644,15 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -648,6 +648,15 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end diff --git a/patches/server/0953-Add-Lifecycle-Event-system.patch b/patches/server/0953-Add-Lifecycle-Event-system.patch index e725e14bc4..61cd59591e 100644 --- a/patches/server/0953-Add-Lifecycle-Event-system.patch +++ b/patches/server/0953-Add-Lifecycle-Event-system.patch @@ -707,7 +707,7 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67 } catch (Throwable e) { LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b1cfc6f5a2511e9bb145442dfb765951a1ee0fca..b9ad8446d702f729673d75dd6978b9db820f380b 100644 +index 1990cc252a8386b299f125991597bdbaacabb591..61f89519c3e061b8286bf6f086d50e0084785054 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1017,6 +1017,11 @@ public final class CraftServer implements Server { @@ -739,10 +739,10 @@ index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a46 + // Paper end - lifecycle events } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index cf29c541b74ab37592997c31adb7b240d92b2bea..12289984948b0cc34df39767945222616844aebb 100644 +index ac362a8a231d1d954b73e1651e0d8a938db631e1..259e0730c6541ce717c242aed6db2bf1f1b08b8c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -653,6 +653,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -657,6 +657,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - spawn egg color visibility diff --git a/patches/server/0954-ItemStack-Tooltip-API.patch b/patches/server/0954-ItemStack-Tooltip-API.patch index 7a2e3afd0a..ebbd955de8 100644 --- a/patches/server/0954-ItemStack-Tooltip-API.patch +++ b/patches/server/0954-ItemStack-Tooltip-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack Tooltip API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 12289984948b0cc34df39767945222616844aebb..4d66c0d64af800c92e84a40e90cda9c6a49d3f04 100644 +index 259e0730c6541ce717c242aed6db2bf1f1b08b8c..4baf089a622ecf56cb9d2116f7974b0fabaaac38 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -643,6 +643,20 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -647,6 +647,20 @@ public final class CraftMagicNumbers implements UnsafeValues { return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName(); } // Paper end diff --git a/patches/server/0976-Rewrite-dataconverter-system.patch b/patches/server/0976-Rewrite-dataconverter-system.patch index 0abf2badef..c04db63ac1 100644 --- a/patches/server/0976-Rewrite-dataconverter-system.patch +++ b/patches/server/0976-Rewrite-dataconverter-system.patch @@ -22437,7 +22437,7 @@ index 0000000000000000000000000000000000000000..f50b81d931a1908d405bb72e0679983a +} diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java new file mode 100644 -index 0000000000000000000000000000000000000000..29d256c2f5d5e338dc7abeb82c0f1ae99ee1edf7 +index 0000000000000000000000000000000000000000..40f9b8f2a3d0b01dc97472f34c441321a0e33079 --- /dev/null +++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V3818.java @@ -0,0 +1,339 @@ @@ -28906,10 +28906,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d return nbttagcompound; }); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 4d66c0d64af800c92e84a40e90cda9c6a49d3f04..a1c9989df460d7ae3666fffe7968750832a30b85 100644 +index 4baf089a622ecf56cb9d2116f7974b0fabaaac38..d3dc93242336e9a68f9241b051fa32815d826185 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -525,7 +525,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -529,7 +529,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); final int dataVersion = compound.getInt("DataVersion"); @@ -28918,7 +28918,7 @@ index 4d66c0d64af800c92e84a40e90cda9c6a49d3f04..a1c9989df460d7ae3666fffe79687508 return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } -@@ -546,7 +546,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -550,7 +550,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); int dataVersion = compound.getInt("DataVersion"); -- cgit v1.2.3