62 Commits
1.19.1 ... 1.21

Author SHA1 Message Date
Blast
3ddb72096d Update push-build.yml 2024-08-11 23:06:29 -04:00
Blast-MC
b6152ed60d 1.12.1 2024-08-11 22:46:10 -04:00
Blast-MC
9040f46126 rebuild server patches 2024-07-23 22:37:54 -04:00
Blast-MC
43c1dcb932 update upstream 2024-07-23 22:01:33 -04:00
Blast-MC
da7ff326fe 1.21 2024-06-23 20:12:32 -04:00
Blast-MC
4c2ae38401 1.20.6 2024-05-19 16:31:52 -04:00
Blast-MC
3a247683f1 fix server crash when respawning dragon 2024-02-08 20:21:07 -05:00
Blast-MC
e0e228c99c fix NPE of item in lava Cauldron 2024-02-08 17:58:05 -05:00
Blast-MC
d166d24ce4 add location to CustomBlockUpdateEvent 2024-02-08 17:57:34 -05:00
Blast-MC
31a0acb859 update upstream 2024-01-29 22:28:13 -05:00
Blast-MC
b7cfec3d53 Merge branch 'master' of github.com:ProjectEdenGG/Parchment
# Conflicts:
#	patches/server/0005-Add-origin-location-to-EntityDamageByBlockEvent.patch
2024-01-25 20:05:33 -05:00
Blast-MC
794a665f20 Fix ProjectEdenGG/Bugs#311 2024-01-25 20:04:14 -05:00
Blast-MC
046ba3260e update upstream, resolves javadoc issue 2024-01-25 20:03:31 -05:00
Griffin Kubesa
711c006e16 Merge pull request #6 from ProjectEdenGG/1.20.4
1.20.4
2024-01-21 09:14:10 -06:00
Blast-MC
39c6747e13 properly implement sidebar display values 2024-01-19 14:34:38 -05:00
Blast-MC
d204d8c9fe add sidebar utility 2024-01-15 20:55:09 -05:00
Blast-MC
4412e8b984 add CustomBlockUpdateEvent 2024-01-15 11:57:09 -05:00
Blast
358a8af2cd Update 0005-Add-origin-location-to-EntityDamageByBlockEvent.patch
Fix ProjectEdenGG/Bugs#304
2024-01-07 19:09:23 -05:00
Blast-MC
1bd783aeb1 temp remove javadoc jar as it's erroring 2023-12-15 23:46:50 -05:00
Blast-MC
999f43f448 Add block breaknaturally overload 2023-12-15 22:01:52 -05:00
Blast-MC
88ca112d35 1.20.4 2023-12-15 20:21:25 -05:00
GriffinCodes
127dae4f19 re-deploy 2023-11-13 00:33:03 -06:00
Lexi Larkin
71be6693a3 fix: bump version 2023-11-11 20:45:32 -05:00
Lexi Larkin
c7cfec78f4 feat: 1.20.2 2023-11-11 20:08:17 -05:00
Griffin Kubesa
6d85991c24 Merge pull request #5 from ProjectEdenGG/1.20.1 2023-08-07 20:48:30 -05:00
Lexi Larkin
58bfb886ca fix: exclude paper-api 2023-08-06 22:50:17 -04:00
Lexi Larkin
1f25e2f005 fix: remove nonfunctional attempt at fix 2023-08-06 22:39:37 -04:00
Lexi Larkin
3cc188ae47 fix: expose eden interfaces in API 2023-08-06 22:28:31 -04:00
Lexi Larkin
ce4157e318 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@40adc23 Fix incorrect javadoc in JarLibrary (#9513)
PaperMC/Paper@c016e03 Fix unbreakable flint and steel consumed when igniting creepers (#9509)
PaperMC/Paper@b1334b5 Mark Player.sendSignChange as deprecated (#9382)
PaperMC/Paper@2f8d9db Pathfinder hasPath should check if path is done. (#9231)
PaperMC/Paper@46a36d3 Make ExperienceOrb entities call EntitySpawnEvent (#9197)
PaperMC/Paper@24d690f Fix hopper not marking source inv as changed (#9070)
PaperMC/Paper@383f0ed Remove sign ticking (#9478)
PaperMC/Paper@d8b8f61 Configurable Region Compression Format (#8505)
PaperMC/Paper@2c54b39 Don't support hex in book title and author (#9493)
PaperMC/Paper@e19177a Rewrote Amethyst logic to throw both BlockGrowEvent and BlockSpreadEvent (#9217)
PaperMC/Paper@4283054 Add player whitelist events (#9209)
PaperMC/Paper@aa93dcf feat: add minimessage tag resolvers overload to CommandSender#sendMessage (#9505)
PaperMC/Paper@b14979e Remove isRemoved skip on .discard() (#9520)
PaperMC/Paper@1837f6c Prevent entity removals if the entity slices is receiving status updates
PaperMC/Paper@a40e48f Add cause to PlayerOpenSignEvent (#9441)
PaperMC/Paper@7d1cc6d Add Translatable interface to MusicInstrument (#9538)
PaperMC/Paper@6c7e3c5 Clarify viewers set mutability in chat events (#9525)
PaperMC/Paper@f402f89 Bump net.kyori.ansi to 1.0.2 (#9546)
PaperMC/Paper@81619a6 Fix treasure map config default (#9572)
PaperMC/Paper@13c9d3c Bump net.kyori:ansi to 1.0.3 (#9575)
PaperMC/Paper@2c55dd8 Expand use of strict advancement dim check (#9545)
PaperMC/Paper@69a8013 Fix inventorycloseevent javadocs (#9533)
PaperMC/Paper@2fa8efc Updated Upstream (Bukkit/CraftBukkit) (#9485)
PaperMC/Paper@508a295 Only erase allay memory on non-item targets (#9570)
PaperMC/Paper@31358d5 API for updating recipes on clients (#6463)
PaperMC/Paper@8fe8ca6 Add clickable version on version command (#9347)
PaperMC/Paper@d6d2b6f Only capture actual tree growth (#6464)
2023-08-06 21:36:15 -04:00
Lexi Larkin
4a430b2238 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@171ba7c Move Log4j plugins to own source set (#9428)
PaperMC/Paper@4356758 Call missing BlockDispenseEvents (#8518)
PaperMC/Paper@c0936a7 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9440)
PaperMC/Paper@12c9700 Fix ThrownEggHatchEvent#setHatching (#9448)
PaperMC/Paper@dadd8b5 Don't allow for supporting block checks to load chunks
PaperMC/Paper@48ea66e Optimize player lookups for beacons
PaperMC/Paper@d7d3f63 Use Nullable annotation for Entity source (#9435)
PaperMC/Paper@e105354 Fix incorrect new blockdata in EntityChangeBlockEvent (#9445)
PaperMC/Paper@5de0f8a Add Sign#getInteractableSideFor (#9388)
PaperMC/Paper@6b325cd Array backed synched entity data (#9460)
PaperMC/Paper@805fdd8 Add deprecations to SignSide string methods (#9467)
PaperMC/Paper@b3dc7a3 fix item meta for tadpole buckets (#9473)
PaperMC/Paper@f9473d9 Add gradle wrapper validation action
PaperMC/Paper@a3c760e Handle block state in EntityDamageByBlockEvent (#9396)
PaperMC/Paper@a60eeb8 Fix mob breaking doors not spawning particles (#9443)
PaperMC/Paper@1f8ca77 Prevent desync for poi and pistons (#9270)
PaperMC/Paper@92bc19b Fix missing item interaction cancelling case (#9427)
PaperMC/Paper@836586d Fix missing item types in SlotType for armor change event (#9379)
PaperMC/Paper@ece4fd3 Suppress Item Meta Validation Checks (#9331)
PaperMC/Paper@aefb73c Add Owner UUID api for AreaEffectCloud (#9364)
PaperMC/Paper@22ed60c Fix BanList API (#9450)
PaperMC/Paper@de3f149 Fix possible NPE on painting creation (#9391)
PaperMC/Paper@fe780d0 Add back accidentally dropped Wandering Trader patch (#9492)
PaperMC/Paper@b533905 fix 2 vanilla issues (#8940)
PaperMC/Paper@c793bd9 Allow LEFT_CLICK_AIR in 3.0->4.5 range of entity (#9211)
2023-07-17 14:01:20 -04:00
Lexi Larkin
e9072bd3a6 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f2c1e13 Fix default permission for xp command (#9419)
PaperMC/Paper@e16fefb add 'accepted' to Done project category (#9429)
2023-07-01 15:29:17 -04:00
Lexi Larkin
b3f2c79d02 feat: shade eden-interfaces 2023-07-01 15:16:43 -04:00
Lexi Larkin
86a21a089b feat: update upstream 2023-06-30 15:19:06 -04:00
Lexi Larkin
17e63ac792 feat: 1.20.1 2023-06-30 14:54:32 -04:00
Blast-Mc
3edba7dac4 Update upstream 2023-03-28 01:13:09 -04:00
Blast-Mc
402652c29d Fix PreEntityShootBowEvent Defaults 2023-03-27 00:31:31 -04:00
Blast-Mc
7a0b6cc24f Merge branch '1.19.4' 2023-03-23 18:31:44 -04:00
Blast-Mc
3397936ab4 Expose SynchedEntityData method 2023-03-23 18:27:44 -04:00
Griffin Kubesa
8f27eca2e3 Merge pull request #4 from ProjectEdenGG/1.19.4 2023-03-21 23:31:56 -05:00
Blast-Mc
0bbed6029c Fix PreEntityShootBowEvent 2023-03-21 00:21:30 -04:00
Blast-Mc
883620f828 Remove plugin dependency change 2023-03-21 00:21:21 -04:00
Blast-Mc
61a11d791c Return displays in getTargetEntity 2023-03-19 20:11:35 -04:00
Blast-Mc
f8028c508e Update upstream 2023-03-19 18:01:04 -04:00
Blast-Mc
7646770baa Add PreEntityShootBowEvent 2023-03-16 23:20:20 -04:00
Blast-Mc
d3a3626a73 Update to 1.19.4 2023-03-16 22:26:09 -04:00
Blast-Mc
85a2184a1c Revert BungeeChat Deprecation 2023-03-15 01:42:00 -04:00
Blast-Mc
f3b4987f33 Misc Updates to 1.19.3 2023-03-01 22:06:35 -05:00
Blast-Mc
89bda77d56 Remove Hanging Entity Debug 2023-03-01 22:06:24 -05:00
Blast-Mc
94524aebdb Update to 1.19.3 2023-01-09 19:21:21 -05:00
Lexi
911d1d646d bump workflow versions
quells some warnings about soon-to-be-deprecated features
2022-12-06 20:16:19 -05:00
Lexi
c42623daa1 Update README.md 2022-12-06 18:26:23 -05:00
Lexi Larkin
930b419022 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@bd496d0 [ci skip] shuffle patches and rebuild
PaperMC/Paper@79f2aa3 Update Velocity natives (#8387)
PaperMC/Paper@21661a7 Fix jigsaw block kicking user (#8404)
PaperMC/Paper@017af78 [ci skip] Added the missing "d" character (#8267)
PaperMC/Paper@8a7dd61 Mark parsed PoiChunks with data as not loaded (#8405)
PaperMC/Paper@7d3a882 Do not log throwable for duplicate entity adds
PaperMC/Paper@8d69cfc Reduce allocation rate for checkBlock
PaperMC/Paper@c6d7375 use BlockFormEvent for mud converting into clay (#8398)
PaperMC/Paper@14c32bc Fix wrong yaw and pitch of CommandSourceStack#getBukkitLocation (#8411)
PaperMC/Paper@f5fa691 Don't print full packages in new chunk system classes
PaperMC/Paper@2534e5c Fix other jigsaw related disconnect bug (#8414)
PaperMC/Paper@e9618f8 Add system property to dump stack on bad plugin class access (#8417)
PaperMC/Paper@6d14093 Add getDrops to BlockState and isPreferredTool to BlockData (#8284)
PaperMC/Paper@ec76e36 Fix a handful of vanilla bugs (#8187)
PaperMC/Paper@ec3cfa9 Only create paper.yml-README.txt on config conversion (#8334)
PaperMC/Paper@928bcc8 Updated Upstream (Bukkit/CraftBukkit) (#8430)
PaperMC/Paper@616db71 Fix nothing mlg (#8432)
PaperMC/Paper@011caa4 [ci skip] Minor patch cleanup
PaperMC/Paper@15e1748 Avoid resizing of ArrayList in ChunkMap#getPlayers (#8416)
PaperMC/Paper@ad3d357 Remove unnecessary onTrackingStart during nav warning
PaperMC/Paper@9d63b07 Fix custom piglin interest items (#8097)
PaperMC/Paper@ff67f1f EntityPickupItemEvent fixes (#8096)
PaperMC/Paper@bcb4220 Correctly handle interactions with items on cooldown (#8008)
PaperMC/Paper@60c973e Exempt players in creative/spectator from nether ceiling damage (#8427)
PaperMC/Paper@77a50b9 Add Unmodifiable annotations to getDrops methods (#8440)
PaperMC/Paper@c389b1c Fix configs that relied on outdated min/max y levels (#6986)
PaperMC/Paper@57555b8 Add missing structure set seed configs (#8030)
PaperMC/Paper@b097a24 Expose isUnderWater to Entity (#8454)
PaperMC/Paper@6b26cfc Add missing Entity + Projectile API (#7632)
PaperMC/Paper@de2d2d4 Add PlayerInventorySlotChangeEvent (#7321)
PaperMC/Paper@f7c8d79 Fix stacktrace in server tests
PaperMC/Paper@b9cf1ac Fix a classloading issue in tests (#8459)
PaperMC/Paper@7fe34e9 Make CraftMinecartTNT public
PaperMC/Paper@514a606 Elder Guardian appearance API (#8455)
PaperMC/Paper@2094011 Update settings directory path in exceptions (#7968)
PaperMC/Paper@0bdf997 Avoid cycle deprecation (#8466)
PaperMC/Paper@eb68bd4 Allow changing bed's 'occupied' property (#8458)
PaperMC/Paper@b560034 Avoid usages of RecipeChoice#getItemStack() (#8453)
PaperMC/Paper@603df98 FIx bedrock patterns (#8474)
PaperMC/Paper@ec00f99 Fix package for PlayerInventorySlotChangeEvent (#8475)
PaperMC/Paper@236a296 Add LivingEntity#swingHand(EquipmentSlot) convenience method (#8456)
PaperMC/Paper@7d64d7c Add converted Slot number to PlayerInventorySlotChangeEvent (#8482)
PaperMC/Paper@ed2c88b Add LivingEntity knockback API (#8479)
PaperMC/Paper@e1d4b26 Fix another case of missing chat headers
PaperMC/Paper@f7da209 Fix inconsistent isChunkLoaded calls
PaperMC/Paper@3dcfec4 Add stacktrace deobfuscation in more places (#8484)
PaperMC/Paper@eb49418 [ci skip] Update workflow dependencies (#8489)
PaperMC/Paper@a163a96 Load Allay duplication cooldown as a long (#8410)
PaperMC/Paper@7187cab Detect headless JREs (#8491)
PaperMC/Paper@60da35e fixed entity vehicle collision event not called (#5053)
PaperMC/Paper@5cdb5f9 Optimized dirt and snow spreading (#5124)
PaperMC/Paper@3d50709 Add MaterialTags for the different Types of Tools (#8049)
PaperMC/Paper@6ea5aa3 Added EntityToggleSitEvent (#7579)
PaperMC/Paper@58483c1 Add fire-tick-delay option (#8037)
PaperMC/Paper@4e67c73 Add config setting for grindstone overstacking (#8156)
PaperMC/Paper@d713b47 Add EquipmentSlot convenience methods (#8477)
PaperMC/Paper@6665076 Add Moving Piston API (#7019)
PaperMC/Paper@0b8f40c Don't fire EntityToggleSitEvent on deserialization & reorder some api patches (#8495)
PaperMC/Paper@05bd9d6 Ignore impossible spawn tick (#8493)
PaperMC/Paper@b8131a0 Mark chunks as saved after saving them
PaperMC/Paper@44ce9b3 Updated Upstream (Bukkit/Spigot) (#8445)
PaperMC/Paper@1c1aeb2 Only limit global sounds to same world if limiting radius (#8499)
PaperMC/Paper@519cb4b Move classes added to net.minecraft.server to paper packages (#8500)
PaperMC/Paper@fc5ae5b Fix incorrect handling of mustNotSave
PaperMC/Paper@25cd3ee Add dirty flag to chunk tick lists
PaperMC/Paper@7b3b593 [ci skip] Update checkout action in workflow (#8510)
PaperMC/Paper@36869cc Fix new block data in EntityChangeBlockEvent for silverfish when mobGriefing isn't enabled (#8099)
PaperMC/Paper@2432233 Add allow server listing & text filtering client options (#7595)
PaperMC/Paper@954e6f0 Fix a bunch more forceDrops for dropping items (#8095)
PaperMC/Paper@32d95e9 Track projectile source for fireworks from dispensers (#8044)
PaperMC/Paper@0249750 Fix EntityArgument suggestion permissions to align with  EntitySelector#checkPermissions (#8511)
PaperMC/Paper@8acb05d Make CommandSyntaxException implement ComponentMessageThrowable (#8513)
PaperMC/Paper@c264018 [ci skip] Undo modification to removed patches in latest commit (#8512)
PaperMC/Paper@304ab35 [ci skip] Remove old todo file
PaperMC/Paper@8a4b752 Fix wrong descriptor in ASMEventExecutorGenerator (#8506)
PaperMC/Paper@b743144 Fix MC-147659 (#8423)
PaperMC/Paper@aaf5e39 Deprecate unused VehicleEntityCollisionEvent methods (#8498)
PaperMC/Paper@13cf546 Fix pumpkin growth modifier (#8517)
PaperMC/Paper@b3b04f2 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8515)
PaperMC/Paper@93b2246 Fix EntityCombustEvent cancellation issues (#8529)
PaperMC/Paper@4a9c9b3 Build updates
PaperMC/Paper@e30b082 Fix setting difficulity inside of API (Fixes #8533)
PaperMC/Paper@ebc0f6b Call PlayerLaunchProjectileEvent for trident (#8027)
PaperMC/Paper@ab1c072 Remove old redundant fix (#8530)
PaperMC/Paper@8ee344f [ci-skip] Rename Paper stop tp Paper end. (#8539)
PaperMC/Paper@3d15120 Fix Advancement#getDisplay() api break (#8541)
PaperMC/Paper@2b47227 Update Commodore modifications (#8542)
PaperMC/Paper@df5fb94 Properly resend entities (#7041)
PaperMC/Paper@3e9f39f Prevent compass from loading chunks
PaperMC/Paper@3ac1a8d Cleanup misc import from last commit
PaperMC/Paper@e6ee4cd Updated Upstream (CraftBukkit) (#8548)
PaperMC/Paper@117579c Add PrePlayerAttackEntityEvent (#8369)
PaperMC/Paper@112fa18 Show exception when headless JRE detection is triggered (#8559)
PaperMC/Paper@5f4952f Cleanup reputation API + back with an EnumMap instead of array (#8258)
PaperMC/Paper@564356d ensure reset EnderDragon boss event name (#8562)
PaperMC/Paper@7955bcc fix MC-252817 (green map markers do not dissappear) (#8545)
PaperMC/Paper@e22dacf update yarn param mappings (#8563)
PaperMC/Paper@2151112 Fix/improve Affects Spawning API (#7329)
PaperMC/Paper@84b5d4a Reorder bukkit damage source entity for explosion (#8553)
PaperMC/Paper@b4c1ae6 Fix MC-121048 (#8429)
PaperMC/Paper@825cb43 [ci skip] Add .fleet/ folder to .gitignore (#8574)
PaperMC/Paper@669fed4 Fix MC-179072 (#8421)
PaperMC/Paper@8f498dc Sync chunk load command improvements (#8554)
PaperMC/Paper@3299886 [ci skip] Add TheFruxz to the license MIT list (#8575)
PaperMC/Paper@0a6f100 Add more collision code skipping logic (#7581)
PaperMC/Paper@76503f8 Strip coordinates from lodestone compasses (#8561)
PaperMC/Paper@b95d4b2 Moving ATs from the at file to individual patches (#8573)
PaperMC/Paper@4a3ae59 [ci skip] Add check for git repo (#8578)
PaperMC/Paper@a7df847 Add Player Warden Warning API (#8470)
PaperMC/Paper@3ab194e Avoid a cubed max search distance for POIs (#8576)
PaperMC/Paper@55a16d8 Fix Varint21FrameDecoder cached length buf usage
PaperMC/Paper@e6e37ba Add api to resolve components (#7648)
PaperMC/Paper@7168438 [ci skip] Rework workflows to support optional paperclip build (#8583)
PaperMC/Paper@da230d5 More vanilla friendly methods to update trades (#8478)
PaperMC/Paper@8aff07a Add /paper dumplisteners command (#8507)
PaperMC/Paper@b8919a7 pr command action fixes (#8591)
PaperMC/Paper@185fa48 Fix chest relooting mechanics (#8580)
PaperMC/Paper@b4beac0 Fixes potential issues arising from optimizing getPlayerByUUID (#8585)
PaperMC/Paper@f637b1a Fix async entity add due to fungus trees (#7626)
PaperMC/Paper@414ea80 ItemStack damage API (#7801)
PaperMC/Paper@d98c370 Add displayName methods for advancements (#8584)
PaperMC/Paper@44bb599 Add Tick TemporalUnit (#5445)
PaperMC/Paper@9f7eef8 Friction API (#6611)
PaperMC/Paper@4048d3e Allow using degrees for ArmorStand rotations (#7847)
PaperMC/Paper@f59c802 Schoolable Fish API (#7089)
PaperMC/Paper@21b964a Added ability to control player's insomnia and phantoms spawning (#6500)
PaperMC/Paper@f1583fc Add `/paper dumplisteners tofile` and increase detail of command output (#8592)
PaperMC/Paper@28b4027 Fix packet duplicating at some points (#8566)
PaperMC/Paper@309133e Fix preemptive connection dropping during shutdown process (#8546)
PaperMC/Paper@8796175 Handle legacy quirk in the console formatter (#8434)
PaperMC/Paper@54daefa Fix whitespace error in recent patch
PaperMC/Paper@41ab602 [ci skip] couple more fixes for build pr jar label (#8599)
PaperMC/Paper@c40f8d5 Sync offhand slot in menus (#7341)
PaperMC/Paper@425baed Fully deserialise persistent anger post async load (#8560)
PaperMC/Paper@ec6a9a3 Updated Upstream (Bukkit/CraftBukkit) (#8604)
PaperMC/Paper@96fdafd Player Entity Tracking Events (#4722)
PaperMC/Paper@407a445 Fix dumplisteners missing folder creation
PaperMC/Paper@b07d5e0 Limit pet look distance (#8612)
PaperMC/Paper@476ef25 Add missing Fluid type (#8608)
2022-12-06 16:54:38 -05:00
Lexi Larkin
89706bedbd Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@b58c0cf Update snekyaml
PaperMC/Paper@f7d16f6 Fixes a couple issues with entity spawn reasons (#8390)
PaperMC/Paper@1bbd273 Fix user auth thread pool queue
2022-09-27 13:49:24 -04:00
Lexi Larkin
cc60bfd0f8 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@0bf8790 Fix client lag spikes due to client light recalc
PaperMC/Paper@aabf676 Prevent unloading worlds with pending player logins
PaperMC/Paper@eff22eb Ensure players are removed from pendingLogin
PaperMC/Paper@046466f Re-arrange most chunk system patches to front (#8338)
PaperMC/Paper@e8c2c3b Fix World#refreshChunk not working for chunks in no-tick range
PaperMC/Paper@09904fd Re-add legacy getChunkAtAsynchronously to ChunkProviderServer
PaperMC/Paper@36a5f15 Allow preventing BlockDestroyEvent from dropping items (#8349)
PaperMC/Paper@e51401e Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8347)
PaperMC/Paper@51183af Fix console completer/highlighter having invalid source stack (#8346)
PaperMC/Paper@ef0e5a6 Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@178f035 Restore no-crash behaviour when read-only config file(s) (#8318)
PaperMC/Paper@267dd18 Stop large look changes from crashing the server (#8326)
PaperMC/Paper@36f0c1b Rebuild patches
PaperMC/Paper@751d092 Properly close section storage managed files (#8364)
PaperMC/Paper@f5f84ff Add custom destroyerIdentity parameter to the sendBlockBreak function (#5840)
PaperMC/Paper@05f6a5c Limit size of Authenticator Cache Thread Pool (#8360)
PaperMC/Paper@ef670eb EndDragonFight killed statuses should be false for newly created worlds (#8354)
PaperMC/Paper@b826065 fire EntityChangeBlockEvent in more places (#6371)
PaperMC/Paper@34777cd Missing eating regain reason (#8244)
PaperMC/Paper@dbda887 Missing some effect cause (#8307)
PaperMC/Paper@63cb747 Added byte array serialization/deserialization for PersistentDataContainers (#7505)
PaperMC/Paper@ea777c3 Add a consumer parameter to ProjectileSource#launchProjectile (#8374)
PaperMC/Paper@470c638 Configurable chat thread limit (#7878)
PaperMC/Paper@dbc2d60 Make WorldCreator#keepSpawnLoaded return the WorldCreator (Fixes #8321) (#8371)
PaperMC/Paper@f8742e2 Also load resources from LibraryLoader (#8335)
PaperMC/Paper@f7e6809 Fix Pathfinding After World Has Changed (#8068)
PaperMC/Paper@ad3dffe Respect preventMovingIntoUnloadedChunks for optimized collision checking (#8259)
PaperMC/Paper@8db45c4 Copper clear on lightning strike calls EntityChangeBlockEvent (#8126)
PaperMC/Paper@9e614e6 Fix ground pathfinding (#7683)
PaperMC/Paper@339e85d Updated Upstream (CraftBukkit) (#8376)
PaperMC/Paper@980c1d1 Updated Upstream (Bukkit/CraftBukkit) (#8378)
PaperMC/Paper@8681503 Call EntityChangeBlockEvent for frogs egg (#8136)
PaperMC/Paper@ec0c550 Call BlockPhysicsEvent more often (#8264)
PaperMC/Paper@f528f53 Correct javadocs on PlayerArmorStandManipulateEvent (#7719)
PaperMC/Paper@3996e6e Updated Upstream (Bukkit/CraftBukkit/Spigot)
PaperMC/Paper@d332623 Avoid potential place where the world map could be modified after its iterator is created (#8315)
PaperMC/Paper@6736f39 Fix mangled patch
PaperMC/Paper@4d52f1d Add method isTickingWorlds to Bukkit (#8316)
PaperMC/Paper@62680d5 Avoid item meta usage for itemstack enchantment getter (#8373)
PaperMC/Paper@b4c025b Fix player desync on dimension change (#8253)
PaperMC/Paper@6d63005 Fix setEggCount method from TurtleLayEggEvent (#8385)
PaperMC/Paper@abe53a7 Fix typos in isTickingWorlds API javadocs (#8382)
PaperMC/Paper@01a1387 Rewrite chunk system (#8177)
PaperMC/Paper@b58c0cf Update snekyaml
2022-09-26 19:36:07 -04:00
Blast-Mc
5257504f67 make fixlight less spammy 2022-08-26 12:18:53 -04:00
Blast-Mc
1b8ef457d3 disable set spawn message 2022-08-25 20:19:33 -04:00
GriffinCodes
485a8e8a0e Rebuild patches, oops 2022-08-20 22:29:11 -05:00
GriffinCodes
af6a52c4d5 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@e6f8284 Updated Upstream (Bukkit/CraftBukkit) (#8270)
PaperMC/Paper@22ad9ee Fix command pool submitting on shutdown (#8272)
PaperMC/Paper@954b3fb Send signature headers when chat event viewers are modified
PaperMC/Paper@2cab696 Don't manually send ClientboundPlayerPositionPacket for refreshPlayer
PaperMC/Paper@2a74071 Simple patch changes for chunk system
PaperMC/Paper@7e11afa Fix mad cursor addition via API (#8276)
PaperMC/Paper@3f0415b Use thread safe Random inside of ServerLoginPacketListenerImpl
PaperMC/Paper@0ddd20c Updated Upstream (CraftBukkit/Spigot)
PaperMC/Paper@9592da1 Add method to get highest anger level of warden
PaperMC/Paper@db17048 [ci skip] Show @org.bukkit.UndefinedNullability in javadocs (#8291)
PaperMC/Paper@5bf2591 Add NamespacedKey biome methods
PaperMC/Paper@4516aed More ThrownPotion API
PaperMC/Paper@4ba43fe Grant temporary immunity to hopper minecarts while actively pulling (fixes #8281) (#8282)
PaperMC/Paper@2da891f Updated Upstream (Bukkit/CraftBukkit)
PaperMC/Paper@a76998d Fix plugin loggers on shutdown (#5592)
2022-08-20 22:28:44 -05:00
Lexi
04f19fbafd Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a15152e Allow old behavior for CommandRegisteredEvent (#8249)
PaperMC/Paper@0118c0b Improve MojangAPI docs and replace @Deprecated with @ApiStatus.Experimental on draft APIs (#8261)
PaperMC/Paper@3624637 Improve documentation of Inventory#removeItem (#8263)
PaperMC/Paper@a47301e Fix Player#chat kicking all clients (#8262)
PaperMC/Paper@78b19f8 Separate Command Sending to Separate Thread Pool (#8170)
PaperMC/Paper@c7e118b Update modern forwarding to v3 (#8219)
2022-08-08 13:55:24 -04:00
Griffin Kubesa
2845ad0a3d Merge pull request #3 from ProjectEdenGG/1.19.2 2022-08-06 15:32:42 -05:00
GriffinCodes
07bbff7701 Update to 1.19.2 2022-08-06 10:21:53 -05:00
Blast-MC
554a39b225 Add NPC to EntityType 2022-08-05 19:11:12 -04:00
66 changed files with 2857 additions and 2622 deletions

View File

@@ -9,20 +9,20 @@ jobs:
strategy: strategy:
matrix: matrix:
java: [17] java: [21]
fail-fast: true fail-fast: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }} - name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
distribution: 'adopt' distribution: 'adopt'
- name: Cache gradle - name: Cache gradle
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.gradle/caches ~/.gradle/caches
@@ -39,7 +39,7 @@ jobs:
./gradlew applyPatches ./gradlew applyPatches
./gradlew createReobfPaperclipJar ./gradlew createReobfPaperclipJar
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: Parchment-PR${{ github.event.pull_request.number }}-JDK${{ matrix.java }} name: Parchment-PR${{ github.event.pull_request.number }}-JDK${{ matrix.java }}
path: build/libs/parchment-paperclip-*-reobf.jar path: build/libs/parchment-paperclip-*-reobf.jar

View File

@@ -9,20 +9,20 @@ jobs:
strategy: strategy:
matrix: matrix:
java: [17] java: [21]
fail-fast: true fail-fast: true
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }} - name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
distribution: 'adopt' distribution: 'adopt'
- name: Cache gradle - name: Cache gradle
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.gradle/caches ~/.gradle/caches
@@ -40,11 +40,11 @@ jobs:
git config --global user.email "no-reply@github.com" git config --global user.email "no-reply@github.com"
git config --global user.name "GitHub Actions" git config --global user.name "GitHub Actions"
./gradlew applyPatches ./gradlew applyPatches
./gradlew createReobfPaperclipJar ./gradlew createMojmapPaperclipJar
./gradlew :parchment-api:publishMavenPublicationToEdenSnapshotsRepository ./gradlew :parchment-api:publishMavenPublicationToEdenSnapshotsRepository
./gradlew publishDevBundlePublicationToEdenSnapshotsRepository -PpublishDevBundle ./gradlew publishDevBundlePublicationToEdenSnapshotsRepository -PpublishDevBundle
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: Parchment-JDK${{ matrix.java }} name: Parchment-JDK${{ matrix.java }}
path: build/libs/parchment-paperclip-*-reobf.jar path: build/libs/parchment-paperclip-*-mojmap.jar

2
.gitignore vendored
View File

@@ -49,6 +49,7 @@ run/
/parchment-server/ /parchment-server/
/Parchment-API/ /Parchment-API/
/parchment-api/ /parchment-api/
/paper-api-generator/
# Compiled class file # Compiled class file
*.class *.class
@@ -74,4 +75,3 @@ run/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid* hs_err_pid*

View File

@@ -8,21 +8,21 @@ It contains changes to the API to make development of our plugin [Nexus](https:/
Requirements: Requirements:
- You need `git` installed, with a configured username and email. - You need `git` installed, with a configured username and email.
On Windows you need to run from git bash. On Windows you need to run from git bash.
- You need `jdk` 16+ installed to compile (and `jre` 16+ to run). - You need `jdk` 17+ installed to compile (and `jre` 17+ to run).
If all you want is a paperclip server jar, just run `./gradlew paperclipJar`. If all you want is a paperclip server jar, just run `./gradlew createReobfPaperclipJar`.
Otherwise, to setup the `Parchment-API` and `Parchment-Server` repo, just run Otherwise, to setup the `parchment-api` and `parchment-server` repos, just run
`./gradlew applyPatches` in your project root. Afterwards you can run `./gradlew build` `./gradlew applyPatches` in your project root. Afterwards you can run `./gradlew build`
to build the respective API and server jars. to build the respective API and server jars.
`./gradlew applyPatches` should initialize the repo such that you can now start modifying and `./gradlew applyPatches` should initialize the repo such that you can now start modifying and
creating patches. The folder `Parchment-API` is the API repository and the `Parchment-Server` creating patches. The folder `parchment-api` is the API repository and the `parchment-server`
folder is the server repository. These contain the source files you will modify. folder is the server repository. These contain the source files you will modify.
### Creating a patch ### Creating a patch
Patches are effectively just commits in either `Parchment-API` or `Parchment-Server`. Patches are effectively just commits in either `parchment-api` or `parchment-server`.
To create one, just add a commit to either repo and run `./gradlew rebuildPatches` and a To create one, just add a commit to either repo and run `./gradlew rebuildPatches` and a
patch will be placed in the patches folder. Modifying commits will also modify its patch will be placed in the patches folder. Modifying commits will also modify its
corresponding patch file. corresponding patch file.
@@ -30,4 +30,4 @@ corresponding patch file.
## License ## License
The fork is based off of [paperweight-examples](https://github.com/PaperMC/paperweight-examples). The fork is based off of [paperweight-examples](https://github.com/PaperMC/paperweight-examples).
See its project page for the license of material used/modified by this project. See its project page for the license of material used/modified by this project.

View File

@@ -0,0 +1,10 @@
# You can use this file to import files from minecraft libraries into the project
# format:
# <artifactId> <fileName>
# both fully qualified and a file based syntax are accepted for <fileName>:
# authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
# datafixerupper com.mojang.datafixers.DataFixerBuilder
# datafixerupper com/mojang/datafixers/util/Either.java
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java

View File

@@ -1,4 +0,0 @@
# You can use this file to import files from vanilla into the project
# both fully qualified and a file based syntax are accepted here:
# net.minecraft.world.level.entity.LevelEntityGetterAdapter
# net/minecraft/world/level/entity/LevelEntityGetter.java

View File

@@ -3,21 +3,21 @@ import io.papermc.paperweight.util.constants.*
plugins { plugins {
java java
`maven-publish` `maven-publish`
id("com.github.johnrengelman.shadow") version "7.1.2" apply false id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.3.8" id("io.papermc.paperweight.patcher") version "1.7.1"
} }
repositories { repositories {
mavenCentral() mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/") { maven("https://repo.papermc.io/repository/maven-public/") {
content { onlyForConfigurations(PAPERCLIP_CONFIG) } content { onlyForConfigurations(PAPERCLIP_CONFIG) }
} }
} }
dependencies { dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.2:fat") remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("net.minecraftforge:forgeflower:1.5.605.7") decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.2") paperclip("io.papermc:paperclip:3.0.3")
} }
allprojects { allprojects {
@@ -26,7 +26,7 @@ allprojects {
java { java {
toolchain { toolchain {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(21))
} }
} }
} }
@@ -34,7 +34,7 @@ allprojects {
subprojects { subprojects {
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(17) options.release.set(21)
} }
tasks.withType<Javadoc> { tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
@@ -45,13 +45,9 @@ subprojects {
repositories { repositories {
mavenCentral() mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/") maven("https://repo.papermc.io/repository/maven-public/")
maven("https://sonatype.projecteden.gg/repository/maven-public/") maven("https://sonatype.projecteden.gg/repository/maven-public/")
} }
dependencies {
implementation("gg.projecteden:eden-interfaces:2.1.0-SNAPSHOT")
}
} }
paperweight { paperweight {
@@ -68,6 +64,15 @@ paperweight {
serverPatchDir.set(layout.projectDirectory.dir("patches/server")) serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("parchment-server")) serverOutputDir.set(layout.projectDirectory.dir("parchment-server"))
} }
patchTasks {
register("generatedApi") {
isBareDirectory.set(true)
upstreamDirPath.set("paper-api-generator/generated")
patchDir.set(layout.projectDirectory.dir("patches/generatedApi"))
outputDir.set(layout.projectDirectory.dir("paper-api-generator/generated"))
}
}
} }
} }
@@ -77,12 +82,11 @@ paperweight {
tasks.generateDevelopmentBundle { tasks.generateDevelopmentBundle {
apiCoordinates.set("gg.projecteden.parchment:parchment-api") apiCoordinates.set("gg.projecteden.parchment:parchment-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.set( libraryRepositories.set(
listOf( listOf(
"https://repo.maven.apache.org/maven2/", "https://repo.maven.apache.org/maven2/",
"https://libraries.minecraft.net/", "https://libraries.minecraft.net/",
"https://papermc.io/repo/repository/maven-public/", "https://repo.papermc.io/repository/maven-public/",
"https://maven.quiltmc.org/repository/release/", "https://maven.quiltmc.org/repository/release/",
"https://sonatype.projecteden.gg/repository/maven-public/" "https://sonatype.projecteden.gg/repository/maven-public/"
) )

View File

@@ -1,9 +1,14 @@
group = gg.projecteden.parchment group = gg.projecteden.parchment
version = 1.19.1-R0.1-SNAPSHOT version = 1.21.1-R0.1-SNAPSHOT
mcVersion = 1.19.1 mcVersion = 1.21.1
paperRef = 532dc51d5f4deb036474e8d5921275f937e4c4ac paperRef = f97aff74b6f7fd4940c0c0b6cca3f8ac6e1afdef
edenVersion = 2.2.8-SNAPSHOT
updatingMinecraft=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.vfs.watch=false org.gradle.vfs.watch=false
org.gradle.warning.mode=none
org.gradle.jvmargs=-Xmx4G

Binary file not shown.

View File

@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

288
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -17,67 +17,98 @@
# #
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -87,9 +118,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -98,7 +129,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
@@ -106,80 +137,109 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

15
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lexi Larkin <lexi@qixils.dev>
Date: Sun, 6 Aug 2023 22:01:19 -0400
Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts
index fd39ed209b20c927054b8482c400beeeeab460a3..f7786d4034afae1926bb249e282f3f204e09ba1a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -14,6 +14,9 @@ val bungeeCordChatVersion = "1.20-R0.2"
val adventureVersion = "4.17.0"
val slf4jVersion = "2.0.9"
val log4jVersion = "2.17.1"
+
+val edenVersion: String by project // Parchment
+
val apiAndDocs: Configuration by configurations.creating {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@@ -27,6 +30,7 @@ configurations.api {
}
dependencies {
+ api("gg.projecteden:eden-interfaces:$edenVersion") // Parchment
api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api
// api dependencies are listed transitively to API consumers
api("com.google.guava:guava:32.1.2-jre")

View File

@@ -8,97 +8,94 @@ Creates new interfaces for objects that have a reference to a player, offlinepla
Also creates interfaces for objects that are like players in that they use all other interfaces and can receive Adventure messages. Also creates interfaces for objects that are like players in that they use all other interfaces and can receive Adventure messages.
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
index 978813b94a5eae0afccbd3b38b463091a46b56ac..617a4b17982e3dac47480cb16046233232f288b7 100644 index 7270c1feece2dc15a4a0503c4bca93a1288f8f13..a941a1e1a9e0c5047ad9f7976e65338ac3f87f68 100644
--- a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java --- a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; @@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Called when a beacon effect is being applied to a player. * Called when a beacon effect is being applied to a player.
*/ */
-public class BeaconEffectEvent extends BlockEvent implements Cancellable { -public class BeaconEffectEvent extends BlockEvent implements Cancellable {
+public class BeaconEffectEvent extends BlockEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment +public class BeaconEffectEvent extends BlockEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment
private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private static final HandlerList HANDLER_LIST = new HandlerList();
private PotionEffect effect;
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
index f530a3d9314e17d1da896cac633f6a422258d9a9..08897d13a8af33ed1cd40c46b0f168e0c4ebfd4a 100644 index ae34e679723a2ef436da04c116038272743a8f35..420842d6882c37c64e0f2e9fd41ba9b289fe7690 100644
--- a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java --- a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.NotNull; @@ -37,7 +37,7 @@ import org.jetbrains.annotations.NotNull;
* Starts off cancelled if the player is wearing a pumpkin head or is not looking
* at the Enderman, according to Vanilla rules. * at the Enderman, according to Vanilla rules.
*
*/ */
-public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable { -public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable {
+public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment +public class EndermanAttackPlayerEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment
@NotNull private final Player player;
public EndermanAttackPlayerEvent(@NotNull Enderman entity, @NotNull Player player) { private static final HandlerList HANDLER_LIST = new HandlerList();
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
index a315c5185cd465dcf63c0ababef195da76dfc786..a65eae92b9f369f0864d872817d9ce96679256bc 100644 index 3029e406cd684efb5645e38711dff9c0bb7b01e4..7ce5cdb02c2b8dc46d01892f495bf06e59d11641 100644
--- a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java --- a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Fired when a Turtle lays eggs * Fired when a Turtle lays eggs
*/ */
-public class TurtleLayEggEvent extends EntityEvent implements Cancellable { -public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
+public class TurtleLayEggEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment +public class TurtleLayEggEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false; private static final HandlerList HANDLER_LIST = new HandlerList();
@NotNull
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
index abeb24fccda2acfdb0dfdadacb8fe688bd97cf78..890069604ca78a9a3f3b4c5f40969a451a1b2067 100644 index 7a2fa4a11b47e4982d1644830d7e28f12b4378ec..0cb8e6b174ab62899068ab2a0fcc9e63834e6efd 100644
--- a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java --- a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Fired when a Turtle starts digging to lay eggs * Fired when a Turtle starts digging to lay eggs
*/ */
-public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable { -public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment +public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false; private static final HandlerList HANDLER_LIST = new HandlerList();
@NotNull private final Location location;
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
index 59ae7bc3a0a2079fe4b3a92d777aca682a58e4e3..b0cc7665e6591c71b7cd4388d028a5f8abd65e64 100644 index 7c049bad187b94331f42f96833d1cf4ce03ef477..72c36b9ebd668750598a5bf1146fea8043126e05 100644
--- a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java --- a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
@@ -20,7 +20,7 @@ import java.util.UUID; @@ -21,7 +21,7 @@ import java.util.UUID;
* *
* <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p> * <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
*/ */
-public class PlayerHandshakeEvent extends Event implements Cancellable { -public class PlayerHandshakeEvent extends Event implements Cancellable {
+public class PlayerHandshakeEvent extends Event implements Cancellable, gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment +public class PlayerHandshakeEvent extends Event implements Cancellable, gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment
private static final HandlerList HANDLERS = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
@NotNull private final String originalHandshake;
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
index 4dcf6242c9acc62d030a94f67b78729ed29f8c85..33550df23fea251368b16dbebad27bdcb1de2e78 100644 index 3f73ec52f9b581001bef3a19a5f1533dfa474356..92a38938ab76d5ae873a1d82b8d53250912ced06 100644
--- a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java --- a/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/profile/PreLookupProfileEvent.java
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable; @@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
* No guarantees are made about thread execution context for this event. If you need to know, check * No guarantees are made about thread execution context for this event. If you need to know, check
* event.isAsync() * {@link Event#isAsynchronous()}
*/ */
-public class PreLookupProfileEvent extends Event { -public class PreLookupProfileEvent extends Event {
+public class PreLookupProfileEvent extends Event implements gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment +public class PreLookupProfileEvent extends Event implements gg.projecteden.api.interfaces.OptionalUniqueId { // Parchment
private static final HandlerList handlers = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
@NotNull private final String name;
@@ -49,11 +49,27 @@ public class PreLookupProfileEvent extends Event { @@ -52,11 +52,26 @@ public class PreLookupProfileEvent extends Event {
* {@link LookupProfileEvent}
* *
* @return The UUID of the profile if it has already been provided by a plugin * @return The UUID of the profile if it has already been provided by a plugin
+ * @deprecated alias of {@link #getUniqueId()} <!-- Parchment: fix inconsistent naming -->
*/ */
@Nullable
- public UUID getUUID() {
+ // Parchment start + // Parchment start
+ @Deprecated + @Deprecated
+ public final UUID getUUID() { @Nullable
+ return getUniqueId(); public UUID getUUID() {
+ } return this.uuid;
+ }
+ /** + /**
+ * If this value is left null by the completion of the event call, then the server will + * If this value is left null by the completion of the event call, then the server will
+ * trigger a call to the Mojang API to look up the UUID (Network Request), and subsequently, fire a + * trigger a call to the Mojang API to look up the UUID (Network Request), and subsequently, fire a
@@ -108,27 +105,28 @@ index 4dcf6242c9acc62d030a94f67b78729ed29f8c85..33550df23fea251368b16dbebad27bdc
+ */ + */
+ @Override + @Override
+ public @Nullable UUID getUniqueId() { + public @Nullable UUID getUniqueId() {
return uuid; + return uuid;
} + }
+ // Parchment end + // Parchment end
+
/** /**
* Sets the UUID for this player name. This will skip the initial API call to find the players UUID. * Sets the UUID for this player name. This will skip the initial API call to find the players UUID.
* <p>
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
index 9be64a95c2345433b6142d611077dedadcef9f5d..e3cea810881868fb5869de72f331733e6893fcee 100644 index 8965974988ad20fbe1d45885f20a3a98d2e9595f..a19e23e55737bdb7ee9909e02ca6414aaf66830f 100644
--- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java --- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
@@ -47,7 +47,7 @@ import org.jetbrains.annotations.Nullable; @@ -53,7 +53,7 @@ import org.jetbrains.annotations.Nullable;
* * <p>
* Only 1 process will be allowed to provide completions, the Async Event, or the standard process. * Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
*/ */
-public class AsyncTabCompleteEvent extends Event implements Cancellable { -public class AsyncTabCompleteEvent extends Event implements Cancellable {
+public class AsyncTabCompleteEvent extends Event implements Cancellable, gg.projecteden.parchment.OptionalLocation { // Parchment +public class AsyncTabCompleteEvent extends Event implements Cancellable, gg.projecteden.parchment.OptionalLocation { // Parchment
@NotNull private final CommandSender sender;
@NotNull private final String buffer; private static final HandlerList HANDLER_LIST = new HandlerList();
private final boolean isCommand;
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
index 89e132525cfae0ce979e37b3e2793df781e47227..f14635ae3112862c1337398bf5f5f56a7f87d90f 100644 index 2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a..640a01478be687b089aeddad422e4bba2bea19b6 100644
--- a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java --- a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java +++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
@@ -8,7 +8,7 @@ import static com.google.common.base.Preconditions.*; @@ -8,7 +8,7 @@ import static com.google.common.base.Preconditions.*;
@@ -263,10 +261,10 @@ index 0000000000000000000000000000000000000000..45410a77714ad28201520c188e280e4f
+} +}
diff --git a/src/main/java/gg/projecteden/parchment/OptionalLocation.java b/src/main/java/gg/projecteden/parchment/OptionalLocation.java diff --git a/src/main/java/gg/projecteden/parchment/OptionalLocation.java b/src/main/java/gg/projecteden/parchment/OptionalLocation.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..23897904c6e2d6195f3613c36d77454587afd8bc index 0000000000000000000000000000000000000000..305713e6095de2849a42ba1f4049b8715f1f907c
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/OptionalLocation.java +++ b/src/main/java/gg/projecteden/parchment/OptionalLocation.java
@@ -0,0 +1,18 @@ @@ -0,0 +1,17 @@
+package gg.projecteden.parchment; +package gg.projecteden.parchment;
+ +
+import org.bukkit.Location; +import org.bukkit.Location;
@@ -279,8 +277,7 @@ index 0000000000000000000000000000000000000000..23897904c6e2d6195f3613c36d774545
+@FunctionalInterface +@FunctionalInterface
+public interface OptionalLocation { +public interface OptionalLocation {
+ /** + /**
+ * Gets a {@link Location} attached to this object if present + * Gets a {@link Location} attached to this object if present *
+ *
+ * @return attached location + * @return attached location
+ */ + */
+ @Nullable Location getLocation(); + @Nullable Location getLocation();
@@ -401,47 +398,47 @@ index 0000000000000000000000000000000000000000..c70ddc6f92d62d2d5baa001c9009ddd3
+ } + }
+} +}
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
index 2c1cda1126e577a88f19071e958eddb5a38785af..39e746f0c8536642346abbb6909fd2053031d695 100644 index 3ddbc099a13df939b3912f30b54e7635840ba5a4..cf34f788b732037713d9a0ab29636de1820afd0a 100644
--- a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java --- a/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java +++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkLoadEvent.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; @@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
* Should only be used for packet/clientside related stuff. * Should only be used for packet/clientside related stuff.
* Not intended for modifying server side state. * Not intended for modifying server side state.
*/ */
-public class PlayerChunkLoadEvent extends ChunkEvent { -public class PlayerChunkLoadEvent extends ChunkEvent {
+public class PlayerChunkLoadEvent extends ChunkEvent implements gg.projecteden.parchment.HasPlayer { // Parchment +public class PlayerChunkLoadEvent extends ChunkEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
private static final HandlerList handlers = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
private final Player player;
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
index 12163a7b0591a7d022dc7eb9ee6608a1b6c39d9b..d81c7307127b135417e06a3b244416bee34b0abe 100644 index 2cac7e27991c04a9ced261f2dd8ad8657ccddf6b..2dc9666fac98e3ff8b569f9510fa0db3ba0eb681 100644
--- a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java --- a/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java +++ b/src/main/java/io/papermc/paper/event/packet/PlayerChunkUnloadEvent.java
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
* Should only be used for packet/clientside related stuff. * Should only be used for packet/clientside related stuff.
* Not intended for modifying server side. * Not intended for modifying server side.
*/ */
-public class PlayerChunkUnloadEvent extends ChunkEvent { -public class PlayerChunkUnloadEvent extends ChunkEvent {
+public class PlayerChunkUnloadEvent extends ChunkEvent implements gg.projecteden.parchment.HasPlayer { // Parchment +public class PlayerChunkUnloadEvent extends ChunkEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
private static final HandlerList handlers = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
private final Player player;
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index ef0cb00ca4cb7d2f5e4ec1c950cce036566d1ae4..df53183beb4c438ea3c821e1ffd8e2719c08f269 100644 index 65618b6b3c950fb27707f243a766511d6cd3aab4..cccf6f315e2aae9d67afe726c7bad4f619e47860 100644
--- a/src/main/java/org/bukkit/Location.java --- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java
@@ -30,7 +30,7 @@ import org.bukkit.entity.Player; @@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
* magnitude than 360 are valid, but may be normalized to any other equivalent * magnitude than 360 are valid, but may be normalized to any other equivalent
* representation by the implementation. * representation by the implementation.
*/ */
-public class Location implements Cloneable, ConfigurationSerializable { -public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
+public class Location implements Cloneable, ConfigurationSerializable, gg.projecteden.parchment.HasLocation { // Parchment +public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition, gg.projecteden.parchment.HasLocation { // Paper // Parchment
private Reference<World> world; private Reference<World> world;
private double x; private double x;
private double y; private double y;
@@ -72,6 +72,13 @@ public class Location implements Cloneable, ConfigurationSerializable { @@ -38,6 +38,13 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
this.yaw = yaw; private float pitch;
} private float yaw;
+ // Parchment start + // Parchment start
+ @Override + @Override
@@ -451,50 +448,43 @@ index ef0cb00ca4cb7d2f5e4ec1c950cce036566d1ae4..df53183beb4c438ea3c821e1ffd8e271
+ // Parchment end + // Parchment end
+ +
/** /**
* Sets the world that this location resides in * Constructs a new Location with the given coordinates
* *
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index a7d1f1e701f23e851f735584a30bedadb0d8b9bd..7b37b6f596b4ac6b8049c7bd195139ac03ba63bc 100644 index 3993fecec5b4c2bbd77e175a168afcad571ce4d1..f2a98e4e25262c452d20e27a9617bf7cfbee9e77 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java --- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -10,7 +10,7 @@ import org.bukkit.profile.PlayerProfile; @@ -19,7 +19,14 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull; * player that is stored on the disk and can, thus, be retrieved without the
import org.jetbrains.annotations.Nullable; * player needing to be online.
*/
-public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable { -public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable {
+public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, gg.projecteden.parchment.HasOfflinePlayer, gg.projecteden.parchment.OptionalPlayer { // Parchment +public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, gg.projecteden.parchment.HasOfflinePlayer, gg.projecteden.parchment.OptionalPlayer { // Parchment
+
/**
* Checks if this player is currently online
@@ -139,6 +139,13 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@Nullable
public Player getPlayer();
+ // Parchment start + // Parchment start
+ @Override + @Override
+ default @org.jetbrains.annotations.NotNull OfflinePlayer getOfflinePlayer() { + default @org.jetbrains.annotations.NotNull OfflinePlayer getOfflinePlayer() {
+ return this; + return this;
+ } + }
+ // Parchment end + // Parchment end
+
/** /**
* Gets the first date and time that this player was witnessed on this * Checks if this player is currently online
* server.
diff --git a/src/main/java/org/bukkit/Raid.java b/src/main/java/org/bukkit/Raid.java diff --git a/src/main/java/org/bukkit/Raid.java b/src/main/java/org/bukkit/Raid.java
index 983a8c20a06d2b509602b27f49c090598b8ecc42..46dd8496f5a2c792ee7811e33c424e88edf8b5b3 100644 index fa98599e3eee37bf68f0e9813497c718f457485c..7af5afbef7b1559221ab6c28131ae698aa8cec76 100644
--- a/src/main/java/org/bukkit/Raid.java --- a/src/main/java/org/bukkit/Raid.java
+++ b/src/main/java/org/bukkit/Raid.java +++ b/src/main/java/org/bukkit/Raid.java
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; @@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Represents a raid event. * Represents a raid event.
*/ */
-public interface Raid { -public interface Raid extends org.bukkit.persistence.PersistentDataHolder { // Paper
+public interface Raid extends gg.projecteden.parchment.HasLocation { // Parchment +public interface Raid extends org.bukkit.persistence.PersistentDataHolder, gg.projecteden.parchment.HasLocation { // Paper // Parchment
/** /**
* Get whether this raid started. * Get whether this raid started.
diff --git a/src/main/java/org/bukkit/Vibration.java b/src/main/java/org/bukkit/Vibration.java diff --git a/src/main/java/org/bukkit/Vibration.java b/src/main/java/org/bukkit/Vibration.java
index 209a302c3a2ed333780ed760314a6ed352fc0767..9d29f1c5af56954bc452fa251d6bc0215ab3fe79 100644 index bbc01e7c192ae6689c301670047ff114306c57cb..2a83ba61686caffb247f17a67af474299dae6be4 100644
--- a/src/main/java/org/bukkit/Vibration.java --- a/src/main/java/org/bukkit/Vibration.java
+++ b/src/main/java/org/bukkit/Vibration.java +++ b/src/main/java/org/bukkit/Vibration.java
@@ -74,7 +74,7 @@ public class Vibration { @@ -74,7 +74,7 @@ public class Vibration {
@@ -507,36 +497,36 @@ index 209a302c3a2ed333780ed760314a6ed352fc0767..9d29f1c5af56954bc452fa251d6bc021
private final Location block; private final Location block;
diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java
index d124768378d6f0c5573f28ee815ea3886fe74868..11a00998b1cb5ee582e225553f15b1b7c1a65b2a 100644 index bfa378fe3d074bafbc0af2c4d858e2a34d3126bd..f6b6a75dc9ae2b8c391025221f151e2169d62913 100644
--- a/src/main/java/org/bukkit/attribute/AttributeModifier.java --- a/src/main/java/org/bukkit/attribute/AttributeModifier.java
+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java +++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable; @@ -18,7 +18,7 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Concrete implementation of an attribute modifier. * Concrete implementation of an attribute modifier.
*/ */
-public class AttributeModifier implements ConfigurationSerializable { -public class AttributeModifier implements ConfigurationSerializable, Keyed {
+public class AttributeModifier implements ConfigurationSerializable, gg.projecteden.api.interfaces.HasUniqueId { // Parchment +public class AttributeModifier implements ConfigurationSerializable, Keyed, gg.projecteden.api.interfaces.HasUniqueId { // Parchment
private final UUID uuid; private final NamespacedKey key;
private final String name; private final double amount;
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index e405c279f6135c94c775a856ab88fd3cace6bd5c..359cad4528e0c9b45ac3447655f24e7925bff7d2 100644 index a13c8ddd4a1222e7a16debb61769af3758502d7c..6672aaad187bb4ac23d9a3397fc0ef2ae3708bb2 100644
--- a/src/main/java/org/bukkit/block/Block.java --- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable; @@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
* (i.e. lighting and power) may not be able to be safely accessed during world * (i.e. lighting and power) may not be able to be safely accessed during world
* generation when used in cases like BlockPhysicsEvent!!!! * generation when used in cases like BlockPhysicsEvent!!!!
*/ */
-public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable { // Paper - translatable -public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
+public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable, gg.projecteden.parchment.HasLocation { // Paper - translatable +public interface Block extends Metadatable, Translatable, net.kyori.adventure.translation.Translatable, gg.projecteden.parchment.HasLocation { // Paper - translatable // Parchment
/** /**
* Gets the metadata for this block * Gets the metadata for this block
diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java diff --git a/src/main/java/org/bukkit/block/BlockState.java b/src/main/java/org/bukkit/block/BlockState.java
index 10cbe71917bc32cca61748bcb0aa3395c554dbf8..280df0fc6f7344863f0fd2ba7592494bcd8bf2da 100644 index 8c7c8c0e54682dc4276109d19d92394cdd4bc189..cbaf558b98f64922c5e15b1cb1f31068e8fdd501 100644
--- a/src/main/java/org/bukkit/block/BlockState.java --- a/src/main/java/org/bukkit/block/BlockState.java
+++ b/src/main/java/org/bukkit/block/BlockState.java +++ b/src/main/java/org/bukkit/block/BlockState.java
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; @@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
* change the state of the block and you will not know, or they may change the * change the state of the block and you will not know, or they may change the
* block to another type entirely, causing your BlockState to become invalid. * block to another type entirely, causing your BlockState to become invalid.
*/ */
@@ -572,12 +562,12 @@ index 2e17b2d4f759531fbe9ee8e9b00c839186af09ca..8f4a293c131cb8b63c31b410ffa211bd
/** /**
* This is the name of the specified AnimalTamer. * This is the name of the specified AnimalTamer.
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 8bc6876c82935988436597161fa0ec94c032174b..b27576e9c7f22e203251487334288239be0dcb9e 100644 index 725ef320f929d5e3d141c1ed3246d73a7d741f31..93506536af557bc9972c295ee3957fe0e3c22053 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
/** * Not all methods are guaranteed to work/may have side effects when
* Represents a base entity in the world * {@link #isInWorld()} is false.
*/ */
-public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter { // Paper -public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter { // Paper
+public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter, gg.projecteden.api.interfaces.HasUniqueId, gg.projecteden.parchment.HasLocation { // Paper // Parchment +public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowEntity>, net.kyori.adventure.sound.Sound.Emitter, gg.projecteden.api.interfaces.HasUniqueId, gg.projecteden.parchment.HasLocation { // Paper // Parchment
@@ -585,36 +575,36 @@ index 8bc6876c82935988436597161fa0ec94c032174b..b27576e9c7f22e203251487334288239
/** /**
* Gets the entity's current position * Gets the entity's current position
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index 5dbbeb92aec212d2e849d16320ed9c084b99fc35..32e5150b14f5d7d19d82d15631065db376814e25 100644 index 294de2c073167e7186fbf1d6885fe5951351cc9c..0b23a17a02c7df498f67dad2b49568c5e8c9127b 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -19,7 +19,15 @@ import org.jetbrains.annotations.Nullable; @@ -20,7 +20,15 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Represents a human entity, such as an NPC or a player * Represents a human entity, such as an NPC or a player
*/ */
-public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder { -public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
+// Parchment start +public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity { // Parchment
+public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder, gg.projecteden.parchment.HasHumanEntity {
+ +
+ // Parchment start
+ @NotNull + @NotNull
+ @Override + @Override
+ default HumanEntity getPlayer() { + default HumanEntity getPlayer() {
+ return this; + return this;
+ } + }
+// Parchment end + // Parchment end
// Paper start // Paper start
@Override @Override
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 6cd0b10d1dc4506cfb1e4db5e1260cb705566cec..a3ff1cb4b2754900879c67638a3488cd9d76cdb1 100644 index 7c56182acaf827f4b1a986a61cea8e9960604c98..9a6f2ed1eb9559789317e21226f67cb6f02c0761 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -40,7 +40,17 @@ import org.jetbrains.annotations.Nullable; @@ -57,7 +57,17 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Represents a player, connected or not * Represents a player, connected or not
*/ */
-public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, com.destroystokyo.paper.network.NetworkClient { // Paper -public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient { // Paper
+public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, com.destroystokyo.paper.network.NetworkClient, gg.projecteden.parchment.HasPlayer { // Paper // Parchment +public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient, gg.projecteden.parchment.HasPlayer { // Paper // Parchment
+ +
+ // Parchment start - fix defaults + // Parchment start - fix defaults
+ /** + /**
@@ -642,7 +632,7 @@ index 691733a642b3295bbe6d484be728c77cd32803bd..a2eae7a9bad13d1ba2bd954888a03738
private boolean dropItems; private boolean dropItems;
private boolean cancel; private boolean cancel;
diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java diff --git a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
index a1350c0f74d445dca09eea6e10abac050bb06990..11bb6f8f7363f31061d5fd0f2e4515099ac40649 100644 index c74ac0cb004aa219ce2f761969a4bb46cb7c9160..0ef554454608f0129b764dc3d6e3d7780ddf2a11 100644
--- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java --- a/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockCanBuildEvent.java
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable; @@ -19,7 +19,7 @@ import org.jetbrains.annotations.Nullable;
@@ -655,7 +645,7 @@ index a1350c0f74d445dca09eea6e10abac050bb06990..11bb6f8f7363f31061d5fd0f2e451509
protected boolean buildable; protected boolean buildable;
diff --git a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java diff --git a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java
index cd04a0bd9d232857408b38605787016a217cb8d2..7035fe7c0f5adb981ac41804605c4fbcf57968bf 100644 index 392cde07d578d684423e1bf369af28696eb7e484..e1dacc04c73e0cabcd04d50540f3a5716550e22f 100644
--- a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java --- a/src/main/java/org/bukkit/event/block/BlockDamageEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockDamageEvent.java
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
@@ -668,10 +658,10 @@ index cd04a0bd9d232857408b38605787016a217cb8d2..7035fe7c0f5adb981ac41804605c4fbc
private final Player player; private final Player player;
private boolean instaBreak; private boolean instaBreak;
diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
index 3dd4bd38e72c04e74e5787fb38ca9abd10bad06b..3783fb96cc7086bc78dc06c573a1343c3a18c3cb 100644 index 4c5ee91de162b202c2db8bf68259ad41a430125d..0d7087301c05bd801b32621e279ff69335b92660 100644
--- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java --- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; @@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
* AIR in most cases. Use #getBlockState() for more Information about the broken * AIR in most cases. Use #getBlockState() for more Information about the broken
* block. * block.
*/ */
@@ -707,7 +697,7 @@ index 6dcd9f828c6c40e48593b0bad5a44a656eb01645..0651bdd983e90e0e1e8a3565dcb5d97c
private final IgniteCause cause; private final IgniteCause cause;
private final Entity ignitingEntity; private final Entity ignitingEntity;
diff --git a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java diff --git a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
index be0a2d1f234d8265d98e54e518a994957b1f3ab7..54cd6735fbcad009330927d760f8bd93ea9c51ec 100644 index 4e3c406ba883aae553e8d69b6b719b872cd6096c..d0a92dc9eba0f61b596e9a388f3aa4076ef2bc65 100644
--- a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java --- a/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
+++ b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java +++ b/src/main/java/org/bukkit/event/block/BlockPlaceEvent.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
@@ -720,10 +710,10 @@ index be0a2d1f234d8265d98e54e518a994957b1f3ab7..54cd6735fbcad009330927d760f8bd93
protected boolean cancel; protected boolean cancel;
protected boolean canBuild; protected boolean canBuild;
diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
index 1268066e30ddb0cd3792ea4b3de894eb04196669..1e20629da438651d3987258b93cf9caf9eff9452 100644 index d944d67f544494355f03c5bc9afd8ea7726e6412..800db8e63bdb8c05ffdc88c3a3b0f1f268a1357e 100644
--- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java --- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java
+++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java +++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
@@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
* <p> * <p>
* If a Sign Change event is cancelled, the sign will not be changed. * If a Sign Change event is cancelled, the sign will not be changed.
*/ */
@@ -733,7 +723,7 @@ index 1268066e30ddb0cd3792ea4b3de894eb04196669..1e20629da438651d3987258b93cf9caf
private boolean cancel = false; private boolean cancel = false;
private final Player player; private final Player player;
diff --git a/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java b/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java diff --git a/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java b/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java
index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..b42465617e83d3413ab647cd9c78212b61ca5833 100644 index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..57f89f569725289d56f1c75db258ac19b6f94f30 100644
--- a/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java --- a/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityEnterLoveModeEvent.java
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
@@ -745,11 +735,8 @@ index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..b42465617e83d3413ab647cd9c78212b
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel; private boolean cancel;
@@ -42,11 +42,27 @@ public class EntityEnterLoveModeEvent extends EntityEvent implements Cancellable @@ -44,9 +44,24 @@ public class EntityEnterLoveModeEvent extends EntityEvent implements Cancellable
*
* @return The Human entity that caused the animal to enter love mode, or
* null if there wasn't one. * null if there wasn't one.
+ * @deprecated alias of {@link #getPlayer()} <!-- Parchment: fix inconsistent naming -->
*/ */
@Nullable @Nullable
- public HumanEntity getHumanEntity() { - public HumanEntity getHumanEntity() {
@@ -775,12 +762,12 @@ index 59aab10c2d27247eb77bd71d75b5f9126aa0fb12..b42465617e83d3413ab647cd9c78212b
/** /**
* Gets the amount of ticks that the animal will fall in love for. * Gets the amount of ticks that the animal will fall in love for.
diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java diff --git a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
index 10d0e18dfd423b108fe381e8142867eb10399359..7f9f266057de42261fa06e4874d7bec5388c90c7 100644 index e468e55d426b8f81f87c0a08451d02b3866c226f..74f0f439aa145d9c8d1c049aee387521f34a39e9 100644
--- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java --- a/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityExplodeEvent.java
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
/** * event isn't called if the {@link org.bukkit.GameRule#MOB_GRIEFING}
* Called when an entity explodes * is disabled as no block interaction will occur.
*/ */
-public class EntityExplodeEvent extends EntityEvent implements Cancellable { -public class EntityExplodeEvent extends EntityEvent implements Cancellable {
+public class EntityExplodeEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment +public class EntityExplodeEvent extends EntityEvent implements Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
@@ -788,10 +775,10 @@ index 10d0e18dfd423b108fe381e8142867eb10399359..7f9f266057de42261fa06e4874d7bec5
private boolean cancel; private boolean cancel;
private final Location location; private final Location location;
diff --git a/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java b/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java diff --git a/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java b/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java
index ea8f9ed43d8e4158e6c9c345252a94a5000c5561..98d308eda8287cb1f1a0aab5208c7c6f13047c05 100644 index 71d664dd89995f088c47d17b38547d530319470c..d931ece8f35c8f01748c59d01617fd59b287030e 100644
--- a/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java --- a/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityPlaceEvent.java
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; @@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
* Note that this event is currently only fired for four specific placements: * Note that this event is currently only fired for four specific placements:
* armor stands, boats, minecarts, and end crystals. * armor stands, boats, minecarts, and end crystals.
*/ */
@@ -801,15 +788,15 @@ index ea8f9ed43d8e4158e6c9c345252a94a5000c5561..98d308eda8287cb1f1a0aab5208c7c6f
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java diff --git a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java
index 6818e9f0ba32ca1a1e612703f7526b29f5a6438f..c9c4a6673fd3995bb9638b0d25fa212412cda807 100644 index 8b2caf665b9e829ceefc89bf41b192f53f3d5773..dbf52ab6f97245d1d4b2325a3e05b5047a3e7e6f 100644
--- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java --- a/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityPortalEnterEvent.java
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/** * Cancelling this event prevents any further processing of the portal for that tick.
* Called when an entity comes into contact with a portal * @see io.papermc.paper.event.entity.EntityInsideBlockEvent
*/ */
-public class EntityPortalEnterEvent extends EntityEvent { -public class EntityPortalEnterEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper
+public class EntityPortalEnterEvent extends EntityEvent implements gg.projecteden.parchment.HasLocation { // Parchment +public class EntityPortalEnterEvent extends EntityEvent implements org.bukkit.event.Cancellable, gg.projecteden.parchment.HasLocation { // Parchment
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final Location location; private final Location location;
@@ -827,7 +814,7 @@ index 961ee511342cd3a12ff2ff74d7b4683c6753123d..892732ab5ae58ec980c4fd05a5a3dfdc
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean canceled; private boolean canceled;
diff --git a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java diff --git a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
index 6fc66197eb2c5d59c70d8d028b7963748371edbe..dc45ec5b6ae8e2958d83a113d23ab0b1a911de3f 100644 index 2bb29fa449cd6c90b52d2786ed15b6154d591607..ce4caa5d3b0801bc7e2fd2c917a4ae6e3f054052 100644
--- a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java --- a/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
+++ b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java +++ b/src/main/java/org/bukkit/event/entity/ItemDespawnEvent.java
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
@@ -840,10 +827,10 @@ index 6fc66197eb2c5d59c70d8d028b7963748371edbe..dc45ec5b6ae8e2958d83a113d23ab0b1
private boolean canceled; private boolean canceled;
private final Location location; private final Location location;
diff --git a/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java b/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java diff --git a/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java b/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java
index 5eb3fb72a13881b8bf0e40037b0002cb0a6eb883..4d5d0b730ad957e44f549518366841492b537ab2 100644 index 883d54dc0cc32973df5d66f2991d1af8150add43..2f56d30b58387128931c563c2d67c759faf1b488 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java --- a/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerLeashEntityEvent.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Called immediately prior to a creature being leashed by a player. * Called immediately prior to a creature being leashed by a player.
*/ */
@@ -853,10 +840,10 @@ index 5eb3fb72a13881b8bf0e40037b0002cb0a6eb883..4d5d0b730ad957e44f54951836684149
private final Entity leashHolder; private final Entity leashHolder;
private final Entity entity; private final Entity entity;
diff --git a/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java b/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java diff --git a/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java b/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java
index 1bcff119ecd95012c568c777e5ca2e891e56831e..517f115123fa2009ba0837b0754411e93808562f 100644 index cc5781f276ec0a503b1bfef19d630c85db897c2a..89b38f2ce9a355f39abc657eff49c3a58f1b6471 100644
--- a/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java --- a/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java
+++ b/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java +++ b/src/main/java/org/bukkit/event/hanging/HangingPlaceEvent.java
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable; @@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Triggered when a hanging entity is created in the world * Triggered when a hanging entity is created in the world
*/ */
@@ -866,12 +853,12 @@ index 1bcff119ecd95012c568c777e5ca2e891e56831e..517f115123fa2009ba0837b0754411e9
private boolean cancelled; private boolean cancelled;
private final Player player; private final Player player;
diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
index 020739697a0b535cad0b15b574f77cdabbdfa3eb..ee4fd41e66852d5d2c62222c7b884473d3f3001d 100644 index 5ffd28fd24b4477a07fc9f6a3f669a6f4da9fa26..7611905895d414eeb45a92ed0e3b6124f3dd85cd 100644
--- a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java --- a/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java +++ b/src/main/java/org/bukkit/event/inventory/FurnaceExtractEvent.java
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
/** * {@link org.bukkit.block.Furnace}, {@link org.bukkit.block.Smoker}, or
* This event is called when a player takes items out of the furnace * {@link org.bukkit.block.BlastFurnace}.
*/ */
-public class FurnaceExtractEvent extends BlockExpEvent { -public class FurnaceExtractEvent extends BlockExpEvent {
+public class FurnaceExtractEvent extends BlockExpEvent implements gg.projecteden.parchment.HasPlayer { // Parchment +public class FurnaceExtractEvent extends BlockExpEvent implements gg.projecteden.parchment.HasPlayer { // Parchment
@@ -879,12 +866,12 @@ index 020739697a0b535cad0b15b574f77cdabbdfa3eb..ee4fd41e66852d5d2c62222c7b884473
private final Material itemType; private final Material itemType;
private final int itemAmount; private final int itemAmount;
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
index 21ad8888c0e403bfc63518502577d651c02dda05..1c59335a8f0a40162190f6fb73ffbfef0cd795d8 100644 index 4db0a07db156c61867644f50c185e63b695e2462..eb6632e2e9d247bd54e02e3a134dfdbed9aeef39 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java --- a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java +++ b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; @@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
/** * on the next tick. Also be aware that this is not an exhaustive list, and
* Represents a player related inventory event * other methods could potentially create issues as well.
*/ */
-public class InventoryCloseEvent extends InventoryEvent { -public class InventoryCloseEvent extends InventoryEvent {
+public class InventoryCloseEvent extends InventoryEvent implements gg.projecteden.parchment.HasHumanEntity { // Parchment +public class InventoryCloseEvent extends InventoryEvent implements gg.projecteden.parchment.HasHumanEntity { // Parchment
@@ -892,25 +879,25 @@ index 21ad8888c0e403bfc63518502577d651c02dda05..1c59335a8f0a40162190f6fb73ffbfef
// Paper start // Paper start
private final Reason reason; private final Reason reason;
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java diff --git a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java
index 9013d043503d175004ad276799e5935b7fa59dc4..4095ca19e6ceff2432e0cbd372e9475f748278a7 100644 index 8e2afeab4c62724148e8bb0c83fb7eec569c7a0c..2843fd117151dc75c87db06915a6732277867a0c 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java --- a/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java +++ b/src/main/java/org/bukkit/event/inventory/InventoryOpenEvent.java
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; @@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Represents a player related inventory event * Called when a player opens an inventory
*/ */
-public class InventoryOpenEvent extends InventoryEvent implements Cancellable { -public class InventoryOpenEvent extends InventoryEvent implements Cancellable {
+public class InventoryOpenEvent extends InventoryEvent implements Cancellable, gg.projecteden.parchment.HasHumanEntity { // Parchment +public class InventoryOpenEvent extends InventoryEvent implements Cancellable, gg.projecteden.parchment.HasHumanEntity { // Parchment
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private net.kyori.adventure.text.Component titleOverride; // Paper
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index 635b8787fc235b61c0d5677def034656e4ec4cef..6f15f4adfa552e2f5960464663ee126282086bb1 100644 index ae02788536d0c6736aba4ccf812844df4f9789f1..327558fcf2aacf0df5a62399fc510c25fcf7cb38 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java --- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
* <p> * Consider rendering any translatable yourself with {@link net.kyori.adventure.translation.GlobalTranslator#render}
* This event is asynchronous, and not run using main thread. * if the client's language is known.
*/ */
-public class AsyncPlayerPreLoginEvent extends Event { -public class AsyncPlayerPreLoginEvent extends Event {
+public class AsyncPlayerPreLoginEvent extends Event implements gg.projecteden.api.interfaces.HasUniqueId { // Parchment +public class AsyncPlayerPreLoginEvent extends Event implements gg.projecteden.api.interfaces.HasUniqueId { // Parchment
@@ -931,10 +918,10 @@ index f6d3b817de3001f04ea4554c7c39a1290af3fd6d..44efb5cc62149b34b994eadac488a902
public PlayerEvent(@NotNull final Player who) { public PlayerEvent(@NotNull final Player who) {
diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
index 6800132c6288b4588fd02b08d26f016c38f27129..8e333a361cdee30a83e9472285dfb0b30b2e72ca 100644 index 175ed12dd1698f4d153c9acdac8340c15a427ea5..5e14dc6968de1b146b31abef19fbba1af8c68b6f 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull; @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
*/ */
@Deprecated @Deprecated
@Warning(reason = "This event causes a login thread to synchronize with the main thread") @Warning(reason = "This event causes a login thread to synchronize with the main thread")
@@ -944,16 +931,16 @@ index 6800132c6288b4588fd02b08d26f016c38f27129..8e333a361cdee30a83e9472285dfb0b3
private Result result; private Result result;
private net.kyori.adventure.text.Component message; // Paper private net.kyori.adventure.text.Component message; // Paper
diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
index 68eab1563caba1ee4f52b308f390e4e172667fc5..7f2be08b1e7b6df4bab8a8996bc276f369a8ff78 100644 index d63bd62606763d0902ea800f0c35a1cfd07fc8ec..ecca20d51f8ac6f27887c55ae2aaa428ecb1ea53 100644
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Called prior to an entity being unleashed due to a player's action. * Called prior to an entity being unleashed due to a player's action.
*/ */
-public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable { -public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable {
+public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment +public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Cancellable, gg.projecteden.parchment.HasPlayer { // Parchment
private final Player player;
private boolean cancelled = false; private boolean cancelled = false;
diff --git a/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java b/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java diff --git a/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java b/src/main/java/org/bukkit/event/raid/RaidTriggerEvent.java
@@ -970,12 +957,12 @@ index 128e43cf12205f82f2b119a773208502cdccfdd4..ca1fed3081e2b0a3271a2dfa0f49cce7
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
// //
diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
index 4a3451af454295ac3e1b688e6665cad9fc594c82..b88cebb219577d59cc338be89c6f391d10702095 100644 index ea26cb90d988d693f26e37229fbdee975c0b11f4..f19aa180b7d4f19f57b9968a4c35a76ad29029c3 100644
--- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java --- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
+++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java +++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull; @@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull;
* advised to ensure the client does not have permission for the relevant * @apiNote Only called for bukkit API commands {@link org.bukkit.command.Command} and
* commands, or use {@link PlayerCommandSendEvent}. * {@link org.bukkit.command.CommandExecutor} and not for brigadier commands ({@link io.papermc.paper.command.brigadier.Commands}).
*/ */
-public class TabCompleteEvent extends Event implements Cancellable { -public class TabCompleteEvent extends Event implements Cancellable {
+public class TabCompleteEvent extends Event implements Cancellable, gg.projecteden.parchment.OptionalLocation { // Parchment +public class TabCompleteEvent extends Event implements Cancellable, gg.projecteden.parchment.OptionalLocation { // Parchment
@@ -983,7 +970,7 @@ index 4a3451af454295ac3e1b688e6665cad9fc594c82..b88cebb219577d59cc338be89c6f391d
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
// //
diff --git a/src/main/java/org/bukkit/event/world/GenericGameEvent.java b/src/main/java/org/bukkit/event/world/GenericGameEvent.java diff --git a/src/main/java/org/bukkit/event/world/GenericGameEvent.java b/src/main/java/org/bukkit/event/world/GenericGameEvent.java
index 2a2a329877d8da45c2d6afecf78ce88d52635cad..22cdf3662b02fb5751ac6d913d781084cd7eee5b 100644 index fb975fefc74d8c9746cab4c02860f55654cf92f7..172699ba31d1ee0697607125d75549930288dd5b 100644
--- a/src/main/java/org/bukkit/event/world/GenericGameEvent.java --- a/src/main/java/org/bukkit/event/world/GenericGameEvent.java
+++ b/src/main/java/org/bukkit/event/world/GenericGameEvent.java +++ b/src/main/java/org/bukkit/event/world/GenericGameEvent.java
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable; @@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
@@ -996,7 +983,7 @@ index 2a2a329877d8da45c2d6afecf78ce88d52635cad..22cdf3662b02fb5751ac6d913d781084
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final GameEvent event; private final GameEvent event;
diff --git a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java diff --git a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java
index 7af8d6e51c824cf0592b722b834f1d4986e3cc08..c28d62fc3dc359f9ebcf926094198ee3c92467aa 100644 index 783e74bc382f0f6d24203fde7b811f588a674731..c0f863b35cc7f508a33ddcb1af9ed6c52115efdc 100644
--- a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java --- a/src/main/java/org/bukkit/event/world/StructureGrowEvent.java
+++ b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java +++ b/src/main/java/org/bukkit/event/world/StructureGrowEvent.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable; @@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
@@ -1009,7 +996,7 @@ index 7af8d6e51c824cf0592b722b834f1d4986e3cc08..c28d62fc3dc359f9ebcf926094198ee3
private boolean cancelled = false; private boolean cancelled = false;
private final Location location; private final Location location;
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 1b577c03c3152d22b70f8bdb321b28ad8fbbc3af..b3449a874666bcd67950ec12da41738f7c24ddee 100644 index 0d519813c12d98b28d62e6d01d7ec6e8c2dba3c3..469b9cc0c4b77844ba0317af51bd9ad873915967 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java --- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java +++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable; @@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
@@ -1022,20 +1009,20 @@ index 1b577c03c3152d22b70f8bdb321b28ad8fbbc3af..b3449a874666bcd67950ec12da41738f
/** /**
* Returns the size of the inventory * Returns the size of the inventory
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index 2448e70d75ae7a678c6befac4506c103edb78875..65ca144618f74bc8e317a4b9c2732ad5ed13a208 100644 index 72f93377b60a3b6a08b8c8264ee7313e89c15da0..019ba8c91c06da12efadc445ada6f634a78e488b 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java --- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.Nullable; @@ -9,7 +9,7 @@ import org.jetbrains.annotations.Nullable;
* contracts of certain methods, there's no guarantee that the game will work * Represents a view linking two inventories and a single player (whose
* as it should. * inventory may or may not be one of the two).
*/ */
-public abstract class InventoryView { -public interface InventoryView {
+public abstract class InventoryView implements gg.projecteden.parchment.HasHumanEntity { // Parchment +public interface InventoryView extends gg.projecteden.parchment.HasHumanEntity { // Parchment
public static final int OUTSIDE = -999; public static final int OUTSIDE = -999;
/** /**
* Represents various extra properties of certain inventory windows. * Represents various extra properties of certain inventory windows.
diff --git a/src/main/java/org/bukkit/loot/LootContext.java b/src/main/java/org/bukkit/loot/LootContext.java diff --git a/src/main/java/org/bukkit/loot/LootContext.java b/src/main/java/org/bukkit/loot/LootContext.java
index 71b7aa9d675e1714e286e6fd4015ead036d912e0..95e120068a7c5c96b1b8553df9cf8654ba63a325 100644 index 9c1ccaed727ec5e5dad93146bbfda798e3f536e7..b4dc13b03d8a33ac13e8af6677e1a8418edc8e20 100644
--- a/src/main/java/org/bukkit/loot/LootContext.java --- a/src/main/java/org/bukkit/loot/LootContext.java
+++ b/src/main/java/org/bukkit/loot/LootContext.java +++ b/src/main/java/org/bukkit/loot/LootContext.java
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; @@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;

View File

@@ -6,12 +6,13 @@ Subject: [PATCH] Add SoundEvent
diff --git a/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java diff --git a/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c0409febb9d index 0000000000000000000000000000000000000000..14fa1d766f49eed2907214fc536222bae9167a85
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java +++ b/src/main/java/gg/projecteden/parchment/event/sound/SoundEvent.java
@@ -0,0 +1,382 @@ @@ -0,0 +1,359 @@
+package gg.projecteden.parchment.event.sound; +package gg.projecteden.parchment.event.sound;
+ +
+import gg.projecteden.parchment.HasLocation;
+import gg.projecteden.parchment.OptionalHumanEntity; +import gg.projecteden.parchment.OptionalHumanEntity;
+import net.kyori.adventure.sound.Sound; +import net.kyori.adventure.sound.Sound;
+import org.bukkit.Location; +import org.bukkit.Location;
@@ -34,7 +35,7 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ * Called when a sound is sent to a player. + * Called when a sound is sent to a player.
+ * Cancelling this event will prevent the packet from sending. + * Cancelling this event will prevent the packet from sending.
+ */ + */
+public final class SoundEvent extends Event implements Cancellable, OptionalHumanEntity { +public final class SoundEvent extends Event implements Cancellable {
+ private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(SoundEvent.class); + private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(SoundEvent.class);
+ +
+ private static final org.bukkit.event.HandlerList handlers = new org.bukkit.event.HandlerList(); + private static final org.bukkit.event.HandlerList handlers = new org.bukkit.event.HandlerList();
@@ -59,16 +60,14 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ private @NotNull Sound sound; + private @NotNull Sound sound;
+ private @NotNull Emitter emitter; + private @NotNull Emitter emitter;
+ private boolean cancelled; + private boolean cancelled;
+ private long seed;
+ private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Sound> soundOverrideFunction; + private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Sound> soundOverrideFunction;
+ private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Emitter> emitterOverrideFunction; + private @Nullable BiFunction<@NotNull SoundEvent, @NotNull Player, @Nullable Emitter> emitterOverrideFunction;
+ +
+ public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull Emitter emitter, long seed, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) { + public SoundEvent(@Nullable HumanEntity except, @NotNull Sound sound, @NotNull Emitter emitter, @Nullable Function<Sound, Double> distanceFunction, @Nullable Function<SoundEvent, List<Player>> recipientsFunction) {
+ super(true); + super(true);
+ this.except = except; + this.except = except;
+ this.sound = Objects.requireNonNull(sound, "sound cannot be null"); + this.sound = Objects.requireNonNull(sound, "sound cannot be null");
+ this.emitter = Objects.requireNonNull(emitter, "emitter cannot be null"); + this.emitter = Objects.requireNonNull(emitter, "emitter cannot be null");
+ this.seed = seed;
+ this.distanceFunction = Objects.requireNonNullElse(distanceFunction, DEFAULT_DISTANCE_FUNCTION); + this.distanceFunction = Objects.requireNonNullElse(distanceFunction, DEFAULT_DISTANCE_FUNCTION);
+ this.recipientsFunction = wrapRecipientsFunction(Objects.requireNonNullElse(recipientsFunction, DEFAULT_RECIPIENTS_FUNCTION)); + this.recipientsFunction = wrapRecipientsFunction(Objects.requireNonNullElse(recipientsFunction, DEFAULT_RECIPIENTS_FUNCTION));
+ } + }
@@ -77,18 +76,6 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ * Gets the player that <b>won't</b> be receiving this sound. + * Gets the player that <b>won't</b> be receiving this sound.
+ * + *
+ * @return player excluded from receiving this sound + * @return player excluded from receiving this sound
+ * @deprecated use {@link #getException()} for more clarity
+ */
+ @Override
+ @Deprecated
+ public @Nullable HumanEntity getPlayer() {
+ return getException();
+ }
+
+ /**
+ * Gets the player that <b>won't</b> be receiving this sound.
+ *
+ * @return player excluded from receiving this sound
+ */ + */
+ public @Nullable HumanEntity getException() { + public @Nullable HumanEntity getException() {
+ return except; + return except;
@@ -140,24 +127,6 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ } + }
+ +
+ /** + /**
+ * Gets the seed used to generate the sound.
+ *
+ * @return seed used to generate the sound
+ */
+ public long getSeed() {
+ return seed;
+ }
+
+ /**
+ * Sets the seed used to generate the sound.
+ *
+ * @param seed seed used to generate the sound
+ */
+ public void setSeed(long seed) {
+ this.seed = seed;
+ }
+
+ /**
+ * Calculates the distance of the sound. + * Calculates the distance of the sound.
+ * <p> + * <p>
+ * The distance value is dynamically calculated using a + * The distance value is dynamically calculated using a
@@ -336,7 +305,7 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ +
+ private record WrappedRecipientsFunction(@NotNull Function<SoundEvent, List<Player>> wrapped) implements Function<SoundEvent, List<Player>> { + private record WrappedRecipientsFunction(@NotNull Function<SoundEvent, List<Player>> wrapped) implements Function<SoundEvent, List<Player>> {
+ @Override + @Override
+ public List<Player> apply(SoundEvent event) { + public @NotNull List<Player> apply(@NotNull SoundEvent event) {
+ List<Player> recipients = wrapped.apply(event); + List<Player> recipients = wrapped.apply(event);
+ HumanEntity except = event.getException(); + HumanEntity except = event.getException();
+ if (except != null) { + if (except != null) {
@@ -362,14 +331,18 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ /** + /**
+ * The class which determines where a sound will emit from. + * The class which determines where a sound will emit from.
+ */ + */
+ public sealed interface Emitter permits EntityEmitter, LocationEmitter { + public sealed interface Emitter extends HasLocation permits EntityEmitter, LocationEmitter {
+ /** + /**
+ * Gets the location at which the sound will be played. + * Gets the location at which the sound will be played.
+ * + *
+ * @return sound's location + * @return sound's location
+ * @deprecated use {@link #getLocation()} instead
+ */ + */
+ @NotNull + @NotNull
+ Location location(); + @Deprecated
+ default Location location() {
+ return getLocation();
+ }
+ } + }
+ +
+ /** + /**
@@ -379,7 +352,7 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ */ + */
+ public record EntityEmitter(@NotNull Entity entity) implements Emitter { + public record EntityEmitter(@NotNull Entity entity) implements Emitter {
+ @Override + @Override
+ public @NotNull Location location() { + public @NotNull Location getLocation() {
+ return entity.getLocation(); + return entity.getLocation();
+ } + }
+ } + }
@@ -390,5 +363,9 @@ index 0000000000000000000000000000000000000000..e612cecc89b060a9c0fc882754e45c04
+ * @param location the location from which the sound will be played + * @param location the location from which the sound will be played
+ */ + */
+ public record LocationEmitter(@NotNull Location location) implements Emitter { + public record LocationEmitter(@NotNull Location location) implements Emitter {
+ @Override
+ public @NotNull Location getLocation() {
+ return location;
+ }
+ } + }
+} +}

View File

@@ -1,54 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lexikiq <noellekiq@gmail.com>
Date: Fri, 18 Jun 2021 14:06:43 -0400
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
index 461727dc7f06efb3550fc370e0db5bd04ba89711..f20ac2ba1921616f346c11ef60c53aba0080728b 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
@@ -12,17 +12,43 @@ import org.jetbrains.annotations.Nullable;
*/
public class EntityDamageByBlockEvent extends EntityDamageEvent {
private final Block damager;
+ private final org.bukkit.Location location; // Parchment
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
super(damagee, cause, damage);
this.damager = damager;
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
}
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
super(damagee, cause, modifiers, modifierFunctions);
this.damager = damager;
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
}
+ // Parchment start
+ public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @Nullable final org.bukkit.Location damageLocation, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
+ super(damagee, cause, modifiers, modifierFunctions);
+ this.damager = damager;
+ if (damageLocation != null)
+ this.location = damageLocation;
+ else if (damager != null)
+ this.location = damager.getLocation();
+ else
+ this.location = null;
+ }
+
+ /**
+ * Gets the location of the damage source.
+ *
+ * @return Originating location of the damage source
+ */
+ @Nullable
+ public org.bukkit.Location getLocation() {
+ return location;
+ }
+ // Parchment end
+
/**
* Returns the block that damaged the player.
*

View File

@@ -0,0 +1,61 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lexikiq <noellekiq@gmail.com>
Date: Fri, 18 Jun 2021 14:06:43 -0400
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
index 148c4aad384ae8e3b8b22d264a84bddfbcafdf1e..61fcdd178fa5a8f13c889a78f431d2a5529c8c43 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.Nullable;
public class EntityDamageByBlockEvent extends EntityDamageEvent {
private final Block damager;
private final BlockState damagerState;
+ private final org.bukkit.Location location; // Parchment
@Deprecated(forRemoval = true)
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
@@ -30,19 +31,40 @@ public class EntityDamageByBlockEvent extends EntityDamageEvent {
super(damagee, cause, damageSource, damage);
this.damager = damager;
this.damagerState = damagerState;
+ this.location = damager != null ? damager.getLocation() : null; // Parchment
}
@Deprecated(forRemoval = true)
public EntityDamageByBlockEvent(@Nullable final Block damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
- this(damager, (damager != null) ? damager.getState() : null, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions);
+ this(damager, (damager != null) ? damager.getState() : null, damagee, cause, (damager != null) ? DamageSource.builder(DamageType.GENERIC).withDamageLocation(damager.getLocation()).build() : DamageSource.builder(DamageType.GENERIC).build(), modifiers, modifierFunctions, null);
}
- public EntityDamageByBlockEvent(@Nullable final Block damager, @Nullable final BlockState damagerState, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
+ public EntityDamageByBlockEvent(@Nullable final Block damager, @Nullable final BlockState damagerState, @NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final DamageSource damageSource, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions, @Nullable final org.bukkit.Location damageLocation) { // Parchment
super(damagee, cause, damageSource, modifiers, modifierFunctions);
this.damager = damager;
this.damagerState = damagerState;
+ // Parchment start
+ if (damageLocation != null)
+ this.location = damageLocation;
+ else if (damager != null)
+ this.location = damager.getLocation();
+ else
+ this.location = null;
+ // Parchment end
}
+ /**
+ * Gets the location of the damage source.
+ *
+ * @return Originating location of the damage source
+ */
+ @Nullable
+ public org.bukkit.Location getLocation() {
+ return location;
+ }
+ // Parchment end
+
+
/**
* Returns the block that damaged the player.
*

View File

@@ -6,19 +6,19 @@ Subject: [PATCH] Expanded Adventure support
Adds support for Adventure in a few places where it was previously missing. Adds support for Adventure in a few places where it was previously missing.
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489642245c2 100644 index 918a045165cdcde264bc24082b7afebb407271de..3f912d3fbf5fdef3b95f81585d2fcf76719d2d04 100644
--- a/src/main/java/org/bukkit/ChatColor.java --- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java +++ b/src/main/java/org/bukkit/ChatColor.java
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable; @@ -13,7 +13,7 @@ import org.jetbrains.annotations.Nullable;
/** * @deprecated ChatColor has been deprecated in favor of <a href="https://docs.advntr.dev/text.html">Adventure</a> API. See {@link net.kyori.adventure.text.format.NamedTextColor} for the adventure equivalent of pre-defined text colors
* All supported color values for chat
*/ */
@Deprecated // Paper
-public enum ChatColor { -public enum ChatColor {
+public enum ChatColor implements net.kyori.adventure.text.format.StyleBuilderApplicable, net.kyori.adventure.text.format.TextFormat { // Parchment +public enum ChatColor implements net.kyori.adventure.text.format.StyleBuilderApplicable, net.kyori.adventure.text.format.TextFormat { // Parchment
/** /**
* Represents black * Represents black
*/ */
@@ -181,6 +181,13 @@ public enum ChatColor { @@ -183,6 +183,13 @@ public enum ChatColor {
public net.md_5.bungee.api.ChatColor asBungee() { public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.MAGIC; return net.md_5.bungee.api.ChatColor.MAGIC;
} }
@@ -26,41 +26,13 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
+ // Parchment start + // Parchment start
+ @Override + @Override
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) { + public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED); + style.apply(net.kyori.adventure.text.format.TextDecoration.OBFUSCATED);
+ } + }
+ // Parchment end + // Parchment end
}, },
/** /**
* Makes the text bold. * Makes the text bold.
@@ -191,6 +198,13 @@ public enum ChatColor { @@ -213,6 +220,13 @@ public enum ChatColor {
public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.BOLD;
}
+
+ // Parchment start
+ @Override
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.BOLD);
+ }
+ // Parchment end
},
/**
* Makes a line appear through the text.
@@ -201,6 +215,13 @@ public enum ChatColor {
public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.STRIKETHROUGH;
}
+
+ // Parchment start
+ @Override
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.STRIKETHROUGH);
+ }
+ // Parchment end
},
/**
* Makes the text appear underlined.
@@ -211,6 +232,13 @@ public enum ChatColor {
public net.md_5.bungee.api.ChatColor asBungee() { public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.UNDERLINE; return net.md_5.bungee.api.ChatColor.UNDERLINE;
} }
@@ -68,27 +40,13 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
+ // Parchment start + // Parchment start
+ @Override + @Override
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) { + public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.UNDERLINED); + style.apply(net.kyori.adventure.text.format.TextDecoration.UNDERLINED);
+ } + }
+ // Parchment end + // Parchment end
}, },
/** /**
* Makes the text italic. * Makes the text italic.
@@ -221,6 +249,13 @@ public enum ChatColor { @@ -233,6 +247,16 @@ public enum ChatColor {
public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.ITALIC;
}
+
+ // Parchment start
+ @Override
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.ITALIC);
+ }
+ // Parchment end
},
/**
* Resets all previous chat colors or formats.
@@ -231,6 +266,16 @@ public enum ChatColor {
public net.md_5.bungee.api.ChatColor asBungee() { public net.md_5.bungee.api.ChatColor asBungee() {
return net.md_5.bungee.api.ChatColor.RESET; return net.md_5.bungee.api.ChatColor.RESET;
} }
@@ -105,14 +63,17 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
}; };
/** /**
@@ -263,6 +308,13 @@ public enum ChatColor { @@ -265,6 +289,16 @@ public enum ChatColor {
return net.md_5.bungee.api.ChatColor.RESET; return net.md_5.bungee.api.ChatColor.RESET;
}; };
+ // Parchment start + // Parchment start
+ @Override + @Override
+ public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) { + public void styleApply(net.kyori.adventure.text.format.Style.@NotNull Builder style) {
+ style.color(net.kyori.adventure.text.format.TextColor.color(asBungee().getColor().getRGB())); + if (isColor())
+ style.color(net.kyori.adventure.text.format.TextColor.color(asBungee().getColor().getRGB()));
+ else
+ style.decorate(net.kyori.adventure.text.format.TextDecoration.valueOf(name()));
+ } + }
+ // Parchment end + // Parchment end
+ +
@@ -120,20 +81,20 @@ index f6eb30f53dad684f156102cf7147b2f00c82c71e..1b4e9840f0e829be533ad0bd1c918489
* Gets the char value associated with this color * Gets the char value associated with this color
* *
diff --git a/src/main/java/org/bukkit/Color.java b/src/main/java/org/bukkit/Color.java diff --git a/src/main/java/org/bukkit/Color.java b/src/main/java/org/bukkit/Color.java
index d2f8f5a8e49f60422b6a41e51248a6710251d61b..40b09a861ba365b126c2b28bb7f18c8fb8b3e5b5 100644 index f8edb964c4af597b03a2de06c464cc06a96b791c..3957d290c606a50b59c7c421ea7c163f4625449c 100644
--- a/src/main/java/org/bukkit/Color.java --- a/src/main/java/org/bukkit/Color.java
+++ b/src/main/java/org/bukkit/Color.java +++ b/src/main/java/org/bukkit/Color.java
@@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull; @@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
* but subject to change. * but subject to change.
*/ */
@SerializableAs("Color") @SerializableAs("Color")
-public final class Color implements ConfigurationSerializable { -public final class Color implements ConfigurationSerializable {
+public final class Color implements ConfigurationSerializable, net.kyori.adventure.text.format.TextColor { // Parchment +public final class Color implements ConfigurationSerializable, net.kyori.adventure.text.format.TextColor { // Parchment
private static final int BIT_MASK = 0xff; private static final int BIT_MASK = 0xff;
private static final int DEFAULT_ALPHA = 255;
/** @@ -310,6 +310,13 @@ public final class Color implements ConfigurationSerializable {
@@ -244,6 +244,13 @@ public final class Color implements ConfigurationSerializable { return getAlpha() << 24 | getRed() << 16 | getGreen() << 8 | getBlue();
return getRed() << 16 | getGreen() << 8 | getBlue() << 0;
} }
+ // Parchment start + // Parchment start
@@ -147,7 +108,7 @@ index d2f8f5a8e49f60422b6a41e51248a6710251d61b..40b09a861ba365b126c2b28bb7f18c8f
* Gets the color as an BGR integer. * Gets the color as an BGR integer.
* *
diff --git a/src/main/java/org/bukkit/DyeColor.java b/src/main/java/org/bukkit/DyeColor.java diff --git a/src/main/java/org/bukkit/DyeColor.java b/src/main/java/org/bukkit/DyeColor.java
index bd213cabddd8752e609544f24cfba95405726155..7e89cadecde96f9c2394446669dc4d98df391940 100644 index 47df858e095c4423c20e49e029d72f0f50d2c924..c7504e017bc57df6903a2d76ce98e9fd4c35a7cc 100644
--- a/src/main/java/org/bukkit/DyeColor.java --- a/src/main/java/org/bukkit/DyeColor.java
+++ b/src/main/java/org/bukkit/DyeColor.java +++ b/src/main/java/org/bukkit/DyeColor.java
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable; @@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;

View File

@@ -5,13 +5,13 @@ Subject: [PATCH] Add UnsafeValues#canPlaceItemOn
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 4fcafddf3792b66c618f91e04d102f374de565a8..716d5371c0ceb5b97c7008a6ac0c7ddf58b01a9f 100644 index 330e3013eda204aa9b33d5e1c3104e0b595abdbc..8093b81f00b84e292a1e6f76af9509ea178a7ab3 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -243,4 +243,17 @@ public interface UnsafeValues { @@ -287,4 +287,18 @@ public interface UnsafeValues {
*/ <A extends Keyed, M> io.papermc.paper.registry.tag.@Nullable Tag<A> getTag(io.papermc.paper.registry.tag.@NotNull TagKey<A> tagKey); // Paper - hack to get tags for non-server backed registries
boolean isCollidable(@org.jetbrains.annotations.NotNull Material material);
// Paper end ItemStack createEmptyStack(); // Paper - proxy ItemStack
+ +
+ // Parchment start + // Parchment start
+ /** + /**
@@ -25,4 +25,5 @@ index 4fcafddf3792b66c618f91e04d102f374de565a8..716d5371c0ceb5b97c7008a6ac0c7ddf
+ */ + */
+ java.util.concurrent.CompletableFuture<Boolean> canPlaceItemOn(@org.jetbrains.annotations.NotNull ItemStack item, @org.jetbrains.annotations.Nullable gg.projecteden.parchment.OptionalHumanEntity player, @org.jetbrains.annotations.NotNull org.bukkit.block.Block block, @org.jetbrains.annotations.NotNull org.bukkit.block.BlockFace face); + java.util.concurrent.CompletableFuture<Boolean> canPlaceItemOn(@org.jetbrains.annotations.NotNull ItemStack item, @org.jetbrains.annotations.Nullable gg.projecteden.parchment.OptionalHumanEntity player, @org.jetbrains.annotations.NotNull org.bukkit.block.Block block, @org.jetbrains.annotations.NotNull org.bukkit.block.BlockFace face);
+ // Parchment end + // Parchment end
+
} }

View File

@@ -5,14 +5,13 @@ Subject: [PATCH] Expose MCUtil Executors
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 56e261efa654e4a6872ccea28f0461df13845d13..be4471e5ac6645cb208cb68de2a7f278c9fa198c 100644 index c043d239c449bf4bb13a24467f2f6c67b4d28d2d..08d834ed5dcb7b281f9f0ed02c396992f62c80c6 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2105,4 +2105,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2226,6 +2226,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ @NotNull
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); UnsafeValues getUnsafe();
// Paper end
+
+ // Parchment start + // Parchment start
+ /** + /**
+ * Gets the executor which runs tasks on an asynchronous thread pool. + * Gets the executor which runs tasks on an asynchronous thread pool.
@@ -28,4 +27,7 @@ index 56e261efa654e4a6872ccea28f0461df13845d13..be4471e5ac6645cb208cb68de2a7f278
+ @NotNull + @NotNull
+ java.util.concurrent.Executor getMainExecutor(); + java.util.concurrent.Executor getMainExecutor();
+ // Parchment end + // Parchment end
} +
// Spigot start
public class Spigot {

View File

@@ -9,7 +9,7 @@ Will eventually (hopefully) be replaced by a more extensive Paper PR with suppor
diff --git a/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java diff --git a/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b40459a89d17 index 0000000000000000000000000000000000000000..ea17d99c7a1d70d88e2c439399cdb376b9dedf47
--- /dev/null --- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java +++ b/src/main/java/gg/projecteden/parchment/inventory/RecipeType.java
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
@@ -24,15 +24,15 @@ index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b404
+ */ + */
+ CRAFTING(false), + CRAFTING(false),
+ /** + /**
+ * Recipes for smelting an item inside of a furnace. + * Recipes for smelting an item inside a furnace.
+ */ + */
+ SMELTING(true), + SMELTING(true),
+ /** + /**
+ * Recipes for smelting an item inside of a blasting furnace. + * Recipes for smelting an item inside a blasting furnace.
+ */ + */
+ BLASTING(true), + BLASTING(true),
+ /** + /**
+ * Recipes for smelting an item inside of a smoker. + * Recipes for smelting an item inside a smoker.
+ */ + */
+ SMOKING(true), + SMOKING(true),
+ /** + /**
@@ -64,12 +64,12 @@ index 0000000000000000000000000000000000000000..28c01caa9d6379046f6af6612719b404
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index e8c0c853eb52d1473c20231660355f77b1f7e016..60172dd594e51351c8253446f6d8c1347920b2a0 100644 index 97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e..64c1287b7a668680e19f8c4c1a678abb0eb5d88e 100644
--- a/src/main/java/org/bukkit/World.java --- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java
@@ -3985,6 +3985,36 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -52,6 +52,36 @@ import org.jetbrains.annotations.Nullable;
@Nullable */
public DragonBattle getEnderDragonBattle(); public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, PersistentDataHolder, Keyed, net.kyori.adventure.audience.ForwardingAudience { // Paper
+ // Parchment start + // Parchment start
+ /** + /**
@@ -101,6 +101,6 @@ index e8c0c853eb52d1473c20231660355f77b1f7e016..60172dd594e51351c8253446f6d8c134
+ ItemStack smeltItem(@NotNull ItemStack toSmelt, gg.projecteden.parchment.inventory.@NotNull RecipeType recipeType); + ItemStack smeltItem(@NotNull ItemStack toSmelt, gg.projecteden.parchment.inventory.@NotNull RecipeType recipeType);
+ // Parchment end + // Parchment end
+ +
// Paper start
/** /**
* Represents various map environment types that a world may be * @return The amount of Entities in this world
*/

View File

@@ -20,7 +20,7 @@ index 2f07efac03f4d12fd2ae9a340d34cf92a90b6cfa..a16d681d5338fdb2a974a2c67dcc0155
+ * + *
+ * @return True if the entity is allowed to tick. + * @return True if the entity is allowed to tick.
+ */ + */
+ public boolean canTick(); + default boolean canTick() { return true; }
+ +
+ /** + /**
+ * Sets whether the hanging entity is allowed to tick. + * Sets whether the hanging entity is allowed to tick.
@@ -28,6 +28,6 @@ index 2f07efac03f4d12fd2ae9a340d34cf92a90b6cfa..a16d681d5338fdb2a974a2c67dcc0155
+ * + *
+ * @param tick True if the entity is allowed to tick. + * @param tick True if the entity is allowed to tick.
+ */ + */
+ public void setCanTick(boolean tick); + default void setCanTick(boolean tick) { throw new UnsupportedOperationException(); }
+ // Parchment end + // Parchment end
} }

View File

@@ -5,11 +5,11 @@ Subject: [PATCH] Add Player#getHiddenEntities API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index e07cf092c4a02e6a76cb9e4805203c72ae01580c..a8da42ea485bd213e0572acd688921aa0092530c 100644 index 9a6f2ed1eb9559789317e21226f67cb6f02c0761..14aee20cdbe0cb9a118582b605257115098760ac 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1440,6 +1440,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2097,6 +2097,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@org.jetbrains.annotations.ApiStatus.Experimental // Paper */
public boolean canSee(@NotNull Entity entity); public boolean canSee(@NotNull Entity entity);
+ // Parchment start + // Parchment start
@@ -19,10 +19,10 @@ index e07cf092c4a02e6a76cb9e4805203c72ae01580c..a8da42ea485bd213e0572acd688921aa
+ * @param plugin Plugin that has hidden entities + * @param plugin Plugin that has hidden entities
+ * @return a view of hidden entity UUIDs + * @return a view of hidden entity UUIDs
+ */ + */
+ @org.jetbrains.annotations.ApiStatus.Experimental + public java.util.@NotNull Set<java.util.UUID> getHiddenEntities(@NotNull Plugin plugin);
+ public java.util.@NotNull Set<UUID> getHiddenEntities(@NotNull Plugin plugin);
+ // Parchment end + // Parchment end
+ +
+
// Paper start
/** /**
* Checks to see if this player is currently flying or not. * Returns whether the {@code other} player is listed for {@code this}.
*

View File

@@ -5,128 +5,100 @@ Subject: [PATCH] Add Timings Events
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
index dd72a34eaa4bedd9ea0b92eaa79091b00eb4dd09..90f8f7a0996cf1a6f6b3e9eef0243b2d629a1214 100644 index e81d0bc309de877ed2b5da6122f55c162e9b5f10..d4d65c301df8f6b9945d636b5f0e623a8289a8bc 100644
--- a/src/main/java/co/aikar/timings/Timings.java --- a/src/main/java/co/aikar/timings/Timings.java
+++ b/src/main/java/co/aikar/timings/Timings.java +++ b/src/main/java/co/aikar/timings/Timings.java
@@ -23,6 +23,8 @@ @@ -145,8 +145,27 @@ public final class Timings {
*/
package co.aikar.timings;
+import co.aikar.timings.event.TimingsModifyEvent;
+import co.aikar.timings.event.TimingsModifyEvent.Action;
import com.google.common.base.Preconditions;
import com.google.common.collect.EvictingQueue;
import com.google.common.collect.Lists;
@@ -135,7 +137,24 @@ public final class Timings {
* @param enabled Should timings be reported * @param enabled Should timings be reported
*/ */
public static void setTimingsEnabled(boolean enabled) { public static void setTimingsEnabled(boolean enabled) {
+ // Parchment start
+ setTimingsEnabled(enabled, null); + setTimingsEnabled(enabled, null);
+ } + }
+ +
+ /** + /**
+ * <p>Sets whether or not the Spigot Timings system should be enabled</p> + * <p>Sets whether or not the Spigot Timings system should be enabled</p>
+ * + *
+ * Calls a {@link TimingsModifyEvent}, if cancelled the timings will not be reset + * Calls a {@link co.aikar.timings.event.TimingsModifyEvent}, if cancelled the timings will not be reset
+ * + *
+ * @param enabled Should timings be reported + * @param enabled Should timings be reported
+ * @param sender The sender asking to reset + * @param sender The sender asking to reset
+ */ + */
+ public static void setTimingsEnabled(boolean enabled, CommandSender sender) { + public static void setTimingsEnabled(boolean enabled, CommandSender sender) {
timingsEnabled = enabled; timingsEnabled = enabled;
warnAboutDeprecationOnEnable();
+ if (sender != null) { + if (sender != null) {
+ if (!new co.aikar.timings.event.TimingsModifyEvent(sender, Action.RESET).callEvent()) { + if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.RESET).callEvent()) {
+ return; + return;
+ } + }
+ } + }
+ // Parchment end
reset(); reset();
} }
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
index 3132dc98d26c54c5e46162e53aaed195d7335c8d..f44ec5789bc98d5558eee6cff39770b4192c3e3c 100644 index 95d87c9dbf2b237787294dfbe7fed87a36e6dedf..d8e0b7fba75c68495f30419258ddf88f1237df07 100644
--- a/src/main/java/co/aikar/timings/TimingsCommand.java --- a/src/main/java/co/aikar/timings/TimingsCommand.java
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java +++ b/src/main/java/co/aikar/timings/TimingsCommand.java
@@ -59,12 +59,14 @@ public class TimingsCommand extends BukkitCommand { @@ -65,10 +65,12 @@ public class TimingsCommand extends BukkitCommand {
} }
final String arg = args[0]; final String arg = args[0];
if ("on".equalsIgnoreCase(arg)) { if ("on".equalsIgnoreCase(arg)) {
- Timings.setTimingsEnabled(true); - Timings.setTimingsEnabled(true);
- sender.sendMessage(text("Enabled Timings & Reset")); + if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.ENABLE).callEvent()) return true; // Parchment
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.ENABLE).callEvent()) { + Timings.setTimingsEnabled(true, sender);
+ Timings.setTimingsEnabled(true, sender); sender.sendMessage(text("Enabled Timings & Reset"));
+ }
return true; return true;
} else if ("off".equalsIgnoreCase(arg)) { } else if ("off".equalsIgnoreCase(arg)) {
- Timings.setTimingsEnabled(false); + if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.DISABLE).callEvent()) return true; // Parchment
- sender.sendMessage(text("Disabled Timings")); Timings.setTimingsEnabled(false);
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.DISABLE).callEvent()) { sender.sendMessage(text("Disabled Timings"));
+ Timings.setTimingsEnabled(false, sender);
+ }
return true; return true;
} @@ -81,15 +83,18 @@ public class TimingsCommand extends BukkitCommand {
@@ -75,20 +77,22 @@ public class TimingsCommand extends BukkitCommand {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if ("verbon".equalsIgnoreCase(arg)) { if ("verbon".equalsIgnoreCase(arg)) {
- Timings.setVerboseTimingsEnabled(true); + if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_ON).callEvent()) return true; // Parchment
- sender.sendMessage(text("Enabled Verbose Timings")); Timings.setVerboseTimingsEnabled(true);
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_ON).callEvent()) { sender.sendMessage(text("Enabled Verbose Timings"));
+ Timings.setVerboseTimingsEnabled(true);
+ }
return true; return true;
} else if ("verboff".equalsIgnoreCase(arg)) { } else if ("verboff".equalsIgnoreCase(arg)) {
- Timings.setVerboseTimingsEnabled(false); + if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_OFF).callEvent()) return true; // Parchment
- sender.sendMessage(text("Disabled Verbose Timings")); Timings.setVerboseTimingsEnabled(false);
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.VERBOSE_OFF).callEvent()) { sender.sendMessage(text("Disabled Verbose Timings"));
+ Timings.setVerboseTimingsEnabled(false);
+ }
return true; return true;
} else if ("reset".equalsIgnoreCase(arg)) { } else if ("reset".equalsIgnoreCase(arg)) {
if (now - lastResetAttempt < 30000) { if (now - lastResetAttempt < 30000) {
- TimingsManager.reset(); + if (!new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.RESET).callEvent()) return true; // Parchment
- sender.sendMessage(text("Timings reset. Please wait 5-10 minutes before using /timings report.", NamedTextColor.RED)); TimingsManager.reset();
+ if (new co.aikar.timings.event.TimingsModifyEvent(sender, co.aikar.timings.event.TimingsModifyEvent.Action.RESET).callEvent()) { sender.sendMessage(text("Timings reset. Please wait 5-10 minutes before using /timings report.", NamedTextColor.RED));
+ TimingsManager.reset();
+ }
} else { } else {
lastResetAttempt = now;
- sender.sendMessage(text("WARNING: Timings v2 should not be reset. If you are experiencing lag, please wait 3 minutes and then issue a report. The best timings will include 10+ minutes, with data before and after your lag period. If you really want to reset, run this command again within 30 seconds.", NamedTextColor.RED));
}
} else if (
"paste".equalsIgnoreCase(arg) ||
diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java diff --git a/src/main/java/co/aikar/timings/TimingsReportListener.java b/src/main/java/co/aikar/timings/TimingsReportListener.java
index 34f4c02c3bdbe571a7efb1f8c61d8924b0c81268..093c1bc755061dc6f54e5dce1ef68fd027fc43a6 100644 index df066d6f8d55afbc0c1897c486d638657a5f8df9..e80b33ecf12815356356bea0e0ecd4da75a5a416 100644
--- a/src/main/java/co/aikar/timings/TimingsReportListener.java --- a/src/main/java/co/aikar/timings/TimingsReportListener.java
+++ b/src/main/java/co/aikar/timings/TimingsReportListener.java +++ b/src/main/java/co/aikar/timings/TimingsReportListener.java
@@ -58,7 +58,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa @@ -62,6 +62,7 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
@Override @Override
public void sendMessage(final @NotNull net.kyori.adventure.identity.Identity source, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { public void sendMessage(final @NotNull net.kyori.adventure.identity.Identity source, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) {
- net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type); + if (!new co.aikar.timings.event.TimingsMessageEvent(this.senders, message).callEvent()) return; // Parchment
+ if (new co.aikar.timings.event.TimingsMessageEvent(this.senders, message).callEvent()) { net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type);
+ net.kyori.adventure.audience.ForwardingAudience.super.sendMessage(source, message, type);
+ }
} }
@NotNull @@ -73,6 +74,7 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
@@ -69,7 +71,9 @@ public class TimingsReportListener implements net.kyori.adventure.audience.Forwa
@Override @Override
public void sendMessage(@NotNull String message) { public void sendMessage(@NotNull String message) {
- senders.forEach((sender) -> sender.sendMessage(message)); + if (!new co.aikar.timings.event.TimingsMessageEvent(this.senders, net.kyori.adventure.text.Component.text(message)).callEvent()) return; // Parchment
+ if (new co.aikar.timings.event.TimingsMessageEvent(this.senders, net.kyori.adventure.text.Component.text(message)).callEvent()) { senders.forEach((sender) -> sender.sendMessage(message));
+ senders.forEach((sender) -> sender.sendMessage(message));
+ }
} }
public void addConsoleIfNeeded() {
diff --git a/src/main/java/co/aikar/timings/event/TimingsEvent.java b/src/main/java/co/aikar/timings/event/TimingsEvent.java diff --git a/src/main/java/co/aikar/timings/event/TimingsEvent.java b/src/main/java/co/aikar/timings/event/TimingsEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..df78c90859999ec18c7b8758e0f1c71281e1abe4 index 0000000000000000000000000000000000000000..9ad67d72e6173d1629f862ca9fd13475950709f0
--- /dev/null --- /dev/null
+++ b/src/main/java/co/aikar/timings/event/TimingsEvent.java +++ b/src/main/java/co/aikar/timings/event/TimingsEvent.java
@@ -0,0 +1,34 @@ @@ -0,0 +1,36 @@
+package co.aikar.timings.event; +package co.aikar.timings.event;
+ +
+import org.bukkit.Bukkit; +import org.bukkit.Bukkit;
@@ -135,19 +107,21 @@ index 0000000000000000000000000000000000000000..df78c90859999ec18c7b8758e0f1c712
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
+ +
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set; +import java.util.Set;
+ +
+public abstract class TimingsEvent extends Event { +public abstract class TimingsEvent extends Event {
+ +
+ private final Set<CommandSender> audience; + private final @NotNull Set<CommandSender> audience;
+ private static final HandlerList handlers = new HandlerList(); + private static final HandlerList handlers = new HandlerList();
+ +
+ public TimingsEvent(Set<CommandSender> audience) { + public TimingsEvent(@NotNull Collection<CommandSender> audience) {
+ super(!Bukkit.isPrimaryThread()); + super(!Bukkit.isPrimaryThread());
+ this.audience = audience; + this.audience = new HashSet<>(audience);
+ } + }
+ +
+ public Set<CommandSender> getAudience() { + public @NotNull Set<CommandSender> getAudience() {
+ return this.audience; + return this.audience;
+ } + }
+ +
@@ -156,62 +130,65 @@ index 0000000000000000000000000000000000000000..df78c90859999ec18c7b8758e0f1c712
+ return handlers; + return handlers;
+ } + }
+ +
+ public static HandlerList getHandlerList() { + public static @NotNull HandlerList getHandlerList() {
+ return handlers; + return handlers;
+ } + }
+ +
+} +}
diff --git a/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java diff --git a/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..5ed7d1d4972842e93e2a9c2ffa799e6fc9136e63 index 0000000000000000000000000000000000000000..33152129508c526031eee68f2ae797563d97be0c
--- /dev/null --- /dev/null
+++ b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java +++ b/src/main/java/co/aikar/timings/event/TimingsGenerateReportEvent.java
@@ -0,0 +1,19 @@ @@ -0,0 +1,20 @@
+package co.aikar.timings.event; +package co.aikar.timings.event;
+ +
+import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender;
+import org.jetbrains.annotations.NotNull;
+ +
+import java.util.Collections; +import java.util.Collections;
+ +
+public class TimingsGenerateReportEvent extends TimingsEvent { +public class TimingsGenerateReportEvent extends TimingsEvent {
+ +
+ private final String paste; + private final @NotNull String paste;
+ +
+ public TimingsGenerateReportEvent(CommandSender sender, String paste) { + public TimingsGenerateReportEvent(@NotNull CommandSender sender, @NotNull String paste) {
+ super(Collections.singleton(sender)); + super(Collections.singleton(sender));
+ this.paste = paste; + this.paste = paste;
+ } + }
+ +
+ public String getPaste() { + public @NotNull String getPaste() {
+ return this.paste; + return this.paste;
+ } + }
+} +}
diff --git a/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java diff --git a/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..04ec925cfa9e385e8ad4763b18570b7bf07c4007 index 0000000000000000000000000000000000000000..626f25e164c6b23481c5a976a6e184e739104305
--- /dev/null --- /dev/null
+++ b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java +++ b/src/main/java/co/aikar/timings/event/TimingsMessageEvent.java
@@ -0,0 +1,33 @@ @@ -0,0 +1,35 @@
+package co.aikar.timings.event; +package co.aikar.timings.event;
+ +
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender;
+import org.bukkit.event.Cancellable; +import org.bukkit.event.Cancellable;
+import org.jetbrains.annotations.NotNull;
+ +
+import java.util.Collection;
+import java.util.HashSet; +import java.util.HashSet;
+import java.util.List; +import java.util.List;
+ +
+public class TimingsMessageEvent extends TimingsEvent implements Cancellable { +public class TimingsMessageEvent extends TimingsEvent implements Cancellable {
+ +
+ public Component message; + public @NotNull Component message;
+ private boolean cancelled; + private boolean cancelled;
+ +
+ public TimingsMessageEvent(List<CommandSender> senders, Component message) { + public TimingsMessageEvent(@NotNull Collection<CommandSender> senders, @NotNull Component message) {
+ super(new HashSet<>(senders)); + super(new HashSet<>(senders));
+ this.message = message; + this.message = message;
+ } + }
+ +
+ public Component getMessage() { + public @NotNull Component getMessage() {
+ return this.message; + return this.message;
+ } + }
+ +
@@ -227,28 +204,29 @@ index 0000000000000000000000000000000000000000..04ec925cfa9e385e8ad4763b18570b7b
+} +}
diff --git a/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java diff --git a/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..1fe9bbedf23fdf7b02de02f5d184d8d956c7056b index 0000000000000000000000000000000000000000..3faf845716d5d3adf360949f28a5e12aa7e20aa6
--- /dev/null --- /dev/null
+++ b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java +++ b/src/main/java/co/aikar/timings/event/TimingsModifyEvent.java
@@ -0,0 +1,40 @@ @@ -0,0 +1,41 @@
+package co.aikar.timings.event; +package co.aikar.timings.event;
+ +
+import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender;
+import org.bukkit.event.Cancellable; +import org.bukkit.event.Cancellable;
+import org.jetbrains.annotations.NotNull;
+ +
+import java.util.Collections; +import java.util.Collections;
+ +
+public class TimingsModifyEvent extends TimingsEvent implements Cancellable { +public class TimingsModifyEvent extends TimingsEvent implements Cancellable {
+ +
+ private final Action action; + private final @NotNull Action action;
+ private boolean cancelled = false; + private boolean cancelled = false;
+ +
+ public TimingsModifyEvent(CommandSender sender, Action action) { + public TimingsModifyEvent(@NotNull CommandSender sender, @NotNull Action action) {
+ super(Collections.singleton(sender)); + super(Collections.singleton(sender));
+ this.action = action; + this.action = action;
+ } + }
+ +
+ public Action getAction() { + public @NotNull Action getAction() {
+ return this.action; + return this.action;
+ } + }
+ +

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Expanded Insomnia API methods
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 1c42b484882a5e6f2c8276c428824b2cbf6a39e3..bce607d829c3ba45388ed31ef251bf19e2048ab4 100644 index 14aee20cdbe0cb9a118582b605257115098760ac..ddfe7859ad921343214d3d82ef01bcc57a35790d 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -50,6 +50,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -67,6 +67,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/ */
@Override @Override
@NotNull Player getPlayer(); @NotNull Player getPlayer();

View File

@@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Fri, 5 Aug 2022 19:09:51 -0400
Subject: [PATCH] Add NPC to EntityType
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
index 6905614c3d277a3a725554f02cc92d4b3430eecc..36023edd1db4185243ffc417fe59a09c104fbb47 100644
--- a/src/main/java/org/bukkit/entity/EntityType.java
+++ b/src/main/java/org/bukkit/entity/EntityType.java
@@ -305,6 +305,7 @@ public enum EntityType implements Keyed, Translatable, net.kyori.adventure.trans
/**
* An unknown entity without an Entity Class
*/
+ NPC("npc", NPC.class, -1, true),
UNKNOWN(null, null, -1, false);
private final String name;

View File

@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Wed, 15 Mar 2023 01:05:09 -0400
Subject: [PATCH] Revert BungeeChat Deprecation
diff --git a/build.gradle.kts b/build.gradle.kts
index f7786d4034afae1926bb249e282f3f204e09ba1a..f689a22e535bb007089b981fe803f1a6af4911c2 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -36,7 +36,7 @@ dependencies {
api("com.google.guava:guava:32.1.2-jre")
api("com.google.code.gson:gson:2.10.1")
// Paper start - adventure
- api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.18") {
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") { // Parchment - revert
exclude("com.google.guava", "guava")
}
// Paper - adventure
@@ -154,7 +154,7 @@ tasks.withType<Javadoc> {
"https://guava.dev/releases/32.1.2-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
"https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
- // "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat
// Paper start - add missing javadoc links
"https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
"https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",

View File

@@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 16 Mar 2023 23:10:47 -0400
Subject: [PATCH] Add PreEntityShootBowEvent
diff --git a/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java b/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..cd156e2d71728f8d30a12df87398875b1ec8915e
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/event/entity/PreEntityShootBowEvent.java
@@ -0,0 +1,61 @@
+package gg.projecteden.parchment.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+public class PreEntityShootBowEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ private final @NotNull ItemStack bow;
+ private final @NotNull ItemStack arrow;
+ boolean relative = true;
+ boolean cancelled = false;
+
+ public PreEntityShootBowEvent(@NotNull Entity entity, @NotNull ItemStack bow, @NotNull ItemStack arrow) {
+ super(entity);
+ this.bow = bow;
+ this.arrow = arrow;
+ }
+
+ public @NotNull ItemStack getBow() {
+ return this.bow;
+ }
+
+ public @NotNull ItemStack getArrow() {
+ return this.arrow;
+ }
+
+ public boolean isRelative() {
+ return this.relative;
+ }
+
+ public void setRelative(boolean relative) {
+ this.relative = relative;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Fri, 15 Dec 2023 20:29:34 -0500
Subject: [PATCH] Add Block BreakNaturally Overload
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 0015bb89899e52d3c8f1ca68807ad7092e690305..2c384d6c1719a3b2b1335a3f2b7e826c1892bd69 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -590,6 +590,20 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
*/
boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
+ // Parchment Start
+ /**
+ * Breaks the block and spawns item drops as if a player had broken it
+ * with a specific tool
+ *
+ * @param player The player to break the block as
+ * @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(Player player, @NotNull ItemStack tool, boolean triggerEffect, boolean dropExperience);
+ // Parchment end
+
/**
* Causes the block to be ticked, this is different from {@link Block#randomTick()},
* in that it is usually scheduled to occur, for example

View File

@@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 21 Dec 2023 20:26:53 -0500
Subject: [PATCH] Add CustomBlockUpdateEvent
diff --git a/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java b/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae798a18bb07d83bfd3acefc222a48e29f9a3ec3
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/event/block/CustomBlockUpdateEvent.java
@@ -0,0 +1,70 @@
+package gg.projecteden.parchment.event.block;
+
+import org.bukkit.block.data.BlockData;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.Location;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class CustomBlockUpdateEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+
+ private BlockData block;
+ private UpdateType updateType;
+ private Location location;
+
+ public CustomBlockUpdateEvent(BlockData block, UpdateType updateType, Location location) {
+ this.block = block;
+ this.updateType = updateType;
+ this.location = location;
+ }
+
+ public CustomBlockUpdateEvent(BlockData block, UpdateType updateType) {
+ this.block = block;
+ this.updateType = updateType;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ public BlockData getBlock() {
+ return block;
+ }
+
+ public UpdateType getUpdateType() {
+ return updateType;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public enum UpdateType {
+ POWERED,
+ SHAPE,
+ INSTRUMENT,
+ PITCH
+ }
+
+}

View File

@@ -0,0 +1,273 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 15 Jan 2024 16:38:52 -0500
Subject: [PATCH] Entity Data Storage
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityData.java b/src/main/java/gg/projecteden/parchment/entity/EntityData.java
new file mode 100644
index 0000000000000000000000000000000000000000..c4b2cd54c6c0d595e67b0fa0f05a32afa40328b3
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityData.java
@@ -0,0 +1,140 @@
+package gg.projecteden.parchment.entity;
+
+import org.bukkit.entity.Entity;
+
+import java.util.*;
+import java.util.function.Supplier;
+
+public final class EntityData {
+ private static final Map<UUID, List<DataSlot>> PARKED = new HashMap<>();
+ private static int DATA_IDX;
+
+ private final List<EntityDataFragment<?>> data = new ArrayList<>();
+ private final Class<?> ownerType;
+ private Entity owner;
+
+ EntityData(Class<?> ownerType) {
+ this.ownerType = ownerType;
+ }
+
+ public static <T extends EntityDataFragment<E>, E extends Entity> EntityDataKey<T, E> createKey(
+ Supplier<T> generator,
+ Class<E> ownerType
+ ) {
+ return new EntityDataKey<>(ownerType, generator, EntityData.DATA_IDX++);
+ }
+
+ public static EntityData create(Entity entity) {
+ EntityData data = new EntityData(entity.getClass());
+
+ List<DataSlot> slots = EntityData.PARKED.get(entity.getUniqueId());
+ if (slots != null) {
+ for (DataSlot slot : slots) {
+ data.set(slot.idx, slot.data);
+ }
+ }
+
+ data.setOwner(entity);
+
+ return data;
+ }
+
+ public <T extends EntityDataFragment<E>, E extends Entity> T get(EntityDataKey<T, E> key) {
+ while (this.data.size() <= key.getIdx()) {
+ this.data.add(null);
+ }
+
+ T out = cast(this.data.get(key.getIdx()));
+ if (out == null) {
+ this.checkEntityType(key.ownerType);
+
+ out = key.getGenerator().get();
+ out.setOwner(cast(this.owner));
+
+ this.data.set(key.getIdx(), out);
+ }
+
+ return out;
+ }
+
+ public <T extends EntityDataFragment<E>, E extends Entity> boolean clear(EntityDataKey<T, E> key) {
+ if (this.data.size() <= key.getIdx()) {
+ return false;
+ }
+
+ this.checkEntityType(key.ownerType);
+ return this.data.set(key.getIdx(), null) != null;
+ }
+
+ public void orphan() {
+ for (EntityDataFragment<?> frag : this.data) {
+ if (frag != null) {
+ frag.onOrphan();
+ }
+ }
+
+ List<DataSlot> persist = new ArrayList<>();
+
+ for (int i = this.data.size() - 1; i >= 0; i--) {
+ EntityDataFragment<?> frag = this.data.get(i);
+ if (frag != null && frag.isPersistent()) {
+ persist.add(new DataSlot(frag, i));
+ }
+ }
+
+ if (!persist.isEmpty()) {
+ EntityData.PARKED.put(this.owner.getUniqueId(), persist);
+ }
+ }
+
+ void set(int slot, EntityDataFragment<?> data) {
+ while (this.data.size() <= slot) {
+ this.data.add(null);
+ }
+
+ this.data.set(slot, data);
+ }
+
+ void setOwner(Entity entity) {
+ Class<?> ownerType = entity.getClass();
+ if (!ownerType.equals(this.ownerType)) {
+ throw new IllegalArgumentException(String.format(
+ "Wrong entity type. (entity=%s@%s, expect=%s@%s)",
+ ownerType, ownerType.getClassLoader(),
+ this.ownerType, this.ownerType.getClassLoader()
+ ));
+ }
+
+ this.owner = entity;
+
+ for (EntityDataFragment<?> frag : this.data) {
+ if (frag != null) {
+ frag.setOwner(cast(entity));
+ }
+ }
+ }
+
+ private void checkEntityType(Class<?> ownerType) {
+ if (!ownerType.isAssignableFrom(this.ownerType)) {
+ throw new IllegalArgumentException(String.format(
+ "Incompatible entity types. (key=%s@%s, expect=%s@%s)",
+ ownerType, ownerType.getClassLoader(),
+ this.ownerType, this.ownerType.getClassLoader()
+ ));
+ }
+ }
+
+ private <S, T> T cast(S src) {
+ return (T) src;
+ }
+
+ private static final class DataSlot {
+ private final EntityDataFragment<?> data;
+ private final int idx;
+
+ private DataSlot(EntityDataFragment<?> data, int idx) {
+ this.data = data;
+ this.idx = idx;
+ }
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataFragment.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataFragment.java
new file mode 100644
index 0000000000000000000000000000000000000000..c3d43c27a61155036e3f74e781da14ab0bc58d5f
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataFragment.java
@@ -0,0 +1,34 @@
+package gg.projecteden.parchment.entity;
+
+import org.bukkit.entity.Entity;
+
+public abstract class EntityDataFragment<E extends Entity> {
+ private E owner;
+ private boolean persistent = true;
+
+ protected EntityDataFragment() {
+ }
+
+ protected void onOwnerChange() {
+ }
+
+ protected void onOrphan() {
+ }
+
+ protected final E getOwner() {
+ return this.owner;
+ }
+
+ protected final void setPersistent(boolean persistent) {
+ this.persistent = persistent;
+ }
+
+ final boolean isPersistent() {
+ return this.persistent;
+ }
+
+ final void setOwner(E entity) {
+ this.owner = entity;
+ this.onOwnerChange();
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataKey.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..c52c8371b2edf4f62533ffcbc7f8d7b1dbc90777
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataKey.java
@@ -0,0 +1,27 @@
+package gg.projecteden.parchment.entity;
+
+import org.bukkit.entity.Entity;
+
+import java.util.function.Supplier;
+
+public final class EntityDataKey<T extends EntityDataFragment<E>, E extends Entity> {
+ private final Supplier<T> generator;
+ private final int idx;
+
+ final Class<E> ownerType;
+
+ EntityDataKey(Class<E> ownerType, Supplier<T> generator, int idx) {
+ this.generator = generator;
+ this.idx = idx;
+
+ this.ownerType = ownerType;
+ }
+
+ Supplier<T> getGenerator() {
+ return this.generator;
+ }
+
+ int getIdx() {
+ return this.idx;
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataServiceKey.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataServiceKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..c9f9c0d235f33925ee247ba4af56bf9f31bf7056
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataServiceKey.java
@@ -0,0 +1,30 @@
+package gg.projecteden.parchment.entity;
+
+public final class EntityDataServiceKey<S> {
+ private final Class<S> serviceType;
+ private S service;
+
+ public EntityDataServiceKey(Class<S> serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public S get() {
+ if (this.service == null) {
+ throw new IllegalStateException("Service is not initialized.");
+ }
+
+ return this.service;
+ }
+
+ public void set(S service) {
+ if (this.service != null) {
+ throw new IllegalStateException("Service is already initialized.");
+ }
+
+ if (!this.serviceType.isInstance(service)) {
+ throw new IllegalArgumentException("Value does not implement service contract.");
+ }
+
+ this.service = service;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 93506536af557bc9972c295ee3957fe0e3c22053..072567951ceecddb4f2bf269e6695b322d3a0f0e 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1159,4 +1159,7 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull String getScoreboardEntryName();
// Paper end - entity scoreboard name
+
+ gg.projecteden.parchment.entity.EntityData getStoredEntityData();
+
}

View File

@@ -0,0 +1,361 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 15 Jan 2024 20:53:14 -0500
Subject: [PATCH] Add Sidebar Utility
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/Sidebar.java b/src/main/java/gg/projecteden/parchment/sidebar/Sidebar.java
new file mode 100644
index 0000000000000000000000000000000000000000..b0c704387e566d76d097595c35d06d8e5cbe204f
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/Sidebar.java
@@ -0,0 +1,123 @@
+package gg.projecteden.parchment.sidebar;
+
+import gg.projecteden.parchment.entity.EntityData;
+import gg.projecteden.parchment.entity.EntityDataFragment;
+import gg.projecteden.parchment.entity.EntityDataKey;
+import org.bukkit.entity.Player;
+
+import java.util.Objects;
+
+public final class Sidebar extends EntityDataFragment<Player> {
+ private static final EntityDataKey<Sidebar, Player> DATA_KEY = EntityData.createKey(Sidebar::new, Player.class);
+
+ private final SidebarBuffer[] buffer = new SidebarBuffer[2];
+
+ private final StageImpl stage = new StageImpl();
+ private final Runnable layoutListener;
+
+ private SidebarLayout layout;
+
+ private boolean visible;
+ private int back;
+
+ public static Sidebar get(Player player) {
+ Objects.requireNonNull(player);
+
+ return player.getStoredEntityData().get(Sidebar.DATA_KEY);
+ }
+
+ private Sidebar() {
+ this.buffer[0] = SidebarBufferUtilSpec.IMPL_KEY.get().create("_sidebar_l");
+ this.buffer[1] = SidebarBufferUtilSpec.IMPL_KEY.get().create("_sidebar_r");
+
+ this.layoutListener = () -> {
+ this.layout.update(this.stage);
+ this.flush();
+ };
+
+ this.setPersistent(false);
+ }
+
+ public void applyLayout(SidebarLayout layout) {
+ if (this.layout != null) {
+ this.layout.unsubscribe(this.layoutListener);
+ this.buffer[this.back].clear();
+ }
+
+ this.layout = layout;
+
+ if (layout == null) {
+ this.hide();
+ } else {
+ layout.setup(this.stage);
+ this.flush();
+
+ layout.subscribe(this.layoutListener);
+ }
+ }
+
+ private void setTitle(String title) {
+ this.buffer[this.back].setTitle(title);
+ }
+
+ private void setLine(int idx, String value, String display) {
+ if (value == null) {
+ this.buffer[this.back].clearLine(idx);
+ } else {
+ this.buffer[this.back].setLine(idx, value, display);
+ }
+ }
+
+ private void flush() {
+ SidebarBuffer front = this.buffer[this.back];
+ SidebarBuffer back = this.buffer[this.back ^ 1];
+ boolean shouldShow = !this.visible;
+
+ if (front.hasDiverged(back)) {
+ front.pushChanges();
+
+ back.sync(front);
+ this.back ^= 1;
+
+ shouldShow = true;
+ }
+
+ if (shouldShow) {
+ front.setActive();
+ this.visible = true;
+ }
+ }
+
+ private void hide() {
+ SidebarBufferUtilSpec.IMPL_KEY.get().hideSidebar(this.getOwner());
+ this.visible = false;
+ }
+
+ @Override
+ protected void onOwnerChange() {
+ this.buffer[0].setOwner(this.getOwner());
+ this.buffer[1].setOwner(this.getOwner());
+
+ if (this.visible) {
+ this.buffer[this.back ^ 1].setActive();
+ }
+ }
+
+ private final class StageImpl implements SidebarStage {
+ @Override
+ public void setTitle(String title) {
+ Sidebar.this.setTitle(title);
+ }
+
+ @Override
+ public void setLine(int line, String value) {
+ this.setLine(line, value, null);
+ }
+
+ @Override
+ public void setLine(int line, String value, String display) {
+ Sidebar.this.setLine(line, value, display);
+ }
+
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBuffer.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBuffer.java
new file mode 100644
index 0000000000000000000000000000000000000000..ec13738dc625464d7fa41484ee44583ef82248fd
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBuffer.java
@@ -0,0 +1,100 @@
+package gg.projecteden.parchment.sidebar;
+
+import org.bukkit.entity.Player;
+
+import java.util.Arrays;
+import java.util.Objects;
+
+public abstract class SidebarBuffer {
+
+ @SuppressWarnings("StringOperationCanBeSimplified")
+ private static final String AUTO_SPACE = new String();
+ protected final String name;
+ protected final int size;
+ protected final String[] liveLines;
+ protected final String[] stagedLines;
+ protected final String[] liveDisplays;
+ protected final String[] stagedDisplays;
+
+ protected String liveTitle = "";
+ protected String stagedTitle = "";
+
+ protected SidebarBuffer(String name, int size) {
+ this.name = name;
+ this.size = size;
+ this.liveLines = new String[size];
+ this.stagedLines = new String[size];
+ this.liveDisplays = new String[size];
+ this.stagedDisplays = new String[size];
+ }
+
+ protected abstract void setActive();
+
+ protected abstract void pushChanges();
+
+ protected abstract void setOwner(Player player);
+
+ protected abstract boolean checkTitle(String title);
+
+ protected abstract boolean checkLine(String line);
+
+ void setTitle(String title) {
+ this.stagedTitle = Objects.requireNonNullElse(title, "");
+ }
+
+ void setLine(int line, String value, String display) {
+ Objects.requireNonNull(value);
+ if (line < 0 || line > this.size - 1) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ this.stagedLines[line] = value;
+ this.stagedDisplays[line] = display;
+
+ for (int i = line - 1; i >= 0; i--) {
+ if (this.stagedLines[i] == null) {
+ this.stagedLines[i] = SidebarBuffer.AUTO_SPACE;
+ } else {
+ break;
+ }
+ }
+ }
+
+ void clearLine(int line) {
+ if (line < 0 || line > this.size - 1) {
+ throw new IndexOutOfBoundsException();
+ }
+
+ this.stagedLines[line] = SidebarBuffer.AUTO_SPACE;
+
+ if (line + 1 == this.size || this.stagedLines[line + 1] == null) {
+ for (int i = line; i >= 0; i--) {
+ if (this.stagedLines[i] == SidebarBuffer.AUTO_SPACE) {
+ this.stagedLines[i] = null;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+ void sync(SidebarBuffer live) {
+ this.stagedTitle = live.liveTitle;
+ System.arraycopy(live.liveLines, 0, this.stagedLines, 0, this.size);
+ System.arraycopy(live.liveDisplays, 0, this.stagedDisplays, 0, this.size);
+ }
+
+ void clear() {
+ this.stagedTitle = "";
+ Arrays.fill(this.stagedLines, null);
+ Arrays.fill(this.stagedDisplays, null);
+ }
+
+ boolean hasDiverged(SidebarBuffer live) {
+ boolean out = !Objects.equals(this.stagedTitle, live.liveTitle);
+ out = out || !Arrays.equals(this.stagedLines, live.liveLines);
+ out = out || !Arrays.equals(this.stagedDisplays, live.liveDisplays);
+
+ return out;
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtilSpec.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtilSpec.java
new file mode 100644
index 0000000000000000000000000000000000000000..22239d7ea5d632f306caba0d139fe1576e85a7dc
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtilSpec.java
@@ -0,0 +1,12 @@
+package gg.projecteden.parchment.sidebar;
+
+import gg.projecteden.parchment.entity.EntityDataServiceKey;
+import org.bukkit.entity.Player;
+
+public interface SidebarBufferUtilSpec {
+ EntityDataServiceKey<SidebarBufferUtilSpec> IMPL_KEY = new EntityDataServiceKey<>(SidebarBufferUtilSpec.class);
+
+ SidebarBuffer create(String bufferName);
+
+ void hideSidebar(Player player);
+}
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarLayout.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarLayout.java
new file mode 100644
index 0000000000000000000000000000000000000000..238d2c1338aee95b24fd31c9643e0f966fe0b79f
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarLayout.java
@@ -0,0 +1,58 @@
+package gg.projecteden.parchment.sidebar;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A sidebar layout. Subclasses can describe custom layouts by using the
+ * {@link #setup(SidebarStage)} and {@link #update(SidebarStage)} hooks.
+ */
+public abstract class SidebarLayout {
+ private final Set<Runnable> subscribers = new HashSet<>();
+
+ /**
+ * Pushes an update to all subscribers.
+ */
+ public final void refresh() {
+ synchronized (this.subscribers) {
+ for (Runnable s : this.subscribers) {
+ s.run();
+ }
+ }
+ }
+
+ /**
+ * Runs when the layout is first applied.
+ *
+ * <p> The provided sidebar stage may be used to create the first
+ * frame of sidebar data, which will be pushed to the client upon
+ * exit of this method.
+ *
+ * @param stage The sidebar stage. Using it outside this method will
+ * result in undefined behavior.
+ */
+ protected void setup(SidebarStage stage) {
+ }
+
+ /**
+ * Runs when a refresh is requested.
+ *
+ * <p> The provided sidebar stage may be used to update the existing
+ * sidebar data, which will be pushed to the client upon exit of
+ * this method. Sidebar data from previous hook calls will stay the
+ * same unless explicitly changed here.
+ *
+ * @param stage The sidebar stage. Using it outside this method will
+ * result in undefined behavior.
+ */
+ protected void update(SidebarStage stage) {
+ }
+
+ final void subscribe(Runnable listener) {
+ this.subscribers.add(listener);
+ }
+
+ final void unsubscribe(Runnable listener) {
+ this.subscribers.remove(listener);
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarStage.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarStage.java
new file mode 100644
index 0000000000000000000000000000000000000000..9e604d3b8183abe342ef5c055069f1c4b16df55c
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarStage.java
@@ -0,0 +1,32 @@
+package gg.projecteden.parchment.sidebar;
+
+/**
+ * An abstracted sidebar stage.
+ */
+public interface SidebarStage {
+ /**
+ * Stages a new title.
+ *
+ * @param title The new title.
+ */
+ void setTitle(String title);
+
+ /**
+ * Stages a new line at the provided index.
+ *
+ * @param line The line index.
+ * @param value The new line.
+ */
+ void setLine(int line, String value);
+
+ /**
+ * Stages a new line at the provided index
+ * Uses the display as the right aligned text
+ *
+ * @param line The line index
+ * @param value The new line
+ * @param display The right aligned text
+ */
+ void setLine(int line, String value, String display);
+
+}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Expose NMS ordinals
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 716d5371c0ceb5b97c7008a6ac0c7ddf58b01a9f..16a332a6f8dad6a2758fd2bf3ab37637b9f26711 100644 index 3ed52d016314c01293530fa760fa5faaf59586ed..f93672ebb76664c5a71030b72966c6b13e107246 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -255,5 +255,12 @@ public interface UnsafeValues { @@ -257,5 +257,12 @@ public interface UnsafeValues {
* @return if the item can be placed * @return if the item can be placed
*/ */
java.util.concurrent.CompletableFuture<Boolean> canPlaceItemOn(@org.jetbrains.annotations.NotNull ItemStack item, @org.jetbrains.annotations.Nullable gg.projecteden.parchment.OptionalHumanEntity player, @org.jetbrains.annotations.NotNull org.bukkit.block.Block block, @org.jetbrains.annotations.NotNull org.bukkit.block.BlockFace face); java.util.concurrent.CompletableFuture<Boolean> canPlaceItemOn(@org.jetbrains.annotations.NotNull ItemStack item, @org.jetbrains.annotations.Nullable gg.projecteden.parchment.OptionalHumanEntity player, @org.jetbrains.annotations.NotNull org.bukkit.block.Block block, @org.jetbrains.annotations.NotNull org.bukkit.block.BlockFace face);

View File

@@ -5,28 +5,29 @@ Subject: [PATCH] Expose EntityType Ordinals
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index ac0f0a4da4282c13f6e1f37710cb615d66b8ef2c..aa98cea349a3929cbb29fa01962ae98d9136cda7 100644 index ceacc0d383e2ee674783d3c0a7df0a951595faca..72b5ce4c93c021ca2f3f1d65b45fdd8cd50d71f4 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -154,6 +154,8 @@ import org.slf4j.Logger; @@ -162,6 +162,8 @@ import org.slf4j.Logger;
public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> { public class EntityType<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
+ private static int ordinal = 0; // Parchment + private static int ordinal = 0; // Parchment
+ private static final java.util.Map<EntityType, Integer> ordinals = new java.util.HashMap<>(); // Parchment + private static final java.util.Map<EntityType, Integer> ordinals = new java.util.HashMap<>(); // Parchment
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
public static final String ENTITY_TAG = "EntityTag"; public static final String ENTITY_TAG = "EntityTag";
private final Holder.Reference<EntityType<?>> builtInRegistryHolder; private final Holder.Reference<EntityType<?>> builtInRegistryHolder;
@@ -294,9 +296,31 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> { @@ -310,9 +312,32 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
private final EntityDimensions dimensions; private final FeatureFlagSet requiredFeatures;
private static <T extends Entity> EntityType<T> register(String id, EntityType.Builder type) { // CraftBukkit - decompile error private static <T extends Entity> EntityType<T> register(String id, EntityType.Builder type) { // CraftBukkit - decompile error
- return (EntityType) Registry.register(Registry.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error - return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
+ // return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
+ // Parchment start + // Parchment start
+ EntityType build = type.build(id); + EntityType build = type.build(id);
+ ordinals.put(build, ordinal); + ordinals.put(build, ordinal);
+ ordinal += 1; + ordinal += 1;
+ return (EntityType) Registry.register(Registry.ENTITY_TYPE, id, (EntityType<T>) build); + return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) build);
} }
+ public int ordinal() { + public int ordinal() {
@@ -38,25 +39,25 @@ index ac0f0a4da4282c13f6e1f37710cb615d66b8ef2c..aa98cea349a3929cbb29fa01962ae98d
+ if (this == o) return true; + if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false; + if (o == null || getClass() != o.getClass()) return false;
+ EntityType<?> that = (EntityType<?>) o; + EntityType<?> that = (EntityType<?>) o;
+ return id.equals(that.id); + return this.builtInRegistryHolder.key().toString().equals(that.builtInRegistryHolder.key().toString());
+ } + }
+ +
+ @Override + @Override
+ public int hashCode() { + public int hashCode() {
+ return java.util.Objects.hash(id); + return java.util.Objects.hash(this.builtInRegistryHolder.key().toString());
+ } + }
+ // Parchment end + // Parchment end
+ +
public static ResourceLocation getKey(EntityType<?> type) { public static ResourceLocation getKey(EntityType<?> type) {
return Registry.ENTITY_TYPE.getKey(type); return BuiltInRegistries.ENTITY_TYPE.getKey(type);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index ee4d1e3f0be4ac94bb03263425b2acfa97a85c0d..840017182f0c75af07bd461d59fc340b3c304b8a 100644 index be2739875ba1ba1a973c4a45c7e6a6996f0daf31..a6eab579c0f4cc6039bdd9914dd770c796b75d3c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -653,6 +653,18 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -665,6 +665,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
final net.minecraft.world.item.context.BlockPlaceContext ctx = context; final net.minecraft.world.item.context.BlockPlaceContext ctx = context;
return future.completeAsync(() -> blockItem.canPlace(ctx, blockState), net.minecraft.server.MCUtil.MAIN_EXECUTOR); return future.completeAsync(() -> blockItem.canPlace(ctx, blockState), io.papermc.paper.util.MCUtil.MAIN_EXECUTOR);
} }
+ +
+ @Override + @Override

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Fix missing CraftMetaSkull serializedProfile
Plugins (ab)using NMS may change the "profile" field using reflections instead of the "setProfile" method, especially if they are targeted towards old Minecraft versions. This fixes the potential discrepancies and NPEs. Plugins (ab)using NMS may change the "profile" field using reflections instead of the "setProfile" method, especially if they are targeted towards old Minecraft versions. This fixes the potential discrepancies and NPEs.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 292ae4a68093b7d939a755e1062cee57da186ab1..4afa90cb68aa31820abce6ab051de405daef6562 100644 index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..fe48cb0fbf3b510b365bed06d84c0c62edd1ad19 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -80,6 +80,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { @@ -133,6 +133,11 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
private void setProfile(GameProfile profile) { private void setProfile(GameProfile profile) {
this.profile = profile; this.profile = profile;
@@ -21,7 +21,7 @@ index 292ae4a68093b7d939a755e1062cee57da186ab1..4afa90cb68aa31820abce6ab051de405
this.serializedProfile = (profile == null) ? null : NbtUtils.writeGameProfile(new CompoundTag(), profile); this.serializedProfile = (profile == null) ? null : NbtUtils.writeGameProfile(new CompoundTag(), profile);
} }
@@ -88,6 +93,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { @@ -141,6 +146,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
super.applyToItem(tag); super.applyToItem(tag);
if (this.profile != null) { if (this.profile != null) {
@@ -29,12 +29,12 @@ index 292ae4a68093b7d939a755e1062cee57da186ab1..4afa90cb68aa31820abce6ab051de405
// SPIGOT-6558: Set initial textures // SPIGOT-6558: Set initial textures
tag.put(SKULL_OWNER.NBT, serializedProfile); tag.put(SKULL_OWNER.NBT, serializedProfile);
// Fill in textures // Fill in textures
@@ -243,6 +249,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { @@ -303,6 +309,8 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
if (meta instanceof CraftMetaSkull) { if (meta instanceof CraftMetaSkull) {
CraftMetaSkull that = (CraftMetaSkull) meta; CraftMetaSkull that = (CraftMetaSkull) meta;
+ refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS + refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
+ that.refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS + that.refreshSerializedProfile(); // Parchment -- fix NPEs from plugins abusing NMS
// SPIGOT-5403: equals does not check properties // SPIGOT-5403: equals does not check properties
return (this.profile != null ? that.profile != null && this.serializedProfile.equals(that.serializedProfile) : that.profile == null); return (this.profile != null ? that.profile != null && this.serializedProfile.equals(that.serializedProfile) : that.profile == null) && Objects.equals(this.noteBlockSound, that.noteBlockSound);
} }

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Sun, 19 Mar 2023 17:32:26 -0400
Subject: [PATCH] Lookup plugin dependencies during runtime
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java
index bfa258faf17ca6118aeddfa4e95bbd082bcd1390..c106c26ccd673e46c5ae9415096923b66efd8af2 100644
--- a/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/dependency/DependencyUtil.java
@@ -2,6 +2,7 @@ package io.papermc.paper.plugin.entrypoint.dependency;
import com.google.common.graph.MutableGraph;
import io.papermc.paper.plugin.configuration.PluginMeta;
+import io.papermc.paper.plugin.manager.PaperPluginManagerImpl;
import io.papermc.paper.plugin.provider.PluginProvider;
import io.papermc.paper.plugin.provider.configuration.LoadOrderConfiguration;
import org.bukkit.plugin.PluginDescriptionFile;
@@ -65,7 +66,7 @@ public class DependencyUtil {
public static List<String> validateSimple(PluginMeta meta, Map<String, PluginProvider<?>> toLoad) {
List<String> missingDependencies = new ArrayList<>();
for (String hardDependency : meta.getPluginDependencies()) {
- if (!toLoad.containsKey(hardDependency)) {
+ if (!toLoad.containsKey(hardDependency) && !PaperPluginManagerImpl.getInstance().isPluginEnabled(hardDependency)) {
missingDependencies.add(hardDependency);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,16 +4,33 @@ Date: Sat, 19 Jun 2021 18:03:59 -0400
Subject: [PATCH] Temporary Access Transformers Subject: [PATCH] Temporary Access Transformers
diff --git a/src/main/java/net/minecraft/core/Holder.java b/src/main/java/net/minecraft/core/Holder.java
index d7bbf60ba94ecd85f991a0c5c70c34fdb00ec9d5..724adc4c35aece988af815e7886fcbd727f0e27e 100644
--- a/src/main/java/net/minecraft/core/Holder.java
+++ b/src/main/java/net/minecraft/core/Holder.java
@@ -137,6 +137,12 @@ public interface Holder<T> {
return new Holder.Reference<>(Holder.Reference.Type.INTRUSIVE, owner, null, value);
}
+ // Parchment start
+ public static <T> Holder.Reference<T> create(HolderOwner<T> owner, @Nullable ResourceKey<T> registryKey, @Nullable T value) {
+ return new Holder.Reference<>(Holder.Reference.Type.STAND_ALONE, owner, registryKey, value);
+ }
+ // Parchment end
+
public ResourceKey<T> key() {
if (this.key == null) {
throw new IllegalStateException("Trying to access unbound value '" + this.value + "' from registry " + this.owner);
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index 8f3b9b8784f0d7b137a1ad87655ee8bad801b59d..5153ae98bd80697a0e8bc71e5484c1f4f2817fe2 100644 index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..45a5f63268ebd67d6601e86e33f9fa5fd458ad0c 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java --- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -205,7 +205,7 @@ public class BlockItem extends Item { @@ -183,7 +183,7 @@ public class BlockItem extends Item {
}).orElse(state); }
} }
- protected boolean canPlace(BlockPlaceContext context, BlockState state) { - protected boolean canPlace(BlockPlaceContext context, BlockState state) {
+ public boolean canPlace(BlockPlaceContext context, BlockState state) { // Parchment + public boolean canPlace(BlockPlaceContext context, BlockState state) { // Parchment: protected -> public
Player entityhuman = context.getPlayer(); Player entityhuman = context.getPlayer();
CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman); CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman);
// CraftBukkit start - store default return // CraftBukkit start - store default return

View File

@@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..44245b61f64e4e2eb21ac4f5e540aa9a
+ } + }
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
index 3f25a9b1a74cfa0c9a4d0379ecda109d99f33db3..b954cda43afbfd367f7f8f436dca65f900706ccb 100644 index 22fe529890f34f66534c01248f654dc911b44c3b..dfa777529d3eb3cc0a6713c58b91b74cff25bc0e 100644
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java --- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -302,6 +302,32 @@ public final class PaperAdventure { @@ -364,6 +364,40 @@ public final class PaperAdventure {
return asVanilla(source); return asVanilla(source);
} }
@@ -62,8 +62,16 @@ index 3f25a9b1a74cfa0c9a4d0379ecda109d99f33db3..b954cda43afbfd367f7f8f436dca65f9
+ }; + };
+ } + }
+ +
+ public static java.util.Optional<net.minecraft.sounds.SoundEvent> asVanillaSound(final Key key) { + public static Optional<SoundEvent> asVanillaSound(final Key key) {
+ return net.minecraft.core.Registry.SOUND_EVENT.getOptional(asVanilla(key)); + return BuiltInRegistries.SOUND_EVENT.getOptional(asVanilla(key));
+ }
+
+ public static Optional<Holder.Reference<SoundEvent>> asSoundHolder(final net.minecraft.resources.ResourceKey<SoundEvent> key) {
+ return BuiltInRegistries.SOUND_EVENT.getHolder(key);
+ }
+
+ public static Optional<Holder.Reference<net.minecraft.sounds.SoundEvent>> asVanillaSoundHolder(final Key key) {
+ return asSoundHolder(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.SOUND_EVENT, asVanilla(key)));
+ } + }
+ +
+ @SuppressWarnings("PatternValidation") + @SuppressWarnings("PatternValidation")
@@ -72,29 +80,32 @@ index 3f25a9b1a74cfa0c9a4d0379ecda109d99f33db3..b954cda43afbfd367f7f8f436dca65f9
+ } + }
+ // Parchment end + // Parchment end
+ +
// NBT public static Packet<?> asSoundPacket(final Sound sound, final double x, final double y, final double z, final long seed, @Nullable BiConsumer<Packet<?>, Float> packetConsumer) {
final ResourceLocation name = asVanilla(sound.name());
public static @Nullable BinaryTagHolder asBinaryTagHolder(final @Nullable CompoundTag tag) { final Optional<SoundEvent> soundEvent = BuiltInRegistries.SOUND_EVENT.getOptional(name);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 083349794d5ceb50322c5a645dd33fbfcc1c8155..12c27ed2ed3a31a26663d78b6429146d384ec0b1 100644 index 2fe9d9b38c01d04416843fdd48d3e33899b7de63..4d496c5fbf7f7431ac908f40b98578b6123e0d35 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1542,12 +1542,40 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1645,12 +1645,46 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@Override @Override
public void playSeededSound(@Nullable Player except, double x, double y, double z, SoundEvent sound, SoundSource category, float volume, float pitch, long seed) { public void playSeededSound(@Nullable Player source, double x, double y, double z, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) {
- this.server.getPlayerList().broadcast(except, x, y, z, (double) sound.getRange(volume), this.dimension(), new ClientboundSoundPacket(sound, category, x, y, z, volume, pitch, seed)); - this.server.getPlayerList().broadcast(source, x, y, z, (double) ((SoundEvent) sound.value()).getRange(volume), this.dimension(), new ClientboundSoundPacket(sound, category, x, y, z, volume, pitch, seed));
+ // Parchment start - sound event + // Parchment start - sound event
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent( + CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
+ except == null ? null : except.getBukkitEntity(), + source == null ? null : source.getBukkitEntity(),
+ net.kyori.adventure.sound.Sound.sound( + net.kyori.adventure.sound.Sound.sound()
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(sound.getLocation()), + .type(sound.unwrap().<net.kyori.adventure.key.Key>map(
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category), + key -> io.papermc.paper.adventure.PaperAdventure.asAdventure(key.location()),
+ volume, + soundEvent -> io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEvent.getLocation())
+ pitch + ))
+ ), + .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
+ .volume(volume)
+ .pitch(pitch)
+ .seed(seed)
+ .build(),
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(this, x, y, z), + gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(this, x, y, z),
+ seed,
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION, + gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION,
+ null + null
+ )); + ));
@@ -102,19 +113,22 @@ index 083349794d5ceb50322c5a645dd33fbfcc1c8155..12c27ed2ed3a31a26663d78b6429146d
} }
@Override @Override
public void playSeededSound(@Nullable Player except, Entity entity, SoundEvent sound, SoundSource category, float volume, float pitch, long seed) { public void playSeededSound(@Nullable Player source, Entity entity, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) {
- this.server.getPlayerList().broadcast(except, entity.getX(), entity.getY(), entity.getZ(), (double) sound.getRange(volume), this.dimension(), new ClientboundSoundEntityPacket(sound, category, entity, volume, pitch, seed)); - this.server.getPlayerList().broadcast(source, entity.getX(), entity.getY(), entity.getZ(), (double) ((SoundEvent) sound.value()).getRange(volume), this.dimension(), new ClientboundSoundEntityPacket(sound, category, entity, volume, pitch, seed));
+ // Parchment start - sound event + // Parchment start - sound event
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent( + CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
+ except == null ? null : except.getBukkitEntity(), + source == null ? null : source.getBukkitEntity(),
+ net.kyori.adventure.sound.Sound.sound( + net.kyori.adventure.sound.Sound.sound()
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(sound.getLocation()), + .type(sound.unwrap().<net.kyori.adventure.key.Key>map(
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category), + key -> io.papermc.paper.adventure.PaperAdventure.asAdventure(key.location()),
+ volume, + soundEvent -> io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEvent.getLocation())
+ pitch + ))
+ ), + .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
+ .volume(volume)
+ .pitch(pitch)
+ .seed(seed)
+ .build(),
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(entity), + gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(entity),
+ seed,
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION, + gg.projecteden.parchment.event.sound.ParchmentSoundEvent.DISTANCE_FUNCTION,
+ null + null
+ )); + ));
@@ -123,143 +137,122 @@ index 083349794d5ceb50322c5a645dd33fbfcc1c8155..12c27ed2ed3a31a26663d78b6429146d
@Override @Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 94944ba458178f9e5b772224da329bb5d85f4394..39dbf7633cfdbd8eb89450d43d71d7f0def152a9 100644 index 763cffdc2e1e2e7cc9af88cc46bbaa240a20fd0d..73f788c8140fb2992beba1f825ac227c962abe64 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2217,7 +2217,19 @@ public class ServerPlayer extends Player { @@ -2560,7 +2560,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@Override @Override
public void playNotifySound(SoundEvent event, SoundSource category, float volume, float pitch) { public void playNotifySound(SoundEvent sound, SoundSource category, float volume, float pitch) {
- this.connection.send(new ClientboundSoundPacket(event, category, this.getX(), this.getY(), this.getZ(), volume, pitch, this.random.nextLong())); - this.connection.send(new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(sound), category, this.getX(), this.getY(), this.getZ(), volume, pitch, this.random.nextLong()));
+ // Parchment start - sound event + // Parchment start - sound event
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent( + CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
+ null, + null,
+ net.kyori.adventure.sound.Sound.sound( + net.kyori.adventure.sound.Sound.sound()
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(event.getLocation()), + .type(io.papermc.paper.adventure.PaperAdventure.asAdventure(sound.getLocation()))
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(category), + .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(category))
+ volume, + .volume(volume)
+ pitch + .pitch(pitch)
+ ), + .seed(this.random.nextLong())
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(level, getX(), getY(), getZ()), + .build(),
+ this.random.nextLong(), sound -> 0d, soundEvent -> java.util.Collections.singletonList(getBukkitEntity()) + gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(level(), getX(), getY(), getZ()),
+ _sound -> 0d, soundEvent -> java.util.Collections.singletonList(getBukkitEntity())
+ )); + ));
+ // Parchment end + // Parchment end
} }
@Override @Override
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 37d8a797bb590c30bf42ab04128489a9390684d3..00c435d8a98cdc2c3d82fe83f8952e17db02eaf7 100644 index 43eeb8ce4bc350c2b524ade11ca25d8d4d21bea5..e37555cf68b6c7108297d98cd84616bad9009bd7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -978,7 +978,7 @@ public abstract class PlayerList { @@ -907,6 +907,9 @@ public abstract class PlayerList {
if (flag2 && !isLocAltered) { isBedSpawn = true;
BlockState data = worldserver1.getBlockState(blockposition); }
worldserver1.setBlock(blockposition, data.setValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE, data.getValue(net.minecraft.world.level.block.RespawnAnchorBlock.CHARGE) - 1), 3); // Paper end - Add PlayerPostRespawnEvent
- entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) location.getX(), (double) location.getY(), (double) location.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong())); + entityplayer1.playNotifySound(SoundEvents.RESPAWN_ANCHOR_DEPLETE.value(), SoundSource.BLOCKS, 1.0F, 1.0F); // Parchment - use existing play sound method
+ entityplayer1.playNotifySound(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, 1.0F, 1.0F); // Parchment - use existing play sound method + // Paper end - Fix SPIGOT-5989
// Paper end +
} }
// Added from changeDimension // Added from changeDimension
this.sendAllPlayerInfo(entityplayer); // Update health, etc...
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 9b131f0a827413e9f5d6d0f7491c5481576cb8b1..7d982b7735c09d87d139c34d1cda5cbfb5327c5f 100644 index 09bcbc0ae36e4e69fee87a7e0c49acf496117a39..a4b7229f0de89c315fcf0ecdeeb0ff743d1b05fa 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1908,7 +1908,21 @@ public abstract class Player extends LivingEntity { @@ -1894,9 +1894,23 @@ public abstract class Player extends LivingEntity {
}
// Paper start - send while respecting visibility
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself - fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity itself
if (fromEntity instanceof ServerPlayer) { - if (fromEntity instanceof ServerPlayer serverPlayer) {
- ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); - serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
+ fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
+ if (fromEntity instanceof ServerPlayer) {
+ // Parchment start - sound event + // Parchment start - sound event
+ CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent( + CraftEventFactory.playSoundEvent(new gg.projecteden.parchment.event.sound.SoundEvent(
+ null, + null,
+ net.kyori.adventure.sound.Sound.sound( + net.kyori.adventure.sound.Sound.sound()
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEffect.getLocation()), + .type(io.papermc.paper.adventure.PaperAdventure.asAdventure(soundEffect.getLocation()))
+ io.papermc.paper.adventure.PaperAdventure.asAdventure(soundCategory), + .source(io.papermc.paper.adventure.PaperAdventure.asAdventure(soundCategory))
+ volume, + .volume(volume)
+ pitch + .pitch(pitch)
+ ), + .seed(fromEntity.random.nextLong())
+ gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(fromEntity.level, x, y, z), + .build(),
+ fromEntity.random.nextLong(), + gg.projecteden.parchment.event.sound.ParchmentSoundEvent.createEmitter(fromEntity.level(), x, y, z),
+ sound -> 0d, + sound -> 0d,
+ soundEvent -> java.util.Collections.singletonList(((ServerPlayer) fromEntity).getBukkitEntity()) + soundEvent -> java.util.Collections.singletonList(((ServerPlayer) fromEntity).getBukkitEntity())
+ )); + ));
+ // Parchment end + // Parchment end
} }
} }
// Paper end // Paper end - send while respecting visibility
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
index 6a0a1731fd6804eb69d3641213712d31bce085b2..81819d12e0becde85b6d66f3b3ffedde847a72f6 100644 index dcbef04bbaab988096bf416163264833e84d1967..4117f12172d1d67283fab21851bf2d1c167da1cb 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java --- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
@@ -526,7 +526,7 @@ public class Raid { @@ -561,7 +561,7 @@ public class Raid {
float f = 13.0F;
boolean flag = true;
Collection<ServerPlayer> collection = this.raidEvent.getPlayers();
- long i = this.random.nextLong();
+ //long i = this.random.nextLong(); // Parchment - remove redundant variable
Iterator iterator = this.level.players().iterator();
while (iterator.hasNext()) {
@@ -538,7 +538,7 @@ public class Raid {
double d2 = vec3d.z + 13.0D / d0 * (vec3d1.z - vec3d.z); double d2 = vec3d.z + 13.0D / d0 * (vec3d1.z - vec3d.z);
if (d0 <= 64.0D || collection.contains(entityplayer)) { if (d0 <= 64.0D || collection.contains(entityplayer)) {
- entityplayer.connection.send(new ClientboundSoundPacket(SoundEvents.RAID_HORN, SoundSource.NEUTRAL, d1, entityplayer.getY(), d2, 64.0F, 1.0F, i)); - entityplayer.connection.send(new ClientboundSoundPacket(SoundEvents.RAID_HORN, SoundSource.NEUTRAL, d1, entityplayer.getY(), d2, 64.0F, 1.0F, i));
+ entityplayer.playNotifySound(SoundEvents.RAID_HORN, SoundSource.NEUTRAL, 64.0F, 1.0F); // Parchment - use existing play sound method + entityplayer.playNotifySound(SoundEvents.RAID_HORN.value(), SoundSource.NEUTRAL, 64.0F, 1.0F); // Parchment - use existing play sound method
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 03d389f3458cd77166a0319fa38c7207e8714e6f..419d85a7561d8d5cecb1a79d6900c3f37e5b5faa 100644 index 8dd85b9ca3b3e3429de4d0ec0654982589c6e93e..33daeb74cdf11c5b920e02b191eb62d5d0937f8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -2,7 +2,6 @@ package org.bukkit.craftbukkit.event; @@ -2251,4 +2251,42 @@ public class CraftEventFactory {
return event;
import com.google.common.base.Function;
import com.google.common.base.Functions;
-import com.google.common.collect.Lists;
import com.mojang.datafixers.util.Either;
import java.net.InetAddress;
import java.util.ArrayList;
@@ -1920,4 +1919,52 @@ public class CraftEventFactory {
return event.callEvent();
} }
// Paper end // Paper end - add EntityFertilizeEggEvent
+ +
+ // Parchment start + // Parchment start
+ private static net.minecraft.network.protocol.@org.jetbrains.annotations.NotNull Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> handleSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event, CraftPlayer recipient) { + private static net.minecraft.network.protocol.@org.jetbrains.annotations.NotNull Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> handleSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event, CraftPlayer recipient) {
+ // init variables
+ net.kyori.adventure.sound.Sound sound = event.calculateSound(recipient); + net.kyori.adventure.sound.Sound sound = event.calculateSound(recipient);
+ ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name());
+ gg.projecteden.parchment.event.sound.SoundEvent.Emitter emitter = event.calculateEmitter(recipient); + gg.projecteden.parchment.event.sound.SoundEvent.Emitter emitter = event.calculateEmitter(recipient);
+ net.minecraft.sounds.SoundSource source = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()); + net.minecraft.sounds.SoundSource source = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source());
+ float volume = sound.volume(); + float volume = sound.volume();
+ float pitch = sound.pitch(); + float pitch = sound.pitch();
+ long seed = event.getSeed(); + long seed = sound.seed().orElse(0L); // TODO: random source?
+ java.util.Optional<net.minecraft.sounds.SoundEvent> soundEvent = io.papermc.paper.adventure.PaperAdventure.asVanillaSound(sound.name()); + net.minecraft.resources.ResourceKey<net.minecraft.sounds.SoundEvent> soundKey = net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.SOUND_EVENT, name);
+ // handle vanilla sounds + net.minecraft.core.Holder.Reference<net.minecraft.sounds.SoundEvent> soundEvent = io.papermc.paper.adventure.PaperAdventure.asVanillaSoundHolder(sound.name()) // TODO: calculate event distance?
+ if (soundEvent.isPresent()) { + .orElseGet(() -> net.minecraft.core.Holder.Reference.create(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.holderOwner(), soundKey, net.minecraft.sounds.SoundEvent.createFixedRangeEvent(name, (float) event.calculateDistance())));
+ if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.EntityEmitter entityEmitter) + if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.EntityEmitter entityEmitter)
+ return new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(soundEvent.get(), source, ((CraftEntity) entityEmitter.entity()).getHandle(), volume, pitch, seed); + return new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(soundEvent, source, ((CraftEntity) entityEmitter.entity()).getHandle(), volume, pitch, seed);
+ else if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.LocationEmitter locationEmitter) { + else if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.LocationEmitter locationEmitter) {
+ Location loc = locationEmitter.location(); + org.bukkit.Location loc = locationEmitter.getLocation();
+ return new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEvent.get(), source, loc.getX(), loc.getY(), loc.getZ(), volume, pitch, seed); + return new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEvent, source, loc.getX(), loc.getY(), loc.getZ(), volume, pitch, seed);
+ }
+ else
+ throw new IllegalArgumentException("Unknown emitter type: " + emitter.getClass().getName());
+ }
+ // handle custom sounds
+ else {
+ // warn if trying to use EntityEmitter with custom sound
+ if (emitter instanceof gg.projecteden.parchment.event.sound.SoundEvent.EntityEmitter)
+ org.slf4j.LoggerFactory.getLogger("SoundEvent").warn("Sound event is using a custom sound ({}) which cannot be used with EntityEmitter. Falling back to playing at the entity's location.", sound.name().asString());
+ Vec3 pos = org.bukkit.craftbukkit.util.CraftVector.toNMS(emitter.location().toVector());
+ return new net.minecraft.network.protocol.game.ClientboundCustomSoundPacket(io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name()), source, pos, volume, pitch, seed);
+ } + }
+ throw new IllegalArgumentException("Unknown emitter type: " + emitter.getClass().getName());
+ } + }
+ +
+ public static void playSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event) { + public static void playSoundEvent(gg.projecteden.parchment.event.sound.SoundEvent event) {
+ org.apache.commons.lang3.Validate.notNull(event, "event"); + org.apache.commons.lang3.Validate.notNull(event, "event");
+ net.minecraft.server.MCUtil.asyncExecutor.execute(() -> { + io.papermc.paper.util.MCUtil.asyncExecutor.execute(() -> {
+ if (!event.callEvent()) + if (!event.callEvent())
+ return; + return;
+ try { + try {

View File

@@ -5,22 +5,20 @@ Subject: [PATCH] Add PlayerUseRespawnAnchorEvent
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index 491ad2098e982f3c947fcae6f258f0b1aa44a562..7d33dae2617991bce244ad906df7053c22e3f515 100644 index 94d067e9eeee73183de25165d8c97043fe256103..3d6e33abbebe526796359fab76768601c227fbe8 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java --- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -51,23 +51,48 @@ public class RespawnAnchorBlock extends Block { @@ -65,7 +65,33 @@ public class RespawnAnchorBlock extends Block {
@Override @Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
ItemStack itemStack = player.getItemInHand(hand);
+
+ // Parchment start -- PlayerUseRespawnAnchorEvent + // Parchment start -- PlayerUseRespawnAnchorEvent
+ org.bukkit.entity.Player bukkitPlayer = player.getBukkitEntity() instanceof org.bukkit.entity.Player ? (org.bukkit.entity.Player) player.getBukkitEntity() : null; + org.bukkit.entity.Player bukkitPlayer = player.getBukkitEntity() instanceof org.bukkit.entity.Player ? (org.bukkit.entity.Player) player.getBukkitEntity() : null;
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult result; + gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult result;
+ // Parchment end + // Parchment end
if (hand == InteractionHand.MAIN_HAND && !isRespawnFuel(itemStack) && isRespawnFuel(player.getItemInHand(InteractionHand.OFF_HAND))) { +
return InteractionResult.PASS; if (RespawnAnchorBlock.isRespawnFuel(stack) && RespawnAnchorBlock.canBeCharged(state)) {
} else if (isRespawnFuel(itemStack) && canBeCharged(state)) {
+ // Parchment start -- PlayerUseRespawnAnchorEvent + // Parchment start -- PlayerUseRespawnAnchorEvent
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE; + result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE;
+ } else if (state.getValue(CHARGE) == 0) { + } else if (state.getValue(CHARGE) == 0) {
@@ -30,46 +28,17 @@ index 491ad2098e982f3c947fcae6f258f0b1aa44a562..7d33dae2617991bce244ad906df7053c
+ } else if (!world.isClientSide) { + } else if (!world.isClientSide) {
+ result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.SET_SPAWN; + result = gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.SET_SPAWN;
+ } else { + } else {
+ return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS;
+ } + }
+
+ if (bukkitPlayer != null) { + if (bukkitPlayer != null) {
+ gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent event = new gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent(bukkitPlayer, block, result); + gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent event = new gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent(bukkitPlayer, block, result);
+ event.callEvent(); + event.callEvent();
+ result = event.getResult(); + result = event.getResult();
+ } + }
+
+ if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.NOTHING) { + if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.NOTHING) {
+ return InteractionResult.PASS; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE) { + } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.CHARGE) {
+ // Parchment end + // Parchment end
charge(world, pos, state); RespawnAnchorBlock.charge(player, world, pos, state);
if (!player.getAbilities().instabuild) { stack.consume(1, player);
itemStack.shrink(1); return ItemInteractionResult.sidedSuccess(world.isClientSide);
}
return InteractionResult.sidedSuccess(world.isClientSide);
- } else if (state.getValue(CHARGE) == 0) {
- return InteractionResult.PASS;
- } else if (!canSetSpawn(world)) {
- if (!world.isClientSide) {
- this.explode(state, world, pos);
- }
-
- return InteractionResult.sidedSuccess(world.isClientSide);
+ // Parchment start -- PlayerUseRespawnAnchorEvent
+ } else if (result == gg.projecteden.parchment.event.player.PlayerUseRespawnAnchorEvent.RespawnAnchorResult.EXPLODE) {
+ this.explode(state, world, pos);
+ return InteractionResult.CONSUME;
+ // Parchment end
} else {
if (!world.isClientSide) {
ServerPlayer serverPlayer = (ServerPlayer)player;
@@ -82,7 +107,6 @@ public class RespawnAnchorBlock extends Block {
// Paper end
}
}
-
return InteractionResult.CONSUME;
}
}

View File

@@ -4,180 +4,16 @@ Date: Fri, 18 Jun 2021 14:04:39 -0400
Subject: [PATCH] Add origin location to EntityDamageByBlockEvent Subject: [PATCH] Add origin location to EntityDamageByBlockEvent
diff --git a/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java b/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java
index 968c915cc494bb3c57169b7b3640002c3a4a8810..0c2b2cb4be57b11d748d13a0ec24b7470619267f 100644
--- a/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java
+++ b/src/main/java/net/minecraft/world/damagesource/BadRespawnPointDamage.java
@@ -7,12 +7,20 @@ import net.minecraft.network.chat.HoverEvent;
import net.minecraft.world.entity.LivingEntity;
public class BadRespawnPointDamage extends DamageSource {
+ @Deprecated // Parchment
protected BadRespawnPointDamage() {
super("badRespawnPoint");
this.setScalesWithDifficulty();
this.setExplosion();
}
+ // Parchment start
+ protected BadRespawnPointDamage(org.bukkit.Location location) {
+ this();
+ location(location);
+ }
+ // Parchment end
+
@Override
public Component getLocalizedDeathMessage(LivingEntity entity) {
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable("death.attack.badRespawnPoint.link")).withStyle((style) -> {
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 67bce77093dcc126098731047447da2031e3388d..051cf78fe9f7700e1f639c804f35903c8079eae9 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -77,6 +77,18 @@ public class DamageSource {
return this;
}
// Paper end
+ // Parchment start
+ private @Nullable org.bukkit.Location location;
+
+ public @Nullable org.bukkit.Location getLocation() {
+ return location;
+ }
+
+ public DamageSource location(@Nullable org.bukkit.Location location) {
+ this.location = location;
+ return this;
+ }
+ // Parchment end
public static DamageSource sting(LivingEntity attacker) {
return new EntityDamageSource("sting", attacker);
@@ -127,7 +139,7 @@ public class DamageSource {
}
public static DamageSource explosion(@Nullable Explosion explosion) {
- return DamageSource.explosion(explosion != null ? explosion.getSourceMob() : null);
+ return DamageSource.explosion(explosion != null ? explosion.getSourceMob() : null).location(explosion != null ? explosion.getBukkitLocation() : null); // Parchment
}
public static DamageSource explosion(@Nullable LivingEntity attacker) {
@@ -138,10 +150,17 @@ public class DamageSource {
return (new EntityDamageSource("sonic_boom", attacker)).bypassArmor().bypassEnchantments().setMagic();
}
+ @Deprecated // Parchment
public static DamageSource badRespawnPointExplosion() {
return new BadRespawnPointDamage();
}
+ // Parchment start
+ public static DamageSource badRespawnPointExplosion(org.bukkit.Location location) {
+ return new BadRespawnPointDamage(location);
+ }
+ // Parchment end
+
public String toString() {
return "DamageSource (" + this.msgId + ")";
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 47d6236daca806878399890a8d08e55233f19fd9..343fe4de3067a451a02e1c68a726408ed81ec216 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -98,7 +98,7 @@ public class EnderDragon extends Mob implements Enemy {
private final Node[] nodes = new Node[24];
private final int[] nodeAdjacency = new int[24];
private final BinaryHeap openSet = new BinaryHeap();
- private Explosion explosionSource = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
+ private Explosion explosionSource;// = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() // Parchment - moved into constructor to fix null world
// Paper start - add var for save custom podium
@Nullable
private BlockPos podium;
@@ -106,6 +106,7 @@ public class EnderDragon extends Mob implements Enemy {
public EnderDragon(EntityType<? extends EnderDragon> entitytypes, Level world) {
super(EntityType.ENDER_DRAGON, world);
+ explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // Parchment - fix null world
this.subEntities = new EnderDragonPart[]{this.head, this.neck, this.body, this.tail1, this.tail2, this.tail3, this.wing1, this.wing2};
this.setHealth(this.getMaxHealth());
this.noPhysics = true;
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 01477e7240f9e33d08d416a7d40ee10f3e5d4abf..e8e1501f31b27d2e4448475db46f98304874575f 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -474,6 +474,13 @@ public class Explosion {
return this.toBlow;
}
+ // Parchment start
+ public @Nullable Location getBukkitLocation() {
+ if (this.level == null) return null;
+ return new Location(level.getWorld(), x, y, z);
+ }
+ // Parchment end
+
public static enum BlockInteraction {
NONE, BREAK, DESTROY;
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index 654a859a37bf991c7a7fa8a44a3d20f8feb223db..52e6c9ea22273759ea9a827125bf561a62272ad9 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -145,7 +145,10 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
world.removeBlock(blockposition1, false);
}
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(), (ExplosionDamageCalculator) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ // Parchment start
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), blockposition.getX() + 0.5D, blockposition.getY() + 0.5D, blockposition.getZ() + 0.5D);
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(location), (ExplosionDamageCalculator) null, location.getX(), location.getY(), location.getZ(), 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ // Parchment end
return InteractionResult.SUCCESS;
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index 6be6adf73dc48ebbac22fe2a9be635f675f18cb1..e814c791137da2a10f4d4dd65f201fc220399975 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -148,7 +148,10 @@ public class RespawnAnchorBlock extends Block {
return pos.equals(explodedPos) && bl2 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
}
};
- world.explode((Entity)null, DamageSource.badRespawnPointExplosion(), explosionDamageCalculator, (double)explodedPos.getX() + 0.5D, (double)explodedPos.getY() + 0.5D, (double)explodedPos.getZ() + 0.5D, 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ // Parchment start
+ org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), explodedPos.getX() + 0.5D, explodedPos.getY() + 0.5D, explodedPos.getZ() + 0.5D);
+ world.explode((Entity)null, DamageSource.badRespawnPointExplosion(location), explosionDamageCalculator, location.getX(), location.getY(), location.getZ(), 5.0F, true, Explosion.BlockInteraction.DESTROY);
+ // Parchment end
}
public static boolean canSetSpawn(Level world) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 419d85a7561d8d5cecb1a79d6900c3f37e5b5faa..fca3f20f5cb5d709eb333423641bdc538e86ba42 100644 index 33daeb74cdf11c5b920e02b191eb62d5d0937f8e..8f438df5d9112460e5b1664a56688bb1c6ddc6fa 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -969,7 +969,7 @@ public class CraftEventFactory { @@ -1198,7 +1198,7 @@ public class CraftEventFactory {
CraftEventFactory.entityDamage = null; }
EntityDamageEvent event;
if (damager == null) {
- event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions);
+ event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, source.getLocation(), modifiers, modifierFunctions); // Parchment - add location
} else if (entity instanceof EnderDragon && /*PAIL FIXME ((EntityEnderDragon) entity).target == damager*/ false) {
event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions);
} else {
@@ -1009,7 +1009,7 @@ public class CraftEventFactory {
return CraftEventFactory.callEntityDamageEvent(damager, entity, cause, modifiers, modifierFunctions, cancelled, source.isCritical()); // Paper - add critical damage API private static EntityDamageEvent callEntityDamageEvent(Block damager, BlockState damagerState, Entity damagee, DamageCause cause, org.bukkit.damage.DamageSource bukkitDamageSource, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions, boolean cancelled) {
} else if (source == DamageSource.OUT_OF_WORLD) { - EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagerState, damagee.getBukkitEntity(), cause, bukkitDamageSource, modifiers, modifierFunctions);
- EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, modifiers, modifierFunctions); + EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagerState, damagee.getBukkitEntity(), cause, bukkitDamageSource, modifiers, modifierFunctions, bukkitDamageSource.getDamageLocation());
+ EntityDamageEvent event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.VOID, entity.getBukkitEntity().getLocation(), modifiers, modifierFunctions); // Parchment - add location return CraftEventFactory.callEntityDamageEvent(event, damagee, cancelled);
event.setCancelled(cancelled); }
CraftEventFactory.callEvent(event);
if (!event.isCancelled()) {
@@ -1019,7 +1019,7 @@ public class CraftEventFactory {
}
return event;
} else if (source == DamageSource.LAVA) {
- EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
+ EntityDamageEvent event = (new EntityDamageByBlockEvent(CraftEventFactory.blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, entity.getBukkitEntity().getLocation().toBlockLocation(), modifiers, modifierFunctions)); // Parchment - add location
event.setCancelled(cancelled);
Block damager = CraftEventFactory.blockDamage;

View File

@@ -5,12 +5,12 @@ Subject: [PATCH] Add UnsafeValues#canPlaceItemOn
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 88abd2d3a9626501b1800ee754b98c6c29c75fb9..0507e40c97567fc379ebe4d0b001af16922ddb3e 100644 index 41c34ffdf9d95a04ed55a1e09ebc78e8cf946777..b43be3c60dc46cd11b652f315d641f16b44b13f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -606,6 +606,55 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -690,6 +690,55 @@ public final class CraftMagicNumbers implements UnsafeValues {
} }
// Paper end // Paper end - proxy ItemStack
+ // Parchment start + // Parchment start
+ @Override + @Override
@@ -57,7 +57,7 @@ index 88abd2d3a9626501b1800ee754b98c6c29c75fb9..0507e40c97567fc379ebe4d0b001af16
+ return future; + return future;
+ } + }
+ final net.minecraft.world.item.context.BlockPlaceContext ctx = context; + final net.minecraft.world.item.context.BlockPlaceContext ctx = context;
+ return future.completeAsync(() -> blockItem.canPlace(ctx, blockState), net.minecraft.server.MCUtil.MAIN_EXECUTOR); + return future.completeAsync(() -> blockItem.canPlace(ctx, blockState), io.papermc.paper.util.MCUtil.MAIN_EXECUTOR);
+ } + }
+ // Parchment end + // Parchment end
+ +

View File

@@ -5,19 +5,19 @@ Subject: [PATCH] Add Player#setGameProfile
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 7d982b7735c09d87d139c34d1cda5cbfb5327c5f..1b0eeb5df33bf68dff193117e6be8a0b88ea1392 100644 index a4b7229f0de89c315fcf0ecdeeb0ff743d1b05fa..0acb4ef6d4ea60d7e4bc17534e84a7a9b477f04e 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1512,6 +1512,12 @@ public abstract class Player extends LivingEntity { @@ -1566,6 +1566,12 @@ public abstract class Player extends LivingEntity {
return this.gameProfile; return this.gameProfile;
} }
+ // Parchment start | TODO: rename to match getter + // Parchment start
+ public void setProfile(GameProfile gameProfile) { + public void setProfile(GameProfile gameProfile) {
+ this.gameProfile = gameProfile; + this.gameProfile = gameProfile;
+ } + }
+ // Parchment end + // Parchment end
+ +
@Nullable public Inventory getInventory() {
public ProfilePublicKey getProfilePublicKey() { return this.inventory;
return this.profilePublicKey; }

View File

@@ -5,23 +5,23 @@ Subject: [PATCH] Expose MCUtil Executors
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index accf680b22a96bab80d3ccdcefe03c787e7501f6..a8a911411a7a1abce016628539c5d0ed1c181185 100644 index c8b82bc41f2042bb4b067f06265a3a22e51f7629..6ee706a17443cd53d6f3d768df07e6e5b51db670 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2899,4 +2899,16 @@ public final class CraftServer implements Server { @@ -3218,4 +3218,16 @@ public final class CraftServer implements Server {
return this.potionBrewer;
} }
// Paper end // Paper end
+ +
+ // Parchment start + // Parchment start
+ @Override + @Override
+ public java.util.concurrent.Executor getAsyncExecutor() { + public java.util.concurrent.Executor getAsyncExecutor() {
+ return net.minecraft.server.MCUtil.asyncExecutor; + return io.papermc.paper.util.MCUtil.asyncExecutor;
+ } + }
+ +
+ @Override + @Override
+ public java.util.concurrent.Executor getMainExecutor() { + public java.util.concurrent.Executor getMainExecutor() {
+ return net.minecraft.server.MCUtil.MAIN_EXECUTOR; + return io.papermc.paper.util.MCUtil.MAIN_EXECUTOR;
+ } + }
+ // Parchment end + // Parchment end
} }

View File

@@ -8,19 +8,10 @@ to easily get the items being dropped by any
block instead of only blocks broken by players. block instead of only blocks broken by players.
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 224ce424b9a22548212ac157ec273c6dd80d6cfb..f33a8f7e46f9d88137de509e22d73edea3804cbe 100644 index a7108b2be0746aa1f0e574d8c6f5ffad6d369835..d9aff85fce2a65794dd57cf790f878b4fc4ec54e 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -308,7 +308,7 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -301,7 +301,7 @@ public class Block extends BlockBehaviour implements ItemLike {
ServerLevel worldserver = lootContext.getLevel();
BlockPos blockposition = new BlockPos((Vec3) lootContext.getParameter(LootContextParams.ORIGIN));
- state.getDrops(lootContext).forEach((itemstack) -> {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(worldserver, blockposition, state.getDrops(lootContext)).forEach((itemstack) -> { // Parchment
Block.popResource(worldserver, blockposition, itemstack);
});
state.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, true);
@@ -316,7 +316,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, Level world, BlockPos pos) { public static void dropResources(BlockState state, Level world, BlockPos pos) {
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
@@ -29,7 +20,7 @@ index 224ce424b9a22548212ac157ec273c6dd80d6cfb..f33a8f7e46f9d88137de509e22d73ede
Block.popResource(world, pos, itemstack); Block.popResource(world, pos, itemstack);
}); });
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true); state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
@@ -326,7 +326,7 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -311,7 +311,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) { public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
@@ -38,20 +29,20 @@ index 224ce424b9a22548212ac157ec273c6dd80d6cfb..f33a8f7e46f9d88137de509e22d73ede
Block.popResource((ServerLevel) world, pos, itemstack); Block.popResource((ServerLevel) world, pos, itemstack);
}); });
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true); state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
@@ -353,7 +353,7 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -347,7 +347,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) { // Paper end - Properly handle xp dropping
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
- Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack).forEach((itemstack1) -> { - Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool).forEach((itemstack1) -> {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack)).forEach((itemstack1) -> { // Parchment + org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool)).forEach((itemstack1) -> { // Parchment
Block.popResource(world, pos, itemstack1); Block.popResource(world, pos, itemstack1);
}); });
state.spawnAfterBreak((ServerLevel) world, pos, stack, true); state.spawnAfterBreak((ServerLevel) world, pos, tool, dropExperience); // Paper - Properly handle xp dropping
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index fca3f20f5cb5d709eb333423641bdc538e86ba42..5e17944a0b612bdb1df6b4a7e540a7afb64d83e6 100644 index 8f438df5d9112460e5b1664a56688bb1c6ddc6fa..d19b9c7773d7d416085dc5a4dbe8113ad5fe9c41 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1966,5 +1966,19 @@ public class CraftEventFactory { @@ -2288,5 +2288,19 @@ public class CraftEventFactory {
} }
}); });
} }

View File

@@ -215,10 +215,10 @@ index 0000000000000000000000000000000000000000..e7114e456f818d7bdd4081620f4b9b93
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f0b14914438840bd819fa7da8b76f4fcc13704d0..bb0bbbb42b2d31e7f72c277e57b551fe602c4309 100644 index 8045d6c9398d1c88595da6e41aa1ed27fb6fbad0..a5a98d23f1b339b320761446a3c4f1f6a3ec3b1f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2410,4 +2410,11 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2475,4 +2475,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.adventure$pointers; return this.adventure$pointers;
} }
// Paper end // Paper end
@@ -226,7 +226,7 @@ index f0b14914438840bd819fa7da8b76f4fcc13704d0..bb0bbbb42b2d31e7f72c277e57b551fe
+ // Parchment start + // Parchment start
+ @Override + @Override
+ public ItemStack smeltItem(ItemStack toSmelt, gg.projecteden.parchment.inventory.RecipeType recipeType) { + public ItemStack smeltItem(ItemStack toSmelt, gg.projecteden.parchment.inventory.RecipeType recipeType) {
+ return world.getRecipeManager().getRecipeFor(gg.projecteden.parchment.inventory.CraftRecipeType.asCookingRecipe(recipeType), new gg.projecteden.parchment.inventory.SingletonContainer(toSmelt), world).map(recipe -> recipe.getResultItem().getBukkitStack()).orElse(null); + return world.getRecipeManager().getRecipeFor(gg.projecteden.parchment.inventory.CraftRecipeType.asCookingRecipe(recipeType), new net.minecraft.world.item.crafting.SingleRecipeInput(CraftItemStack.asNMSCopy(toSmelt)), world).map(recipe -> recipe.value().getResultItem(world.registryAccess()).getBukkitStack()).orElse(null);
+ } + }
+ // Parchment end + // Parchment end
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Disable sleep status announcements
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 12c27ed2ed3a31a26663d78b6429146d384ec0b1..85ebc791c0b6b14d93c757392140b4fd8732291a 100644 index 4d496c5fbf7f7431ac908f40b98578b6123e0d35..5619beb2cf3b5c31e392a2c4a1b7fc01330c7587 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -919,7 +919,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1003,7 +1003,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
} }
private void announceSleepStatus() { private void announceSleepStatus() {

View File

@@ -5,27 +5,27 @@ Subject: [PATCH] Add config for ticking TIME_SINCE_REST
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
index e2c612dd55fcb2769fb06f7878b8d0873f2be139..e8df4b71ab6d3b8143a708d15e9b3d0495c0ee23 100644 index 4bcf27f98765abf693e535cfc1756c27a10cb316..6a698656c90c368d5c64f4a0b2a16500c7dadc02 100644
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -252,6 +252,7 @@ public class WorldConfiguration extends ConfigurationPart { @@ -290,6 +290,7 @@ public class WorldConfiguration extends ConfigurationPart {
} }
public boolean disablePlayerCrits = false; public boolean disablePlayerCrits = false;
+ public boolean tickTimeSinceSleep = true; // Parchment + public boolean tickTimeSinceSleep = true; // Parchment
public boolean nerfPigmenFromNetherPortals = false; public boolean nerfPigmenFromNetherPortals = false;
public PillagerPatrols pillagerPatrols; @Comment("Prevents merging items that are not on the same y level, preventing potential visual artifacts.")
public boolean onlyMergeItemsHorizontally = false;
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 1b0eeb5df33bf68dff193117e6be8a0b88ea1392..c41925004c232eb8a5e1e000a9060254f074c3db 100644 index 0acb4ef6d4ea60d7e4bc17534e84a7a9b477f04e..dae72e66a976701c0cb1fc26e6c37657b79da423 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -294,7 +294,7 @@ public abstract class Player extends LivingEntity { @@ -304,7 +304,7 @@ public abstract class Player extends LivingEntity {
this.awardStat(Stats.CROUCH_TIME); this.awardStat(Stats.CROUCH_TIME);
} }
- if (!this.isSleeping()) { - if (!this.isSleeping()) {
+ if (!this.isSleeping() && this.level.paperConfig().entities.behavior.tickTimeSinceSleep) { // Parchment + if (!this.isSleeping() && this.level().paperConfig().entities.behavior.tickTimeSinceSleep) { // Parchment
this.awardStat(Stats.TIME_SINCE_REST); this.awardStat(Stats.TIME_SINCE_REST);
} }
} }

View File

@@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lexi <lexi@qixils.dev>
Date: Thu, 23 Jun 2022 14:41:24 -0400
Subject: [PATCH] Add HangingFrame Tick API
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 25f5c7346f06bcb58cdaaee2a61b0154761925df..dfc29d0f7a5c7f10588438f4b1d3b00b003a7974 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -20,7 +20,11 @@ import org.apache.commons.lang3.Validate;
public abstract class HangingEntity extends BlockAttachedEntity {
protected static final Predicate<Entity> HANGING_ENTITY = entity -> entity instanceof HangingEntity;
+
+ private int checkInterval; { this.checkInterval = this.getId() % this.level().spigotConfig.hangingTickFrequency; } // Paper - Perf: offset item frame ticking
+ public BlockPos pos;
protected Direction direction = Direction.SOUTH;
+ public boolean tick = true; // Parchment
protected HangingEntity(EntityType<? extends HangingEntity> type, Level world) {
super(type, world);
@@ -53,6 +57,38 @@ public abstract class HangingEntity extends BlockAttachedEntity {
protected abstract AABB calculateBoundingBox(BlockPos pos, Direction side);
@Override
+ public void tick() {
+ if (tick && !this.level().isClientSide) { // Parchment
+ this.checkBelowWorld();
+ if (this.checkInterval++ == this.level().spigotConfig.hangingTickFrequency) { // Spigot
+ this.checkInterval = 0;
+ if (!this.isRemoved() && !this.survives()) {
+ // CraftBukkit start - fire break events
+ BlockState material = this.level().getBlockState(this.blockPosition());
+ org.bukkit.event.hanging.HangingBreakEvent.RemoveCause cause;
+
+ if (!material.isAir()) {
+ // TODO: This feels insufficient to catch 100% of suffocation cases
+ cause = org.bukkit.event.hanging.HangingBreakEvent.RemoveCause.OBSTRUCTION;
+ } else {
+ cause = org.bukkit.event.hanging.HangingBreakEvent.RemoveCause.PHYSICS;
+ }
+
+ org.bukkit.event.hanging.HangingBreakEvent event = new org.bukkit.event.hanging.HangingBreakEvent((org.bukkit.entity.Hanging) this.getBukkitEntity(), cause);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (this.isRemoved() || event.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause
+ this.dropItem((Entity) null);
+ }
+ }
+ }
+
+ }
+
public boolean survives() {
if (!this.level().noCollision(this)) {
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
index f1e3f2b89bcd969f3c80548e165881a9b290eb53..f2d46e908ca0030da514a686763e65a57f02cf35 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
@@ -66,4 +66,16 @@ public class CraftHanging extends CraftBlockAttachedEntity implements Hanging {
public String toString() {
return "CraftHanging";
}
+
+ // Parchment start
+ @Override
+ public boolean canTick() {
+ return this.getHandle().tick;
+ }
+
+ @Override
+ public void setCanTick(boolean tick) {
+ this.getHandle().tick = tick;
+ }
+ // Parchment end
}

View File

@@ -5,24 +5,24 @@ Subject: [PATCH] Add Player#getHiddenEntities API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ef9c3a7b15a4901e1662e6d55504b9cbbb804ad3..21a5f34e12af4435982c73fb48c7c9f679c364a6 100644 index 992437a6e838f653f32d33b5b3f702c484640a97..49d5cdd931de7c28faadd211a52109f28a9df6e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1794,6 +1794,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2165,6 +2165,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
registerEntity(player); this.server.getPluginManager().callEvent(new PlayerShowEntityEvent(this, entity));
}
} }
// Paper start
+ +
+ // Parchment start + // Parchment start
+ @Override + @Override
+ public Set<UUID> getHiddenEntities(Plugin plugin) { + public Set<UUID> getHiddenEntities(Plugin plugin) {
+ return hiddenEntities.entrySet().stream() + return invertedVisibilityEntities.entrySet().stream()
+ .filter(entry -> entry.getValue().contains(CraftPlayer.getPluginWeakReference(plugin))) + .filter(entry -> entry.getValue().contains(CraftPlayer.getPluginWeakReference(plugin)))
+ .map(Map.Entry::getKey) + .map(Map.Entry::getKey)
+ .collect(java.util.stream.Collectors.toSet()); + .collect(java.util.stream.Collectors.toSet());
+ } + }
+ // Parchment end + // Parchment end
+ +
@Override
public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) { public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) {
ServerPlayer self = getHandle(); ServerPlayer self = this.getHandle();
self.gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);

View File

@@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lexi <lexi@qixils.dev>
Date: Thu, 23 Jun 2022 14:41:24 -0400
Subject: [PATCH] Add HangingFrame Tick API
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 334a47b5e0d205c57dfcbb17168cbd3f21d15606..1ffc318c12cde935aea58d6d1efff53818893bf9 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -41,6 +41,7 @@ public abstract class HangingEntity extends Entity {
private int checkInterval; { this.checkInterval = this.getId() % this.level.spigotConfig.hangingTickFrequency; } // Paper
public BlockPos pos;
protected Direction direction;
+ public boolean tick = true; // Parchment
protected HangingEntity(EntityType<? extends HangingEntity> type, Level world) {
super(type, world);
@@ -116,7 +117,7 @@ public abstract class HangingEntity extends Entity {
@Override
public void tick() {
- if (!this.level.isClientSide) {
+ if (tick && !this.level.isClientSide) { // Parchment
this.checkOutOfWorld();
if (this.checkInterval++ == this.level.spigotConfig.hangingTickFrequency) { // Spigot
this.checkInterval = 0;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
index 62e11bf104b8d39ac73883e2a5d207e5f7393253..639bd33ae91ed818bda29fed776adb8c169458d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java
@@ -72,4 +72,16 @@ public class CraftHanging extends CraftEntity implements Hanging {
public EntityType getType() {
return EntityType.UNKNOWN;
}
+
+ // Parchment start
+ @Override
+ public boolean canTick() {
+ return this.getHandle().tick;
+ }
+
+ @Override
+ public void setCanTick(boolean tick) {
+ this.getHandle().tick = tick;
+ }
+ // Parchment end
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Big Barrels
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
index f52487e1cfcfab1bf22ab2cb52f998283a86e340..9f8394d0348b068623b3acafe18b40a3ed0503d0 100644 index 6186e55014bbb9d5bedaa0e9d196879c55339d42..4f02184ec9aa7067f0ee20f041799d25494cb358 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
@@ -67,7 +67,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity { @@ -68,7 +68,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
public BarrelBlockEntity(BlockPos pos, BlockState state) { public BarrelBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.BARREL, pos, state); super(BlockEntityType.BARREL, pos, state);
@@ -17,7 +17,7 @@ index f52487e1cfcfab1bf22ab2cb52f998283a86e340..9f8394d0348b068623b3acafe18b40a3
this.openersCounter = new ContainerOpenersCounter() { this.openersCounter = new ContainerOpenersCounter() {
@Override @Override
protected void onOpen(Level world, BlockPos pos, BlockState state) { protected void onOpen(Level world, BlockPos pos, BlockState state) {
@@ -118,7 +118,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity { @@ -119,7 +119,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override @Override
public int getContainerSize() { public int getContainerSize() {
@@ -26,7 +26,7 @@ index f52487e1cfcfab1bf22ab2cb52f998283a86e340..9f8394d0348b068623b3acafe18b40a3
} }
@Override @Override
@@ -138,7 +138,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity { @@ -139,7 +139,7 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override @Override
protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add Timings Events
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 06bff37e4c1fddd3be6343049a66787c63fb420c..b6567f558cd25698208a06513c241646e0b28341 100644 index 7620c72a4c243cbeea245203ce03a97cbfa7d922..37da50840a55e9df555aaf3aceb21661e472bcff 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java --- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -349,6 +349,8 @@ public class TimingsExport extends Thread { @@ -348,6 +348,8 @@ public class TimingsExport extends Thread {
timingsURL = con.getHeaderField("Location"); timingsURL = con.getHeaderField("Location");
listeners.sendMessage(text("View Timings Report: ", NamedTextColor.GREEN).append(text(timingsURL).clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, timingsURL)))); listeners.sendMessage(text("View Timings Report: ", NamedTextColor.GREEN).append(text(timingsURL).clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, timingsURL))));

View File

@@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Sun, 24 Jul 2022 19:37:33 -0400
Subject: [PATCH] Expanded Insomnia API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 49d5cdd931de7c28faadd211a52109f28a9df6e5..1dc933a1b8a5d731de0d1a1e9754eafb8460224d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -213,6 +213,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
private long lastSaveTime; // Paper - getLastPlayed replacement API
+ private boolean bypassesInsomnia = false; // Parchment - Insomnia api
+
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
@@ -3565,4 +3567,31 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
((ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer)this.getHandle())
.moonrise$getViewDistanceHolder().setSendViewDistance(viewDistance);
}
+
+ // Parchment start
+ @Override
+ public boolean isInsomniac() {
+ return net.minecraft.world.entity.EntitySelector.IS_INSOMNIAC.test(this.getHandle());
+ }
+
+ @Override
+ public void setBypassInsomnia(boolean val) {
+ this.bypassesInsomnia = val;
+ }
+
+ @Override
+ public boolean doesBypassInsomnia() {
+ return this.bypassesInsomnia;
+ }
+
+ @Override
+ public void setTimeSinceLastRest(int ticks) {
+ this.getHandle().getStats().setValue(this.getHandle(), net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST), net.minecraft.util.Mth.clamp(ticks, 1, Integer.MAX_VALUE));
+ }
+
+ @Override
+ public int getTimeSinceLastRest() {
+ return net.minecraft.util.Mth.clamp(this.getHandle().getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
+ }
+ // Parchment end
}

View File

@@ -0,0 +1,50 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 25 Jul 2022 09:11:13 -0400
Subject: [PATCH] Add spam bypass permission
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 60ff21c8df4168f14da04a12073bde47cd4693c4..51c9f6239d0bbf2090b29cc3052a0925b1763649 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -756,9 +756,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
// CraftBukkit start
- if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits
- this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause
- return;
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
+ if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits
+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - AsyncTabCompleteEvent & kick event cause
+ return;
+ }
}
// CraftBukkit end
// Paper start - Don't suggest if tab-complete is disabled
@@ -2452,6 +2454,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot start - spam exclusions
private void detectRateSpam(String s) {
+ if (this.getCraftPlayer().hasPermission("spam.bypass")) return; // Parchment - spam bypass
// CraftBukkit start - replaced with thread safe throttle
boolean counted = true;
for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
@@ -3206,10 +3209,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {
- if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
- this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
- return;
- }
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
+ if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
+ return;
+ }
+ } // Parchment - spam bypass
}
// Paper end - auto recipe limit
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 25 Aug 2022 20:09:40 -0400
Subject: [PATCH] Disable set respawn message
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5174b23c6e04da7a3d833ea3fd191b5956a49809..323330172fde196c6e992484d22479d9f8b041db 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2524,9 +2524,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
forced = event.isForced();
// Paper end - Add PlayerSetSpawnEvent
- if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper - Add PlayerSetSpawnEvent
- this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper - Add PlayerSetSpawnEvent
- }
+ /* Parchment start
+ if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper
+ this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper
+ } Parchment end */
this.respawnPosition = pos;
this.respawnDimension = dimension;

View File

@@ -1,89 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Sun, 24 Jul 2022 19:37:33 -0400
Subject: [PATCH] Expanded Insomnia API
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index e39965c2e50bc8ee424ea07819346e0611398e28..752031332fa3d3d932b535cfb503197ce8d321be 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -27,7 +27,10 @@ public final class EntitySelector {
return !entity.isSpectator();
};
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
- public static Predicate<Player> isInsomniac = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
+ public static Predicate<Player> isInsomniac = (player) -> {
+ return net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000 && // Paper
+ !((org.bukkit.entity.Player) player.getBukkitEntity()).doesBypassInsomnia(); // Parchment
+ };
private EntitySelector() {}
// Paper start
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index c41925004c232eb8a5e1e000a9060254f074c3db..2966c5324c19066a5aa8a14183acca21209f96bd 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -294,7 +294,7 @@ public abstract class Player extends LivingEntity {
this.awardStat(Stats.CROUCH_TIME);
}
- if (!this.isSleeping() && this.level.paperConfig().entities.behavior.tickTimeSinceSleep) { // Parchment
+ if (!this.isSleeping() && this.level.paperConfig().entities.behavior.tickTimeSinceSleep && !((org.bukkit.entity.Player) this.getBukkitEntity()).doesBypassInsomnia()) { // Parchment
this.awardStat(Stats.TIME_SINCE_REST);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 21a5f34e12af4435982c73fb48c7c9f679c364a6..f96c810f0aafb70a2896c576b1ca0daab2cd114e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -70,6 +70,7 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import net.minecraft.server.players.UserWhiteListEntry;
import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntitySelector;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.ai.attributes.AttributeMap;
import net.minecraft.world.entity.ai.attributes.Attributes;
@@ -171,6 +172,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
private long lastSaveTime;
// Paper end
+ private boolean bypassesInsomnia = false;
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
@@ -1871,6 +1873,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}
+ // Parchment start
+ @Override
+ public boolean isInsomniac() {
+ return EntitySelector.isInsomniac.test(this.getHandle());
+ }
+
+ @Override
+ public void setBypassInsomnia(boolean val) {
+ this.bypassesInsomnia = val;
+ }
+
+ @Override
+ public boolean doesBypassInsomnia() {
+ return this.bypassesInsomnia;
+ }
+
+ @Override
+ public void setTimeSinceLastRest(int ticks) {
+ this.getHandle().getStats().setValue(this.getHandle(), net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST), net.minecraft.util.Mth.clamp(ticks, 1, Integer.MAX_VALUE));
+ }
+
+ @Override
+ public int getTimeSinceLastRest() {
+ return net.minecraft.util.Mth.clamp(this.getHandle().getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
+ }
+ // Parchment end
+
@Override
public ServerPlayer getHandle() {
return (ServerPlayer) entity;

View File

@@ -1,52 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 25 Jul 2022 09:11:13 -0400
Subject: [PATCH] Add spam bypass permission
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ff7df8026f85b7ad51458a0b720a8baf71cd9bd1..3481e44c64924ebdfeec0a950efec22b0afb653d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -874,16 +874,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async
// CraftBukkit start
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
// Paper start
- String str = packet.getCommand(); int index = -1;
+ String str = packet.getCommand();
+ int index = -1;
if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) {
server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
+ } // Parchment - spam bypass
// Paper end
// CraftBukkit end
// Paper start - Don't suggest if tab-complete is disabled
@@ -2587,6 +2590,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Spigot start - spam exclusions
private void detectRateSpam(String s) {
+ if (this.getCraftPlayer().hasPermission("spam.bypass")) return; // Parchment - spam bypass
// CraftBukkit start - replaced with thread safe throttle
boolean counted = true;
for ( String exclude : org.spigotmc.SpigotConfig.spamExclusions )
@@ -3363,10 +3367,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (!this.getCraftPlayer().hasPermission("spam.bypass")) { // Parchment - spam bypass
if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
+ } // Parchment - spam bypass
}
// Paper end
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 25 Aug 2022 20:32:01 -0400
Subject: [PATCH] Make FixLight use action bar
diff --git a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
index 85950a1aa732ab8c01ad28bec9e0de140e1a172e..e8186e9569c57bc68ac20f6fac0c90001986b5e6 100644
--- a/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
+++ b/src/main/java/io/papermc/paper/command/subcommands/FixLightCommand.java
@@ -95,16 +95,22 @@ public final class FixLightCommand implements PaperSubcommand {
((StarLightLightingProvider)lightengine).starlight$serverRelightChunks(chunks,
(final ChunkPos chunkPos) -> {
++relitChunks[0];
- sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
- text("Relit chunk ", BLUE), text(chunkPos.toString()),
- text(", progress: ", BLUE), text(ONE_DECIMAL_PLACES.get().format(100.0 * (double) (relitChunks[0]) / (double) pending[0]) + "%")
+
+ sender.getBukkitEntity().sendActionBar(text().color(DARK_AQUA).append(
+ text("Relighting Chunks: ", DARK_AQUA), text(chunkPos.toString()),
+ text(" " + relitChunks[0], net.kyori.adventure.text.format.NamedTextColor.YELLOW),
+ text("/", DARK_AQUA),
+ text(pending[0] + " ", net.kyori.adventure.text.format.NamedTextColor.YELLOW),
+ text("(" + (int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%)", net.kyori.adventure.text.format.NamedTextColor.YELLOW)
));
},
(final int totalRelit) -> {
final long end = System.nanoTime();
+ final long diff = Math.round(1.0e-6 * (end - start));
sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
- text("Relit ", BLUE), text(totalRelit),
- text(" chunks. Took ", BLUE), text(ONE_DECIMAL_PLACES.get().format(1.0e-6 * (end - start)) + "ms")
+
+ text("Relit ", DARK_AQUA), text(totalRelit, net.kyori.adventure.text.format.NamedTextColor.YELLOW),
+ text(" chunks. Took ", DARK_AQUA), text(diff + "ms", net.kyori.adventure.text.format.NamedTextColor.YELLOW)
));
if (done != null) {
done.run();

View File

@@ -0,0 +1,214 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 16 Mar 2023 23:11:05 -0400
Subject: [PATCH] Add PreEntityShootBowEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 3b5cf6ffb74d11bea5eb21bd66d679734ff5000c..321499a52848101b6c36bef18a35f5367c62913c 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -201,15 +201,21 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@Override
public void performRangedAttack(LivingEntity target, float pullProgress) {
+
ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW));
ItemStack itemstack1 = this.getProjectile(itemstack);
AbstractArrow entityarrow = this.getArrow(itemstack1, pullProgress, itemstack);
+
+ // Parchment start
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(this.getBukkitEntity(), this.getMainHandItem().asBukkitCopy(), itemstack1.asBukkitCopy());
+ if (!preEvent.callEvent()) return;
+ // Parchment end
double d0 = target.getX() - this.getX();
double d1 = target.getY(0.3333333333333333D) - entityarrow.getY();
double d2 = target.getZ() - this.getZ();
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4), preEvent.isRelative()); // Parchment
// CraftBukkit start
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
index c858556ea457931aa14e338e20672cb50cb19f0e..b93db38d69ea6f12f4c1d2f73800753a04309772 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
@@ -179,12 +179,16 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW));
ItemStack itemstack1 = this.getProjectile(itemstack);
AbstractArrow entityarrow = ProjectileUtil.getMobArrow(this, itemstack1, pullProgress, itemstack);
+
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(this.getBukkitEntity(), this.getMainHandItem().asBukkitCopy(), itemstack1.asBukkitCopy());
+ if (!preEvent.callEvent()) return;
+ // Parchment end
double d0 = target.getX() - this.getX();
double d1 = target.getY(0.3333333333333333D) - entityarrow.getY();
double d2 = target.getZ() - this.getZ();
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
- entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
+ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4), preEvent.isRelative()); // Parchment
// Paper start - EntityShootBowEvent
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 9ca29b3d4bf8bca5f51f3644e12fcbec2cb5d35e..3c314a9db7467c1066f9e5c8857438bb01317274 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -167,8 +167,10 @@ public abstract class AbstractArrow extends Projectile {
}
@Override
- public void shoot(double x, double y, double z, float power, float uncertainty) {
- super.shoot(x, y, z, power, uncertainty);
+ // Parchment start
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
+ super.shoot(x, y, z, speed, divergence, relative);
+ // Parchment end
this.life = 0;
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index de64de5d1328d3e0826c9990eb7c7eca5088cb9c..1a4678def2e1f0a48a94c73b2ea5ab3215e6ba3b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -181,9 +181,17 @@ public abstract class Projectile extends Entity implements TraceableEntity {
}
public void shoot(double x, double y, double z, float power, float uncertainty) {
- Vec3 vec3d = this.getMovementToShoot(x, y, z, power, uncertainty);
+ // Parchment start
+ shoot(x, y, z, power, uncertainty, true);
+ }
+
+ public void shoot(double x, double y, double z, float speed, float divergence, boolean relative) {
+ // Parchment end
+ Vec3 vec3d = this.getMovementToShoot(x, y, z, speed, divergence);
- this.setDeltaMovement(vec3d);
+ if (relative) { // Parchment
+ this.setDeltaMovement(vec3d);
+ } // Parchment
this.hasImpulse = true;
double d3 = vec3d.horizontalDistance();
@@ -194,6 +202,12 @@ public abstract class Projectile extends Entity implements TraceableEntity {
}
public void shootFromRotation(Entity shooter, float pitch, float yaw, float roll, float speed, float divergence) {
+ // Parchment start
+ shootFromRotation(shooter, pitch, yaw, roll, speed, divergence, true);
+ }
+
+ public void shootFromRotation(Entity shooter, float pitch, float yaw, float roll, float speed, float divergence, boolean relative) {
+ // Parchment end
float f5 = -Mth.sin(yaw * 0.017453292F) * Mth.cos(pitch * 0.017453292F);
float f6 = -Mth.sin((pitch + roll) * 0.017453292F);
float f7 = Mth.cos(yaw * 0.017453292F) * Mth.cos(pitch * 0.017453292F);
@@ -204,7 +218,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
if (vec3d.lengthSqr() > 4D * 4D) {
vec3d = vec3d.normalize().scale(2D);
}
- if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity) {
+ if (!shooter.level().paperConfig().misc.disableRelativeProjectileVelocity && relative) { // Parchment
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.onGround() ? 0.0D : vec3d.y, vec3d.z));
}
// Paper end - allow disabling relative velocity
diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
index 6eb5c0f23d9dc61e69ad5ad493c89602a9dcd4b5..63ba7c2ecdd80e10d611aeb08fa786a478107cb9 100644
--- a/src/main/java/net/minecraft/world/item/BowItem.java
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
@@ -31,8 +31,13 @@ public class BowItem extends ProjectileWeaponItem {
float f = getPowerForTime(i);
if (!((double)f < 0.1)) {
List<ItemStack> list = draw(stack, itemStack, player);
- if (world instanceof ServerLevel serverLevel && !list.isEmpty()) {
- this.shoot(serverLevel, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null);
+
+ if (!world.isClientSide() && !list.isEmpty()) {
+ // Parchment start
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(user.getBukkitEntity(), stack.asBukkitCopy(), itemStack.asBukkitCopy());
+ if (!preEvent.callEvent()) return;
+ // Parchment end
+ this.shoot((ServerLevel) world, player, player.getUsedItemHand(), stack, list, f * 3.0F, 1.0F, f == 1.0F, null, preEvent.isRelative());
}
world.playSound(
@@ -53,9 +58,9 @@ public class BowItem extends ProjectileWeaponItem {
@Override
protected void shootProjectile(
- LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target
+ LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target, boolean relative
) {
- projectile.shootFromRotation(shooter, shooter.getXRot(), shooter.getYRot() + yaw, 0.0F, speed, divergence);
+ projectile.shootFromRotation(shooter, shooter.getXRot(), shooter.getYRot() + yaw, 0.0F, speed, divergence, relative);
}
public static float getPowerForTime(int useTicks) {
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
index c39fa953accd6cf35672f452052cca42fe6f29d0..9bbdf240f7ee520e5d13155ca34f26235f4e5f5b 100644
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
@@ -137,7 +137,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
@Override
protected void shootProjectile(
- LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target
+ LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target, boolean relative
) {
Vector3f vector3f;
if (target != null) {
@@ -198,8 +198,14 @@ public class CrossbowItem extends ProjectileWeaponItem {
) {
if (world instanceof ServerLevel serverLevel) {
ChargedProjectiles chargedProjectiles = stack.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY);
+ // Parchment start
+ gg.projecteden.parchment.event.entity.PreEntityShootBowEvent preEvent = new gg.projecteden.parchment.event.entity.PreEntityShootBowEvent(shooter.getBukkitEntity(), stack.asBukkitCopy(), chargedProjectiles.getItems().get(0).asBukkitCopy());
+ if (!preEvent.callEvent()) return;
+ // TODO: handle relative flag in CrossbowAttackMob#shootCrossbowProjectile
+ // Parchment end
+
if (chargedProjectiles != null && !chargedProjectiles.isEmpty()) {
- this.shoot(serverLevel, shooter, hand, stack, chargedProjectiles.getItems(), speed, divergence, shooter instanceof Player, target);
+ this.shoot(serverLevel, shooter, hand, stack, chargedProjectiles.getItems(), speed, divergence, shooter instanceof Player, target, preEvent.isRelative());
if (shooter instanceof ServerPlayer serverPlayer) {
CriteriaTriggers.SHOT_CROSSBOW.trigger(serverPlayer, stack);
serverPlayer.awardStat(Stats.ITEM_USED.get(stack.getItem()));
diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
index 32dd0b13a0819f597d8a93c6bc3a155781067544..a74540e3a0aa61534fd84868bf8a29d97ccb6e6b 100644
--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
+++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
@@ -46,9 +46,10 @@ public abstract class ProjectileWeaponItem extends Item {
public abstract int getDefaultProjectileRange();
- protected void shoot(ServerLevel world, LivingEntity shooter, InteractionHand hand, ItemStack stack, List<ItemStack> projectiles, float speed, float divergence, boolean critical, @Nullable LivingEntity target) {
+
+ protected void shoot(ServerLevel world, LivingEntity shooter, InteractionHand hand, ItemStack stack, List<ItemStack> projectiles, float speed, float divergence, boolean critical, @Nullable LivingEntity target, boolean relative) {
float f2 = EnchantmentHelper.processProjectileSpread(world, stack, shooter, 0.0F);
- float f3 = projectiles.size() == 1 ? 0.0F : 2.0F * f2 / (float) (projectiles.size() - 1);
+ float f3 = projectiles.size() == 1 ? 0.0F : 20.0F / (float) (projectiles.size() - 1);
float f4 = (float) ((projectiles.size() - 1) % 2) * f3 / 2.0F;
float f5 = 1.0F;
@@ -61,7 +62,7 @@ public abstract class ProjectileWeaponItem extends Item {
f5 = -f5;
Projectile iprojectile = this.createProjectile(world, shooter, stack, itemstack1, critical);
- this.shootProjectile(shooter, iprojectile, i, speed, divergence, f6, target);
+ this.shootProjectile(shooter, iprojectile, i, speed, divergence, f6, target, relative);
// CraftBukkit start
org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(shooter, stack, itemstack1, iprojectile, hand, speed, true);
if (event.isCancelled()) {
@@ -91,7 +92,7 @@ public abstract class ProjectileWeaponItem extends Item {
return 1;
}
- protected abstract void shootProjectile(LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target);
+ protected abstract void shootProjectile(LivingEntity shooter, Projectile projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target, boolean relative);
protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) {
Item item = projectileStack.getItem();

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Sun, 19 Mar 2023 20:02:00 -0400
Subject: [PATCH] Return Displays in getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fe435d4a387bb28be6831cec0c8bb0a7c8b603a4..b5c5294a59aad34e21da88bb9d7a6fc70d1a959b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4183,7 +4183,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 direction = this.getLookAngle();
Vec3 end = start.add(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance);
- List<Entity> entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(Entity::isPickable));
+ List<Entity> entityList = this.level().getEntities(this, getBoundingBox().expandTowards(direction.x * maxDistance, direction.y * maxDistance, direction.z * maxDistance).inflate(1.0D, 1.0D, 1.0D), EntitySelector.NO_SPECTATORS.and(entity -> entity.isPickable() || entity instanceof Display)); // Parchment - add displays
double distance = 0.0D;
EntityHitResult result = null;

View File

@@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 21 Dec 2023 20:58:03 -0500
Subject: [PATCH] Add CustomBlockUpdateEvent
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
index 1d82cfe7af0dc42f88901fb0c44896771fdf8a93..60bb2fe8bb5773d7d0d4279af2216f4c175eca74 100644
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
@@ -66,12 +66,14 @@ public class NoteBlock extends Block {
@Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.INSTRUMENT).callEvent()) return this.defaultBlockState();
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return this.defaultBlockState(); // Paper - place without considering instrument
return this.setInstrument(ctx.getLevel(), ctx.getClickedPos(), this.defaultBlockState());
}
@Override
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.INSTRUMENT, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world.getMinecraftWorld())).callEvent()) return state;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return state; // Paper - prevent noteblock instrument from updating
boolean flag = direction.getAxis() == Direction.Axis.Y;
@@ -80,6 +82,7 @@ public class NoteBlock extends Block {
@Override
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.POWERED, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return; // Paper - prevent noteblock powered-state from updating
boolean flag1 = world.hasNeighborSignal(pos);
@@ -119,7 +122,8 @@ public class NoteBlock extends Block {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
} else {
- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) state = (BlockState) state.cycle(NoteBlock.NOTE); // Paper - prevent noteblock note from updating
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates ||
+ !new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.PITCH, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) state = (BlockState) state.cycle(NoteBlock.NOTE); // Paper - prevent noteblock note from updating
world.setBlock(pos, state, 3);
this.playNote(player, state, world, pos);
player.awardStat(Stats.TUNE_NOTEBLOCK);
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index 6fe5be785423a35b6ff4e6206ca281b66845b979..227c969c0c52709ccc85663d3b7dce282bba75b0 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -67,21 +67,25 @@ public class TripWireBlock extends Block {
@Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
- if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return this.defaultBlockState(); // Paper - place tripwire without updating
Level world = ctx.getLevel();
BlockPos blockposition = ctx.getClickedPos();
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.defaultBlockState()), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE).callEvent()) return this.defaultBlockState();
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return this.defaultBlockState(); // Paper - place tripwire without updating
+
return (BlockState) ((BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(TripWireBlock.NORTH, this.shouldConnectTo(world.getBlockState(blockposition.north()), Direction.NORTH))).setValue(TripWireBlock.EAST, this.shouldConnectTo(world.getBlockState(blockposition.east()), Direction.EAST))).setValue(TripWireBlock.SOUTH, this.shouldConnectTo(world.getBlockState(blockposition.south()), Direction.SOUTH))).setValue(TripWireBlock.WEST, this.shouldConnectTo(world.getBlockState(blockposition.west()), Direction.WEST));
}
@Override
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world.getMinecraftWorld())).callEvent()) return state;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent tripwire from updating
return direction.getAxis().isHorizontal() ? (BlockState) state.setValue((Property) TripWireBlock.PROPERTY_BY_DIRECTION.get(direction), this.shouldConnectTo(neighborState, direction)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos);
}
@Override
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
if (!oldState.is(state.getBlock())) {
this.updateSource(world, pos, state);
@@ -90,6 +94,7 @@ public class TripWireBlock extends Block {
@Override
protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
if (!moved && !state.is(newState.getBlock())) {
this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
@@ -98,6 +103,7 @@ public class TripWireBlock extends Block {
@Override
public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return state;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent disarming tripwires
if (!world.isClientSide && !player.getMainHandItem().isEmpty() && player.getMainHandItem().is(Items.SHEARS)) {
world.setBlock(pos, (BlockState) state.setValue(TripWireBlock.DISARMED, true), 4);
@@ -108,6 +114,7 @@ public class TripWireBlock extends Block {
}
private void updateSource(Level world, BlockPos pos, BlockState state) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.SHAPE, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
int i = aenumdirection.length;
@@ -141,6 +148,7 @@ public class TripWireBlock extends Block {
@Override
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.POWERED, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwires from detecting collision
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
if (!world.isClientSide) {
@@ -152,6 +160,7 @@ public class TripWireBlock extends Block {
@Override
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ if (!new gg.projecteden.parchment.event.block.CustomBlockUpdateEvent(org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), gg.projecteden.parchment.event.block.CustomBlockUpdateEvent.UpdateType.POWERED, org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, world)).callEvent()) return;
if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwire pressed check
if ((Boolean) world.getBlockState(pos).getValue(TripWireBlock.POWERED)) {
this.checkPressed(world, pos);

View File

@@ -0,0 +1,92 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 15 Jan 2024 16:39:10 -0500
Subject: [PATCH] Entity Data Storage
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
new file mode 100644
index 0000000000000000000000000000000000000000..30f8fd154136d05267e8737ff04a0be45b23a35d
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
@@ -0,0 +1,16 @@
+package gg.projecteden.parchment.entity;
+
+public class EntityDataServices {
+
+ private static boolean initialized;
+
+ public static void init() {
+ if (initialized) {
+ throw new RuntimeException("EntityData Services already initialized");
+ }
+ initialized = true;
+
+ // Initialize Services Here
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index dd56c8e041116ef3602a9f89c998c8208ab89b51..9197be4019ddbe16e09c781a74809d15f569e0f3 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -287,6 +287,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
return false;
}
+ gg.projecteden.parchment.entity.EntityDataServices.init();
+
// CraftBukkit start
// this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up
this.server.loadPlugins();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1f7594e22f0f08ae110ef9b42f15119358aa5723..577a6cc50cf41dc3e590edb955a372c4c2a83fe2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -169,6 +169,31 @@ import org.bukkit.plugin.PluginManager;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, CommandSource, ScoreHolder, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker
+ @javax.annotation.Nullable
+ private gg.projecteden.parchment.entity.EntityData storedEntityData;
+
+ /**
+ * Retrieves the stored EntityData for this entity
+ * @return The currently stored EntityData
+ */
+ public gg.projecteden.parchment.entity.EntityData getStoredEntityData() {
+ if (this.storedEntityData == null) {
+ this.storedEntityData = gg.projecteden.parchment.entity.EntityData.create(this.getBukkitEntity());
+ }
+ return this.storedEntityData;
+ }
+
+ /**
+ * Clears the currently stored EntityData for this entity
+ * @return the previously stored EntityData
+ */
+ public @javax.annotation.Nullable gg.projecteden.parchment.entity.EntityData clearStoredEntityData() {
+ gg.projecteden.parchment.entity.EntityData data = this.storedEntityData;
+ this.storedEntityData = null;
+
+ return data;
+ }
+
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
public boolean preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; keep initial motion on first setPositionRotation
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 2cde808bfa797256409879505ba205a71f381981..1bde22a5ec330980ee697830cb2c6a7441394722 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -80,6 +80,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
};
// Paper end - Folia schedulers
+ public gg.projecteden.parchment.entity.EntityData getStoredEntityData() {
+ return this.entity.getStoredEntityData();
+ }
+
public CraftEntity(final CraftServer server, final Entity entity) {
this.server = server;
this.entity = entity;

View File

@@ -0,0 +1,275 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Mon, 15 Jan 2024 20:53:54 -0500
Subject: [PATCH] Add Sidebar Utility
diff --git a/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
index 30f8fd154136d05267e8737ff04a0be45b23a35d..7091340870607605521239893b8ab763f49d7999 100644
--- a/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
+++ b/src/main/java/gg/projecteden/parchment/entity/EntityDataServices.java
@@ -1,5 +1,8 @@
package gg.projecteden.parchment.entity;
+import gg.projecteden.parchment.sidebar.SidebarBufferUtil;
+import gg.projecteden.parchment.sidebar.SidebarBufferUtilSpec;
+
public class EntityDataServices {
private static boolean initialized;
@@ -11,6 +14,7 @@ public class EntityDataServices {
initialized = true;
// Initialize Services Here
+ SidebarBufferUtilSpec.IMPL_KEY.set(new SidebarBufferUtil());
}
}
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferImpl.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..3184478d24e6c984d4e5b5f67253f966315b298c
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferImpl.java
@@ -0,0 +1,181 @@
+package gg.projecteden.parchment.sidebar;
+
+import gg.projecteden.parchment.util.StringUtils;
+import net.minecraft.network.Connection;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.numbers.BlankFormat;
+import net.minecraft.network.chat.numbers.FixedFormat;
+import net.minecraft.network.chat.numbers.NumberFormat;
+import net.minecraft.network.protocol.game.*;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.world.scores.DisplaySlot;
+import net.minecraft.world.scores.Objective;
+import net.minecraft.world.scores.PlayerTeam;
+import net.minecraft.world.scores.Team;
+import net.minecraft.world.scores.criteria.ObjectiveCriteria;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+import java.util.Objects;
+
+public class SidebarBufferImpl extends SidebarBuffer {
+
+ private static final int NAME_LIMIT = 38;
+ private static final int AFFIX_LIMIT = 16;
+ private static final int SIZE = 15;
+
+ static final int SIDEBAR_SLOT = 1;
+ private final Objective objective = new Objective(DedicatedServer.getServer().getScoreboard(), this.name,
+ ObjectiveCriteria.DUMMY, Component.literal(this.stagedTitle), ObjectiveCriteria.RenderType.INTEGER,
+ false, null);
+
+ private Connection connection;
+
+ SidebarBufferImpl(String name) {
+ super(name, SidebarBufferImpl.SIZE);
+ }
+
+ protected void setActive() {
+ objective.setDisplayName(Component.literal(StringUtils.colorize(this.stagedTitle)));
+ ClientboundSetObjectivePacket packet = new ClientboundSetObjectivePacket(this.objective, ClientboundSetObjectivePacket.METHOD_CHANGE);
+ ClientboundSetDisplayObjectivePacket packet2 = new ClientboundSetDisplayObjectivePacket(DisplaySlot.SIDEBAR, this.objective);
+
+ this.connection.send(packet);
+ this.connection.send(packet2);
+ }
+
+ protected void pushChanges() {
+ if (!Objects.equals(this.liveTitle, this.stagedTitle)) {
+ this.liveTitle = this.stagedTitle;
+
+ ClientboundSetObjectivePacket packet = new ClientboundSetObjectivePacket(this.objective, ClientboundSetObjectivePacket.METHOD_CHANGE);
+
+ this.connection.send(packet);
+ }
+
+ int liveEnd = this.size;
+ for (int i = 0; i < this.size; i++) {
+ if (this.liveLines[i] == null) {
+ liveEnd = i;
+ break;
+ }
+ }
+
+ int stagedEnd = this.size;
+ for (int i = 0; i < this.size; i++) {
+ if (this.stagedLines[i] == null) {
+ stagedEnd = i;
+ break;
+ }
+ }
+
+ int maxEnd = Math.max(liveEnd, stagedEnd);
+ int liveIdx = liveEnd - maxEnd;
+ int stagedIdx = stagedEnd - maxEnd;
+
+ for (int i = 0; i < this.size; i++) {
+ String live = liveIdx >= 0 ? this.liveLines[liveIdx] : null;
+ String staged = stagedIdx >= 0 ? this.stagedLines[stagedIdx] : null;
+
+ String liveDisplay = liveIdx >= 0 ? this.liveDisplays[liveIdx] : null;
+ String stagedDisplay = stagedIdx >= 0 ? this.stagedDisplays[stagedIdx] : null;
+
+ if (!Objects.equals(live, staged) || !Objects.equals(liveDisplay, stagedDisplay)) {
+ if (live != null) {
+ this.sendDelete(live, liveEnd - liveIdx);
+ }
+
+ if (staged != null) {
+ this.sendCreate(staged, stagedEnd - stagedIdx, this.stagedDisplays[stagedIdx]);
+ }
+ }
+
+ liveIdx++;
+ stagedIdx++;
+ }
+
+ System.arraycopy(this.stagedLines, 0, this.liveLines, 0, this.size);
+ System.arraycopy(this.stagedDisplays, 0, this.liveDisplays, 0, this.size);
+ }
+
+ @Override
+ protected void setOwner(Player player) {
+ this.connection = ((CraftPlayer) player).getHandle().connection.connection;
+
+ ClientboundSetObjectivePacket packet = new ClientboundSetObjectivePacket(this.objective, ClientboundSetObjectivePacket.METHOD_ADD);
+ this.connection.send(packet);
+
+ for (int i = 0; i < this.size; i++) {
+ String live = this.liveLines[i];
+
+ if (live != null) {
+ this.sendCreate(live, i, stagedDisplays[i]);
+ }
+ }
+ }
+
+ @Override
+ protected boolean checkTitle(String line) {
+ return line.length() <= 32;
+ }
+
+ @Override
+ protected boolean checkLine(String line) {
+ return line.length() <= SidebarBufferImpl.NAME_LIMIT + SidebarBufferImpl.AFFIX_LIMIT * 2;
+ }
+
+ private void sendCreate(String value, int line, String display) {
+ String id = "\u00a7" + (char) ('\u0080' + line);
+ value = StringUtils.colorize(value);
+
+ if (value.length() > SidebarBufferImpl.NAME_LIMIT) {
+ String prefix = value.substring(0, SidebarBufferImpl.AFFIX_LIMIT);
+ String suffix = "";
+
+ value = value.substring(SidebarBufferImpl.AFFIX_LIMIT);
+
+ if (value.length() > SidebarBufferImpl.NAME_LIMIT) {
+ suffix = value.substring(SidebarBufferImpl.NAME_LIMIT);
+ value = value.substring(0, SidebarBufferImpl.NAME_LIMIT);
+ }
+
+ PlayerTeam team = new PlayerTeam(DedicatedServer.getServer().getScoreboard(), this.getTeamName(line));
+ team.setPlayerPrefix(Component.literal(prefix));
+ team.setPlayerSuffix(Component.literal(suffix));
+ team.setNameTagVisibility(Team.Visibility.NEVER);
+ team.setCollisionRule(Team.CollisionRule.NEVER);
+ team.getPlayers().add(id + value);
+ ClientboundSetPlayerTeamPacket packet = ClientboundSetPlayerTeamPacket.createAddOrModifyPacket(team, true);
+
+ this.connection.send(packet);
+ }
+
+ java.util.Optional<NumberFormat> numberFormat = java.util.Optional.of((display == null || display.isEmpty() || display.isBlank()) ? BlankFormat.INSTANCE : new FixedFormat(Component.literal(StringUtils.colorize(display))));
+ ClientboundSetScorePacket packet = new ClientboundSetScorePacket(id + value, this.name, line, null, numberFormat);
+
+ this.connection.send(packet);
+ }
+
+ private void sendDelete(String value, int line) {
+ String id = "\u00a7" + (char) ('\u0080' + line);
+
+ value = StringUtils.colorize(value);
+
+ if (value.length() > SidebarBufferImpl.NAME_LIMIT) {
+ value = value.substring(
+ SidebarBufferImpl.AFFIX_LIMIT,
+ Math.min(value.length(), SidebarBufferImpl.AFFIX_LIMIT + SidebarBufferImpl.NAME_LIMIT)
+ );
+
+ ClientboundSetPlayerTeamPacket packet = ClientboundSetPlayerTeamPacket.createRemovePacket(DedicatedServer.getServer().getScoreboard().getPlayerTeam(this.getTeamName(line)));
+ this.connection.send(packet);
+ }
+
+ ClientboundResetScorePacket packet = new ClientboundResetScorePacket(id + value, this.name);
+ this.connection.send(packet);
+ }
+
+ private String getTeamName(int line) {
+ return this.name + "/" + Integer.toUnsignedString(line, 32);
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtil.java b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..599e84adf8e480508b9c2ce87baca07e163d345e
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/sidebar/SidebarBufferUtil.java
@@ -0,0 +1,19 @@
+package gg.projecteden.parchment.sidebar;
+
+import net.minecraft.network.protocol.game.ClientboundSetDisplayObjectivePacket;
+import net.minecraft.world.scores.DisplaySlot;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class SidebarBufferUtil implements SidebarBufferUtilSpec {
+ @Override
+ public SidebarBuffer create(String name) {
+ return new SidebarBufferImpl(name);
+ }
+
+ @Override
+ public void hideSidebar(Player player) {
+ ClientboundSetDisplayObjectivePacket packet = new ClientboundSetDisplayObjectivePacket(DisplaySlot.SIDEBAR, null);
+ ((CraftPlayer) player).getHandle().connection.send(packet);
+ }
+}
diff --git a/src/main/java/gg/projecteden/parchment/util/StringUtils.java b/src/main/java/gg/projecteden/parchment/util/StringUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..0f8700f43e5503d5b002368fa36d8e6a7577658f
--- /dev/null
+++ b/src/main/java/gg/projecteden/parchment/util/StringUtils.java
@@ -0,0 +1,30 @@
+package gg.projecteden.parchment.util;
+
+import net.md_5.bungee.api.ChatColor;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class StringUtils {
+
+ private static final String colorChar = "§";
+ private static final String altColorChar = "&";
+ private static final String colorCharsRegex = "[" + colorChar + altColorChar + "]";
+ private static final Pattern hexPattern = Pattern.compile(colorCharsRegex + "#[a-fA-F\\d]{6}");
+
+ public static String colorize(String input) {
+ if (input == null)
+ return null;
+
+ while (true) {
+ Matcher matcher = hexPattern.matcher(input);
+ if (!matcher.find()) break;
+
+ String color = matcher.group();
+ input = input.replace(color, ChatColor.of(color.replaceFirst(colorCharsRegex, "")).toString());
+ }
+
+ return ChatColor.translateAlternateColorCodes(altColorChar.charAt(0), input);
+ }
+
+}

View File

@@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Blast-MC <cjblanton2@gmail.com>
Date: Thu, 25 Jan 2024 19:59:13 -0500
Subject: [PATCH] Add Block BreakNaturally Overload
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index d9aff85fce2a65794dd57cf790f878b4fc4ec54e..4ed92f149be39929a874678bdfa049694270d3b5 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -299,24 +299,28 @@ public class Block extends BlockBehaviour implements ItemLike {
return state.getDrops(lootparams_a);
}
- public static void dropResources(BlockState state, Level world, BlockPos pos) {
+ public static List<ItemEntity> dropResources(BlockState state, Level world, BlockPos pos) {
if (world instanceof ServerLevel) {
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, (BlockEntity) null)).forEach((itemstack) -> { // Parchment
- Block.popResource(world, pos, itemstack);
+ itemEntities.add(Block.popResourceWithReturn(world, pos, itemstack));
});
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
+ return itemEntities;
}
-
+ return new java.util.ArrayList<>();
}
- public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
+ public static List<ItemEntity> dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
if (world instanceof ServerLevel) {
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity)).forEach((itemstack) -> { // Parchment
- Block.popResource((ServerLevel) world, pos, itemstack);
+ itemEntities.add(Block.popResourceWithReturn((ServerLevel) world, pos, itemstack));
});
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
+ return itemEntities;
}
-
+ return new java.util.ArrayList<>();
}
// Paper start - Add BlockBreakBlockEvent
@@ -344,15 +348,17 @@ public class Block extends BlockBehaviour implements ItemLike {
// Paper start - Properly handle xp dropping
dropResources(state, world, pos, blockEntity, entity, tool, true);
}
- public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
+ public static List<ItemEntity> dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity entity, ItemStack tool, boolean dropExperience) {
// Paper end - Properly handle xp dropping
if (world instanceof ServerLevel) {
+ List<ItemEntity> itemEntities = new java.util.ArrayList<>();
org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDropResourcesEvent(world, pos, Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, tool)).forEach((itemstack1) -> { // Parchment
- Block.popResource(world, pos, itemstack1);
+ itemEntities.add(Block.popResourceWithReturn(world, pos, itemstack1));
});
state.spawnAfterBreak((ServerLevel) world, pos, tool, dropExperience); // Paper - Properly handle xp dropping
+ return itemEntities;
}
-
+ return new java.util.ArrayList<>();
}
public static void popResource(Level world, BlockPos pos, ItemStack stack) {
@@ -366,6 +372,17 @@ public class Block extends BlockBehaviour implements ItemLike {
}, stack);
}
+ public static ItemEntity popResourceWithReturn(Level world, BlockPos pos, ItemStack stack) {
+ double d0 = (double) EntityType.ITEM.getHeight() / 2.0D;
+ double d1 = (double) pos.getX() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
+ double d2 = (double) pos.getY() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D) - d0;
+ double d3 = (double) pos.getZ() + 0.5D + Mth.nextDouble(world.random, -0.25D, 0.25D);
+
+ ItemEntity itemEntity = new ItemEntity(world, d1, d2, d3, stack);
+ Block.popResource(world, () -> itemEntity, stack);
+ return itemEntity;
+ }
+
public static void popResourceFromFace(Level world, BlockPos pos, Direction direction, ItemStack stack) {
int i = direction.getStepX();
int j = direction.getStepY();
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index ac11f18690434922179b61ffcc3036dea025b0cb..f9aae49eed516bce00cb968de36ca8b3de038311 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -500,6 +500,11 @@ public class CraftBlock implements Block {
@Override
public boolean breakNaturally(ItemStack item, boolean triggerEffect, boolean dropExperience) {
+ return this.breakNaturally(null, item, triggerEffect, dropExperience);
+ }
+
+ @Override
+ public boolean breakNaturally(Player player, ItemStack item, boolean triggerEffect, boolean dropExperience) {
// Paper end
// Order matters here, need to drop before setting to air so skulls can get their data
net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
@@ -509,7 +514,12 @@ public class CraftBlock implements Block {
// Modelled off EntityHuman#hasBlock
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
- net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), this.position, this.world.getBlockEntity(this.position), null, nmsItem, false); // Paper - Properly handle xp dropping
+ List<net.minecraft.world.entity.item.ItemEntity> itemEntities = net.minecraft.world.level.block.Block.dropResources(iblockdata, this.world.getMinecraftWorld(), this.position, this.world.getBlockEntity(this.position), null, nmsItem, false);
+
+ if (player != null) {
+ new org.bukkit.event.block.BlockDropItemEvent(this, this.getState(), player, itemEntities.stream().map(i -> (org.bukkit.entity.Item) CraftEntity.getEntity((org.bukkit.craftbukkit.CraftServer) Bukkit.getServer(), i)).toList()).callEvent();
+ }
+
// Paper start - improve Block#breanNaturally
if (triggerEffect) {
if (iblockdata.getBlock() instanceof net.minecraft.world.level.block.BaseFireBlock) {