Commits vergleichen

...

1548 Commits
1.19 ... master

Autor SHA1 Nachricht Datum
9505258ec4 Merge pull request 'Update to 1.21.1' (#15) from 1.21.1 into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #15
Reviewed-by: Lixfel <lixfel@steamwar.de>
2024-08-27 19:21:31 +02:00
abfde9e36e steamwarci.yml aktualisiert
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-27 19:11:30 +02:00
88fd8688a9 Fix CI
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-27 14:10:58 +02:00
037a909005 Update to 1.21.1
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-27 13:57:27 +02:00
ba810f1058 Merge remote-tracking branch 'upstream/master' 2024-08-27 13:49:34 +02:00
Lixfel
66f1534cfd Fix CI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-08-16 07:56:58 +02:00
Lixfel
203381a204 CI fixed?
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-16 07:49:47 +02:00
Lixfel
ba981a97c0 Fix CI (add inner jar and inner jar deployment)
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-15 12:39:52 +02:00
854824431b Fix Commits
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-15 10:55:24 +02:00
397b42d3af Fix CI
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-15 10:45:29 +02:00
Lulu13022002
11b4ac7c65
Fix disableEndCredits world config (#11261) 2024-08-14 21:26:38 +02:00
hyperdefined
9ab644ed29
Fix TooltipContext.create being wrong(#11254)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-08-14 14:39:45 +02:00
ab00a73799 Split Patches
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-13 11:50:00 +02:00
be922367c3 Merge Patches
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-13 10:44:34 +02:00
fa5a4a7c1f Fix CI
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-12 21:10:09 +02:00
b3c5a9b5bb Fix WallBlock and tested
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-12 21:09:31 +02:00
Nassim Jahnke
7c9240f4a6
Improve standard messenger logging 2024-08-12 18:42:08 +02:00
Jake Potrebic
1798e949e5
Fix BasicCommand suggestion arg count (#11241) 2024-08-12 09:40:39 +02:00
hyperdefined
4a97ba3ea8
Fix setSendViewDistance's return (#11247) 2024-08-12 09:27:27 +02:00
Jake Potrebic
f97aff74b6
[ci skip] Fix Effect javadocs (#11182) 2024-08-12 00:35:45 +02:00
Lulu13022002
098bd39092
Remove arbitrary book page limit (#11228) 2024-08-12 00:30:23 +02:00
Newwind
ab0d24aa6f
Configuration for horizontal-only item merging (#11219) 2024-08-12 00:16:20 +02:00
Jake Potrebic
dd941cc40a
Re-add patches for can-place/can-destroy API (#11238)
* Re-add patches for can-place/can-destroy API

This API is all deprecated for removal and has to be replaced
as the structure of it has too radically changed

* update patches

* add link to MaterialRerouting

* Deprecation

---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-08-11 13:51:37 -07:00
Jake Potrebic
1187544fb0
Fix teleport event getTo returning null (#11239) 2024-08-11 22:42:39 +02:00
Jake Potrebic
1c3c47ab0b
Correctly check enchants for ItemStack#damage (#11240) 2024-08-11 13:27:24 -07:00
9b92b0b328 Patches V2
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-08-11 21:51:14 +02:00
678af5b9fa Patches V1 2024-08-11 18:24:35 +02:00
191d74a113 Merge remote-tracking branch 'upstream/master' into 1.21-2 2024-08-11 17:35:38 +02:00
Lulu13022002
7d7f123e98
Fix wrong spawn reason for trial spawners (#11229) 2024-08-10 15:19:54 -07:00
Lulu13022002
1cecc24cad
Fix tag key generator output inconsistencies (#11218)
* Fix tag key generator output inconsistencies

* use NonNull instead of NotNull for generated api

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-08-10 15:11:57 -07:00
Lulu13022002
70dfa467e7
Fix CraftMetaShield equality (#11232) 2024-08-10 15:08:00 +02:00
Nassim Jahnke
306d0dfdf0
Update generated code 2024-08-10 12:43:24 +02:00
Nassim Jahnke
83b6b26d39
Update to 1.21.1 2024-08-10 12:24:38 +02:00
Nassim Jahnke
b1b5d4c1e4
Check shooter in configurable projectile relative velocity patch 2024-08-10 11:55:08 +02:00
Joo200
4d7cef3418
Fix source of knockback for spigot events (#11176) 2024-08-09 22:57:55 +02:00
Bjarne Koll
77a5779e24
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11197)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2ec53f49 PR-1050: Fix empty result check for Complex Recipes
10671012 PR-1044: Add CrafterCraftEvent
4d87ffe0 Use correct method in JavaDoc
ae5e5817 SPIGOT-7850: Add API for Bogged shear state
46b6d445 SPIGOT-7837: Support data pack banner patterns
d5d0cefc Fix JavaDoc error
b3c2b83d PR-1036: Add API for InventoryView derivatives
1fe2c75a SPIGOT-7809: Add ShieldMeta

CraftBukkit Changes:
8ee6fd1b8 SPIGOT-7857: Improve ItemMeta block data deserialization
8f26c30c6 SPIGOT-7857: Fix spurious internal NBT tag when deserializing BlockStateMeta
759061b93 SPIGOT-7855: Fire does not spread or burn blocks
00fc9fb64 SPIGOT-7853: AnvilInventory#getRepairCost() always returns 0
7501e2e04 PR-1450: Add CrafterCraftEvent
8c51673e7 SPIGOT-5731: PortalCreateEvent#getEntity returns null for nether portals ignited by flint and steel
d53d0d0b1 PR-1456: Fix inverted logic in CraftCrafterView#setSlotDisabled
682a678c8 SPIGOT-7850: Add API for Bogged shear state
fccf5243a SPIGOT-7837: Support data pack banner patterns
9c3bd4390 PR-1431: Add API for InventoryView derivatives
0cc6acbc4 SPIGOT-7849: Fix FoodComponent serialize with "using-converts-to" using null
2c5474952 Don't rely on tags for CraftItemMetas
20d107e46 SPIGOT-7846: Fix ItemMeta for hanging signs
76f59e315 Remove redundant clone in Dropper InventoryMoveItemEvent
e61a53d25 SPIGOT-7817: Call InventoryMoveItemEvent for Crafters
894682e2d SPIGOT-7839: Remove redundant Java version checks
2c12b2187 SPIGOT-7809: Add ShieldMeta and fix setting shield base colours

Spigot Changes:
fb8fb722 Rebuild patches
34bd42b7 SPIGOT-7835: Fix issue with custom hopper settings
2024-08-09 22:05:50 +02:00
Nassim Jahnke
4e6a2a13a3
Check for block type in SculkSensorBlock#canActivate 2024-08-07 14:34:12 +02:00
granny
042f15ffbd
[ci skip] chore: fix incorrect commit hash in PR builds (#11198)
* fix incorrect hash in PR builds

* only apply ref on pull_request triggers
2024-08-06 10:37:26 -07:00
metabrix
7e44684a1f
Fix wrong assumption about locale being null in the login phase (#11204)
Fixes #11203
2024-08-05 21:02:19 +02:00
Nassim Jahnke
5a5c3a4a24
Remove chunk unload trace debug
The issue the patch was initially added for has already been fixed and filling stacktraces can be expensive
2024-08-05 19:57:34 +02:00
Spottedleaf
df3b6544f7 ConcurrentUtil: Fix concurrent long map resize chain pull function
The function assumed that the current resize chain pointed to
the previous table, when in fact it pointed to the current table.

The function is supposed to restore the resize chain to the previous
table, previous increment, and previous index + new increment.
2024-08-01 16:55:33 -07:00
Spottedleaf
0a1be9ae87 Make loadChunksForMoveAsync use new chunk system load calls
This is to allow the call to work properly when on Folia,
as Folia does not have a main thread.
2024-07-30 19:50:14 -07:00
Jason Penilla
58c7ea3193
Preserve command node when re-registering modern commands through old API (#11184)
* Preserve command node when re-registering modern commands through old API

* make fix more targeted

mainly because it didn't work for vanilla commands :)
2024-07-30 11:42:55 -07:00
Jason Penilla
67d414a927
Allow plugin aliases to override vanilla commands (#11186)
fixes #11035
2024-07-30 11:28:05 -07:00
Spottedleaf
227544cfc7 Move TickThread changes from Moonrise patch to MCUtils
The common changes from Moonrise should be entirely in MCUtils
2024-07-30 05:32:20 -07:00
Shane Freeder
100d75a11c
Don't entirely die just because a plugin jar was bad 2024-07-29 16:54:46 +01:00
Shane Freeder
438863c4c5
Shutdown L4J cordially if the server stops before it's even started (#11172)
primarily, this allows us to ensure that appenders are flushed, console, log files
before the JVM exits to avoid issues such as error messages disappearing
2024-07-29 16:10:53 +01:00
Spottedleaf
0246a9da86 Add mob bucket items to item id to entity map in DataConverter
Mojang missed these in their mapping. Since the entity data
is used when spawning the bucketed mob, we need to have these
inside the id map to ensure that the entity data is converted
correctly if the entity id is missing.
2024-07-28 17:40:59 -07:00
Spottedleaf
3234b20ee4 Do not allow chunk unloading outside of the regular tick loop
Allowing chunk loading to occur at any point via purgeUnload()
introduces possible undesirable behavior to occur recursively
inside the chunk system.
2024-07-28 16:18:25 -07:00
Spottedleaf
50bdfc3e2c Null check tracker in Entity#resendPossiblyDesyncedEntityData
Accidentally dropped this check last commit. It is possible
that this is called while the entity is not tracked.
2024-07-28 15:49:38 -07:00
Spottedleaf
f774787a39 Copy missed changes to chunk system from Folia 2024-07-28 15:34:07 -07:00
Spottedleaf
694b120d0b Remove Entity tracker field
Now the only tracker field is from the entity tracker
optimisations.
2024-07-28 15:28:52 -07:00
Jake Potrebic
f82bea6940
Add argument for FinePosition to brig API (#11094) 2024-07-28 11:23:18 -07:00
powercas_gamer
dcbd99de4a
Fix Owen's typos (#11179) 2024-07-28 10:58:57 -07:00
Tamion
66165f712a
Fix PickupStatus getting reset (#11154) 2024-07-27 16:37:51 +02:00
Newwind
645a677122
Make max interaction range configurable (#11164)
The server validates incoming interaction packets by ensuring the player
sending them is inside their interaction range. For this, the server adds
a magic value, by default 1.0, to the original interaction range to
account for latency issues.

This value however may be too low in high latency environments.
The patch exposes a new configuration option to configure said value.
2024-07-27 14:18:16 +02:00
Shane Freeder
e1462a9253
Bump MCUtils#asyncExecutor core size
Long ago we discovered that the default thread pools would not increase
the number of threads running the pool until queue addition failed.
Bumping the core size mitigates an issue with spark-paper, and in general,
keeping async threads around generally beats having to spin new ones
everytime we want to execute a periodic async task.
2024-07-26 13:43:48 +01:00
Lulu13022002
5a5035be96
Fix a couple of ItemMeta related NPEs (#11149) 2024-07-23 10:11:00 +02:00
powercas_gamer
5512af798f
[ci skip] remove timings from issue templates (#11127) 2024-07-22 23:30:57 +02:00
Lulu13022002
73a863b337
Fix horse inventories indices (#11139) 2024-07-22 15:17:25 +02:00
Tamion
aa36ae6576
Fix EntityUnleashEvent cancellation on distance cause (#11131) 2024-07-21 12:33:37 +02:00
Riley Park
3a47518b4b
Deprecate more Timings things for removal (#11126) 2024-07-20 19:40:41 -07:00
Riley Park
7e91a2c3ab Update the bundled spark version 2024-07-20 13:56:37 -07:00
Riley Park
9aea24002a Properly lookup plugin classes when looked up by spark
fixes #11124
2024-07-20 13:00:29 -07:00
Riley Park
aa3b356834
Improve server startup logging (#11110)
* Improve server startup logging

* Add plugin info at startup

---------

Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2024-07-20 10:36:52 -07:00
Riley Park
5fee9c62da Move configuration option to a system property 2024-07-20 10:14:55 -07:00
Riley Park
681c01336b
Bundle spark (#11093) 2024-07-20 09:35:39 -07:00
Jason Penilla
f1f01a1622
Adjust done message again (#11118)
what paper now shows as level loading time is the time displayed by vanilla or spigot in the 'done' message

the time in the done message is now the actual time since the servers Main class was initialized
2024-07-19 12:36:09 -07:00
Bjarne Koll
968bdeb46f
Make CraftComplexRecipe extend CraftingRecipe (#11114) 2024-07-19 19:29:31 +02:00
Nassim Jahnke
e71c1df54c
Call PlayerChunkUnloadEvent 2024-07-19 13:50:38 +02:00
Nassim Jahnke
7ea403902b
Fixup startup time log message 2024-07-19 13:38:43 +02:00
Nassim Jahnke
75af62b298
Split rewriting flag into paper.disableOldApiSupport and paper.disablePluginRemapping (#11108) 2024-07-19 13:08:08 +02:00
Bjarne Koll
2a39276794
Add CrafterCraftEvent (#11082)
Ports the proposed CrafterCraftEvent proposed in an
open upstream PR.

See: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/1044
2024-07-19 11:21:26 +02:00
Jason Penilla
d08e8d1afa
Add total time to done message (#11109)
* Add total time to done message

Previously it would only show the world load time which is misleading

* Add comments
2024-07-18 15:33:14 -07:00
Nassim Jahnke
a8db527449
Even more cleanup of mcutil patch 2024-07-18 18:15:13 +02:00
granny
3c8a7fe1a4
Re-add missing chunk event calls (#11104) 2024-07-18 13:34:34 +02:00
Nassim Jahnke
dd11ef8441
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11102)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
3a3bea52 SPIGOT-7829: Increase maximum outgoing plugin message size to match Vanilla intention
5cd1c8cb SPIGOT-7831: Add CreatureSpawnEvent.SpawnReason#POTION_EFFECT
a8e278f0 SPIGOT-7827: Sync EntityPortalEvent with PlayerPortalEvent since non-players can now create portals
53729d12 Remove spurious ApiStatus.Internal annotation
b9f57486 SPIGOT-7799, PR-1039: Expose explosion world interaction in EntityExplodeEvent and BlockExplodeEvent
7983b966 PR-1029: Trial changing a small number of inner enums to classes/interfaces to better support custom values

CraftBukkit Changes:
403accd56 SPIGOT-7831: Add CreatureSpawnEvent.SpawnReason#POTION_EFFECT
812761660 Increase outdated build delay
bed1e3ff6 SPIGOT-7827: Sync EntityPortalEvent with PlayerPortalEvent since non-players can now create portals
2444c8b23 SPIGOT-7823: Suspicious sand and gravel material are not marked as having gravity correctly
aceddcd0b SPIGOT-7820: Enum changes - duplicate method name
a0d2d6a84 SPIGOT-7813: Material#isInteractable() always returns false
8fd64b091 SPIGOT-7806: Handle both loot and inventory item drop behaviour in PlayerDeathEvent
a4ee40b74 SPIGOT-7799, PR-1436: Expose explosion world interaction in EntityExplodeEvent and BlockExplodeEvent
082aa51c5 PR-1424: Trial changing a small number of inner enums to classes/interfaces to better support custom values
66e78a96b SPIGOT-7815: Consider EntityDamageEvent status for Wolf armor damage

Spigot Changes:
5bbef5ad SPIGOT-7834: Modify max value for generic.max_absorption
2024-07-18 10:13:20 +02:00
Jake Potrebic
44c3dd0d4c
fix exact choice shapeless recipes (#10973) 2024-07-17 12:48:31 -07:00
Spottedleaf
2df5bba16a Log throwable when failing to save chunk/poi/entity data 2024-07-17 11:48:24 -07:00
Spottedleaf
b653276565 Finish chunk tick iteration optimisation port from Moonrise 2024-07-17 11:34:26 -07:00
Spottedleaf
4efd24b336 Remove unused chunk system hooks in MCUtils 2024-07-17 11:08:28 -07:00
Spottedleaf
00b949f1bb Remove Moonrise utils to MCUtils, remove duplicated/unused utils 2024-07-17 10:28:32 -07:00
Spottedleaf
967f98aa81 Optimise chunk tick checking during chunk tick
We don't need to check for this with the chunk system, as
ticking chunks are actually guaranteed to ticking. Additionally,
ticking chunks may only become non-ticking during the chunk holder
manager tick - which will not happen during chunk ticking.
2024-07-17 07:43:49 -07:00
Spottedleaf
05ed6a6ff5 Fix priority scheduling logic
This resolves sync loads not being properly prioritised.
2024-07-17 07:39:30 -07:00
Riley Park
ceeb8c14ee
Disable timings by default (#11095) 2024-07-16 17:33:40 -07:00
Jake Potrebic
506f1651e5
Don't store removed components in multiple places (#11091) 2024-07-16 16:39:57 -07:00
Jake Potrebic
a6ceda12c5
distinguish between null and empty map in API (#10829) 2024-07-16 11:36:07 -07:00
Tamion
ef96a69e84
Fire EntityChangeBlockEvent for weaving potion effect (#11087) 2024-07-16 10:15:18 +02:00
Jakub Zacek
2cd8c461af
Add OMINOUS_ITEM_SPAWNER SpawnReason (#10897) 2024-07-15 17:35:51 -04:00
Spottedleaf
b57b24d549 Do not try to stop main thread during watchdog shutdown
In Java 21, Thread#stop is no longer implemented and wiill throw
an exception when called. As a result, we simply cannot halt
the main thread during shutdown anymore.
2024-07-15 12:46:23 -07:00
Spottedleaf
9fd77108e3 Apply automatic regionfile header recalculation patch 2024-07-15 12:20:47 -07:00
Spottedleaf
77fcb29607 Apply incremental player/level saving patch 2024-07-15 11:57:56 -07:00
Spottedleaf
3b45454190 Port random ticking optimisation from Moonrise 2024-07-15 11:13:08 -07:00
Spottedleaf
8b23018575 Avoid collision shapes outside world border in findFreePosition
This is to correctly adhere to Vanilla behavior.
2024-07-15 09:56:17 -07:00
Lulu13022002
aa929d6666
Call PlayerLaunchProjectileEvent for wind charge (#10911) 2024-07-15 17:07:07 +02:00
Jake Potrebic
05e5865da3
Add ItemType#getItemRarity (#11049) 2024-07-15 16:38:20 +02:00
powercas_gamer
b4f04ff4b3
Add Plugin#getDataPath (#11080) 2024-07-15 14:07:17 +02:00
Tamion
8b35adca88
Fix HelpCommand searching (#11066)
Prevent a IOB exception when querying topic
suggestions on query string `/`.

Additionally hide help topics indices if no topics
are visible to the player requesting them.
2024-07-15 12:42:10 +02:00
Malfrador
9fd5b3cfbd
Add AttributeModifier constructor without EquipmentSlotGroup (#11079) 2024-07-15 12:31:41 +02:00
Lulu13022002
99ae7bbc97
Don't require author and title to be set on signed book meta (#11068) 2024-07-14 15:33:52 +02:00
Nassim Jahnke
34a2917dcc
Add default canUse and permission methods to BasicCommand (#11047) 2024-07-14 14:04:38 +02:00
Nassim Jahnke
1595e4afc0
Make watchdog thread extend TickThread again 2024-07-14 13:59:18 +02:00
Spottedleaf
2288e13816 Update last chunk position in findSupportingBlock
Fixes fetching chunks needlessly multiple times.

Thanks Lulu13022002 for pointing this out
2024-07-13 11:44:52 -07:00
Bjarne Koll
5a503d7db4
Bulk bugfixes for itemstack damage API (#11063)
A general set of bugfixes for itemstack damage related logic.

1. Prevent NPE when calling deprecated ItemStack#getMaxItemUseDuration()
2. Do not apply enchantments when damaging items via API
3. Do not error when passing a null equipment slot to hurtAndBreak
4. Correctly call PlayerItemBreakEvent
2024-07-12 20:47:08 +02:00
Nassim Jahnke
ffe31a1cd0
Readd async saveddata io 2024-07-12 17:58:54 +02:00
Bjarne Koll
70ff1ec079
Only skip damage tick if damage is unmodified zero (#11058)
Only skip the damage tick logic on player entities if the original
damage was zero and was not modified by plugins down the line.

This way all the following three scenarios trigger the damage tick

  a) vanilla damage was 0, plugin set it to non zero
  b) vanilla damage was non zero, plugin did not modify it
  c) vanilla damage was non zero, plugin set it to zero.

Regarding case c, the argument here is that EntityDamageEvent#setDamage
should not modify the damage tick logic.
2024-07-12 09:47:50 +02:00
Nassim Jahnke
2773dc4847
Add light block to indestructible block list 2024-07-12 09:24:50 +02:00
Shane Freeder
c6e9579688
Fix explosions calculation getting stuck (#11061)
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2024-07-12 09:16:03 +02:00
Spottedleaf
0e02aa5b8e Port watchdog detail patch 2024-07-11 12:28:27 -07:00
Spottedleaf
1d0fcb5aaf Port lag compensation patch 2024-07-11 12:22:59 -07:00
Spottedleaf
821081d646 Drop unapplied patches
1012-Use-distance-map-to-optimise-entity-tracker.patch:
1025-Collision-optimisations.patch:
1034-Actually-optimise-explosions.patch:
1039-Send-full-pos-packets-for-hard-colliding-entities.patch:
Implemented in Moonrise patch

1037-Distance-manager-tick-timings.patch:
Not needed

0668-Implement-regenerateChunk.patch:
API does not appear to be used, and it is a real pain to
implement this properly. The old patch did not handle
populators correctly, for example.
2024-07-11 12:13:41 -07:00
Spottedleaf
90ae1dc573 Port collision optimisation patch from Moonrise
Drop random ticking optimisation for now
2024-07-11 12:09:15 -07:00
Spottedleaf
7bd22b1835 Optimise entity tracker
Patch is ported from Folia
2024-07-11 09:23:56 -07:00
Spottedleaf
f250ec0a2e Increment ChunkHolderManager current tick
This is an oversight from copying from Folia. The current tick
should be incremented so that incremental autosave can properly
occur.
2024-07-11 08:57:31 -07:00
Spottedleaf
a594d182e4 Fix entities not being visible to clients when teleporting
When teleporting, the spawn position packet will contain the
old position. Then the following tracking update will send a
teleport packet, but the client will lerp the position change
over 3 ticks. However, the client does not tick entities in
unloaded chunks - resulting in the lerp never occuring.

We fix this by sending the current position in the spawn packet.
2024-07-11 08:34:10 -07:00
Spottedleaf
8b558d9e0b Apply entity tracker desync patch 2024-07-11 08:15:36 -07:00
Spottedleaf
f7124df56b Fix recursive chunk loading in chunk unload event
Since the chunk may not even be at a loaded ticket level, the
getChunk call may invoke a sync load. To prevent this, we can
retrieve the full loaded chunk first which is guaranteed to be
non-null when unloading.
2024-07-11 07:16:42 -07:00
Nassim Jahnke
20889d04d8
Fix method reflection remapping with null parameter types passed
Fixes #11052
2024-07-10 18:22:02 +02:00
Bjarne Koll
b0ef3ca25a
Only call EntityDamageEvents before actuallyHurt (#11045)
The recent upstream update moved around the event logic for
EntiyDamageEvent and its derivatives.
However, the event was called on every call to #hurt as it was moved out
of actuallyHurt.

This patch moves the invocation directly before the #actuallyHurt calls,
respective invulnerable timings.
2024-07-09 17:13:51 +02:00
Bjarne Koll
70b0e84476
Properly apply damage tick after absorption (#11043)
The logic in place to prevent players from processing a damage
tick/knockback/etc when hit with 0 damage incorrectly used the damage
events final damage value, which is reduced by absorption.

Instead, use the event's "raw damage", e.g. the amount passed to hurt,
in order to determine if the damage tick should be skipped.
This still allows plugins to change the damage to a non-zero value and
properly damage ticks the player in such a case, but correctly processes
the damage tick in cases where the original damage is non zero but the
actual damage is.
2024-07-08 21:20:18 +02:00
Nassim Jahnke
62ed302bf4
Fix entity distance check when applying knockback
Fixes #11036
2024-07-07 19:27:45 +02:00
Jake Potrebic
2fa5e0e0df
Fix horse inventories (#11028) 2024-07-06 14:25:23 -07:00
Bjarne Koll
4d20922b79
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11024)
* Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e86f4dc4 PR-1041: Improve getPlayer(String) docs to clarify it matches the name
9738f005 Fix spawner API documentation
69ebd9fd PR-1034: Add TrialSpawnerSpawnEvent
23cffd9c PR-973: Improve spawner API and add API for Trial Spawners
8bf19163 PR-1038: Clarify HumanEntity#openInventory(InventoryView) JavaDoc
1ff76351 SPIGOT-7732, SPIGOT-7786: Add freezing damage modifier
02161cb4 PR-1034: Add CreatureSpawnEvent.SpawnReason#TRIAL_SPAWNER
f9cb6f34 SPIGOT-7777: All entity potion effects are removed on death
25d548eb PR-1031: Expose Creeper igniter
ccbf0915 SPIGOT-7770: Reserve spaces in shaped recipes for blank ingredients
17f7097c Clarify ambiguity around what is API
71714f0c Remove note from InventoryView JavaDoc
aaf49731 PR-1030: Deprecate more unused methods in UnsafeValues
3a9dc689 SPIGOT-7771: Material.getDefaultAttributes always returns an empty map

CraftBukkit Changes:
c3ceeb6f7 SPIGOT-7814: Call PlayerShearEntityEvent for Bogged
97b1e4f58 Fix wolf armor not dropping from use of shears
fd2ef563a SPIGOT-7812: Revert "SPIGOT-7809: Restore shield/banner conversion for base colours"
f672c351b SPIGOT-7811: Enchantments are applied on sweeping attack even if damage event is cancelled
cfe29350b SPIGOT-7808: Fix implementation of Enchantment#getName() for bad name return
19335f69e SPIGOT-7809: Restore shield/banner conversion for base colours
ae4f5a0be SPIGOT-7805: Fix jukebox deserialization
62e3b73a4 SPIGOT-7804: Fix written book serialization
aac911d26 SPIGOT-7800, SPIGOT-7801: Keep vanilla behaviour for items dropped on player death
13ece474f PR-1429: Implement TrialSpawnerSpawnEvent
bf13e9113 PR-1354: Improve spawner API and add API for Trial Spawners
515fe49e1 Increase outdated build delay
9cd5a19a0 SPIGOT-7794: Cancelling InventoryItemMoveEvent destroys items
ce40c7b14 SPIGOT-7796: Kickplayer newlines not working
5167256ff SPIGOT-7795: Fix damage/stats ignore the invulnerable damage time
f993563ee Improve cross-world teleportation handling
ab29122cf PR-1433: HumanEntity#openInventory(InventoryView) should only support views belonging to the player
764a541c5 SPIGOT-7732: Issue with the "hurt()" method of EntityLiving and invulnerable time
820084b5f SPIGOT-7791: Skull BlockState with null profile causes NullPointerException
5e46f1c82 SPIGOT-7785: Teleporting a player at the right moment can mess up vanilla teleportation
cbd95a6b3 SPIGOT-7772: Include hidden / non-sampled players in player count
3153debc5 SPIGOT-7790: Server crashes after bee nest is forced to update
e77bb26bb SPIGOT-7788: The healing power of friendship advancement is never granted
ee3d7258a SPIGOT-7789: Fix NPE in CraftMetaFirework applyToItem
2889b3a11 PR-1429: Add CreatureSpawnEvent.SpawnReason#TRIAL_SPAWNER
cdd05bc7f SPIGOT-7777: Speed attribute stays after death; missing EntityPotionEffectEvent call
d0e6af2d4 PR-1428: Expose Creeper igniter
d01c70e93 PR-1425: Fix bytecode transformation taking care of class-to-interface compatibility.
b2b08f68c SPIGOT-7770: Fix certain shaped recipes not registering
3f8e4161f PR-1426: Deprecate more unused methods in UnsafeValues
2c9dd879e SPIGOT-7771: Material.getDefaultAttributes always returns an empty map

Spigot Changes:
491f3675 Rebuild patches
0a642bd7 Rebuild patches
8897571b Rebuild patches
cb8cf80c Fix newlines in custom restart message
1aabe506 Rebuild patches
2024-07-06 21:19:14 +02:00
Jason Penilla
8d91b859cb
Prioritize vanilla commands in function parsing (#11011)
* Prioritize vanilla commands in function parsing

* Handle command blocks as well
2024-07-04 11:49:00 -07:00
Nassim Jahnke
be8ac7acc3
Fix respawn error due to null location
Closes #11017
2024-07-04 16:20:03 +02:00
Nassim Jahnke
b89e6a0195
Readd more patches 2024-07-04 12:46:15 +02:00
Spottedleaf
8c8b227547 Execute chunk tasks mid-tick
If the server tick length is high, then the amount of time
available to process chunk tasks inbetween ticks is low. As a
result, chunk loading and generation may appear to slow down.

To ensure that chunk tasks are always processed, we add logic to
execute chunk tasks during tile entity tick, entity tick, chunk
random ticking, and scheduled block/fluid ticking. The mid-tick task
execution is timed so that it is not prioritised over the server
tick.
2024-07-03 19:22:43 -07:00
powercas_gamer
7eec21e80d
[ci skip] add adventure-key javadoc (#11014) 2024-07-02 21:52:04 +01:00
granny
b45d9b6c97
Fix summon_entity effect attempting to add incorrect entity (#11004) 2024-07-01 10:16:07 +02:00
Nassim Jahnke
aa8d38d3db
Add forRemoval to material data deprecations (#10996)
2018 is calling
2024-06-29 10:58:37 +02:00
Nassim Jahnke
1f5db50424
Change item/xp merge and entity tracking range defaults (#10986) 2024-06-27 22:08:34 +02:00
Spottedleaf
dd49fba8c5 Fix NPE when retrieving an entity with a null UUID
While the null UUID is almost certainly an error, the old
implementation did not NPE as it used a plain HashMap for lookup
by UUID, whereas we use a ConcurrentHashMap which will NPE on
null keys.
2024-06-23 18:59:56 -07:00
Jake Potrebic
dd31654684
bump reflection-rewriter to 0.0.3 (#10969) 2024-06-23 16:39:45 -07:00
Lulu13022002
b99d071a36
Swap some nullable annotations (#10960) 2024-06-24 00:42:44 +02:00
Jake Potrebic
1d3fc0ee68
Bump reflection-rewriter to 0.0.2 (#10927) 2024-06-24 00:29:50 +02:00
Jake Potrebic
897ece48d5
Call EntityPortalEnterEvent on endgateways and make cancellable (#10892) 2024-06-23 15:01:12 -07:00
Lulu13022002
5ae4758c8b
Fix speed for launched trident using api (#10936) 2024-06-23 14:37:20 -07:00
Lulu13022002
97afc9a00c
Fix StackOverflowError for new dispenser interaction (#10949) 2024-06-23 22:24:17 +02:00
SoSeDiK
b2e5587a2e
Expose LivingEntity#canUseSlot (#10930) 2024-06-23 22:11:39 +02:00
Lulu13022002
95aa440473
Add missing effect cause and deprecate PATROL_CAPTAIN cause (#10958) 2024-06-23 22:08:13 +02:00
scarfacered
19eefe9321
Fix SoundEffects only to players diff (#10966)
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2024-06-23 22:03:32 +02:00
Shane Freeder
812701d901
Do not crash when an exp orb attempts to mend an unrepairable item 2024-06-23 14:04:58 +01:00
Lulu13022002
76c2f16f57
Fix wrong diff applying delta twice (#10959) 2024-06-22 20:11:34 +02:00
Pedro
77c763b5ef
Fix PlayerShearBlockEvent drops ignored for Pumpkin (#10956) 2024-06-22 14:50:47 +01:00
Spottedleaf
19105a9019 Fix unload queue storing chunks in wrong sections
The unload queue stored the chunks in the same section as
the chunk coordinate, when it needed to apply the unload shift.

Additionally, change the default region shift to the ticket
propagator shift as there is no benefit to using a low region
shift since no regionizing is occuring. This makes the unload
queue shift 6, which should reduce the number of sections to deal
with while processing unloads.
2024-06-21 11:57:03 -07:00
Lulu13022002
9cd0201535
Preserve velocity for fireball (#10934) 2024-06-21 11:06:31 -07:00
Lulu13022002
0409a68f50
deprecate and update some entity tags (#10932) 2024-06-21 18:51:00 +02:00
Lulu13022002
081146c56e
Validate using_converts_to for food component (#10931) 2024-06-21 18:48:48 +02:00
Lulu13022002
d64be7e10a
Fix NPE of AbstractArrow#getWeapon (#10933) 2024-06-21 18:48:29 +02:00
Lulu13022002
a0fad76fb6
Fix base damage for trident (#10948) 2024-06-21 18:48:18 +02:00
Shane Freeder
0a1b133c28
Revert "Fixes exception log messages getting dropped during bootstrap (#10935)" (Closes #10945)
This reverts commit 2118196dd5.
2024-06-21 10:06:03 +01:00
Shane Freeder
8b1d26df0b
Fix diff in sprint interruption option (Closes #10939) 2024-06-21 01:21:23 +01:00
Jake Potrebic
2118196dd5
Fixes exception log messages getting dropped during bootstrap (#10935) 2024-06-20 11:26:07 -07:00
Lulu13022002
bab07e0ff9
Validate speed for tool component rule (#10923) 2024-06-20 09:32:32 -07:00
Lulu13022002
666bc4dbb2
Experimental annotation changes (#10914)
* Experimental annotation changes

* wind charge damage type is not experimental anymore
2024-06-20 09:03:09 -07:00
Lulu13022002
cf60574a2f
Fix jukebox playable component not being applied on item meta (#10922) 2024-06-20 08:57:56 -07:00
Spottedleaf
2df432f6af Re-add chunk system debug commands
Re-adds the 'chunkinfo', 'holderinfo' and 'debug chunks' commands.

Additionally, this re-adds chunk debug dumping during watchdog
long timeouts.
2024-06-19 12:11:21 -07:00
Spottedleaf
e0d9d6028c Add debug for chunk system unload crash
Somehow, a chunkholder is present in the unload queue after
it has been unloaded. It is likely that this is a result of
adding the chunk holder to the unload queue while it is
unloading. However, that should not be possible.

To find out where it is being added to the unload queue, track
the last stacktrace which adds to the unload queue and check
on chunk holder remove if the holder is present in the unload queue
and log the stacktrace.
2024-06-19 10:55:04 -07:00
Spottedleaf
f4ddd4ac24 Fix ChunkHolder#getFullChunkNow returning non-null when it should not
In the new chunk system, the chunk is only at FULL when either
the FULL callbacks have been invoked or during the FULL callbacks.
2024-06-19 10:42:48 -07:00
Spottedleaf
38428c0d6c Cleanup MCUtils patch for chunk system
Remove utilities that are unused, as well as replacing
the full chunk map with a concurrentutil implementation.

Additionally, fix the addition/removal of chunks to/from the
full chunk map so that getChunkIfLoaded correctly returns a
non-null chunk when calling the load or unload events.
2024-06-19 10:29:03 -07:00
Spottedleaf
c0268ca86e Copy missing diff from old chunk system patch
Fixes:
- EntitiesLoadEvent/EntitiesUnloadEvent not firing
- Chunks not saving properly in a lot of cases
2024-06-19 09:27:15 -07:00
Spottedleaf
250e78c42a Re-add fixlight command 2024-06-19 08:41:24 -07:00
Jason Penilla
4ea696ffe4
Add ticket for chunk load in isChunkGenerated 2024-06-18 21:15:20 -07:00
Jason Penilla
3b1c85b3a2
Execute chunk tasks while waiting for chunk load in isChunkGenerated
this shouldn't be needed as we are requesting EMPTY status, however there is a deeper issue that we will just work around for now

fixes #10916
2024-06-18 21:04:35 -07:00
Jason Penilla
d23825aa56
Add missing null check to getFullChunkIfLoaded
fixes #10915
2024-06-18 18:27:50 -07:00
Jason Penilla
126f6d7dc1
Remove getUnloadingChunkHolder check
It always returns null now. So it could NPE and is not useful.
2024-06-18 12:51:40 -07:00
Jason Penilla
7bbe6820c2
Fix CraftWorld#isChunkGenerated
The upstream implementation is returning true for non-full chunks.

This fix is not ideal since the new chunk system doesn't have a region file/chunk status patch. May want to be revisited before a non-experimental release.
2024-06-18 12:44:07 -07:00
Nassim Jahnke
090775eff4
Use ItemStack.empty() when air is passed into constructor 2024-06-18 15:31:30 +02:00
Bjarne Koll
4514f41ffa
Correct duplicate attribute check (#10901)
Brackets got lost during the update, leading to an incorrect
precondition call.
2024-06-18 11:11:14 +02:00
Jake Potrebic
b4b820851f
Fix NPE for Jukebox#setRecord
Fallback to the global registry if no level exists
Fixes #10899
2024-06-17 17:44:04 -07:00
Emilia Kond
b9f7098723
[ci skip] Fix javadoc mistake in EnchantmentRegistryEntry.Builder (#10898)
The javadoc for EnchantmentRegistryEntry.Builder accidentally refers to
GameEventRegistryEntry, which is a different buildable registry entry.
2024-06-17 22:54:49 +01:00
Nassim Jahnke
21c9a7c79d
Rebuild patches 2024-06-17 21:21:06 +02:00
willkroboth
b3e072a625
Fix hasFiredAsync parameter when AsyncPlayerSendCommandsEvent is called (#10896) 2024-06-17 21:17:51 +02:00
Jake Potrebic
bf8552f0f0
Delegate ItemStack (#10852) 2024-06-17 21:12:42 +02:00
Nassim Jahnke
13992b17c7
Make chunk system loggers calm down a bit 2024-06-17 13:43:21 +02:00
Nassim Jahnke
152f4feff3
Add back improved watchdog support patch 2024-06-17 13:36:43 +02:00
Jake Potrebic
a7f6633362
make EntityPortalReadyEvent#setTargetWorld work again 2024-06-16 15:48:38 -07:00
Jake Potrebic
fb762cf368
remove remaining reference to 'pgive' 2024-06-16 15:38:59 -07:00
Jake Potrebic
8dfb85c173
Enchantment and GameEvent Registry builders (#10889)
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-06-17 00:00:12 +02:00
Jason Penilla
de8220c3bc
Update ChunkMap#distanceManager mapping patch 2024-06-16 14:50:57 -07:00
Nassim Jahnke
61b85e4cbf
Fix legacy cb version in remapper 2024-06-16 23:23:50 +02:00
Spottedleaf
f8ee0a06c5 Fix implementations of ChunkHolder#getChunkIfPresent
Implementations for ChunkStatuses below FULL are supposed to always
return ProtoChunk instances. However, since we used the last completed
status, it could return LevelChunk.

To resolve this, follow Vanilla behavior of tracking chunk
completions by status and replace old ProtoChunk statuses with
ImposterProtoChunk when the chunk generates to FULL.

Additionally, implement an optimisation for retrieving full chunks
by storing a map of pos -> LevelChunk. This requires only a simple
map lookup to occur for full chunks which are loaded.
2024-06-16 14:09:44 -07:00
Jake Potrebic
d9111ccec2
Registry Modification API (#10893)
* Registry Modification API

* some fixes

* even more fixes
2024-06-16 12:39:59 -07:00
Nassim Jahnke
106dbae220
Fix getAddress connection check 2024-06-16 21:31:39 +02:00
Jake Potrebic
167961e744
call EntityDamageItemEvent for thorns 2024-06-16 09:47:53 -07:00
Bjarne Koll
fbc2a55cde
Update Wither#canTravelThroughPortals 2024-06-16 18:04:11 +02:00
Bjarne Koll
e1c0033552
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2b4b6d14 PR-1023: Convert InventoryView to interface

CraftBukkit Changes:
68603b1c1 Use expanded interaction ranges for traced interact events
eae9f760c PR-1414: Convert InventoryView to interface
ee9eafe67 Fix Implementation for DamageSource#isIndirect for internal custom causing entity
2024-06-16 17:23:42 +02:00
Jake Potrebic
ec4c712efa
update 'improve mass craft perf' patch 2024-06-16 08:08:06 -07:00
Jakub Zacek
d8c298007f
Add Adventure API to ServerLinks (#10891) 2024-06-16 13:54:38 +02:00
Nassim Jahnke
c84a3b541c
Remove fully dropped patches 2024-06-16 13:14:53 +02:00
Nassim Jahnke
dc684c60d1
Remove bad server.scheduleOnMain disconnect calls from old patches
The new behavior of disconnect to block the current thread until the disconnect succeeded is better than throwing it off to happen at some point
2024-06-16 12:56:00 +02:00
Nassim Jahnke
752f957e12
Add back more patches 2024-06-16 12:47:57 +02:00
Bjarne Koll
60f3bd8d0c
De-deprecate BlockData#getDestroySpeed 2024-06-16 12:44:22 +02:00
Yannick Lamprecht
1f8e7a7b09
address compile and test issue (#10890) 2024-06-16 11:47:44 +02:00
Spottedleaf
f873bcee24 Fix NPE in V3808
The armor items may not exist, so we need to null check it.
2024-06-15 22:59:15 -07:00
Owen1212055
7240d9d81c
Restore functionality to sand dupe setting 2024-06-15 22:04:02 -04:00
Owen1212055
5a5412ca70
Owen fixing stuff!!! 2024-06-15 21:43:06 -04:00
Jake Potrebic
5e7cd0784b
add some generated typed/tag keys 2024-06-15 15:52:14 -07:00
Spottedleaf
b090c65fe0 Remove unnecessary changes from chunk status fix 2024-06-15 15:31:04 -07:00
Bjarne Koll
e339ec27b4
Deprecate BlockData#getDestroySpeed for removal
The method sadly is not usable in 1.21 without a player as all of an
enchantments attribtue modifiers rely on a base value supplied by a
player. The method could only offer a rough estimate based on some
default values, however a better method for this should be added down
the line rather than trying to force such logic into the existing one.
2024-06-16 00:19:10 +02:00
Bjarne Koll
3555a7776e
Properly forward DispenseEvent #getItem to saddle
Correctly use the DispenseEvent's #getItem ItemStack when placing the
saddle on entities during a dispense behaviour instead of the original
stack.
2024-06-16 00:01:55 +02:00
Bjarne Koll
7df472527f
Configurable damage tick when blocking with shield (#10877)
A long standing bug in spigot and its derivatives was the fact that
players taking damage while blocking with a shield would not receive
invulnerability, while they do in vanilla.

This enabled the pvp technique of disabling a shield and immediately
attacking again to knock a player into the air.
While upstream fixed this and properly aligned itself with vanilla
damage logic (in this specific case) changing such long standing
behaviour has some downsides.

To allow players used to this specific bug to still use it, this patch
introduces a configuration option to re-introduce said bug.
As there is no easy way to *only* re-add this bug, the option is found
in the unsupported section as it may introduce other damage related
disparity from vanilla.
2024-06-15 23:17:51 +02:00
Aya
d41636f445
Add back RecipeIterator fixes patch (#10887) 2024-06-15 21:53:46 +02:00
Jake Potrebic
c1aefeecc6
correctly change enchantment registry to a 'delayed' version 2024-06-15 12:04:06 -07:00
Nassim Jahnke
56b5b7d452
Fix max chunk status checks 2024-06-15 19:57:59 +02:00
Nassim Jahnke
0008fa17e9
Add back more optimization patches 2024-06-15 19:24:11 +02:00
Bjarne Koll
04dad71064
Improve enchantWithLevels logic
Previously would stream and optionally filter out all entries in the
enchantment registry.
Moves it to using the empty optional if treasure is allowed, leaving the
logic to EnchantmentHelper.
2024-06-15 19:08:11 +02:00
Nassim Jahnke
a835ad1076
Merge remote-tracking branch 'origin/dev/1.21' into dev/1.21 2024-06-15 18:52:19 +02:00
Ghast
b420038799
Fix ItemMeta#removeEnchantments (#10886) 2024-06-15 18:52:01 +02:00
Jake Potrebic
fb511c698e
Fix Player#sendBlockState (#10855) 2024-06-15 18:52:00 +02:00
Jake Potrebic
5bd7f4e8ae
Update AbstractArrow item method implementations for 1.20.6 (#10885) 2024-06-15 18:48:27 +02:00
Bjarne Koll
0b6701da5a
Revert DamageSource#getCausingEntity to vanilla 2024-06-15 18:39:55 +02:00
Nassim Jahnke
4bc15f13aa
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
e2160a18 Make MapCursor#type not depends on deprecated values

CraftBukkit Changes:
6ce172642 SPIGOT-7761: Ender pearl does not damage or spawn endermites
f5a63f734 SPIGOT-7759: Chunk not there when requested in ChunkUnloadEvent
28287259c Remove unused import
eb9a7dde0 SPIGOT-7757: Cannot set item in Stonecutter Inventory
f8be9d752 Move deserialized removed unhandled tags to dedicated removedTags
a7e576186 Fix potential mutability issue with CraftMetaItem copy constructor
995885452 SPIGOT-7741: Vanilla ItemComponent in commands can't remove components
9ef69aa0b PR-1284: Move ItemType <-> ItemMeta linking to a centralized place
3e82eafbe PR-1420: Fix DirectEntity and CausingEntity Damager for Creepers ignited by Player
c23daa71f SPIGOT-7751: Fix crash caused by arrows from trial spawners
Make MapCursor#type not depends on deprecated values
SPIGOT-7761: Ender pearl does not damage or spawn endermites
2024-06-15 18:31:58 +02:00
Jake Potrebic
5d834b1b71
rebuild patches 2024-06-15 06:22:06 -07:00
Nassim Jahnke
ee9b820fbe
Update more optimization patches 2024-06-15 14:12:22 +02:00
Jason Penilla
097284d06b
Bump tiny-remapper to 0.10.3
Fixes warnings when using some java 21 features
2024-06-14 21:44:18 -07:00
Jason Penilla
512fd08eca
Update Gradle Wrapper to v8.8 2024-06-14 17:53:11 -07:00
Spottedleaf
730882fca9 Chunk System and Starlight WIP
Chunk system patch was refactored to take advantage of
newer ConcurrentUtil's concurrent long hash table (which
fixes hash collisions caused by chaining fastutil's long hash
and CHM's hash) plus some other minor improvements.

The chunk system was also merged with Starlight, which mostly
provides a small improvement to ThreadedLevelLightEngine#checkBlock
as the scheduling was rewritten.
2024-06-14 17:39:15 -07:00
Jake Potrebic
ffe310a8e1
remove api that was scheduled for removal 2024-06-14 14:07:44 -07:00
Jake Potrebic
188cff20c7
remove old vanilla goals 2024-06-14 13:38:42 -07:00
Jake Potrebic
5fca3ae47b
update generated API 2024-06-14 13:11:23 -07:00
Spottedleaf
f5693896c5 Update ConcurrentUtil
Mostly for the primitive long to reference hashtable impl
2024-06-14 10:47:33 -07:00
Spottedleaf
df633e5ffa DataConverter 1.21 2024-06-14 10:34:45 -07:00
Spottedleaf
38b3182a90 Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
befcf86d SPIGOT-7740: Fix using new map cursor types
09229095 Add EntityDamageEvent.DamageCause#CAMPFIRE

CraftBukkit Changes:
a1d2cd152 SPIGOT-7747: Mob head is not dropped when mob was blown up by a charged creeper
8078294bc SPIGOT-7746: Server Crashing when Players Getting into End Portals
8d842e250 SPIGOT-7744: Fix exception for shooting projectiles with flame enchantment
64e0ad129 SPIGOT-7744: Fix crash when shooting arrows in creative mode
819f7a10a Fix player items not dropping on death
0a0229bb5 Implement DamageCause#CAMPFIRE and minor improvement in exception for Unhandled block damage
2024-06-14 10:15:52 -07:00
Nassim Jahnke
66f7b672ed
Fix body equipmentslot and effect enum 2024-06-14 18:53:32 +02:00
Nassim Jahnke
038f8d915e
Fixup and deprecate player profiles in ping event
The player sample uses game profile internally, but discards everything but the name and uuid and does not follow player profile restrictions, so it doesn't make sense to use that in the event.
2024-06-14 18:17:26 +02:00
Nassim Jahnke
5442bffab5
Make it compile 2024-06-14 18:02:15 +02:00
Bjarne Koll
184a943ad4
Adopt previous commit changes in API 2024-06-14 16:04:56 +02:00
Bjarne Koll
547f09dfa0
Some work on the ItemMend events 2024-06-14 16:01:00 +02:00
Bjarne Koll
69d1d0a4f4
Pretend to fix compile errors 2024-06-14 15:16:29 +02:00
Nassim Jahnke
a308c7c8d7
Fix more compile issues 2024-06-14 14:28:06 +02:00
Nassim Jahnke
0d3ce2d704
Fix more compile issues 2024-06-14 14:11:52 +02:00
Nassim Jahnke
3c04f9f668
Fix a few compile errors 2024-06-14 13:07:50 +02:00
Bjarne Koll
6a34750160
Move unapplied patches to the back 2024-06-14 12:05:15 +02:00
Bjarne Koll
6d4e235784
988 2024-06-14 11:59:44 +02:00
Bjarne Koll
4140de28eb
960 2024-06-14 11:07:50 +02:00
Bjarne Koll
a399f23903
956 2024-06-14 10:56:28 +02:00
Bjarne Koll
14c03366ed
922 2024-06-14 10:17:11 +02:00
Jason Penilla
33b36cde31
update some patches 2024-06-13 20:41:44 -07:00
Jake Potrebic
52b49fbcc8
788/1053 2024-06-13 18:30:23 -07:00
Jake Potrebic
8731266275
650/1053 2024-06-13 17:08:12 -07:00
Jake Potrebic
ba163e10bb
585/1053 2024-06-13 16:32:45 -07:00
Bjarne Koll
ed2ea4538e
538 2024-06-14 00:44:26 +02:00
Jake Potrebic
083bd9e75c
531/1053 2024-06-13 14:42:02 -07:00
Jake Potrebic
27e29ccaf2
487/1053 2024-06-13 13:57:13 -07:00
Jake Potrebic
0bc9aeef26
385 2024-06-13 13:14:13 -07:00
Jake Potrebic
ec05cb8b38
279 2024-06-13 12:04:27 -07:00
Jake Potrebic
0b7552272a
194 2024-06-13 11:09:28 -07:00
Jake Potrebic
2055809b1e
117 2024-06-13 10:30:39 -07:00
Jake Potrebic
8a37f93925
62 2024-06-13 10:12:48 -07:00
Jake Potrebic
7fbb8278e7
Finish API patches 2024-06-13 08:45:43 -07:00
Bjarne Koll
79e2cb620e
Update upstream (Bukkit/CraftBukkit/Spigot) (#10875)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
376e37db SPIGOT-7677: Update which entities are marked as spawnable
06c4add3 SPIGOT-7737: Add separate TreeType.MEGA_PINE
19b7caaa SPIGOT-7731: Spawn eggs cannot have damage
e585297e PR-1022: Add force option to Player#spawnParticle
d26e0094 PR-1018: Add methods to get players seeing specific chunks
8df1ed18 PR-978: Add Material#isCompostable and Material#getCompostChance
4b9b59c7 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
8d1e700a PR-1020: Cast instead of using #typed when getting BlockType and ItemType to better work with testing / mocks
fa28607a PR-1016: Fix incorrect assumption of Fireball having constant speed
4c6c8586 PR-1015: Add a tool component to ItemMeta
6f6b2123 PR-1014: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects
f511cfe1 PR-1013, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType
def44cbf SPIGOT-7669: Fix typo in ProjectileHitEvent#getHitBlockFace documentation
53fa4f72 PR-1011: Throw an exception if a RecipeChoice is ever supplied air

CraftBukkit Changes:
ee95e171a SPIGOT-7737: Add separate TreeType.MEGA_PINE
0dae4c62c Fix spawn egg equality check and copy constructor
ab59e847c Fix spawn eggs with no entity creating invalid stacks and disconnect creative clients
3b6093b28 SPIGOT-7736: Creative spawn egg use loses components
c6b4d5a87 SPIGOT-7731: Spawn eggs cannot have damage
340ccd57f SPIGOT-7735: Fix serialization of player heads with note block sound
fd2f41834 SPIGOT-7734: Can't register a custom advancement using unsafe()
02456e2a5 PR-1413: Add force option to Player#spawnParticle
6a61f38b2 SPIGOT-7680: Per-world weather command
58c41cebb PR-1409: Add methods to get players seeing specific chunks
16c976797 PR-1412: Fix shipwreck loot tables not being set for BlockTransformers
7189ba636 PR-1360: Add Material#isCompostable and Material#getCompostChance
900384556 SPIGOT-7676: Enforce locale parameter in toLowerCase and toUpperCase method calls and always use root locale
bdb40c5f1 Increase outdated build delay
d6607c7dd SPIGOT-7675: Fix FoodComponent config deserialization
b148ed332 PR-1406: Fix incorrect assumption of Fireball having constant speed
3ec31ca75 PR-1405: Add a tool component to ItemMeta
5d7d675b9 PR-1404: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects
960827981 PR-1403, SPIGOT-4288, SPIGOT-6202: Add material rerouting in preparation for the switch to ItemType and BlockType
94e44ec93 PR-1401: Add a config option to accept old keys in registry get calls
a43701920 PR-1402: Fix ChunkSnapshot#isSectionEmpty() is always false
87d0a3368 SPIGOT-7668: Move NONE Registry updater to FieldRename to avoid some class loader issues
2ea1e7ac2 PR-1399: Fix regression preventing positive .setDamage value from causing knockback for 0 damage events
ba2d49d21 Increase outdated build delay

Spigot Changes:
fcd94e21 Rebuild patches
342f4939 SPIGOT-7661: Add experimental unload-frozen-chunks option
2024-06-13 16:45:27 +02:00
Bjarne Koll
906df69f05
Prevent internal NPE on ItemStack#damage (#10836)
ItemStack#damage internally uses ItemStack#hurtAndBreak, which
previously would call a Consumer in case the item broke.
Since 1.20.5 the break game event logic however resides in said method
and was using the equipment slot passed, which is null in the case of
the API ItemStack#damage method.

This commit prevents the NPE by first null checking the slot.
Addittionally, hurtAndBreak also now checks if the player has infinite
materials, e.g. is in creative mode, to prevent damaging the item.

As such as filter is undesirable for API calls, this commit also skips
this logic in case of an API invocation.
2024-06-10 08:24:52 +02:00
Lulu13022002
bd5867a96f
Handle alpha channel from potion_contents component (#10808) 2024-06-04 16:55:29 -04:00
Jake Potrebic
88d76d9fe5
Make Bogged implement Shearable (#10844) 2024-06-04 16:26:40 -04:00
Jake Potrebic
79c1ce1844
Add since to deprecated for removals (#10848) 2024-06-04 15:40:18 -04:00
Spottedleaf
4f13be937e Do not perform chunk existance check for I/O scheduling
In order to check if a chunk exists, the RegionFile lock
(if the RegionFile is opened) will be acquired. However,
the RegionFile may be performing I/O operations, in which
case will stall the acquire operation.

To ensure that threads scheduling loads do not incur a stall,
we can avoid this check entirely - the RegionFile I/O
thread(s) will eventually perform the exist check itself.
2024-06-03 13:31:41 -07:00
Bjarne Koll
b8f2101c36
Only assign blockstate data if super ctor did not (#10841)
The CraftBlockStateMeta constructor CraftBlockStateMeta(Map) invokes its
parent constructor, which itself invokes deserializeInternal, which is
implemented on CraftBlockStateMeta to read the components and block
entity tag from the passed map.

Field initialization happens after the call to the super constructor,
meaning the current code overwrites the parsed internal data with the
EMPTY defaults.

This is prevented by moving the initialization into its own code block
that can null check the fields prior to defaulting their value to EMPTY.
2024-06-03 10:39:20 -07:00
Jake Potrebic
54fbd0cf0c
clarify what getEntityId actually returns (#10839) 2024-06-03 10:20:43 -07:00
Jake Potrebic
ac647513b2
Use RegistryOps in the correct places (#10843) 2024-06-02 15:19:17 -07:00
Bjarne Koll
5d8e53d78d
Fix CommandSourceStack#bypassSelectorPermissions (#10837)
The previous implementation would throw a command exception if the
CommandSourceStack had its bypassSelectorPermissions flag set to true,
which is the incorrect behaviour.

Instead, it should only throw an exception if the flag is set to false
and all its other checks "fail" too.
2024-06-01 16:26:11 +02:00
Jake Potrebic
0513374b1f
Fire TabCompleteEvent for legacy commands (#10834) 2024-05-31 17:46:42 +02:00
TotalledZebra
3181470ad7
Add entity heal API (#10267) 2024-05-30 22:31:45 +02:00
Jake Potrebic
a47e11d464
fix knockback events (#10831)
* fix knockback events

* squash

* handle cancelled event for explosions
2024-05-30 13:17:16 -07:00
Jason Penilla
06e69c8991
Use CommandSourceStack in AsyncPlayerSendCommandsEvent (#10826) 2024-05-30 11:32:43 -07:00
Shane Freeder
8e6554a80a
Fix sending disconnect packet in phases where it doesn't exist 2024-05-30 19:05:39 +01:00
Jake Potrebic
0fcf3e347f
Deprecate InvAction#HOTBAR_MOVE_AND_READD (#10784) 2024-05-29 14:56:14 -07:00
SoSeDiK
27d2ed84f4
Extend fishing API (#10634)
Adds a missing fishing state when the fish is lured and fires an event for it.
Also adds a way to control the fish swimming time towards the bobber.
2024-05-29 23:45:01 +02:00
Jake Potrebic
efd91e52a6
Add registry-related argument types (#10770)
* Add registry-related argument types

* fix tests
2024-05-29 14:11:52 -07:00
Jake Potrebic
a31dc90741
Several fixes and new api for experience merging/stacking (#9242) 2024-05-29 22:58:57 +02:00
Bjarne Koll
ed85aac53c
Flatten namespaced vanilla command alias redirects (#10821)
The brigadier command dispatcher is not capable of executing commands
that redirect more than one.
The exemplary alias 'minecraft:tp' may hence not redirect to 'tp' it
instead has to redirect to 'teleport' as 'tp' itself is merely a
redirect.
2024-05-29 21:47:07 +02:00
Jake Potrebic
7e2b682e54
Fix skipping custom block entity tag (#10812) 2024-05-29 21:22:51 +02:00
Jake Potrebic
d9e659a618
Allow firework effects with no colors (#10814) 2024-05-29 20:50:44 +02:00
Jake Potrebic
716b868b08
Use RegistryOps for loadAdvancement (#10799) 2024-05-29 20:27:29 +02:00
Jake Potrebic
672c07728f
handle BODY slot for non-mobs (#10822) 2024-05-29 11:23:51 -07:00
Lulu13022002
84f6e6e0b1
Fix max temper API for llama (#10823) 2024-05-29 11:17:56 -07:00
Bjarne Koll
9d6f2cced7
[ci skip] Rebuild patches (#10803) 2024-05-28 14:19:41 +02:00
Bjarne Koll
9c917fef08
[ci skip] Clean up paperclip build-pr workflow (#10802) 2024-05-28 14:19:31 +02:00
Bjarne Koll
b0c9b9c4d8
Only remove worldgen block entity on changed block (#10794) 2024-05-28 11:45:03 +02:00
Shane Freeder
23fe1166d4
Fix missing debug trace 2024-05-27 18:33:34 +01:00
Tamion
347bbe3897
Fix Cancelling BlockPlaceEvent calling onRemove (#10773) 2024-05-27 00:03:48 +02:00
Jake Potrebic
b0e3ca43b8
Prevent NPE if hooked entity was cleared (#10712) 2024-05-26 23:41:30 +02:00
Lulu13022002
841ab4134d
Fix more item desync when an event is cancelled (#10654) 2024-05-26 23:30:45 +02:00
Cross
1b8cdc6d82
Extend Player Interact cancellation to cover Jigsaw blocks (#10719) 2024-05-26 22:54:55 +02:00
Jake Potrebic
6649a171dc
Fix BlockStateMeta equals (#10795) 2024-05-26 22:49:00 +02:00
Lulu13022002
ac4ee06c01
Fix integer overflow for lag compensating eating check (#10797) 2024-05-26 22:35:58 +02:00
Jake Potrebic
9774a52d11
fix and cleanup loot table patches (#10100)
* fix and cleanup loot table patches

* fixes
2024-05-26 12:51:15 -07:00
Lulu13022002
ca50b87947
Clear firework item properly (#10793) 2024-05-26 19:57:38 +02:00
Jake Potrebic
a7ae966530
readd itemstack data sanitization (#10454)
* readd itemstack data sanitization

* use autocloseable
2024-05-26 10:56:33 -07:00
Jake Potrebic
4e10fadfdc
reset meta block state on BlockStateMeta#setBlockState 2024-05-25 22:36:55 -07:00
Jake Potrebic
41bee55b53
Fix NPE for color-related metas
Fixes #10789
2024-05-25 19:55:51 -07:00
Janet Blackquill
f0bd0cca8f
Expose anvil cost in the API (#10682) 2024-05-26 01:47:14 +02:00
Jake Potrebic
26e90b9ffb
Fix CraftMetaBlockState for data components (#10731)
This will go on forever...
2024-05-25 16:37:35 -07:00
Lulu13022002
535dca56c2
Fix a few issues with ItemMeta (#10740) 2024-05-26 00:58:56 +02:00
jake-brennan714
4fd3ac00b4
[ci skip] Update Player#getListeningPluginChannels Jdoc (#10778) 2024-05-25 23:59:01 +02:00
Lulu13022002
dff591d292
Allow to define new map cursor types (#10782) 2024-05-25 23:56:44 +02:00
TonytheMacaroni
377733d44c
Use getter/setter on Mob for equipment drop chances (#10780) 2024-05-24 19:52:54 +02:00
Shane Freeder
3004717b0e
Do not re-wrap vanilla goals (#10751)
There is no need to rewrap vanilla goals when they're being reregistered,
this breaks some expectations around behavior outside of general
wasting of resources.

Resolves: #10743
2024-05-24 16:22:41 +02:00
Jason Penilla
5e7b65a9a9
Allow using PluginLoader classpath API from Bukkit plugins (#10758)
Allows using the PluginLoader API without any of the other changes imposed by switching to a paper-plugin.yml.

Used by setting paper-plugin-loader in plugin.yml to the class name of your PluginLoader.

Also allows skipping the libraries field by setting paper-skip-libraries to true (by default both libraries and jars provided by the PluginLoader are added to the classpath).
2024-05-23 13:13:02 -07:00
Jake Potrebic
2a90732677
Remove incorrect logic for Fireball#setVelocity (#10764) 2024-05-23 12:48:11 -07:00
Jake Potrebic
6de7a1f052
Improve default item attributes API (#10765) 2024-05-23 11:44:07 -07:00
Jason Penilla
d408381c77
Print CommandRegisteredEvent deprecation warnings again (#10756) 2024-05-23 10:44:45 -07:00
Jake Potrebic
3de408ee3e
Fix equipment slot and group API (#10767) 2024-05-23 10:39:44 -07:00
Jake Potrebic
a9201d4a7d
[ci skip] Move logic in our patches to ItemType/BlockType (#10772) 2024-05-23 10:32:02 -07:00
Jake Potrebic
b14958485d
Always show command exception stack traces in logs (#10766) 2024-05-22 10:24:09 -07:00
Jake Potrebic
d3ffa62b7f
fix default item attributes 2024-05-22 07:16:50 -07:00
Spottedleaf
980cff9f29 Fix compile 2024-05-21 08:41:36 -07:00
Spottedleaf
66cb880754 Remove ThreadedWorldUpgrader patch
The patch does not implement Vanilla forceUpgrade behavior.
Specifically, poi/entity conversion and regionfile recreation.

The Vanilla force upgrader is also no longer broken by CB, so the
bug fixes from this patch are not relevant anymore.
2024-05-21 08:21:28 -07:00
Jason Penilla
9bf4855524
Add a better warning message than "Server performance will be affected" for CommandRegisteredEvent use (#10754) 2024-05-20 11:15:21 -07:00
Jake Potrebic
7d2e5c33ea
Add an 'empty' RecipeChoice for certain ingredient slots (#10710) 2024-05-20 07:20:47 -07:00
Jake Potrebic
591521e697
Check for more correct profile validation (#10730) 2024-05-19 17:45:43 -07:00
Jake Potrebic
b3b340617e
fix CompassMeta not being correct (#10737) 2024-05-19 17:15:44 -07:00
Shane Freeder
0ad09de75b
Make PaperSimplePluginClassLoader show class which is not found 2024-05-18 21:17:54 +01:00
Jake Potrebic
5a9afbee65
Fixes issues in the suppress dismount cancellation patch (#10735) 2024-05-17 14:37:16 -07:00
Jake Potrebic
d8d59e0cde
Fix NPE sending resource pack without prompt
Fixes KyoriPowered/adventure#1075
2024-05-17 14:22:45 -07:00
Riley Park
f17519338b
Expose server build information (#10729)
* Expose server build information

* squash patches

* final tweaks

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2024-05-15 17:06:59 -07:00
Jason Penilla
3fc93581bb
Show stacktrace when modifyItemStack fails 2024-05-13 22:58:50 -07:00
Jason Penilla
2faa3b2f44 Correctly copy alias requirements in command upgrader
Fixes NPE when converting namespaced commands.

Since the brigadier command api, more aliased commands
(namespaced variants) are registered in the vanilla dispatcher,
which made this issue more apparent.
2024-05-13 15:55:15 -07:00
Spottedleaf
bebcc9cc93 Make exception during command conversion non-fatal
Instead of allowing chunks to fail to convert completely,
simply log the exception and the offending command. Command
conversion failure should never result in chunk data deletion,
as commands are not critical chunk data.
2024-05-13 14:40:02 -07:00
scarfacered
fa8a407072
Remove Adventure snapshot repo from dev bundle (#10716)
* Remove Adventure snapshot repo

* do not remove trailing comma
2024-05-13 10:38:28 -07:00
Jake Potrebic
218d33ccb1
fix creating complex recipes that have air results
Fixes #10715
2024-05-13 06:16:52 -07:00
Jake Potrebic
0688f212f5
Better way to keep paper datapack enabled 2024-05-12 21:48:07 -07:00
Jake Potrebic
11c39637de
Improve Recipe validation (#10707) 2024-05-12 13:46:46 -07:00
Bjarne Koll
f041f48458
Prevent infinite recursion on cyclic brig redirect (#10705)
Prevent infinite recursion when declaring a cyclic relation between
command nodes via child nodes redirecting to an nth parent by marking a
command node as unwrapped before unwrapping its children.
2024-05-12 17:41:21 +02:00
Owen
7e48f66c05
Properly pass requirement on namespaced redirects (#10701) 2024-05-11 23:46:42 -07:00
Jason Penilla
711f82e01e
Fix signed book page serialization (#10696) 2024-05-12 00:13:18 +02:00
Jake Potrebic
ac554ad46d
Updated Upstream (Bukkit/CraftBukkit) (#10691)
Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fa99e752 PR-1007: Add ItemMeta#getAsComponentString()
94a91782 Fix copy-pasted BlockType.Typed documentation
9b34ac8c Largely restore deprecated PotionData API
51a6449b PR-1008: Deprecate ITEMS_TOOLS, removed in 1.20.5
702d15fe Fix Javadoc reference
42f6cdf4 PR-919: Add internal ItemType and BlockType, delegate Material methods to them
237bb37b SPIGOT-1166, SPIGOT-7647: Expose Damager BlockState in EntityDamageByBlockEvent
035ea146 SPIGOT-6993: Allow #setVelocity to change the speed of a fireball and add a note to #setDirection about it
8c7880fb PR-1004: Improve field rename handling and centralize conversion between bukkit and string more
87c90e93 SPIGOT-7650: Add DamageSource for EntityDeathEvent and PlayerDeathEvent

CraftBukkit Changes:
4af0f22e8 SPIGOT-7664: Item meta should prevail over block states
c2ccc46ec SPIGOT-7666: Fix access to llama and horse special slot
124ac66d7 SPIGOT-7665: Fix ThrownPotion#getEffects() implementation only bringing custom effects
66f1f439a Restore null page behaviour of signed books even though not strictly allowed by API
6118e5398 Fix regression listening to minecraft:brand custom payloads
c1a26b366 Fix unnecessary and potential not thread-safe chat visibility check
12360a7ec Remove unused imports
147b098b4 PR-1397: Add ItemMeta#getAsComponentString()
428aefe0e Largely restore deprecated PotionData API
afe5b5ee9 PR-1275: Add internal ItemType and BlockType, delegate Material methods to them
8afeafa7d SPIGOT-1166, SPIGOT-7647: Expose Damager BlockState in EntityDamageByBlockEvent
4e7d749d4 SPIGOT-6993: Allow #setVelocity to change the speed of a fireball and add a note to #setDirection about it
441880757 Support both entity_data and bucket_entity_data on axolotl/fish buckets
0e22fdd1e Fix custom direct BlockState being not correctly set in DamageSource
f2182ed47 SPIGOT-7659: TropicalFishBucketMeta should use BUCKET_ENTITY_DATA
2a6207fe1 PR-1393: Improve field rename handling and centralize conversion between bukkit and string more
c024a5039 SPIGOT-7650: Add DamageSource for EntityDeathEvent and PlayerDeathEvent
741b84480 PR-1390: Improve internal handling of damage sources
0364df4e1 SPIGOT-7657: Error when loading angry entities
2024-05-11 23:48:37 +02:00
Owen
b98d20a8ac
Brigadier Command Support (#8235)
Adds the ability for plugins to register their own brigadier commands 

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-05-11 16:30:30 -04:00
Jason Penilla
447f9a1e16
[ci skip] Fix paperclip PR label 2024-05-11 11:13:19 -07:00
Jake Potrebic
6c02dbcfa1
handle recent ItemMeta changes in serialization logic 2024-05-11 09:14:23 -07:00
Jake Potrebic
a61d58d467
adjust ItemMeta to distinguish null and empty modifiers
Fixes #10686 (again)
2024-05-11 07:16:23 -07:00
Jake Potrebic
cdb6ba8ef1
Fix keepalive time interval (#10690) 2024-05-10 17:23:58 -07:00
Jake Potrebic
39532a1f8c
Fix stacks losing empty attr modifiers
Fixes #10686
2024-05-10 12:05:07 -07:00
Jason Penilla
4fd58a1b8f
Add conversion for summon command 2024-05-10 12:57:07 +02:00
Nassim Jahnke
7f1a154d15
Add validation to player profile and properties (#10680) 2024-05-10 12:52:03 +02:00
Spottedleaf
8748ae16ac Use MCDataConverter instead of raw convert call for cmd converter
MCDataConverter uses the breakpoint system, which for future
updates may be neccesary (probably not).

Also, add the 1.20.6 version field.
2024-05-10 00:34:37 -07:00
Joseph Burton
2df1dace32 Fix DataConverter ConverterParticleToNBT.parseProperties
- The old code was using `StringReader.peek()` in a place where it meant to be `StringReader.skip()`.
- The vanilla code allows a trailing comma, but only if there is no whitespace between it and the closing bracket, which is a bit weird. I think that's a bug and it shouldn't allow trailing commas, but if you disagree then only the first issue needs to be fixed.
2024-05-10 00:32:31 -07:00
Spottedleaf
b56e92f3d4 Fix chunk data version check not running in chunk system
The old read() method should just redirect to the new
chunk system method, however due to an error in moving
the chunk system patch around the data version check was
left in the old (UNUSED) read() method.
2024-05-09 23:47:13 -07:00
Spottedleaf
cc29d2b7d5 Invalidate PathTypeCache when pathfinding updates are disabled
The configuration should not allow the cache to break. Additionally,
invalidating the cache is cheap and as such there is no gain to avoid
invalidating it.
2024-05-09 23:07:32 -07:00
Spottedleaf
1b67e02385 Fix entity tracker desync when new players are added to the tracker
The delta position packet instructs the client to update
the entity position by a position difference. However, this position
difference is relative to the last position in the entity tracker
state, not the last position which has been sent to the player. As
a result, if the last position the player has recorded is different
than the one stored in the entity tracker (which occurs when a new
player is added to an existing entity tracker state) then the sent
position difference will cause a position desync for the client.

We can resolve this problem by either tracking the last position
sent per-player, or by simply resetting the last sent position
in the entity tracker state every time a new player is added.
Resetting the last sent position every time a new player is
added to the tracker is just easier to do, so that is what
this patch does.
2024-05-09 17:08:59 -07:00
Nassim Jahnke
f2512b1238
Print data component type on encoding error 2024-05-09 15:12:12 +02:00
Nassim Jahnke
ab2a85a35f
[ci skip] Clarify var entry in contributing file 2024-05-09 15:10:27 +02:00
Shane Freeder
5729b294ee
Update Adventure to 4.17.0 Release 2024-05-08 15:48:45 +01:00
Bjarne Koll
eee55d019f
Correctly compare holders in BeaconMenu (#10673) 2024-05-07 18:18:57 -07:00
Lulu13022002
89ad61fd00
Fix hopper pull event being skipped after the first call (#10667) 2024-05-07 14:28:45 +02:00
Jason Penilla
9e51f94941
Fix ping event always receiving protocol version 0 (#10671) 2024-05-07 14:24:45 +02:00
Jake Potrebic
ac3a5471c8
Fix BlockStateMeta (#10647)
* Fixes CraftMetaBlockState block entity data components

* rebase and merge into general item meta fix

* Add javadoc notice

* Update message

---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-05-05 12:56:46 -07:00
SoSeDiK
2a6a5fef59
Add a way to check whether the chest is blocked (#10635)
* More Chest Block API

* rebased and slight logic fixes
2024-05-05 10:57:28 -07:00
Bridge
21d91ce634
Prevent profile lookups when unnecessary (#10651) 2024-05-05 19:07:30 +02:00
Tamion
716dfd8698
Fix EntityLoadCrossbowEvent (#10645)
* fix

* hehe
2024-05-05 09:54:04 -07:00
Lulu13022002
816ea9ecd5
[ci skip] Update old particle reference in javadoc (#10652) 2024-05-05 18:44:06 +02:00
NonSwag
54c5ecb4e4
Add missing SpigotConfig logCommands check (#10659) 2024-05-05 18:41:02 +02:00
Nostal Yuu
0e43d3c103
Added API to get player's proxy address (#10400) 2024-05-05 18:39:32 +02:00
Jake Potrebic
9d8d38d137
Updated Upstream (CraftBukkit) (#10646)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
66fd94322 SPIGOT-7652: Remove remap for SPELL_MOB_AMBIENT which no longer exists
ecfa4f973 SPIGOT-7654: ItemStack#isSimilar does not work with empty BlockStateMeta
4460ecc49 SPIGOT-7655: ItemMeta#addItemFlags(ItemFlag.HIDE_ATTRIBUTES) not working when no attribute modifiers set
5d84f48a4 SPIGOT-7653: Update ApiVersion.CURRENT with latest version and include tests
2024-05-05 18:08:55 +02:00
Lulu13022002
b13c7dbe36
Add missing experimental field and annotations (#10653) 2024-05-05 09:00:54 -07:00
Bjarne Koll
7ae2c671c6
Keep components using single items in creative (#10664)
The craftbukkit implementation stores the old and new data patch of an
item during ItemStack#useOn(UseOnContext) to properly cancel events via
comparison and change detection of the component patch.

However, it uses #getComponentsPatch to fetch the new stack component
patch, which always yields an empty patch set if an itemstack is
considered empty by the game.
As the restoration of an itemstack's count to its previous state is
handled after the entire ItemStack#useOn method, items used in creative
mode temporarily have a count of zero, which causes craftbukkit to
consider their new component patch as EMPTY even tho said item may have
data.
The new patch is applied and, after useOn completes, the count is reset
if the player is in creative mode, leading to lost data.

This commit fixes said inconsistency by directly accessing the
components of the item via components#asPatch, storing the proper
component patch even for an item that temporarily has a count of zero.
2024-05-05 11:40:36 +02:00
Jake Potrebic
7401313e16
fix shear drops for wolf and bogged
Fixes #10661
2024-05-04 22:48:10 -07:00
Nassim Jahnke
6fcca46674
Add missing step in V3818 2024-05-04 22:50:20 +02:00
Jake Potrebic
5632210f10
add RegistryAccess for managing registries (#10154)
* add RegistryAccess for managing registries

* add missing types to key data generator

* fix some stuff

* Add RegistryKeys for all other non-server-backed registries

* fix tests

* remove Experimental annotations
2024-05-04 11:22:35 -07:00
Joseph Burton
156675c773
Fix lodestone compass target conversion 2024-05-04 12:58:06 +02:00
Joseph Burton
0db72ac19e
Fix can_place_on conversion and size check for item containers 2024-05-02 20:23:15 +02:00
Shane Freeder
59fe7ccc3b
default save-empty-scoreboard-teams to vanilla
The primary environmental factor which caused this feature to be implemented
is no longer much of a factor within the community
2024-05-02 09:53:43 +01:00
SoSeDiK
544ce20e01
Expose #hasColor to leather armor (#10638) 2024-05-01 19:14:42 +02:00
SoSeDiK
18c201b838
Add EquipmentSlot#getOppositeHand (#10632) 2024-05-01 19:14:27 +02:00
SoSeDiK
faa7aa266a
Add GameMode#isInvulnerable (#10633) 2024-05-01 19:14:17 +02:00
Nassim Jahnke
310b47bb96
Update Java version references, add note on var usages 2024-05-01 18:44:39 +02:00
Andrew Teeter
b8c454c2ba
Add damage check for mending (#10631) 2024-05-01 12:01:48 +02:00
SoSeDiK
4cfd9e25fa
Expose canReach to mob pathfinding API (#10636) 2024-05-01 12:00:11 +02:00
Noah van der Aa
3e0eb4a1ba
Updated Upstream (CraftBukkit) (#10624)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
666f091c6 SPIGOT-7649: Allow /setworldspawn command in all worlds again
2024-04-30 16:53:54 -07:00
Jake Potrebic
fa6013d83b
Fixes beds not exploding in the nether
Also correctly marks the captured BlockState as "unplaced"
Fixes #10629
2024-04-30 16:42:43 -07:00
Jason Penilla
8c058f88a6
Update paperweight to 1.6.3 (#10626) 2024-04-30 10:30:14 -07:00
Nassim Jahnke
4ea67abd46
[ci skip] Remove trailing comma in projects action 2024-04-30 15:56:43 +02:00
Nassim Jahnke
937a67a651
Add initial size cap to component map 2024-04-30 11:14:35 +02:00
Jason Penilla
3fdd0948b7
Fix sealed package check in BytecodeModifyingURLClassLoader (#10627) 2024-04-30 01:21:16 -07:00
Jake Potrebic
25e44bc63b
fix dumpitem command nbt format
use the snbt visitor instead of plain string
2024-04-29 18:49:19 -07:00
Jake Potrebic
812ccb96a4
fix spawnChunkRadius gamerule resetting
Fixes #10622
2024-04-29 15:22:29 -07:00
Noah van der Aa
44ee092878
1.20.6 (#10623) 2024-04-30 00:16:07 +02:00
Riley Park
fbe3c00675 [ci skip] update projects workflow configuration 2024-04-29 13:29:50 -07:00
Bjarne Koll
8f7ac62905
Validate manifest provided mapping namespace (#10612)
With plugins adopting paperweights mapping namespaces in their manifest
file in and after paper 1.20.5, incorrectly spelled namespaces
previously were simply implied as the spigot namespace.

This commit properly ensures plugin authors are using a known mapping
namespace in their manifest, avoiding down the line confusion on
incorrect remapping behaviour.

The commit also fixes two incorrect log parameters.
2024-04-28 20:43:50 -07:00
Jake Potrebic
f9397e108e
Fix incorrect Commodore mapping of sweeping enchant 2024-04-28 17:25:21 -07:00
Jake Potrebic
69a971a35c
Reset component prototype on itemtype change 2024-04-28 17:13:30 -07:00
Jason Penilla
05308fc299
Remap plugin libraries with namespace set to spigot (#10610)
* Remap plugin libraries with namespace set to spigot

* Remap plugin libraries with namespace set to spigot
2024-04-28 14:55:10 -07:00
Jason Penilla
7f2d5315fd
Rewrite reflection in library loader jars (#10608)
* Rewrite reflection in library loader jars

* Address todos
2024-04-28 13:14:10 -07:00
Jake Potrebic
61c9c07e95
Fix CraftMetaBlockState adding extra tags 2024-04-28 12:34:16 -07:00
Riley Park
82a801201e [ci skip] adjust projects workflow for label changes 2024-04-28 12:12:57 -07:00
Noah van der Aa
0f3e324152
[ci skip] Fix discussion template file name (#10607) 2024-04-28 11:16:07 -07:00
Riley Park
ba673a3b78
[ci skip] Feature requests are now in GitHub Discussions (#10606)
* [ci skip] feature requests are now discussions, not issues

* Re-add discussion template

* [ci skip] remove old feature label

---------

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
2024-04-28 11:12:37 -07:00
Shane Freeder
52ff3b7382
Add itemName components (Resolves #10467) (#10471)
* Add itemName components (Resolves ##10467)

* improve javadocs and formatting

* rebased

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-04-28 10:08:59 -07:00
Jake Potrebic
0f4d328fc1
final missing validation for data components 2024-04-28 09:46:33 -07:00
Nassim Jahnke
aed7dcab98
Fix overly strong name validation in player heads
Closes #10477
2024-04-28 18:25:32 +02:00
Jake Potrebic
4491ac05d1
respect hard list size limits in ItemMeta 2024-04-28 09:06:14 -07:00
Nassim Jahnke
9d6e7e3df0
Don't hard fail on plugin remap error
Closes #10474
2024-04-28 17:25:44 +02:00
Jake Potrebic
c4a1cd137a
Fix issue with empty lists in adventure predicates
Fixes #10473
2024-04-28 08:22:16 -07:00
Shane Freeder
37b3891032
Fix another missing book meta tag 2024-04-28 13:48:20 +01:00
Shane Freeder
6e31f385e3
Fix book meta lacking resolved tag from older versions (Fixes #10470) 2024-04-28 13:22:54 +01:00
Nassim Jahnke
1a03cc9b60
Fix test compilation 2024-04-28 14:20:52 +02:00
Jake Potrebic
306b203c2d
more fixes for ItemMeta relating to components 2024-04-27 22:27:51 -07:00
Jake Potrebic
e16263c39f
Fix firework meta NPE
Fixes #10466
2024-04-27 20:57:42 -07:00
caramel
a3c4dc95e3
Fix the incorrect codec usage in the Style convert (#10465) 2024-04-27 20:32:11 -07:00
Jason Penilla
f187fd696a
Only scan org.bukkit.craftbukkit.inventory in MetaHandledTagsTest
fixes tests OOMing
2024-04-27 18:25:15 -07:00
Jake Potrebic
d93c6f91f7
remove calls to DoNotUse methods 2024-04-27 18:18:20 -07:00
Jake Potrebic
3e90a19183
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
304e83eb PR-1002: Improve documentation and implementation of getMaxStackSize
e8215ea2 SPIGOT-7638: Library loader does not seem to resolve every dependency
79c595c0 SPIGOT-7637: Bad logic in checking nullability of AttributeModifier slots

CraftBukkit Changes:
91b1fc3f1 SPIGOT-7644: Fix ItemMeta#getAsString
4e77a81e1 SPIGOT-7615: PlayerLeashEntityEvent cancelled eats lead
996f660f3 Do not remove leash knot if leasing to an existing leash knot gets cancelled
f70367d42 SPIGOT-7643: Fix inverted leash event cancelled usage and remove leash knot if no entity gets leashed
7ddb48294 SPIGOT-7640: Abnormal jumping height of wind charge
080c8711e SPIGOT-7639: Incoming plugin channels not working
ad549847e Open a direct connection instead of pinging mojang server to check if it is reachable
38e2926c5 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime
2024-04-27 18:00:01 -07:00
Jake Potrebic
d964c15e15
fix last test issue 2024-04-27 17:45:37 -07:00
Jason Penilla
7e3d5b569d
bump paperweight to 1.6.2 to fix spurious build failure from scanJar OOM 2024-04-27 17:38:20 -07:00
Jake Potrebic
8ce62b3492
Fix issue with hopppers
Fixes #10464
2024-04-27 17:33:25 -07:00
Jake Potrebic
4ad6022ee3
improve checking handled tags in itemmeta (#9470) 2024-04-27 17:33:17 -07:00
Jason Penilla
83767f9544
Use JetBrains runtime for run tasks
allows for better runtime class redefinition

closes #10459
2024-04-27 17:28:40 -07:00
Nassim Jahnke
d99d84a8aa
Temporarily comment out adventure jd links 2024-04-28 02:05:52 +02:00
Jason Penilla
8454786c8d
Bump tiny-remapper (real) 2024-04-27 16:26:28 -07:00
Jason Penilla
75c22d545f
Bump tiny-remapper 2024-04-27 16:26:03 -07:00
Jason Penilla
aeb3f376a2
update paperweight to 1.6.1 2024-04-27 16:07:55 -07:00
Jake Potrebic
d02bb811de
proper migration to gamerules for keep spawn loaded distance 2024-04-27 15:50:38 -07:00
Nassim Jahnke
dd571d89f2
Fix bad diff in build gradle file 2024-04-28 00:43:17 +02:00
Nassim Jahnke
06cae13223
Update jdk version and distribution in actions 2024-04-28 00:26:43 +02:00
Jake Potrebic
a771940776
Revert to vanilla handling of LivingEntity#actuallyHurt (#10463) 2024-04-27 14:35:53 -07:00
Jake Potrebic
53d8edd756
properly check for experimental stuff in generator 2024-04-27 14:32:35 -07:00
Jake Potrebic
b3ea907b77
more ItemFlag fixes 2024-04-27 14:32:34 -07:00
Jason Penilla
20af7a753c
remove funny diff 2024-04-27 14:11:35 -07:00
Jason Penilla
a390119b04
Move cb version definition to gradle patch 2024-04-27 14:02:33 -07:00
Jason Penilla
b7e148a107
Move obfhelper/stack deobf diff into original patch 2024-04-27 13:54:09 -07:00
Lulu13022002
af97400701
update generator 2024-04-27 22:32:16 +02:00
Jason Penilla
711dbd74ea
Bump adventure ansi serializer 2024-04-27 13:31:37 -07:00
Jason Penilla
e2552eea24
Start cleaning up plugin remapping patches 2024-04-27 13:27:01 -07:00
Lulu13022002
0b1b1fe067
fix helmet damage reduction inconsistencies
See: https://github.com/PaperMC/Paper/issues/9555#issuecomment-1681120506
2024-04-27 21:56:29 +02:00
Lulu13022002
55b1a8740d
fix PotionEffectType#getEffectAttributes 2024-04-27 21:48:14 +02:00
Spottedleaf
f933c35700 Update DataConverter to 1.20.6-rc1
Fixes trader llama inventory incorrectly converting
2024-04-27 12:41:47 -07:00
Jake Potrebic
c82766d436
fix item flags 2024-04-27 12:18:01 -07:00
Jason Penilla
f037f08035
Unify plugin remapping debug flags 2024-04-27 11:41:56 -07:00
Shane Freeder
5731f346e2
Restore Handle Large Packets Disconnecting Client Patch 2024-04-27 15:06:52 +01:00
Jake Potrebic
f85d423535
improve dumpitem and pgive commands 2024-04-26 23:57:49 -07:00
Jake Potrebic
91b5de66bf
bunch of fixes and improvements 2024-04-26 23:17:58 -07:00
Jake Potrebic
81f4405e26
add back hunk to async SavedData IO 2024-04-26 19:33:30 -07:00
Jake Potrebic
9bac3894e1
more fixes 2024-04-26 19:09:42 -07:00
Jake Potrebic
68e23db25d
add back missing call to profile fill events 2024-04-26 18:41:54 -07:00
Jake Potrebic
80bd01527f
fix adventure converters not using RegistryOps 2024-04-26 18:16:31 -07:00
Jake Potrebic
2f19f0fb7b
fix enchantment order issue 2024-04-26 18:06:41 -07:00
Jason Penilla
548504381f
Don't tell people to build the reobf jar 2024-04-26 18:05:17 -07:00
Jake Potrebic
f1fc1b30be
readd old UUID format patch 2024-04-26 17:41:36 -07:00
Jake Potrebic
ba8512a0d8
fix javadocs for SpawnerEntry$Equipment API 2024-04-26 17:00:40 -07:00
Jake Potrebic
c38f96b0e5
deprecate our ItemRarity API 2024-04-26 17:00:40 -07:00
Jason Penilla
6a4974b1b9
Remove shadow from build classpath
it isn't used
2024-04-26 16:48:34 -07:00
Jason Penilla
ff77f82539
paperweight 1.6.0 2024-04-26 16:19:59 -07:00
Jake Potrebic
464cc81633
fix custom potion mixes 2024-04-26 16:17:14 -07:00
Jake Potrebic
4c53acedce
fix exact choice recipes 2024-04-26 15:25:20 -07:00
Jake Potrebic
882ea0a430
fix adventure translations 2024-04-26 15:08:39 -07:00
Jason Penilla
e856d17ec5
Update paper plugin check in PluginRemapper 2024-04-26 14:31:53 -07:00
Jake Potrebic
19ac9d43ce
remove no longer needed patches and fix tests 2024-04-26 14:29:21 -07:00
Jason Penilla
1bc278b125
Update patched spigot decompiler to fix inconsistency based on processing order 2024-04-26 11:45:56 -07:00
Jake Potrebic
44e68c301a
fix some more issues 2024-04-26 11:39:20 -07:00
Jake Potrebic
cc81668863
fix some issues on the todo list 2024-04-26 09:22:55 -07:00
Jake Potrebic
f6fae41cdf
fix chat_type issue 2024-04-26 08:33:00 -07:00
Owen1212055
00dac83d67
Drop old decompile fix 2024-04-26 08:39:10 -04:00
Nassim Jahnke
8b28f9f564
Fix accumulated total ticking chunks not being updated 2024-04-26 11:55:56 +02:00
Nassim Jahnke
478a971a7b
Fix light setting in protochunk 2024-04-26 11:18:15 +02:00
Nassim Jahnke
813cfbf2b0
Fix compile issues 2024-04-26 10:45:00 +02:00
Jake Potrebic
7e9da43b33
support patch versions in api-version 2024-04-25 23:29:16 -07:00
Jason Penilla
2997fd6459
plugin manager updates 2024-04-25 23:18:04 -07:00
Jake Potrebic
43d110e9a9
fix issue with item default attribute API 2024-04-25 23:10:38 -07:00
Jake Potrebic
bcdf1f96b8
fixup loom pattern select event patch 2024-04-25 22:44:49 -07:00
Jason Penilla
c5c2a5fe13
hunk system fixes 2024-04-25 22:25:02 -07:00
Jason Penilla
62b96c520f
compile fixes 2024-04-25 21:58:13 -07:00
Jason Penilla
867eb9054b
compile fixes 2024-04-25 20:15:07 -07:00
Jason Penilla
7c6411b930
compile fixes 2024-04-25 19:54:07 -07:00
Jason Penilla
d2ef0622c9
generator fix 2024-04-25 19:09:21 -07:00
Jake Potrebic
31ad90b018
some more compile fixes 2024-04-25 18:51:31 -07:00
Jason Penilla
a244281287
Replace VanillaGradle use and update generated API 2024-04-25 18:40:50 -07:00
Jake Potrebic
10e6143499
fixup adventure's book meta handling 2024-04-25 17:46:17 -07:00
Jake Potrebic
e85e1ec4a6
fixup sus effect entry patches 2024-04-25 17:10:12 -07:00
Jake Potrebic
3062eb208d
address my own comments 2024-04-25 16:24:08 -07:00
Nassim Jahnke
68aea43526
Fixup damage source change 2024-04-25 23:28:56 +02:00
Nassim Jahnke
2641c02193
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
69fa4695 Add some missing deprecation annotations
f850da2e Update Maven plugins/versions
8d8400db Use regular compiler seeing as ECJ doesn't support Java 21 JRE
c29e1688 Revert "BUILDTOOLS-676: Downgrade Maven compiler version"
07bce714 SPIGOT-7355: More field renames and fixes
6a8ea764 Fix bad merge in penultimate commit
50a7920c Fix imports in previous commit
83640dd1 PR-995: Add required feature to MinecraftExperimental for easy lookups
fc1f96cf BUILDTOOLS-676: Downgrade Maven compiler version

CraftBukkit Changes:
90f1059ba Fix item placement
661afb43c SPIGOT-7633: Clearer error message for missing particle data
807b465b3 SPIGOT-7634: Armadillo updates infrequently
590cf09a8 Fix unit tests always seeing Mojang server as unavailable
7c7ac5eb2 SPIGOT-7636: Fix clearing ItemMeta
4a72905cf SPIGOT-7635: Fix Player#transfer and cookie methods
ebb50e136 Fix incorrect Vault implementation
b33fed8b7 Update Maven plugins/versions
6f00f0608 SPIGOT-7632: Control middle clicking chest does not copy contents
db821f405 Use regular compiler seeing as ECJ doesn't support Java 21 JRE
8a2976737 Revert "BUILDTOOLS-676: Downgrade Maven compiler version"
0297f87bb SPIGOT-7355: More field renames and fixes
2d03bdf6a SPIGOT-7629: Fix loading banner patterns
e77951fac Fix equality of deserialized display names
c66f3e4fd SPIGOT-7631: Fix deserialisation of BlockStateMeta
9c2c7be8d SPIGOT-7630: Fix crash saving unticked leashed entities
8c1e7c841 PR-1384: Disable certain PlayerProfile tests, if Mojang's services or internet are not available
ced93d572 SPIGOT-7626: sendSignChange() has no effect
c77362cae SPIGOT-7625: ItemStack with lore cannot be serialized in 1.20.5
ff2004387 SPIGOT-7620: Fix server crash when hoppers transfer items to double chests
8b4abeb03 BUILDTOOLS-676: Downgrade Maven compiler version
2024-04-25 23:23:57 +02:00
Nassim Jahnke
ed790385ed
More compile fixes 2024-04-25 22:47:32 +02:00
Nassim Jahnke
8d3759d4a5
More more compile fixes 2024-04-25 22:34:46 +02:00
Nassim Jahnke
d01f6b2fd2
Fix more compile issues 2024-04-25 21:57:59 +02:00
Jason Penilla
ca9001a936
compile fixes 2024-04-25 12:16:00 -07:00
Jason Penilla
820f999ba4
Fixes for cb pkg ver 2024-04-25 11:16:53 -07:00
Noah van der Aa
04a25c2813
Fix WorldCreator#keepSpawnLoaded 2024-04-25 19:57:27 +02:00
Jason Penilla
768befec89
Remove patch renaming scripts
These are pretty specific to tasks that kenny and I were doing when they were written, no need to keep them around when they aren't useful for others.
2024-04-25 10:53:29 -07:00
Bjarne Koll
b984f66d13
Missing FQN in CraftPotionBrewer getter 2024-04-25 19:45:17 +02:00
Bjarne Koll
9c580566b9
Some more compilation fixes 2024-04-25 19:42:24 +02:00
Noah van der Aa
f4c7639986
Un-jankify root user detection 2024-04-25 19:13:12 +02:00
Bjarne Koll
bab31b6f55
Update Enchantment damage increase API
The Enchantment damage increase API added previously used the
EntityCategory enum as a parameter. These values are now however
determined by tags instead of the categories themselves.

Deprecated the outdated api method, create a new overload that takes
EntityType instead and implement deprecated method by guessing an entity
type from the builtin registry based on the category passed.
This method allows
a) the tags to still be modified and the legacy
   method still respecting such.
b) potential cursed implementations of enchantments of plugins to not
   break that override the getDamageBonus method on Enchantment.
2024-04-25 18:42:50 +02:00
Jake Potrebic
653f0432b5
readd fix bee aging patch 2024-04-25 09:06:13 -07:00
Jake Potrebic
ccf158a817
update smithing recipe copy data components API 2024-04-25 08:13:36 -07:00
Owen1212055
b8da9ac51a
item meta patch work 2024-04-25 09:22:52 -04:00
Owen1212055
457e2c8a5a
pass more stuff 2024-04-25 09:01:54 -04:00
Owen1212055
45900385cd
Fix properly resend patches 2024-04-25 08:42:47 -04:00
Owen1212055
345b5c1c4c
Patches!!!!!!! (we are done) 2024-04-25 08:36:48 -04:00
Nassim Jahnke
6da0d8cc91
(Almost) all patches applied 2024-04-25 14:23:55 +02:00
Nassim Jahnke
2debcaff9d
More more patches, including hopper optimization patch 2024-04-25 14:07:39 +02:00
Nassim Jahnke
c9907c650f
More patches 2024-04-25 13:02:27 +02:00
Nassim Jahnke
ec4ada852e
Apply and move up non-optimization patches 2024-04-25 12:27:57 +02:00
Nassim Jahnke
f6ea3736a7
Patches 2024-04-25 11:42:10 +02:00
Spottedleaf
e9eec78fc7 chunk system 2024-04-25 01:52:52 -07:00
Spottedleaf
ec9f7e3850 starlight 2024-04-25 00:14:22 -07:00
Spottedleaf
6a87d141f3 dataconverter 2024-04-24 23:49:13 -07:00
Jason Penilla
b673721d77
compile fixes 2024-04-24 22:29:18 -07:00
Jason Penilla
690b1cd321
compile fixes 2024-04-24 22:16:04 -07:00
Jason Penilla
25f7c68e6b
compile fixes 2024-04-24 21:38:28 -07:00
Jason Penilla
ce0e78c103
compile fixes
compile fixes

compile fixes
2024-04-24 21:18:42 -07:00
Jake Potrebic
1444b3632e
work on adventure 2024-04-24 20:14:51 -07:00
Jason Penilla
bb1351cb8d
some work on adventure 2024-04-24 18:10:18 -07:00
Jason Penilla
c95db4fcaa
adventure 4.17.0-SNAPSHOT 2024-04-24 17:46:57 -07:00
Jason Penilla
b7338094a5
Drop conduit api patch (upstream implemented same api with same method signatures) 2024-04-24 17:40:30 -07:00
Jason Penilla
1df7e21459
Apply more API-implementing patches 2024-04-24 17:36:24 -07:00
Jake Potrebic
11044315fd
955 2024-04-24 16:25:57 -07:00
Owen1212055
e0a245d2ea
Patches!!!!!!! 2024-04-24 18:36:55 -04:00
Jason Penilla
051855997e
Update reflection rewriter to 0.0.1 release 2024-04-24 15:02:37 -07:00
Noah van der Aa
961782982b
Restore original formatting for MC-252817 patch 2024-04-24 23:26:18 +02:00
Noah van der Aa
4d9e824a44
more more work (806) 2024-04-24 23:23:56 +02:00
Noah van der Aa
22227ccf26
more more work (757) 2024-04-24 22:32:38 +02:00
Noah van der Aa
71ae391eb3
more work (721) 2024-04-24 22:05:42 +02:00
Jason Penilla
90095cd7c4
694 2024-04-24 11:03:59 -07:00
Jason Penilla
fc5c0dae7f
683 2024-04-24 10:59:51 -07:00
Jason Penilla
e832328b7e
Check for existing am session before running continueServerUpdate 2024-04-24 10:48:00 -07:00
Nassim Jahnke
4e654f2a3a
More patch work 2024-04-24 19:27:48 +02:00
Nassim Jahnke
1de0dc8828
666 plus 1 2024-04-24 17:35:46 +02:00
Owen1212055
21afc0a2e2
Patches!!!!!!! 2024-04-24 10:30:32 -04:00
Owen1212055
a403a8d085
Patches!!!!!!! 2024-04-24 10:29:12 -04:00
Owen1212055
2d9d0d8b1d
Patches! 2024-04-24 09:46:45 -04:00
Owen1212055
5be858e9b7
Patches! 2024-04-24 08:11:27 -04:00
Jake Potrebic
cc4614854a
405 2024-04-23 23:44:48 -07:00
Jake Potrebic
9079c90d22
354 2024-04-23 23:05:14 -07:00
Jake Potrebic
1d7d7e92f2
301 2024-04-23 22:43:09 -07:00
Jake Potrebic
309ebc13fc
253 2024-04-23 19:46:06 -07:00
Jake Potrebic
8244815161
221 2024-04-23 19:21:40 -07:00
Owen1212055
906f906089
Patches! 2024-04-23 18:25:14 -07:00
Owen1212055
0225537fd1
Update upstream 2024-04-23 21:13:33 -04:00
Owen1212055
487555b627
update 2024-04-23 21:13:33 -04:00
Jake Potrebic
d6a3c0c239
fix 2 of our javadoc errors 2024-04-23 16:30:24 -07:00
Jake Potrebic
862d00478e
work on some API stuff 2024-04-23 16:26:24 -07:00
Jason Penilla
5cfd92b240
Fix api compile 2024-04-23 14:47:29 -07:00
Jason Penilla
f2350fe0d1
Set mercury sourceCompat 2024-04-23 14:43:32 -07:00
Jason Penilla
d07c487d4d
Don't use defaultToolchain method for run tasks 2024-04-23 14:39:36 -07:00
Jason Penilla
2eeed9e6fa
41 2024-04-23 14:31:37 -07:00
Jason Penilla
9cac5b6f4f
Fix continueServerUpdate with 2-line subjects 2024-04-23 14:26:28 -07:00
Jason Penilla
eb41348d39
33 2024-04-23 14:12:24 -07:00
Jason Penilla
ffccfd5488
Apply timings 2024-04-23 14:04:59 -07:00
Jason Penilla
598a1cb947
Apply shadow removal patch 2024-04-23 13:41:25 -07:00
Jason Penilla
dd6ce09922
Fix reflection diff and order wrt commodore diff 2024-04-23 13:36:31 -07:00
Nassim Jahnke
7cdf804392
Work 2024-04-23 22:13:16 +02:00
Jason Penilla
380c4d2313
Add plugin remapping patches 2024-04-23 11:44:42 -07:00
Jake Potrebic
ef057bba7d
work on Adventure patch 2024-04-23 11:32:19 -07:00
Jason Penilla
00c14f2e7b
Move logging patches after adventure 2024-04-23 11:31:38 -07:00
Jake Potrebic
f2c45ed1d3
do some work 2024-04-23 11:03:16 -07:00
Jake Potrebic
abc49bf069
Begin update to 1.20.5 2024-04-23 10:02:08 -07:00
leguan
f4c7d373e4
[ci skip] Fix javadoc typo (#10445) 2024-04-22 19:08:37 +01:00
Jake Potrebic
a6b6ecdd22
More Raid API (#7537) 2024-04-20 15:57:51 -04:00
Tamion
fc53ff5a71
Add Configuration for finding Structures outside World Border (#10437) 2024-04-20 15:29:32 -04:00
Janet Blackquill
c5f68ff9be
Add CartographyItemEvent and get/setResult for CartographyInventory (#10396) 2024-04-20 14:10:35 -04:00
Florian Beck
a033033b7a
Added chunk view API (#10398) 2024-04-20 13:56:59 -04:00
Nassim Jahnke
3af1346520
Allow setting player list name early 2024-04-20 15:24:42 +02:00
Tamion
908b8141c9
Fix inventory desync with PlayerLeashEntityEvent (#10436) 2024-04-19 20:23:32 -07:00
Jake Potrebic
3b078f822a
Add API for ticking fluids (#10435)
* Add API for ticking fluids

* update javadocs
2024-04-19 13:03:32 -07:00
brickmonster
9e886c4310
Remove dead code (LegacyResult) (#10411)
* Stop firing AsyncPlayerChatPreviewEvent as chat preview was removed in 1.19.3. This is in parity with upstream

* formatting and small tweaks

* correctly set MESSAGE_CHANGED flag for modern modifications

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-04-19 12:47:24 -07:00
Jason Penilla
862299b6a6
"Downgrade" Vineflower to 1.10.1 release (#10423)
* "Downgrade" Vineflower to 1.10.1 release

The main thing we lose from the 1.11 snapshots is a recent fix for redundant casts.

* Thanks intellij

* a
2024-04-16 12:44:59 -07:00
Owen
4445d23544
Deprecate ItemStack#setType & add ItemStack#withType (#10290) 2024-04-12 17:16:22 -04:00
ButterDebugger
3263470312
Add color transition and clone functions to ParticleBuilder (#10342) 2024-04-12 16:07:28 -04:00
Cross
f061e76e1f
Fix hit criteria advancement triggered before changing state (#10409)
* Fix hit criteria advancement being triggered before changing block state.

* Rebase

---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-04-12 12:42:00 -07:00
Shane Freeder
46d462b83e
Fix StackOverflowException thrown on shutdown (Fixes #10404) (#10408)
paper previously migrated away from using executeIfPossible as this throws a
RejectedExecutionException when the server is shutting down, which is then picked
up by the Connection handler object and causes the player to be kicked without
the intended disconnection message that comes from commands such as /stop, /restart

This was fine, because previously changes made in spigot would just prevent these
packets from being executed anyways. Instead, we'll just use a marker exception
to try to detect this specific state.
2024-04-12 12:37:00 -07:00
Hy3z
8fe90dede7
[ci skip] Referenced InventoryDragEvent in documentation of InventoryClickEvent (#10395) 2024-04-12 15:19:55 -04:00
Jake Potrebic
526795bacd
Update patches to handle vineflower decompiler (#10406)
* Update patches to handle vineflower decompiler

* update patches again to handle inlined simple lambdas

* update vf again and re-apply/rebuild patches

* update patches after removal of verify-merges flag

* fix compile issue

* remove maven local

* fix some issues

* address more issues

* fix collision patch

* use paperweight release

* more fixes

* update fineflower and fix patches again

* add missing comment descriptor

---------

Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2024-04-12 12:14:06 -07:00
Lulu13022002
37db2d7e4c
[ci skip] Update book page/char limit for book meta doc (#10415) 2024-04-12 11:58:44 -07:00
gecko10000
a7f1dc6a07
Change online mode default for Velocity configuration (#10413) 2024-04-12 18:21:31 +01:00
Jake Potrebic
5436d44bf2
Deprecate several Keyed#getKey methods (#10357)
- Structure (can already be defined inline in datapacks
- PatternType (can be defined inline in 1.20.5 data components)
- MusicInstrument (same as above)
2024-04-07 22:20:51 -07:00
Shane Freeder
1207162055
Allow player-list API to self un/list (#10358) 2024-04-06 20:45:43 -04:00
Joseph Burton
241d8e26fb
Ignore minecart in activation range (#10359) 2024-04-06 19:50:43 -04:00
Noah van der Aa
8e75001cb8
Disable vertical air friction when item entities have friction disabled (#10369) 2024-04-06 19:36:59 -04:00
Evan
3d31e45e7e
Add BlockBreakProgressUpdateEvent (#10300) 2024-04-06 18:28:17 -04:00
Lulu13022002
acf838f535
Backport some stuff from the generators branch (#10365) 2024-04-06 14:51:47 -07:00
Tamion
182e79bce1
Add more item use API (#10304) 2024-04-06 17:44:27 -04:00
Lulu13022002
d8456ee65b
Don't throw NPE for unplaced blockstate on #getDrops (#10366) 2024-04-06 17:26:56 -04:00
powercas_gamer
bbee11fb0e
Deprecate Bukkit#getLogger (#10388)
* Deprecate Bukkit#getLogger

* fix typo in MaterialSetTags

* change to Internal and squash into other patch

* improve api note message

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-04-06 14:20:29 -07:00
Pierpaolo Coletta
06361fa662
Fix invalid block entities created during world gen (#10375) 2024-04-06 17:16:54 -04:00
Bridge
a774fbaca8
feat: Entity#teleportAsync method with TeleportFlags (#10371)
* feat: Entity#teleportAsync method with TeleportFlags

* use method-local class

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-04-06 13:38:37 -07:00
Jake Potrebic
bd38e0318a
Updated Upstream (Bukkit/CraftBukkit) (#10379)
Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
f02baa38 PR-988: Add World#getIntersectingChunks(BoundingBox)
9321d665 Move getItemInUse up to LivingEntity
819eef73 PR-959: Add access to current item's remaining ticks
c4fdadb0 SPIGOT-7601: Add AbstractArrow#getItem
be8261ca Add support for Java 22
26119676 PR-979: Add more translation keys
66753362 PR-985: Correct book maximum pages and characters per page documentation
c8be92fa PR-980: Improve getArmorContents() documentation
f1120ee2 PR-983: Expose riptide velocity to PlayerRiptideEvent

CraftBukkit Changes:
dfaa89bbe PR-1369: Add World#getIntersectingChunks(BoundingBox)
51bbab2b9 Move getItemInUse up to LivingEntity
668e09602 PR-1331: Add access to current item's remaining ticks
a639406d1 SPIGOT-7601: Add AbstractArrow#getItem
0398930fc SPIGOT-7602: Allow opening in-world horse and related inventories
ffd15611c SPIGOT-7608: Allow empty lists to morph to any PDT list
2188dcfa9 Add support for Java 22
45d6a609f SPIGOT-7604: Revert "SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime"
06d915943 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime
ca3bc3707 PR-1361: Add more translation keys
366c3ca80 SPIGOT-7600: EntityChangeBlockEvent is not fired for frog eggs
06d0f9ba8 SPIGOT-7593: Fix sapling growth physics / client-side updates
45c2608e4 PR-1366: Expose riptide velocity to PlayerRiptideEvent
29b6bb79b SPIGOT-7587: Remove fixes for now-resolved MC-142590 and MC-109346
2024-04-06 12:53:39 -07:00
Jason Penilla
a2035440cf
build: Compile against and shade the filtered jar (#9747)
* Compile against & shade the filtered jar

* Move check for if the paper asset root needs to be pushed

* Don't disable incremental compilation

* Remove mavenLocal

* use paperweight release
2024-04-04 17:12:05 -07:00
DungeonDev
e709245b55
Add config option for tripwire disarming fix
Fixes #10382

Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
2024-04-02 12:18:22 +02:00
Jason Penilla
45d1486fec
build: Update paperweight to 1.5.12 and Gradle Wrapper to 8.7 (#10361) 2024-03-29 10:43:36 -07:00
Jake Potrebic
710dced8b7
[ci skip] move custom brig exception to paper package 2024-03-26 08:38:26 -07:00
Nassim Jahnke
00fd87a10f
Return dummy string instead of empty optional 2024-03-25 13:26:01 +01:00
maxcom1
b6001403e9
Add methods to change entity physics (#10334) 2024-03-23 17:26:17 -04:00
FireInstall
9ec7dfcbc4
Move invisible setting up to entities (#10346) 2024-03-23 20:27:30 +01:00
Shane Freeder
88419b2075
Do not copy profile data if profiles are the same (#10259) 2024-03-20 22:47:50 +01:00
TonytheMacaroni
41ffa0cf8c
Expose power on fireballs (#10302) 2024-03-20 22:33:34 +01:00
Jake Potrebic
de620b8480
Clone mutable types in events when changes are discarded (#10333) 2024-03-20 21:42:29 +01:00
maxcom1
05fe15e0fc
Fire EntityChangeBlockEvent on beehive nectar deposit (#10306)
* Add BeehiveNectarDepositEvent

* Fire EntityChangeBlockEvent instead of a separate event
2024-03-20 12:35:10 -07:00
Nassim Jahnke
55ffcb1111
Fix tripwire disarming not working as intended 2024-03-19 20:09:02 +01:00
Kichura
09d6dfb0df
[ci skip] Upstream dependencies in workflow scripts. (#10338) 2024-03-19 13:30:03 +00:00
viciscat
99a641690a
Expand Hopper BlockState API (#10328) 2024-03-16 20:28:50 +01:00
Jake Potrebic
d361a7f609
Fix DamageSource API (#10307)
Uses the correct entity in the EntityDamageByEntity event
Returns the correct entity for API's DamageSource#getCausingEntity
2024-03-16 11:51:22 -07:00
leguan
e6034867ba
Add onboarding message for initial server start (#10312) 2024-03-16 19:10:26 +01:00
Ikko Eltociear Ashimine
cd110a8995
[ci skip] Update CONTRIBUTING.md (#10318)
tempermental -> temperamental
2024-03-16 18:56:04 +01:00
Suppergerrie2
ab1afb0ed8
Fix missing profiler.pop() in PathFinder::findPath (#10320) 2024-03-15 11:09:47 +00:00
f7dafd4d0e Revert "IO_Uring support"
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
This reverts commit d2fab8f93b.
2024-03-14 10:36:12 +01:00
32ff11c890 Merge pull request 'IO_Uring support' (#12) from io_uring into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #12
2024-03-14 09:08:36 +01:00
d2fab8f93b IO_Uring support
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-03-13 18:29:40 +01:00
Bjarne Koll
62b220a87f
Allow passenger retaining teleport via end gateway (#10283)
Previously paper disabled the abilities for entities to teleport via end
gateways if they were being used as a vehicle.

While the behaviour generally worked fine for entities riding other
entities, players would quickly end up in an invalid state, not seeing
their passenger anymore.

This commit removes the paper introduced limitation by now properly
updating the passengers location of a player when they are teleporting
through an end gateway.
2024-03-10 01:08:44 +01:00
Jake Potrebic
80e1a45959
Add param to overrides to the correct method is called (#10308) 2024-03-09 18:16:27 -05:00
Jake Potrebic
a0931f4864
Updated Upstream (Bukkit/CraftBukkit) (#10301)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
7ca2b46c SPIGOT-7594: Fix typo and include missing MinecraftExperimental annotation in Loot Table enum

CraftBukkit Changes:
176c0ad39 Fix copying BlockStates with fields (eg, Banner)
ee685bd2a Fix Camel not standing up when hurt
619936d4b Increase outdated build delay
2024-03-08 15:52:00 -08:00
Jason Penilla
0052e2db39
build: Update tiny-remapper to 0.10.1 & remove unused repo from dev bundle config (#10303) 2024-03-07 10:11:47 -08:00
Jake Potrebic
6ad63fba30
Per world ticks per spawn settings (#6891) 2024-03-03 17:53:58 -05:00
Owen
89d51d5f29
Allow enabling sand duping (#10191)
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable.

It should be noted that this decision does not promise all future exploits will be configurable.
2024-03-03 17:05:34 -05:00
Yannick Lamprecht
b21eb4d9a4
add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta (#10245)
The existing method with PotionEffect suggests that all attributes are used. In fact, only the PotionEffectType and the duration are used.



---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-03-03 16:40:18 -05:00
Shane Freeder
60218cd207
Don't tick empty worlds (#9025) 2024-03-03 16:10:45 -05:00
Jake Potrebic
880fef77ab
Deprecate extra ban methods with raw BanEntry (#9580) 2024-03-03 12:54:52 -08:00
Gero
ce5c8dd379
Configurable max block/fluid ticks (#10266) 2024-03-03 15:43:00 -05:00
Yannick Lamprecht
bbc03d8116
improve BanList types (#10239) 2024-03-03 12:36:17 -08:00
Rodney
8870d22bc7
Fire EntityDamageByEntityEvent for unowned wither skulls patch (#10244) 2024-03-03 14:35:50 -05:00
Yannick Lamprecht
9c4bb0df0e
add rich message component support to configuration (#10225) 2024-03-03 10:59:22 -08:00
granny
54a23403da
check if itemstack is stackable first (#10285) 2024-03-03 10:37:00 -08:00
Bjarne Koll
850b736e14
Close PRs opened from orgs or bot accounts (#10281)
Expands the existing close_invalid_prs workflow to also close prs that
were opened from repositories not owned by user accounts.
This is required as such PRs cannot be edited by maintainers.

The implementation re-uses the existing job instead of creating a new
job to limit the amount of checks to the bare minimum.
2024-02-28 15:18:58 +01:00
Nassim Jahnke
681bbff110
Fix spawnreason saving 2024-02-23 23:15:11 +01:00
Bjarne Koll
d0ebfbbd15
Fix corrupted plugin.yml breaking plugin loading (#10279)
Fix corrupted plugin.yml file in one plugin not loading any plugins by
the server.

Co-authored-by: Aleksander Jagiello <themolkapl@gmail.com>
2024-02-23 18:54:44 +01:00
Shane Freeder
e3bc4c4107
Make debug mode print current configuration phase 2024-02-23 13:54:52 +00:00
Nassim Jahnke
71c84c8132
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD

CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor

Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
Shane Freeder
3ea95efdeb
Do not access world state to see if we can see a Player
Thrown into the adventure patch because I don't see the justification of a patch existing
for something like this.
2024-02-22 16:23:15 +00:00
Nassim Jahnke
4939f87118
Add more ResourceLocation checks, some cleanup 2024-02-18 13:52:12 +01:00
Jason Penilla
351923d17e
Run round-trip adventure codec tests with JSON, NBT, and Java ops. Use JavaOps for conversions. (#10031) 2024-02-17 16:58:56 -05:00
viciscat
d95341e44a
FluidState API (#9951)
* Add new FluidState API functionality
---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2024-02-17 15:44:03 -05:00
David Mayr
1964b22439
Scoreboard objective number format api (#10036)
* feat: number format api

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: make each individual score customizable

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* docs: fix incorrect descriptions

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: use access transformers

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: use adventure codecs

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* test: test for matching styles

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: convert number formats to interfaces

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: add style conversion to adventure patch

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: use paper adventure method in PaperScoreboardFormat

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* chore: rename methods to avoid a method in records

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* fix: check if objective is still registered

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: improve style conversion

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: modify how the getter behaves in score

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: use fluent naming

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* docs: add spaces before the paper comments

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* chore: styling changes

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* chore: make constant final

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* feat: add methods for styled format instead of constants

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* fix: remove incorrect getTrackedPlayers check

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* docs: add . at the end of sentences

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* docs: explain null behaviour

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* docs: mention score creation

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>

* rebase and fix javadoc comments

* remove server implementation defaults

* fix format for PaperScoreboardFormat

---------

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-02-17 12:22:00 -08:00
Emilia Kond
9a66f2b2e1
[ci skip] Fix javadoc mistake in PluginMeta (#10258)
"Schematic versioning" is not a real thing. The intended versioning
scheme is "semantic versioning". Introduced in #8108.
2024-02-17 11:37:55 -08:00
leguan
a07d526698
[ci skip] Fix JavaDoc mistake in BlockPistonRetractEvent (#10250) 2024-02-17 11:15:15 -08:00
Jake Potrebic
7ccefdcd6c
Fire entity knockback event for ownerless tnt (#7171) 2024-02-16 15:44:43 -08:00
Shane Freeder
7f85940143
Updated Upstream (Bukkit) (#10255)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
58ce1b0f Improve compatibility of new DamageSource API
2024-02-16 23:44:38 +01:00
Pedro
37df12143c
Fix BlockState being set to null for damage events (#10252) 2024-02-15 10:05:50 +01:00
Nassim Jahnke
31699ae9a8
Updated Upstream (Bukkit/CraftBukkit) (#10242)
* Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
a6a9d2a4 Remove some old ApiStatus.Experimental annotations
be72314c SPIGOT-7300, PR-829: Add new DamageSource API providing enhanced information about entity damage
b252cf05 SPIGOT-7576, PR-970: Add methods in MushroomCow to change stew effects
b1c689bd PR-902: Add Server#isLoggingIPs to get log-ips configuration
08f86d1c PR-971: Add Player methods for client-side potion effects
2e3024a9 PR-963: Add API for in-world structures
a23292a7 SPIGOT-7530, PR-948: Improve Resource Pack API with new 1.20.3 functionality
1851857b SPIGOT-3071, PR-969: Add entity spawn method with spawn reason
cde4c52a SPIGOT-5553, PR-964: Add EntityKnockbackEvent

CraftBukkit Changes:
38fd4bd50 Fix accidentally renamed internal damage method
80f0ce4be SPIGOT-7300, PR-1180: Add new DamageSource API providing enhanced information about entity damage
7e43f3b16 SPIGOT-7581: Fix typo in BlockMushroom
ea14b7d90 SPIGOT-7576, PR-1347: Add methods in MushroomCow to change stew effects
4c687f243 PR-1259: Add Server#isLoggingIPs to get log-ips configuration
22a541a29 Improve support for per-world game rules
cb7dccce2 PR-1348: Add Player methods for client-side potion effects
b8d6109f0 PR-1335: Add API for in-world structures
4398a1b5b SPIGOT-7577: Make CraftWindCharge#explode discard the entity
e74107678 Fix Crafter maximum stack size
0bb0f4f6a SPIGOT-7530, PR-1314: Improve Resource Pack API with new 1.20.3 functionality
4949f556d SPIGOT-3071, PR-1345: Add entity spawn method with spawn reason
20ac73ca2 PR-1353: Fix Structure#place not working as documented with 0 palette
3c1b77871 SPIGOT-6911, PR-1349: Change max book length in CraftMetaBook
333701839 SPIGOT-7572: Bee nests generated without bees
f48f4174c SPIGOT-5553, PR-1336: Add EntityKnockbackEvent
2024-02-11 22:28:00 +01:00
Warrior
cde5587e58
Add getChunkSnapshot includeLightData parameter (#10234) 2024-02-10 22:28:56 +01:00
Emilia Kond
4b58a85158
Fire BlockPreDispenseEvent for droppers (#10226) 2024-02-10 22:19:22 +01:00
Jake Potrebic
e6a521514e
Properly track the changed item from dispense events (#8658) 2024-02-10 22:17:24 +01:00
Jake Potrebic
2fa2d32ceb
Fix possible StackOverflowError for some dispenser iteractions (#8524) 2024-02-10 21:17:40 +01:00
Lulu13022002
bf6e803c6c
Fix WaterBottleSplashEvent not forwarding hit result (#10203) 2024-02-10 20:27:29 +01:00
Warrior
99bae594c8
Propagate failed to bind to port error (#10235) 2024-02-10 20:23:50 +01:00
Yannick Lamprecht
581fb30a4c
itemstack expose tooltip lines (#10185)
* Itemstack Tooltip API

* re-order methods so advanced is first

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-02-09 17:12:50 -08:00
Lulu13022002
97c01206bc
Fix fox drops on death (#8862) 2024-02-09 16:07:10 -08:00
Tamion
cbe62d91fb
Add Conduit API (#10195) 2024-02-09 23:03:27 +01:00
Micah Rao
69b52b4d8e
Check for server JARs in plugin directory (#10228) 2024-02-09 22:05:13 +01:00
Tamion
9c04729de1
Add Arrow/Stinger Removal Time API (#10193) 2024-02-09 21:56:13 +01:00
Moulberry
534659e97e
Fix NotNull locales (#10216)
Two methods returning locales are annotated @NotNull, despite being able
to return null
2024-02-09 20:30:50 +00:00
Jake Potrebic
934cd77da8
Lifecycle Event System (#9629)
* registering stuff event system

* simply by removing a ton of unneeded generics

* separate RegistryEvent and RegistrarEvent

* add logic for removing hooks when a plugin is disabled

* cleanup more

* swap around the way things are registered

* block further hook registrations for JavaPlugin

* Slightly more extensible to support registry mod API

* rename some types

* more moving/renaming

* remove 'hook' name

* Rename to 'lifecycle'

* move more impls for the server

* add priorities

* added lock for bootstrap event registration

* slight refactor to allow 'register anywhere' event types

* Move event type list to server impl

* use builder pattern to create event handler configurations

* add some more javadocs

* fix some issues, slight refactors

* call predicate and method renames

* add owner aware events

* rebased and refactored owner aware events

* add single helper method for registering simple handler

* compile fixes

* check owner and fix generics on register helper

* javadoc fixes and a few type renames

* more javadoc fixes

* move service loader file to correct location

* rename to Monitorable and Prioritizable

* add invalidation system for events after running them

* block reloading plugins in certain situations

* update test plugin

* remove dummy events

* rebase
2024-02-09 12:12:01 -08:00
Nassim Jahnke
9e171ef8ff
Improve tag parser handling, move hunks out of chunk system patch 2024-02-05 12:31:51 +01:00
Nassim Jahnke
c5d168cef9
More provider source fixup 2024-02-02 12:44:09 +01:00
Nassim Jahnke
8bc5be8ba7
Add missing catch 2024-02-01 11:41:29 +01:00
Nassim Jahnke
7f856a1d1f
Fix sleeping pos desync 2024-02-01 10:53:15 +01:00
Nassim Jahnke
87ce7c7209
Small refactor of Paper plugin context preparation 2024-02-01 10:51:29 +01:00
Lulu13022002
294347bee2
[ci skip] Cleanup events (#10202) 2024-02-01 10:15:57 +01:00
Rowan
b3c81089ae
[ci skip] Fix incorrect documentation for BlockDropItemEvent (#10175)
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-01-27 20:42:46 +01:00
Jake Potrebic
3841722fe1
Properly check if a loot table exists (#10190) 2024-01-27 20:21:18 +01:00
Warrior
0cc3a7ec6b
Disable memory reserve allocating (#10180) 2024-01-27 20:06:03 +01:00
Luis
b333831b70
Make spawn egg colours visible (#10158)
Co-authored-by: Yannick Lamprecht <1420893+yannicklamprecht@users.noreply.github.com>
2024-01-27 19:32:05 +01:00
Chase Henderson
4643b0d959
Shulker duplicate event (#10135) 2024-01-27 19:13:12 +01:00
Jake Potrebic
ed130f1170
[ci skip] clarify javadocs for Block#getDrops (#10153) 2024-01-27 18:35:09 +01:00
Tamion
7f7d05a21c
[ci skip] Remove IRC link from the README (#10194) 2024-01-27 13:11:43 +01:00
Nassim Jahnke
1ed50dade8
Fix javadoc errors, remove unused classes 2024-01-26 21:34:40 +01:00
Nassim Jahnke
fe53b0e76f
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
1d522878 PR-966: Introduce getRespawnLocation as a replacement for getBedSpawnLocation
cc01b745 PR-965: Add DragonBattle#setPreviouslyKilled
28e3702f SPIGOT-6921, PR-957: Add methods to remove all enchantments on an ItemStack
8872404e PR-961: Add BlockData#copyTo
4054cc7b PR-956: Add method to get an offline player's location

CraftBukkit Changes:
292ec79e0 SPIGOT-7568: Call EntityChangeBlockEvent for DecoratedPot
b44bf5aa8 SPIGOT-7575: SuspiciousStewMeta creates invalid PotionEffect data
161784713 PR-1340: Centralize the conversion from and to Minecraft / Bukkit registry items even more and add a test case for them
b93c5a30d PR-1338: Introduce getRespawnLocation as a replacement for getBedSpawnLocation
fb973486c SPIGOT-7570: PrepareItemCraftEvent#isRepair() always returns false
c9c24535e PR-1337: Add DragonBattle#setPreviouslyKilled
c8b4da803 SPIGOT-6921, PR-1330: Add methods to remove all enchantments on an ItemStack
95bc1c4f5 PR-1333: Add BlockData#copyTo
36e2f9ce1 PR-1329: Add method to get an offline player's location

Spigot Changes:
c198da22 SPIGOT-7563: Update to latest release of bungeecord-chat
2024-01-26 20:19:17 +01:00
Nassim Jahnke
bd2fd615ce
[ci skip] Fixup a few bad comments 2024-01-26 19:41:41 +01:00
Nassim Jahnke
b03f255532
Finish moving patches back and improving compilable state 2024-01-25 12:10:23 +01:00
Nassim Jahnke
1831240d1c
[ci skip] Move chunk system patch back 2024-01-25 00:41:51 +01:00
Shane Freeder
b700460999
Convert average tick value in the GUI to the correct granularity 2024-01-24 16:27:32 +00:00
Nassim Jahnke
a4a08b7342
[ci skip] Move chunk system patch a bit back 2024-01-24 17:14:57 +01:00
Nassim Jahnke
d405ff1255
[ci skip] Fixup last commit 2024-01-24 14:05:59 +01:00
Nassim Jahnke
ad2cf68a7f
[ci skip] Move chunk system patch back a bit 2024-01-24 13:42:24 +01:00
Nassim Jahnke
51bef80755
[ci skip] Remove removed patches 2024-01-24 11:55:36 +01:00
Nassim Jahnke
11645e3268
[ci skip] (Mostly) finish adding identifying patch comments 2024-01-24 11:45:17 +01:00
FireInstall
76da4bc683
Expose LootTable of DecoratedPot (#10023) 2024-01-23 15:57:17 -05:00
Jake Potrebic
24dc2bfc50
Add BlockStateMeta#clearBlockState (#10160) 2024-01-23 15:41:47 -05:00
1stGlitch
581b101180
Add world to Entity AddTo/RemoveFrom Events (#10183)
When a plugin listens to the EntityAddToWorld and EntityRemoveFromWorld events, I don't believe there is currently any method of directly obtaining which world the entity was actually added to/removed from. Using event.getEntity().getWorld() works in many cases, but not all. Specifically, when an entity is teleported from one world to another, the location of the entity is updated prior to the removal event being called. This means that when an entity goes through a nether/end portal or is teleported between worlds with a command, a plugin listening to the EntityRemoveFromWorldEvent has no way of determining which world the entity was actually removed from (without relying on other events).

To resolve this, I've added the world as a field in the events along with a getter to retrieve it. I also removed an unused import and made the documentation more clear on the event behaviour when chunks load/unload.
2024-01-23 15:17:14 -05:00
Nassim Jahnke
c57d1aa245
Move diffs around to compile without later ones applied 2024-01-23 18:06:51 +01:00
Nassim Jahnke
e66037960b
[ci skip] Move some disruptive patches back 2024-01-23 15:57:42 +01:00
Nassim Jahnke
52619e7a21
[ci skip] Add more patch identifying comments 2024-01-23 14:39:23 +01:00
Nassim Jahnke
484d6bfb4e
[ci skip] Move some disruptive patches back 2024-01-23 12:47:01 +01:00
Nassim Jahnke
25013d9970
[ci skip] Move some disruptive patches back 2024-01-22 21:13:10 +01:00
Nassim Jahnke
9eb0b38157
[ci skip] Add more patch identifying comments 2024-01-22 19:01:10 +01:00
Nassim Jahnke
684319f9c6
[ci skip] Add more patch identifying comments 2024-01-22 18:04:55 +01:00
Nassim Jahnke
27cabc19a0
[ci skip] Add more patch identifying comments 2024-01-21 19:59:34 +01:00
Nassim Jahnke
d9df6bc5e6
[ci skip] Add more patch identifying comments, cleanup 2024-01-21 17:55:04 +01:00
Nassim Jahnke
e9e0bc168d
[ci skip] Add more identifying patch comments 2024-01-21 16:01:04 +01:00
Nassim Jahnke
98e6d20ebd
[ci skip] Add more identifying patch comments 2024-01-21 13:38:50 +01:00
Nassim Jahnke
f7dd304b1f
[ci skip] Add more identifying patch comments 2024-01-21 12:11:43 +01:00
Nassim Jahnke
8d94596e30
[ci skip] Add more identifying patch comments 2024-01-20 23:41:26 +01:00
Shane Freeder
b48d737759
Async world data IO saving (#10171)
Co-authored-by: Cryptite <cryptite@gmail.com>
2024-01-20 22:51:15 +01:00
Pantera (Mad_Daniel)
4a98986e28
Add back Reduce allocation of Vec3D by entity tracker patch (#10179) 2024-01-20 12:26:51 -05:00
Nassim Jahnke
68c3297947
[ci skip] Add more identifying patch comments 2024-01-20 14:25:44 +01:00
Lulu13022002
8e41ef4cc5
Add visual blockdata api for primed tnt (#10146) 2024-01-19 18:01:12 -05:00
Nassim Jahnke
42e88a8b7b
[ci skip] Add more identifying patch comments 2024-01-19 22:13:42 +01:00
Nassim Jahnke
1c956abfbc
[ci skip] Add more identifying patch comments, merge related patches 2024-01-19 17:54:05 +01:00
Nassim Jahnke
eeb6afc435
[ci skip] Add more identifying patch comments, merge related patches 2024-01-19 15:30:44 +01:00
Nassim Jahnke
cc693ce82b
[ci skip] Add more identifying patch comments, merge related patches 2024-01-19 12:55:49 +01:00
Nassim Jahnke
106c67a811
[ci skip] Add more identifying patch comments 2024-01-18 22:00:40 +01:00
Shane Freeder
f61ebdce91
Fix issue with kick event causes being passed improperly 2024-01-18 19:36:08 +00:00
Nassim Jahnke
3e20d3a275
[ci skip] Add more identifying patch comments 2024-01-18 18:57:15 +01:00
Nassim Jahnke
5e73c555bc
[ci skip] Add more identifying patch comments 2024-01-18 15:56:25 +01:00
Nassim Jahnke
94807a1d2e
[ci skip] Minor cleanup and patch merges 2024-01-16 19:27:39 +01:00
Nassim Jahnke
ebf97bdfdd
[ci skip] Add more patch identifying comments 2024-01-16 13:32:52 +01:00
Owen
848a3960f6
Add mob goal generator (#9980) 2024-01-15 14:36:10 -05:00
Nassim Jahnke
0ef59845bf
[ci skip] Add more patch identifying comments, merge related patches 2024-01-15 12:50:31 +01:00
Nassim Jahnke
f9fdedf2d7
[ci skip] Add more patch identifying comments, merge related patches 2024-01-14 17:04:39 +01:00
Nassim Jahnke
93a848c4b9
Readd missed line 2024-01-14 13:51:41 +01:00
Nassim Jahnke
c151c956e0
Fixup AsyncPreLoginEvent patches
Fixes #10165
2024-01-14 13:47:09 +01:00
Jake Potrebic
8657cd91d7
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10164)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
63c208dd Remove no longer used import
70be76c7 PR-958: Further clarify deprecation of TAG_CONTAINER_ARRAY
ae21f4ac PR-955: Add methods to place structures with block/entity transformers
e3d960f2 SPIGOT-7547: Remark that Damageable#setAbsorptionAmount() is capped to a specific value
b125516c Fix typo in RecipeChoice.ExactChoice docs
309497c1 Add EntityMountEvent and EntityDismount Event
2fd45ae3 Improve ItemFactory#enchantItem consistency
2b198268 PR-933: Define native persistent data types for lists

CraftBukkit Changes:
771182f70 PR-1327: Add methods to place structures with block/entity transformers
e41ad4c82 SPIGOT-7567: SpawnReason for SNOWMAN is reported as BUILD_IRONGOLEM
76931e8bd Add EntityMountEvent and EntityDismount Event
9b29b21c7 PR-1183: Better handle lambda expression and renaming of classes in Commodore
1462ebe85 Reformat Commodore.java
9fde4c037 PR-1324: Improve ItemFactory#enchantItem consistency
4e419c774 PR-1295: Define native persistent data types for lists
dd8cca388 SPIGOT-7562: Fix Score#getScore and Score#isScoreSet
690278200 Only fetch an online UUID in online mode
1da8d9a53 Fire PreLogin events even in offline mode
2e88514ad PR-1325: Use CraftBlockType and CraftItemType instead of CraftMagicNumbers to convert between minecraft and bukkit block / item representation

Spigot Changes:
864e4acc Restore accidentally removed package-info.java
f91a10d5 Remove obsolete EntityMountEvent and EntityDismountEvent
828f0593 SPIGOT-7558: Deprecate silenceable lightning API as sound is now client-side and cannot be removed
cdc4e035 Remove obsolete patch fetching correct mode UUIDs
49e36b8e Merge related BungeeCord patches
6e87b9ab Remove obsolete firing of PreLogin events in offline mode
5c76b183 Remove redundant patch dealing with exceptions in the crash reporter
3a2219d1 Remove redundant patch logging cause of unexpected exception
2024-01-14 10:46:04 +01:00
Nassim Jahnke
78fcb8e766
[ci skip] Update contributing guidelines to include identifying commit titles in comments (#10162) 2024-01-14 00:42:59 +01:00
Jake Potrebic
17275ffd68
[ci skip] add more comments & move 1 hunk to correct patch 2024-01-13 12:31:02 -08:00
Nassim Jahnke
c0e4697dbd
[ci skip] Add more patch identifying comments 2024-01-13 18:34:33 +01:00
Nassim Jahnke
e84621a9d8
[ci skip] Add more patch identifying comments 2024-01-13 16:35:59 +01:00
Nassim Jahnke
8c8862f3a8
Also check for the actual character length in ResourceLocation validation 2024-01-12 23:33:43 +01:00
Nassim Jahnke
a0ffb57745
[ci skip] Small cleanup to mc utils patch 2024-01-12 21:58:54 +01:00
Nassim Jahnke
f28caff927
Limit ResourceLocation length to nbt string tag length 2024-01-12 19:33:17 +01:00
Jake Potrebic
ec196207c2
Use a ConcurrentHashMap for enum mappings for BlockData (#10161)
This API should be thread-safe as there is no world state
2024-01-12 16:25:12 +00:00
Jake Potrebic
a80d31b1bd
Log command execution exceptions if debug=true (#10130) 2024-01-11 08:15:17 -08:00
Nassim Jahnke
07b956e3a3
Fix tests by disabling them 2024-01-06 19:13:45 +01:00
Nassim Jahnke
f1c5f0198c
[ci skip] Fix typo 2024-01-06 15:11:45 +01:00
Nassim Jahnke
e46276eb71
Fixup NamespacedKey parsing 2024-01-06 15:07:59 +01:00
Nassim Jahnke
570cfb44d6
Validate missed resource location parsing 2024-01-06 09:51:49 +01:00
Jake Potrebic
a58e29db99
Fix a borked update of 'Properly handle BlockBreakEvent#isDropItems' (#10134) 2024-01-05 10:07:43 +01:00
Warrior
25a99b12e8
Fix BlockDestroyEvents effectBlock not being set (#10131) 2024-01-05 01:09:04 +01:00
Jake Potrebic
a93acc4275
Fix EntityChangePoseEvent being called during worldgen (#10120) 2024-01-04 12:55:01 -08:00
Jake Potrebic
8379027ee0
Fix cmd permission levels for command blocks (#7404) 2024-01-04 12:37:59 -08:00
Owen
19a620213f
Fix experience & improvements to block events (#8067)
This is a lot but basically adds a method to disable the dropping of experience and drops experience by default.
This way things that require XP to be dropped manually (via modification), they can drop XP themselves when needed but without touching anywhere else that may drop xp.

It should be noted this causes breakNaturally() to now drop experience.
2024-01-04 15:18:59 -05:00
Nassim Jahnke
7eaff48d7c
[ci skip] Replace some magic values with constant references 2024-01-04 14:38:26 +01:00
Nassim Jahnke
b2a6d575dd
Validate ResourceLocation in NBT reading 2024-01-04 13:55:17 +01:00
Bjarne Koll
259bc76026
Pass system properties to maven repo session (#10117)
The maven repository sessions used by the maven library loader requires
the java.version property to later evaluate the active profiles of
dependencies when downloading them during the plugin loader logic.

This commit fixes this by passing all system properties as a hopefully
future-proof way to provide the required data to said session.
2024-01-04 11:13:12 +00:00
Jake Potrebic
ae001ae6ee
Fix untrack event not being called for all 'untracks' (#10110) 2024-01-03 20:57:49 -08:00
Jake Potrebic
1fa48d140c
include relative flags in PlayerTeleportEvent (#8190) 2024-01-02 20:42:26 +01:00
Owen
509876d26f
Keep fully frozen entities fully activated (#10103)
* Keep fully frozen entities fully activated

* Rebase and switch to isFreezing

---------

Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2024-01-02 11:08:34 -08:00
Jake Potrebic
692db0c81d
fix CustomModelData being removed (#10113) 2024-01-02 19:51:09 +01:00
Jake Potrebic
816bacc2c3
Call EntityChangeBlockEvent for cake eating (#10105) 2024-01-02 19:45:36 +01:00
Jake Potrebic
58e120b77c
[ci skip] Remove extraneous diff added in 1.20.3 update (#10101) 2024-01-02 10:29:53 -08:00
Jake Potrebic
983377b55a
Correctly check if bucket dispenses will succeed for event (#10109) 2024-01-02 09:14:42 -08:00
Spottedleaf
1281f4f552 Make region/lock shift accessors per world
This has been done to ensure that the shifts are not used
until the world object is being constructed, which is before
the global configuration is initialised. There also isn't any
reason for these shifts to be global anyways.
2023-12-30 15:45:24 -08:00
Jake Potrebic
0ae58c09a1
cleanup player death event adventure logic (#10095)
There was a TODO left there regarding the translated death
message being used by plugins to identify the cause of death. This
should be mitigated now because the LegacyComponentSerializer default
implemenation uses our custom flattener which renders vanilla
translatable components to their English representation.
2023-12-29 12:28:58 -08:00
Jake Potrebic
3484ae987a
Call entity_die game event after event cancel check (#10096) 2023-12-29 11:57:32 -08:00
caramel
e56e53f83a
Fix some component bugs in login disconnect packet (#10090) 2023-12-29 20:51:52 +01:00
caramel
5e978d3a3d
Fix Folia scheduler tasks not canceling when plugin disable (#10091) 2023-12-29 01:59:19 +01:00
Jake Potrebic
e4ab50de34
Properly disallow async Player#chat (#8123)
Clarify asynchronous status of AsyncChatEvent
2023-12-28 16:50:06 -08:00
Tamion
2951732742
Add HiddenPotionEffect API (#9910) 2023-12-28 19:38:44 -05:00
Cryptite
b2ffb1b02d
Add PlayerShieldDisableEvent (#9177) 2023-12-29 01:27:34 +01:00
Jake Potrebic
2c3ccb80f0
Add drops to shear events (#5678) 2023-12-28 14:41:07 -08:00
Jake Potrebic
3c0d6aaed9
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10085)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
0c7aedbc SPIGOT-7554, PR-954: Add DecoratedPotInventory

CraftBukkit Changes:
53ebb05e3 SPIGOT-7554, PR-1323: Add DecoratedPotInventory
33a2d8773 Ensure that PlayerMoveEvent is always fired where applicable
7df18510f SPIGOT-7555: Don't cast ItemFlags to byte
19aec59ea Use provided case for non-existent OfflinePlayers

Spigot Changes:
e7ce55a3 Remove obsolete PlayerMoveEvent improvements
3e5e22c0 Remove obsolete lowercasing of non existent OfflinePlayer names
2023-12-28 12:47:57 -08:00
Jake Potrebic
8221b085f9
Fix global sound event gamerule not being respected (#8727) 2023-12-27 16:33:05 -08:00
Md5Lukas
c081104395
Add experience points api (#9688) 2023-12-28 00:49:45 +01:00
Alex
88d28d6bdd
Fix long loading screen when refreshing skins (#10026)
Send `ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START` when refreshing players after
player profile changes.
2023-12-28 00:22:44 +01:00
Jake Potrebic
a401585cfa
Fix campfire recipes not always outputting full result (#8754) 2023-12-27 15:02:49 -08:00
Jake Potrebic
d1f507fc0e
Don't fire 2 game events for certain cauldron interactions (#8904) 2023-12-27 14:32:39 -08:00
Jake Potrebic
0d6a0c3b28
Fix command block async message (again) (#10082) 2023-12-27 10:30:15 +01:00
Owen
dc621507f5
Catch async usage of playsound (#10021) 2023-12-26 15:00:21 -05:00
Jake Potrebic
f483b38596
fix NPE on EntityTeleportEvent getTo (#10016) 2023-12-26 11:22:41 -08:00
Warrior
4fdda9e583
Keep newlines in outdated client/server message (#10042) 2023-12-26 14:02:22 -05:00
Jake Potrebic
c215ce1858
[ci skip] cleanup patch diff from last commit 2023-12-25 16:47:06 -08:00
Nassim Jahnke
e035fd7034
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
cc9aa21a SPIGOT-6399, SPIGOT-7344: Clarify collidable behavior for player entities
f23325b6 Add API for per-world simulation distances
26e1774e Add API for per-world view distances
0b541e60 Add PlayerLoginEvent#getRealAddress
5f027d2d PR-949: Add Vector#fromJOML() overloads for read-only vector types

CraftBukkit Changes:
bcf56171a PR-1321: Clean up some stuff which got missed during previous PRs
7f833a2d1 SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst
752aac669 Implement APIs for per world view and simulation distances
57d7ef433 Preserve empty enchantment tags for glow effect
465ec3fb4 Remove connected check on setScoreboard
f90ce621e Use one PermissibleBase for all command blocks
5876cca44 SPIGOT-7550: Fix creation of Arrow instances
f03fc3aa3 SPIGOT-7549: ServerTickManager#setTickRate incorrect Precondition
9d7f49b01 SPIGOT-7548: Fix wrong spawn location for experience orb and dropped item

Spigot Changes:
ed9ba9a4 Drop no longer required patch ignoring -o option
86b5dd6a SPIGOT-7546: Fix hardcoded check for outdated client message
aa7cde7a Remove obsolete APIs for per world view and simulation distances
6dff577e Remove obsolete patch preserving empty `ench` tags
a3bf95b8 Remove obsolete PlayerLoginEvent#getRealAddress
1b02f5d6 Remove obsolete connected check on setScoreboard patch
acf717eb Remove obsolete command block PermissibleBase patch
053fa2a9 Remove redundant patch dealing with null tile entities
2023-12-26 00:18:13 +01:00
Nassim Jahnke
61768e08e7
[ci skip] Remove no longer needed mappings change 2023-12-25 19:15:48 +01:00
Nassim Jahnke
1cda66e395
Hotfix Entity isInRain reobf issue
Caused by upstream making the method public, which then causes an accidental override from an unrelated method
Fixes #10078
2023-12-25 18:37:20 +01:00
EpicPlayerA10
ff7b9b0380
Increase default custom payload channel size limit (#10006) 2023-12-25 12:01:18 +01:00
Jake Potrebic
4adca3d7a3
Update to adventure 4.15 (#10045) 2023-12-25 11:51:44 +01:00
Jake Potrebic
49f9f6f2cd
Add Registry#getKey (#10066)
Some types that have registries support existing without
being in a registry and therefore have no key. This is part
one of supporting that, adding a Registry#getKey(Object) method
to be able to get the key for an object so we can remove Keyed
from such objects.

This also deprecates Keyed#getKey on TrimMaterial and TrimPattern
as these are the 2 offending types currently in the api.
2023-12-23 13:16:27 -08:00
Jake Potrebic
e7e1c8a832
Fix and add new scoreboard API (#10037) 2023-12-23 11:53:07 -08:00
Jake Potrebic
1e7dd72f15
Remove 'fix Vanilla Minecart speed' patch (#10068)
The game uses 0.95d now
2023-12-22 17:44:36 -08:00
Jake Potrebic
b4c9e7e5d4
add missing Experimental annotations (#10012) 2023-12-21 13:13:05 -08:00
Jake Potrebic
d11a58802a
Remove duplicate code in chunk tick iteration (#10056) 2023-12-21 09:15:00 -08:00
Jake Potrebic
45e01a2a78
Use correct max stack size in crafter (#10057) 2023-12-21 09:10:28 -08:00
Lulu13022002
086ca616d8
Fix world border edge collision (#10053)
The collision shape of the border is determined by flooring the min values and ceiling the max values, so the isCollidingWithBorder() function should mirror such behavior.
2023-12-19 21:31:07 -08:00
Jason Penilla
5385b21fd3
[ci skip] Make test results viewable in-browser and downloadable (#10055)
* Post test results

* empty commit

* Make a test fail

* Add missing check

* Disable commenting

* Revert "Make a test fail"

This reverts commit d919653c2b38a3afb74d28e5462685f7ec54b16a.

* remove commenting permission
2023-12-19 19:33:46 -08:00
Jake Potrebic
8c007d90a5
properly read and store sus effect duration (#10050) 2023-12-19 13:31:49 -08:00
Jake Potrebic
47b2c186d7
Don't fire the drop event on player deaths (#10046) 2023-12-18 20:57:49 -08:00
Spottedleaf
0b952981e6 Make worldborder collisions consistent with Vanilla
Vanilla now requires the use of WorldBorder#isInsideCloseToBorder
to consider a border collision
2023-12-18 17:12:55 -08:00
Jake Potrebic
e3140fb70e
hotfix spawning item/xp in wrong spot 2023-12-17 20:23:39 -08:00
Jake Potrebic
ff26d54ee0
send sound and particle packets immediately even if off main (#10033) 2023-12-17 11:39:40 -08:00
Jake Potrebic
de04cbced5
Updated Upstream (Bukkit/CraftBukkit) (#10034)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries

CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion

Spigot Changes:
06d602e7 Rebuild patches
2023-12-16 18:09:28 -08:00
Spottedleaf
f1820dc80a Fix incorrect border collision detection
The epsilon used was in the opposite direction, which would cause
the getCollisions method to incorrectly return it for when players
were exactly on the border but not colliding. To bring it in-line
with the rest of the collision code, the collision must be into
the border by +EPSILON.

Fixes https://github.com/PaperMC/Paper/issues/9859
2023-12-14 18:57:17 -08:00
Jason Penilla
7e15d977ec
Remove no longer needed diff from adventure patch 2023-12-12 13:44:09 -08:00
booky10
dc3ef2ae0f
Fix vanilla components not being translated (#9893)
* Fix vanilla components not being translated

* Add nullability check, simplify adventure component encoding

Changes suggested by @jpenilla
2023-12-12 13:40:33 -08:00
Jason Penilla
0fadaed078
[ci skip] move decomp fixes to correct patch 2023-12-11 22:08:51 -08:00
Jake Potrebic
7c2dc4b342
Use Codecs for adventure Component conversions & network serialization (#10014)
* finish implementing all adventure components in codecs

* add some initial tests

* Add round trip tests for text and translatable components

* Add more round trip test data (score component is failing)

* Add more round trip test data

* Fix SCORE_COMPONENT_MAP_CODEC

* Improve test failure messages

* Add failure cases

* Add a couple more test data

* Make use of AdventureCodecs

* Update patches after rebase

* Squash changes into adventure patch

* Fix AT formatting

* update comment

---------

Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2023-12-11 22:02:06 -08:00
Jason Penilla
82f9280ae4
Fix deprecated bungee APIs still serializing to JSON in packets (#10028) 2023-12-11 20:24:48 -08:00
Owen
28abbaa7bd
Catch setEnabled to ensure classloader is properly unloaded (#10020) 2023-12-10 20:02:26 -05:00
Jake Potrebic
dd16335e40
fix NPE when iterating over default drops (#10017) 2023-12-10 10:33:36 -08:00
Jake Potrebic
3434a6fc66
Update key gen for 1.20.4 (#10015) 2023-12-10 10:25:01 -08:00
Jake Potrebic
166761f29f
Update and clean up api dependencies (#10018) 2023-12-10 10:04:19 -08:00
caramel
bcbe5dcd78
Fix PlayerInteractEvent#getClickedBlock() returning wrong block in adventure mode (#10019) 2023-12-10 11:02:24 +01:00
Nassim Jahnke
b42a1da873
Use uuid param in setResourcePack 2023-12-09 13:53:08 +01:00
Jake Potrebic
abfb6b219b
more work on adventure codecs 2023-12-08 21:48:02 -08:00
Jake Potrebic
9051fc347c
remove redundant patch 2023-12-08 15:14:42 -08:00
Jake Potrebic
f17622cc3d
more cleanup and resource pack api fixes 2023-12-08 15:13:02 -08:00
Jake Potrebic
7606e6da39
fixup tests and add missing API detected by those tests 2023-12-08 12:07:56 -08:00
Lulu13022002
8d8eb3bdf6
optimise explosion damage further
and use the right entity for the dragon part damage
2023-12-08 20:47:27 +01:00
Jake Potrebic
2f92d4e00e
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type

CraftBukkit Changes:
cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20db PR-1303: Create registry for banner pattern and cat type
4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
2023-12-08 11:00:39 -08:00
Jason Penilla
f9edc4b1cd
Update paperweight to 1.5.11 2023-12-08 11:12:59 -07:00
Jason Penilla
930a24f965
1.20.4 2023-12-07 13:27:28 -07:00
Owen1212055
ff72782888
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
cdfe62e4 Update to Minecraft 1.20.4

CraftBukkit Changes:
51eea725f Update to Minecraft 1.20.4

Spigot Changes:
ce0f71e4 Update to Minecraft 1.20.4
2023-12-07 15:15:25 -05:00
Jake Potrebic
d0476837a5
more adventure codec stuff
and fix tests
2023-12-07 11:14:29 -08:00
Noah van der Aa
9223f05a40
Updated Upstream (CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
c9cb08551 SPIGOT-7536: Using Crafter crashes server
2023-12-07 13:03:14 +01:00
Jake Potrebic
6577db6dd6
cleanup Optimize MappedRegistry patch 2023-12-06 22:41:13 -08:00
Jason Penilla
6c4c13df44
Update adventure 2023-12-06 21:24:16 -07:00
Owen1212055
9227a9648c
Clean up username validation logic 2023-12-06 20:26:58 -05:00
Owen1212055
b277feb448
Hotfix DefaultDispenseItemBehavior#spawnItem 2023-12-06 19:45:28 -05:00
Jason Penilla
3b94cc3546
Clean up settings script 2023-12-06 15:57:51 -07:00
Jason Penilla
ada77b3a3b
Wait on stream redirect futures (update helper task) 2023-12-06 15:32:08 -07:00
Nassim Jahnke
6bafacfb14 Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9a294519 SPIGOT-7533, 943: Add missing Poses for 1.20.3
be2884c4 Add unique ID to PlayerResourcePackStatusEvent
d9c1eb83 Add additional @MinecraftExperimental annotations
68f5bb6a SPIGOT-7526: Add missing PlayerResourcePackStatusEvent statuses

CraftBukkit Changes:
368c48be1 Fix formatting issue in previous commit
da8f91f31 SPIGOT-7534: Error when chunk with decorated pot trying to save
d20c9291a SPIGOT-7532: Entity#isValid() returns false after server restart
ec1fa2ead PR-1309: Add tests for Bukkit Pose
5a7080b58 Add unique ID to PlayerResourcePackStatusEvent
0fd734950 SPIGOT-7528: Fix certain custom shaped recipes
2023-12-06 23:01:51 +01:00
Nassim Jahnke
b1f94a84e8 Update cb package version 2023-12-06 22:51:50 +01:00
Nassim Jahnke
772d430cd1 Fix timings check with tick freezes 2023-12-06 22:40:08 +01:00
Nassim Jahnke
896e29bba7 Inline imports in loottable patch 2023-12-06 22:22:22 +01:00
Nassim Jahnke
d1dbe0020d Fix lootable patch, cb crash due to unimplemented methods 2023-12-06 22:17:56 +01:00
Jason Penilla
0addaa1cf2
Temp adventure update 2023-12-06 13:53:16 -07:00
Nassim Jahnke
c833571526 Make it compile again 2023-12-06 21:28:59 +01:00
Owen1212055
a2b6275487
Add missing removed patches 2023-12-06 13:26:04 -07:00
Jason Penilla
f10b36d7fc
wait for second pass apply 2023-12-06 13:26:04 -07:00
Nassim Jahnke
9bc67abccf Fixup 2023-12-06 21:19:37 +01:00
Owen1212055
ff2946e04b
Fix some missing diffs 2023-12-06 15:11:00 -05:00
Owen1212055
d3f1bc04b4
Remove some patches 2023-12-06 15:09:14 -05:00
Nassim Jahnke
b32a34c71d Add missing timings stop 2023-12-06 21:04:01 +01:00
Nassim Jahnke
03541446b2 Drop old packs in setResourcePack 2023-12-06 20:46:49 +01:00
Nassim Jahnke
c2b70338fc It compiles 2023-12-06 20:40:37 +01:00
Nassim Jahnke
1d028f3853 More compile fixes 2023-12-06 20:10:59 +01:00
Jason Penilla
05148728de
build script updates 2023-12-06 11:48:37 -07:00
Jake Potrebic
deb02722b2
more compile fixes 2023-12-06 10:36:49 -08:00
Lulu13022002
6b272a65e7
remove old diff 2023-12-06 19:29:36 +01:00
Noah van der Aa
5999d669ac
More compile fixes 2023-12-06 19:21:41 +01:00
Nassim Jahnke
67f1688c30 Toggle updatingMinecraft property 2023-12-06 19:21:09 +01:00
Nassim Jahnke
b8f9558745 Apply all patches 2023-12-06 19:19:19 +01:00
Jake Potrebic
a364b7e88b
fix more compile issues 2023-12-06 10:07:47 -08:00
Jake Potrebic
0dee538a62
Upstream blocked Player#remove so our patch needed to be refactored 2023-12-06 09:54:52 -08:00
Jake Potrebic
6c4efc92be
fix mismatched bracket in game packet listener 2023-12-06 09:47:45 -08:00
Bjarne Koll
13b92ad487
Make things explodes via patches 2023-12-06 18:33:52 +01:00
Bjarne Koll
855a8196cf
Fix custom potion mixes patch 2023-12-06 17:40:36 +01:00
Owen1212055
9546b9c587
Patches!!! MORE MORE MORE MOOOOORE 2023-12-06 11:34:54 -05:00
Owen1212055
cd61b5d98e
Patches!!! MORE 2023-12-06 11:21:56 -05:00
Owen1212055
6bf2ebf200
Patches!!! (2) 2023-12-06 11:00:26 -05:00
Owen1212055
25dc4afafa
Patches!!! 2023-12-06 10:17:00 -05:00
Jason Penilla
46be245976
add description to helper 2023-12-05 21:59:52 -07:00
Jake Potrebic
cc78c7f5f5
fix serializing TextColor with name 2023-12-05 20:56:02 -08:00
Jason Penilla
29e137669e
p a t c h e s 2023-12-05 21:49:31 -07:00
Jason Penilla
2053d6ace7
Improve update helper task 2023-12-05 21:46:41 -07:00
Jason Penilla
fc12258f24
more patch 2023-12-05 20:57:46 -07:00
Jason Penilla
c7a463a736
Add update helper task 2023-12-05 20:35:33 -07:00
Jason Penilla
723c05e7fe
some patches :D 2023-12-05 20:34:04 -07:00
Jason Penilla
5513f8a795
patches ... 2023-12-05 20:00:14 -07:00
Jason Penilla
bdbdca8a56
Bump Gradle wrapper to 8.5 2023-12-05 17:58:17 -07:00
Jake Potrebic
ad99d4568b
initial work on native Adventure codecs 2023-12-05 16:49:11 -08:00
Jason Penilla
6e9a238a8c
some more patch 2023-12-05 15:55:31 -07:00
Jason Penilla
7a59fd38d4
patches up to anti x ray 2023-12-05 15:32:41 -07:00
Jason Penilla
9d9fcf7e62
fix timings patch field use 2023-12-05 15:25:25 -07:00
Jason Penilla
1a33343012
some more patches 2023-12-05 15:21:44 -07:00
Jason Penilla
a30aad98f7
some patches 2023-12-05 15:12:48 -07:00
Jake Potrebic
c3f3edea07
port UnknownCommandEvent patch 2023-12-05 13:51:34 -08:00
Jason Penilla
b89fff0490
Update generated API 2023-12-05 14:36:33 -07:00
Jason Penilla
dfac4f9df2
patches 2023-12-05 14:34:01 -07:00
Jason Penilla
fad3fa9bde
Update loot table and other patches 2023-12-05 14:20:44 -07:00
Nassim Jahnke
2a9a9c4cf0 Remove unnecessary import 2023-12-05 20:56:22 +01:00
Nassim Jahnke
2efd9bb99f More more more work 2023-12-05 20:54:55 +01:00
Nassim Jahnke
d7fc0c5ab2 More more work 2023-12-05 20:39:26 +01:00
Nassim Jahnke
603b32976b More work 2023-12-05 20:14:54 +01:00
Nassim Jahnke
9b56221762 Adventure (kind of) 2023-12-05 19:38:29 +01:00
Nassim Jahnke
8e8d6aeeb0 Finish API 2023-12-05 18:33:18 +01:00
Nassim Jahnke
2a1ace0cf2 Prepare for 1.20.3 dev 2023-12-05 18:20:55 +01:00
Jake Potrebic
931781c220
[ci skip] rebuild patches 2023-12-03 10:09:54 -08:00
Owen
9271ee7643
Dont resend blocks on interactions (#9413)
In general, the client now has an acknowledgment system that will cause block changes made by the client to be reverted correctly.

Essentially:

The client enters a "prediction" stage, where any block changes made will have its old blockstate captured (this is referred to as "server state").
If you update blocks during this stage, the client will update this captured server state as long as they're still currently predicting.
After prediction is done (via an ack packet) all captured blockstates are reverted to their captured server state.
This means that if the server actually updated a block and send a block update packet, it's correctly set, while if a block wasn't updated on the server but WAS updated on the client (server state wasn't updated), that change will be reverted.

It should be noted that this system does not yet support block entities, so those still need to be resynced when needed.

I discovered this when noticing that blocks broken outside of the player's valid interaction distance are still properly reverted, even though the server doesn't send any block updates, only an ack packet.
2023-12-02 22:41:35 -05:00
Jake Potrebic
8e061ce9c8
Add Structure check API (#9062) 2023-12-02 18:11:57 -08:00
Owen
5cbd5352b4
Fix Mushroom cow stew api (#9934) 2023-12-02 17:54:58 -08:00
Jake Potrebic
37bee09e3d
Restore vanilla entity drops behavior (#7650) 2023-12-02 17:35:10 -08:00
MrPowerGamerBR
ffa4115239
Configurable Dry and Wet Farmland Tick Rates (#9968)
* Configurable Dry and Wet Farm Land Nearby Water Tick Rates

* Rebase and squash

---------
2023-12-02 17:00:17 -08:00
hyper1423
40872ece07
Fix CraftMetaItem#addAttributeModifier duplication check (#9995) 2023-12-03 01:59:13 +01:00
Jake Potrebic
3766afadd5
[ci skip] Add mention of FQ imports (#9994) 2023-12-02 22:52:14 +01:00
Tamion
977a729eb0
[ci skip] Correct Windows requiring path to gradlew (#9976)
* [ci skip] Correct Windows requiring path to gradlew

* Update CONTRIBUTING.md
2023-12-02 13:32:46 -08:00
MrPowerGamerBR
8bda1f72a5
Remove unnecessary durability check in ItemStack#isSimilar (#9979)
* Optimize "ItemStack#isSimilar(...)" by removing the unnecessary durability check

* Change patch name and add a better commit message
2023-12-02 13:31:25 -08:00
Jake Potrebic
2184fbca00
Log correct recipes and advancement count on server start (#9978) 2023-12-02 13:17:35 -08:00
waterlily1
9993eb9d16
Updates documentation in EntityEquipment.java (#9992)
* Updates documentation in EntityEquopment.java to reflect behavior mentioned in issue #9867

* rebase and squash patches

---------

Co-authored-by: schwaa96 <schwaa96@mi.fu-berlin.de>
2023-12-02 12:29:47 -08:00
Jason Penilla
2182d47792
Update mapping-io (#9975) 2023-11-28 15:18:21 -07:00
Jake Potrebic
4d111a32bb
Un-experimentalize Entity TP APIs (#9964) 2023-11-28 11:40:25 -08:00
Jake Potrebic
b37bbcfd98
Use ? super in Consumer/Predicate API (#9939) 2023-11-25 15:03:02 -08:00
Gijs de Jong
f9938d3949
Fix plugin bootstrap dependency tree population (#9963)
This patch fixes a bug where the dependency tree used for classpath joining,
wasn't built using the bootstrap dependencies, for plugin bootstrappers.
2023-11-25 17:57:12 -05:00
Jake Potrebic
0b20f94297
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9953)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
96340858 PR-938: Various Sound API improvements
cbfe0ff0 PR-937: Minor improvements to World#rayTrace documentation
e979ee95 PR-935: Change Consumer and Predicates to super
27ae46dc SPIGOT-3641, SPIGOT-7479, PR-931: Add missing values to EntityEffect
0616ec8b Add eclipse .factorypath file to .gitignore

CraftBukkit Changes:
8e162d008 PR-1301: Various Sound API improvements
eeb7dfc2d SPIGOT-7520: Attribute LootTableSeed missing for generated containers with attached LootTable
d433f086d PR-1297: Change Consumer and Predicates to super
864f616da SPIGOT-7518: Fix NullPointerException when calling Block#applyBoneMeal()
5a2d905af Add eclipse .factorypath file to .gitignore
7c6bf15d4 Fix SkullMeta configuration serialization / deserialization with note block sound

Spigot Changes:
7de1049b Rebuild patches
2023-11-25 14:34:42 -08:00
Jake Potrebic
8eac3e1b93
Don't fire EntityPotionEffectEvent during worldgen (#9965) 2023-11-25 14:18:37 -08:00
Warrior
8280211e52
Fix yaw being ignored for first spawn pos (#9959) 2023-11-25 14:09:26 -08:00
MrPowerGamerBR
faa2f475b0
Lazily create LootContext for criterions (#9969)
For each player on each tick, enter block triggers are invoked, and these create loot contexts that are promptly thrown away since the trigger doesn't pass the predicate

To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance
2023-11-25 17:01:26 -05:00
TonytheMacaroni
334b2f20db
Fix max nearby entities class check (#9967) 2023-11-25 16:48:32 -05:00
Shane Freeder
ed753d34d2
Re-add missing vanilla safeMode arg 2023-11-25 09:49:48 +00:00
Jake Potrebic
96d5e6ca48
Code Generation for TypedKeys (#9233)
Currently includes generated key holder classes for types
used in the Registry Modification API
2023-11-22 20:56:28 -08:00
Jason Penilla
e1cd9e59e5
Update paperweight to 1.5.10 and Gradle to 8.4 (#9957) 2023-11-22 06:27:50 +01:00
Tamion
eda3d537d6
[ci skip] Improve PlayerChatEvent Deprecation Message (#9956) 2023-11-22 05:46:51 +01:00
Isaac - The456
250388defe
add getAdvancementProgress() to PlayerAdvancementCriterionGrantEvent (#9865)
this allows for simpler checks for if an advancement would be given to a player,
and denying it (as the advancement grant event is non-cancelable)
2023-11-18 20:18:48 -05:00
booky10
86117967db
Fix missing event call for entity teleport API (#9937)
* Fix missing event call for entity teleport API

Previously a plugin couldn't cancel or modify an entity-teleport from another plugin.

* rebase
2023-11-18 20:05:34 -05:00
TonytheMacaroni
581c7434be
Add API to retrieve an attribute modifier from a UUID (#9924)
* Add attribute modifier from UUID API

* Add method to remove by UUID

* Add overload for UnmodifiableAttributeInstance, better precondition messages

* rebase
2023-11-18 19:55:57 -05:00
Jake Potrebic
39dee1ab52
More paper config cleanup (#9938)
Also adds a warning and error message if a newer config version
was found signaling a downgrade.
2023-11-18 16:29:14 -08:00
Jake Potrebic
e5274eeac9
Fix spawners checking max nearby entities with correct type (#8945)
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2023-11-18 15:59:12 -08:00
Bjarne Koll
0a8c873722
Call LivingEntity#onItemPickup before mutation (#9948)
The existing EntityPickupItemEvent fixes patch moves the call to LivingEntity#onItemPickup for piglins after the respective EntityPickupItemEvent calls, which is correct.
However the patch moved the call so far down the line that the existing logic already mutated the picked up item entity, leading to faulty state being passed to the onItemPickup method.

To prevent logic in LivingEntity#onItemPickup to read from an ItemEntity that was already mutated, this commit moves the calls prior to the two respective mutations (either gold_nugget or rest).

This was chosen above taking a copy of the original item and restoring state later on to avoid a full item stack clone.
2023-11-17 07:43:25 +01:00
SoSeDiK
ce7f068095
Correct typo in javadoc (#9944) 2023-11-13 19:25:46 +01:00
Jake Potrebic
f186318a91
Run the chat callback on the main thread as expected (#9935) 2023-11-11 15:33:19 -08:00
Jake Potrebic
a506b48daa
Fix several issues with EntityBreedEvent (#8677)
Upstream did not account for different hands when storing
the breed item for later use in the event. Also they only
stored a reference to the stack, not a copy so if the stack
changed after love mode was started, the breed item in the event
also changed. Also in several places, the breed item was stored after
it was decreased by one to consume the item.
2023-11-11 15:23:02 -08:00
Jake Potrebic
aee3830763
Deprecate Material#isInteractable (#9216) 2023-11-11 17:21:22 -05:00
booky10
9548629853
Add hand to fish event for all player interactions (#9929) 2023-11-11 23:00:45 +01:00
Jake Potrebic
531ef27e89
Use ApiStatus.Internal instead of Deprecated (#9042)
Mainly correctly marks a lot of still used "magic values"
as Internal instead of "Deprecated".
2023-11-11 13:52:32 -08:00
booky10
9ee60eca7d
Add aggressive mob API (#9838) 2023-11-11 16:17:36 -05:00
Owen
dd47ec6fe2
Add Entity Movement Direction API (#7085)
This allows you to get player movement when riding vehicles, etc.
2023-11-11 16:04:34 -05:00
Jake Potrebic
d8847bc1f3
Updated Upstream (Bukkit/CraftBukkit) (#9922)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fde5602a PR-927: Add PlayerRecipeBookSettingsChangeEvent
949ff217 PR-930: Add methods to get/set evoker fang attack delay
f6f7c79d SPIGOT-7514, PR-929: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
d40e22da PR-712: Add API to get full result of crafting items

CraftBukkit Changes:
c8feb0629 PR-1291: Improve precondition message in Entity#playEffect
482c56a00 PR-1285: Add PlayerRecipeBookSettingsChangeEvent
cdf798800 PR-1290: Add methods to get/set evoker fang attack delay
2c1b5f78f SPIGOT-7514, PR-1289: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
6aa644ae9 PR-992: Add API to get full result of crafting items
ffb1319bc PR-1287: Fix scoreboards not updating in Player#setStatistic
2023-11-11 12:25:45 -08:00
Luis
63e77b531d
Add Enchantment cost API (#9856)
Cost is a property of individual enchantments, and is used by vanilla in combination with environmental aspects like tool enchantability and bookshelf count to determine the final cost of an enchantment as shown in an enchanting table.

Having access to the base cost of an enchantment using these vanilla methods can allow plugin developers to determine the "value" of an enchantment, and use it in custom logic where needed. I came across this recently when trying to assign an economic value to enchantments during tool repairing, and noticed these values don't seem to be obtainable under the current API.
2023-11-11 15:09:48 -05:00
Tamion
6675d13b31
Fix strikeLightningEffect powers lightning rods & clears copper (#9780)
* Fix strikeLightningEffect powers lightning rods and clears copper

* Fixed vanilla behavior break

* rebase

* revert spigot cleanup and remove setter

* better fix for behaviour break

* rebase and clean

* fix
2023-11-11 12:09:14 -08:00
Jake Potrebic
c95bc5f86d
Don't unpack loot table for TEs not in world (#9918)
Fixed by 23w44a/1.20.3
2023-11-11 11:23:12 -08:00
Shane Freeder
4675152f49
Don't leave the NearbyPlayers tracker in an entirely busted state on double-add detection 2023-11-05 22:15:38 +00:00
Jason Penilla
274e54ba58
Bump tiny-remapper for Java 21 support (#9902) 2023-11-04 20:33:04 -07:00
Layla Silbernberg / LadySilver47
8cafc07297
Added missing enchantables to material tags (#9888) 2023-11-05 00:37:51 +01:00
Tamion
e289accb03
Add more API to LingeringPotionSplashEvent (#9901)
* Add createAreaEffectCloud API

* Add missing NotNull

* Add missing Paper comments

* Better solution

* Better naming

* New patch and rename

* rename patch
2023-11-04 16:24:06 -07:00
NonSwag
2553f30153
fix secure profile with proxy online mode (#9700) 2023-11-05 00:12:47 +01:00
booky10
75d04e9b04
Broadcast take item packets with collector as source (#9884)
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
2023-11-04 15:16:55 -07:00
TonytheMacaroni
23860da6c2
Add predicate for block when raytracing (#9691)
* Add predicate for block data when raytracing blocks

* Match based on block, instead of block data

* Use instanceof instead of casting

* Use Position instead of Location, add overload for rayTraceEntities

* Implement requested changes

* Invert predicate

* Cleanup
2023-11-04 15:00:51 -07:00
TrollyLoki
8a3980c60b
Add API to get the collision shape of a block before it's placed (#9821)
* Add API to get the collision shape of a block before it's placed

* Tweak API documentation

* Clarify behavior

* Rebase

* Rebase
2023-11-04 16:32:10 -05:00
Jake Potrebic
0cdce89d59
Fix a bunch of stuff with player spawn locations (#9887)
If a playerdata doesn't contain a valid, loaded world, reset
to the main world spawn point
2023-11-04 14:11:55 -07:00
powercas_gamer
15a0de2eef
Make Team extend ForwardingAudience (#9852) 2023-11-04 21:50:56 +01:00
booky10
43c343228e
Add entity API for getting the combined gene of a Panda (#9891) 2023-11-04 21:28:23 +01:00
Tamion
bffb08c2f9
Deprecate Player#boostElytra (#9899)
The Paper method was chosen for deprecation because it was more
restrictive in that it has an isGliding check.
2023-11-04 13:20:13 -07:00
Jake Potrebic
6592fed511
Use a server impl for hopper event to track get/setItem calls (#9905)
* Use a server impl for hopper event to track getItem/setItem calls

* Rebase

* Comments
2023-11-04 12:58:40 -07:00
Warrior
aa6c4c11e5
Include packet class name in packet encoding error messages (#9907) 2023-11-04 12:34:34 -07:00
booky10
f78d7ce8ff
Remove "fix-curing-zombie-villager-discount" exploit option (#9895) 2023-11-04 20:20:01 +01:00
Lulu13022002
44057da467
Remove duplicate water-sensitivity damage for unaware mobs (#9908) 2023-11-04 12:10:27 -07:00
Warrior
230682d51b
Add raw iron & raw copper blocks to anti xray defaults (#7622) 2023-11-04 15:07:48 +00:00
TomTom
487109fddc
Readd 0414 use distance map to optimise entity tracker (#9868) 2023-11-03 14:05:57 +00:00
Nassim Jahnke
8493340be4 Add another slot sanity check 2023-11-03 14:49:55 +10:00
Md5Lukas
0b218903a8
Fix villager infection chance not being handled properly (#9897) 2023-11-01 14:59:00 -07:00
Jake Potrebic
1865625d95
Fix NPE when no valid world is found on legacy Players (#9885) 2023-10-29 15:33:32 +00:00
booky10
5bb30ce95b
Fix entity camera not being reset when cancelling spectating start/stop events (#9883) 2023-10-29 01:45:07 +01:00
Shane Freeder
3e4eaf2188
[ci skip] Fix module derp 2023-10-29 01:32:13 +01:00
Shane Freeder
415d7081d2
[ci skip] Fix author in last patch 2023-10-29 00:58:15 +01:00
Gero
a81a384303
Implement Velocity VarInt optimizations (#8418)
---------

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2023-10-28 19:56:47 -04:00
booky10
5bdfb29ba1
Add player idle duration API (#9833)
* Add player idle duration API

Implements API for getting, setting and resetting a player's idle duration.

* Remove idle duration setter

* Rebase
2023-10-28 19:25:46 -04:00
caramel
c6fac381ed
fix UnsafeValues#loadAdvancement doesn't recalculate position (#9846) 2023-10-28 16:13:33 -07:00
Kenox
8b1ac39e89
Fix warden spawn reason from DEFAULT to NATURAL (#8744) 2023-10-28 19:10:31 -04:00
caramel
52849f6da6
Cleanup disable explosion knockback patch (#9858) 2023-10-28 15:50:26 -07:00
Tamion
b1faa5d5f4
Fix PotionAPI ignores icon flag (#9864)
* fix PotionAPI ignores icon flag

* also fix CraftPotionUtil#toBukkit

* also CraftPotionUtil#fromBukkit

* use CraftPotionUtil
2023-10-28 15:39:47 -07:00
Warrior
b3cac042c1
Fix crash when version_history.json is empty (#9871) 2023-10-28 15:24:54 -07:00
SplotyCode
29350674b3
Fix null item in sendEquipmentChange (#9869) 2023-10-28 15:15:20 -07:00
Jake Potrebic
8cf2503804
Updated Upstream (Bukkit/CraftBukkit) (#9876)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
19830133 PR-925: Add hit entity/block to events extending ProjectileHitEvent

CraftBukkit Changes:
5a72c3c04 SPIGOT-7510: Try to fix broken reflection usage of plugins
6fa69f235 PR-1281: Add hit entity/block to events extending ProjectileHitEvent
224f733ac Fix NPE introduced in #f4d977e
2023-10-28 15:02:13 -07:00
Lulu13022002
996d529fb3
Resend entity using the bundle packet (#9853) 2023-10-27 15:48:13 +02:00
Jason Penilla
b974a6b6f3
Update paperweight to 1.5.9 (#9872) 2023-10-26 16:34:58 -07:00
Jake Potrebic
acc6d012b0
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9861) 2023-10-26 14:56:40 -07:00
Jason
c1ac98328c
Fix log level of advancement debug message (#9860) 2023-10-23 19:07:44 +02:00
Jake Potrebic
90fe0d58a5
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9825)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry
255b2aa1 SPIGOT-7080: Add World#locateNearestBiome
ff984826 Remove javadoc.io doc links

CraftBukkit Changes:
71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry
a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome
ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag
b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler
38c599f9d PR-1272: Only allow one entity in CraftItem instead of two
f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld

Spigot Changes:
e0e223fe Remove javadoc.io doc links
2023-10-22 20:12:00 +01:00
Shane Freeder
489bff9bbd
Temp fix for serialisable blockdata 2023-10-22 19:56:25 +01:00
MiniDigger | Martin
71a1787f6c
[ci skip] cleanup some ATs (#9840) 2023-10-21 17:17:55 -07:00
Lulu13022002
3a5c6f8cee
Fix NPE in SculkBloomEvent world access (#9857) 2023-10-21 13:20:24 -07:00
Brokkonaut
a3e4d1aa36
Don't check if we can see non-visible entities 2023-10-21 20:53:33 +01:00
Spottedleaf
4b0bc74c90 Initialise default nibble arrays in ChunkAccess directly
When ChunkAccess was converted to an abstract class some versions
ago, the code to initialise nibble arrays should have been moved.
However, the code was not moved and so now mods constructing their
own implementations of ChunkAccess would not have the nibble arrays
initialised.

This is ported to Paper from Starlight to keep the code base in sync,
not because it fixes anything known.
2023-10-16 18:57:45 -07:00
Spottedleaf
00331d943e Fix mushrooms not generating in swamps
During feature generation, light data is not initialised and
will always return 15 in Starlight. Vanilla can possibly return
0 if partially initialised, which allows some mushroom blocks to
generate.

In general, the brightness value from the light engine should not
be used until the chunk is ready. To emulate Vanilla behavior better,
we return 0 as the brightness during world gen unless the target
chunk is finished lighting.

The regular light retrieval outside of WorldGenRegion remains
the same, as behaviorally chunks not lit should be at max
skylight and zero block light.
2023-10-16 18:52:28 -07:00
Spottedleaf
2f4281e2b4 Remove unused skyLightSources
There is no point in initialising the sources in Starlight,
as we do not use them. Additionally, they are not saved to
disk so we do not need them.

Maintaining and initialising them is not a negligible cost,
which is why they are being removed.
2023-10-16 18:49:41 -07:00
caramel
e57af7d01e
sync netty version with vanilla (#9842) 2023-10-15 15:41:17 +01:00
caramel
44ee1cd05e
fix recipe packet limiter (#9841) 2023-10-15 15:11:15 +01:00
Md5Lukas
852c1c236d
Add additional tags to ItemMeta obfuscation filtering (#9665) 2023-10-14 23:41:15 +02:00
Md5Lukas
3e1c5e3eb0
Add BlockData setter for FallingBlock (#9829) 2023-10-14 22:46:31 +02:00
Jakub Zacek
e4d184f39d
Replace bukkit Consumers with java consumers (#9836) 2023-10-14 22:43:32 +02:00
froobynooby
3e9d2ac5f2
Don't call options events on login (#9834)
* Don't call options events on login

* Merge changes into client options API patch
2023-10-14 11:32:00 -07:00
SplotyCode
f613437019
Fix CraftPlayerProfile#setId regression (#9822) 2023-10-12 01:20:25 +00:00
Jake Potrebic
2f5bb7e306
add predicate recipe choice only for potion mixes (#9486) 2023-10-10 16:07:21 -07:00
Tamion
1a4778d260
Fix PlayerSwapHandItemsEvent NPE when a hand set to null (#9763)
* Fix PlayerSwapHandItemsEvent throwing exception when mainhand or offhand set to null

* use fully qualified import

* Use ItemStack#empty() instead of new ItemStack

* Add NotNull annotation to getters

* Add missing Paper comments
2023-10-10 15:38:25 -07:00
caramel
5509610db5
Fix UnsafeValues#loadAdvancement (#9753) 2023-10-10 15:19:00 -07:00
Jake Potrebic
7e5dd92f9f
fix flat bedrock world config (#9728) 2023-10-10 14:43:10 -07:00
TrollyLoki
69ce9276e4
Make setVelocity method of Fireballs change the travel direction to an arbitrary vector (#9815) 2023-10-10 23:09:45 +02:00
Xander de Keijzer
72f7945e77
Fix painting loosing art on face change (#9798) 2023-10-10 22:24:35 +02:00
Jake Potrebic
e87240b674
Fixes for loot tables (#9818) 2023-10-10 10:35:49 -07:00
Jason
a2ba45239c
Update paperweight to 1.5.8 (#9814) 2023-10-09 18:04:26 -07:00
Spottedleaf
99b735c1ac Make EntityLookup#get use read lock for entity maps
On Folia, this map is modified by multiple threads and iterating
it may throw errors, for example using the /kill command or any
other command that uses an entity selector.
2023-10-09 10:02:37 -07:00
Warrior
a702a083cd
Move clientBrandName over to ServerPlayer (#9809) 2023-10-08 12:07:48 +02:00
powercas_gamer
adb4fb4bd3
[ci skip] update mappings link (#9801) 2023-10-07 11:54:43 +02:00
Bjarne Koll
29a0209575
Properly check water block when random ticking ice (#9804)
Readds a lost update to the shared mutable state in the random block
ticking optimisation.
2023-10-06 21:34:00 +01:00
Jason
08c0b488b9
[ci skip] update paperweight to 1.5.7 & re-enable filterpatches (#9799) 2023-10-06 08:58:09 -07:00
Nassim Jahnke
cfe311d7a5
Fix item effects conversion if no tag is present
Fixes #9796
2023-10-05 16:03:26 +10:00
Nassim Jahnke
431e6418ab
Fixup player profile getters and constructor to expected nullability (#9770) 2023-10-05 05:31:24 +00:00
Warrior
02cfaa8ff8
Fix mobs not spawning when using an older config (#9793) 2023-10-04 10:08:47 -07:00
Shane Freeder
5eec4ec3bf
Quick tweaks to logical flow of getMapData 2023-10-04 16:25:26 +01:00
booky10
f36bb59739
Fix entity data not updated for firework attached to entity (#9783) 2023-10-03 18:29:44 -07:00
Jake Potrebic
6573d9555d
update configurate (#9230) 2023-10-03 18:06:23 -07:00
Nassim Jahnke
9d21a88218
Fix tests 2023-10-04 07:58:30 +10:00
Nassim Jahnke
bb1c0dd6fa
Implement tracking range y setting 2023-10-03 22:19:39 +10:00
Nassim Jahnke
f6969b6374
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
09b1c123 PR-916: Add more lightning API
c085f3de PR-859: Add Entity#getTrackedBy

CraftBukkit Changes:
1bf30a4e9 SPIGOT-7495: Spawning bee entity in asynchronous BlockPopulator causes IllegalStateException - Accessing LegacyRandomSource from multiple threads
476c5bccd PR-1267: Add more lightning API
40d5e6c02 PR-1190: Add Entity#getTrackedBy
40d41acc1 SPIGOT-7491: Downgrade bundled SQLite to be updated next release
44b31da38 PR-1264: Load Bukkit class before creating Registry item
dc45a6738 SPIGOT-7496: Failure to load datapacks with multiple identical predicates
f508657d6 Fix decompile error affecting javac
ef7a4743d PR-1265: Ensure UTF-8 used in new test resource

Spigot Changes:
224dad51 Rebuild patches
2023-10-03 22:00:24 +10:00
Lulu13022002
38376f43a0
Some jd fixes (#9781) 2023-10-01 00:20:51 +00:00
Nassim Jahnke
c4ba28a21a
Don't throw when removing unplaced player in NearbyPlayers 2023-09-30 15:37:00 +10:00
Nassim Jahnke
0f69290f07
[ci skip] Fix typo (important) 2023-09-29 13:20:32 +10:00
Nassim Jahnke
4cdbb0c86c
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
044d4ee9 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning
57b73d57 PR-913: Deprecate Projectile#doesBounce() and #setBounce()
43373c44 PR-904: Update FeatureFlag for 1.20.2
a7bbbf0c PR-911: Expand DataPack API with 1.20.2 pack version methods
0341e3a0 SPIGOT-7489: Add TeleportDuration to Display Entity
bcd8d2aa PR-912: Update Minecraft Wiki URLs

CraftBukkit Changes:
99aafc222 Increase outdated build delay
dab849f08 SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning
041b29ae3 Upgrade specialsource-maven-plugin
851a32cff PR-1263: Remove unused implementation of AbstractProjectile#doesBounce() and #setBounce()
251af0da3 PR-1261: Expand DataPack API with 1.20.2 pack version methods
46e4ba627 Upgrade specialsource-maven-plugin
df3738a24 SPIGOT-7489: Add TeleportDuration to Display Entity
8d0fea457 PR-1262: Update Minecraft Wiki URLs
e62905aab SPIGOT-7490: Fix entity equipment updates

Spigot Changes:
a0f3d486 Rebuild patches
2023-09-29 13:05:28 +10:00
Jake Potrebic
1765917a6f
Fix creating the reverse map for loot table keys (#9766) 2023-09-28 16:29:34 -07:00
Spottedleaf
fe54a13b13 Properly call overloaded super onDisconnect
Since the method is overloaded, the call to super (which is changed
to call the overloaded method) without the additional parameters
will result in recursion.
2023-09-26 13:16:24 -07:00
Spottedleaf
b3b961f9d5 Fire PlayerConnectionCloseEvent for configuration packet listener
If the player moves to the configuration stage, we also need
to fire the event.
2023-09-26 09:20:17 -07:00
Spottedleaf
c207429b21 Fix VoxelShape#isFullBlock() for non-single AABB types
The correct logic to implement NOT_SAME with Shapes#block()
is to test whether any shape data exists outside of [0.0, 1.0]
and to test whether the shape is completely filled from 0.0 to 1.0
on all axis. This can be implemented by checking whether the
bounds represent the full block and whether everything within
the bounds is filled.
2023-09-26 09:16:11 -07:00
Jake Potrebic
298c47857b
Fix tests that broke during the junit 5 update (#9757)
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2023-09-25 09:05:05 +10:00
Shane Freeder
3cf03fc31a
Fix/update wiki (#9758) 2023-09-25 09:02:46 +10:00
Shane Freeder
5cbce366b2 Handle new brand payload type 2023-09-24 19:48:29 +01:00
Warrior
5923b7d085
Fix missing map initialize event call & missing map id assignment (#9756) 2023-09-24 19:17:29 +01:00
Nassim Jahnke
e284bb1215
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fb23cbb3 Define surefire plugin version
d022084a Define ordering for MetadataStoreTest
99a7f6f0 PR-910: Match generic max absorption attribute name style with the rest
c7390d71 PR-909: Update tests to JUnit 5

CraftBukkit Changes:
f0661c351 PR-1230: Move unstructured PDC NBT serialisation to SNBT
452fcb599 PR-1256: Update tests to JUnit 5
2023-09-24 18:25:25 +10:00
Spottedleaf
7a00758b1b Rebuild patches 2023-09-23 23:41:38 -07:00
Spottedleaf
11138a770e Re-add remove streams for Brain AI patch 2023-09-23 23:40:49 -07:00
Spottedleaf
8b9e3dcd9e Optimise nearby player retrieval
Instead of searching/testing every player online on the server,
we can instead use the nearby player tracking system to reduce
the number of tests per search.
2023-09-23 23:40:49 -07:00
Nassim Jahnke
866d2d9f4a
Use correct ClientboundLevelChunkWithLightPacket constructor in later patch 2023-09-24 16:29:07 +10:00
Jake Potrebic
025c5d7a28
rebuild patches 2023-09-23 22:35:37 -07:00
Jake Potrebic
ea56138b30
Fix some issues 2023-09-23 22:33:49 -07:00
Spottedleaf
5dca26ce54 Fix race condition on UpgradeData.BlockFixers class init
The CHUNKY_FIXERS field is modified during the constructors
of the BlockFixers, but the code that uses CHUNKY_FIXERS does
not properly ensure that BlockFixers has been initialised before
using it, leading to a possible race condition where instances of
BlockFixers are accessed before they have initialised correctly.

We can force the class to initialise fully before accessing the
field by calling any method on the class, and for convenience
we use values().
2023-09-23 22:31:43 -07:00
Spottedleaf
84556f3cda Add lag compensation for breaking blocks 2023-09-23 22:31:42 -07:00
Spottedleaf
38dc3b25d8 Optimise chunk tick iteration
When per-player mob spawning is enabled we do not need to randomly
shuffle the chunk list. Additionally, we can use the NearbyPlayers
class to quickly retrieve nearby players instead of possible
searching all players on the server.
2023-09-23 22:31:00 -07:00
Nassim Jahnke
8d922746d9
Drop no longer needed patch 2023-09-24 13:09:52 +10:00
Nassim Jahnke
2ec643a53c
Readd anti xray and oversized block entity patches 2023-09-24 12:35:16 +10:00
Noah van der Aa
6be43952eb Migrate paper log ips option to new server.properties option 2023-09-23 23:21:21 +02:00
Jason Penilla
9624451ffd
Add missing kick event cause 2023-09-23 08:50:32 -07:00
Lulu13022002
b561a12078
Fix SuspiciousStewMeta 2023-09-23 16:41:51 +02:00
Lulu13022002
9c126fd2a9
fix test 2023-09-23 13:38:46 +02:00
Owen1212055
38b7565d9e
Remove Spigot Bug Fix for MC-109346 2023-09-23 01:51:40 -04:00
Owen1212055
8b512e3466
Support Paper ip address config + add missing logs 2023-09-23 01:50:13 -04:00
Nassim Jahnke
9df2066642
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
dfe1fb48 PR-906: Add missing MinecraftExperimental annotation to Bundles
825ab30d PR-905: Add missing MapCursor.Type and update documentation
e03d10e6 PR-903: Make BARRIER Waterlogged
1961ead6 PR-898: Use Java Consumer instead of Bukkit Consumer

CraftBukkit Changes:
f71a799f0 Make BARRIER Waterlogged
172f76a45 Upgrade specialsource-maven-plugin
f0702775c SPIGOT-7486: Alternate approach to null profile names
069495671 SPIGOT-7485: Allow air entity items since required for Vanilla logic
5dfd33dc2 SPIGOT-7484: Cancelling PlayerEditBookEvent does not update client's book contents
02d490788 PR-1250: Standardize and centralize Bukkit / Minecraft registry conversion
9024a09b9 PR-1251: Use Java Consumer instead of Bukkit Consumer
6d4b25bf1 Increase diff stability
2023-09-23 12:21:59 +10:00
Nassim Jahnke
4c17176c77
Update foojay resolver convention plugin 2023-09-23 11:46:31 +10:00
Nassim Jahnke
a353f4d207
Readd network optimization patch 2023-09-23 11:45:34 +10:00
Spottedleaf
a50d7c340b Make sure to maintain the players sent to set for ChunkHolder
Required for proper block/light updates to clients
2023-09-22 17:07:02 -07:00
Nassim Jahnke
02807238c4
Fix chat processing 2023-09-23 09:58:19 +10:00
Nassim Jahnke
d23c4a50e6
Fix local attribute setting 2023-09-23 09:42:59 +10:00
Nassim Jahnke
b3ec8bd8ae
Revert "re-add distance map patch"
This reverts commit 81c5901c67.
2023-09-23 09:38:10 +10:00
Jake Potrebic
81c5901c67
re-add distance map patch 2023-09-22 16:26:10 -07:00
Jake Potrebic
47aeab84ad
fixup display slots patch (#9746) 2023-09-22 16:07:33 -07:00
Jake Potrebic
915bb9220e
Fixup advancement patch (#9745) 2023-09-22 16:03:34 -07:00
Spottedleaf
6af97e11b6 Port patches from folia dev/optimisations 2023-09-22 15:56:00 -07:00
Spottedleaf
d259503c92 Fix recursion with pathfind entity event
With the function overload, need to pass the entity
through to the super call
2023-09-22 15:39:00 -07:00
Spottedleaf
ea01aa335a Add some patches, fix compile 2023-09-22 15:33:14 -07:00
Spottedleaf
e88856dd75 Chunk system patch 2023-09-22 13:13:57 -07:00
Jason Penilla
896aa8b54a
Rebuild patches 2023-09-22 10:59:56 -07:00
Jason Penilla
ead3ddba32
Move unapplied patches so ATs import 2023-09-22 10:57:45 -07:00
MiniDigger | Martin
603c33df06 some more compile fixes 2023-09-22 19:43:52 +02:00
MiniDigger | Martin
1ebaffacf5 some compile fixes 2023-09-22 19:31:02 +02:00
Noah van der Aa
f4d8a64094 more more more more more more more more more more more work: passing the torch 2023-09-22 19:26:54 +02:00
Lulu13022002
63a1b0c137
some compile issues 2023-09-22 19:25:18 +02:00
Lulu13022002
a91e19f1df
more work
all server patches done (almost)
2023-09-22 18:59:52 +02:00
Lulu13022002
8baf510f92
some work 2023-09-22 18:11:35 +02:00
Noah van der Aa
ac7e4ad35e
more more more more more more more more more more more work: passing the torch 2023-09-22 17:51:48 +02:00
Noah van der Aa
3aa8e7ef3f
more more more more more more more more more more work 2023-09-22 17:35:51 +02:00
Noah van der Aa
4875ee4814
more more more more more more more more more work 2023-09-22 17:24:59 +02:00
Noah van der Aa
32d9c6684b
more more more more more more more more work 2023-09-22 17:08:04 +02:00
Noah van der Aa
772fb3e385
more more more more more more more work
can't let lynx inflate his commit count too much
2023-09-22 16:59:18 +02:00
Bjarne Koll
2617c927a0
More work work work work work work work work work 2023-09-22 16:42:56 +02:00
Bjarne Koll
e5bd562d28
Work here, work there, work for everyone 2023-09-22 16:35:40 +02:00
Bjarne Koll
452009bbde
Working hard on messing with leafs patches 2023-09-22 16:20:09 +02:00
Bjarne Koll
574bc968d3
More work 2023-09-22 15:47:26 +02:00
Bjarne Koll
95a31de306
More work work work 2023-09-22 15:33:37 +02:00
Bjarne Koll
af1090259a
Fix PaperAdvancementDisplay 2023-09-22 15:19:33 +02:00
Bjarne Koll
74094edf08
More more more (more ??) more work 2023-09-22 15:15:57 +02:00
Bjarne Koll
662b6c5ca8
Port sidebar slots patch 2023-09-22 14:33:54 +02:00
Bjarne Koll
79fef73926
More work work work 2023-09-22 14:22:24 +02:00
Bjarne Koll
00d82983bd
Missing paper comment 2023-09-22 13:42:04 +02:00
Bjarne Koll
2cb3a1a3dc
Fix leave message in common packet listener 2023-09-22 13:39:00 +02:00
Noah van der Aa
fc84aee124
more more more more more more work 2023-09-22 09:24:44 +02:00
Jake Potrebic
2cee84193c
and some more 2023-09-21 22:41:27 -07:00
Jake Potrebic
a62835bbb1
almost halfway done with server patches 2023-09-21 21:40:51 -07:00
Jake Potrebic
24fd5aea0c
and some more patches 2023-09-21 21:05:18 -07:00
Jake Potrebic
2bc818efd4
some more patches 2023-09-21 20:29:51 -07:00
Jake Potrebic
78a003ee89
work and compile errors 2023-09-21 20:17:35 -07:00
Jake Potrebic
7b29d1f4c5
even more work 2023-09-21 19:17:21 -07:00
Jake Potrebic
ef6a41195d
some more work 2023-09-21 15:26:51 -07:00
Jake Potrebic
a27262375c
some work 2023-09-21 15:01:00 -07:00
Noah van der Aa
c60dd35989
more more more more more work 2023-09-21 23:09:04 +02:00
Noah van der Aa
7ebfdd5e6d
more more more more work 2023-09-21 22:35:39 +02:00
Noah van der Aa
91671751e7
more more more work 2023-09-21 22:14:58 +02:00
Noah van der Aa
20253f478f
more more work 2023-09-21 21:54:46 +02:00
Noah van der Aa
2b72b74a36
more work 2023-09-21 21:00:11 +02:00
Noah van der Aa
b6e46e90cd
rebuild old indexes, first work 2023-09-21 19:39:51 +02:00
Noah van der Aa
6267e26420
So it begins... 2023-09-21 19:18:04 +02:00
Jake Potrebic
773dd72446
Updated Upstream (Bukkit/CraftBukkit) (#9739)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
69c7ce23 PR-990: Use Mockito instead of InvocationHandler for test mocking
997de31d PR-893: Add a stream method to Registry to make it easier to use and to avoid unnecessary wrapping
6a8ce581 Fix malformed javadoc in previous commit
26c74f6d PR-890: Add more Sculk API (bloom, shriek, bloom event)
aa067abf PR-895: Load GameEvent and MusicInstrument from registry

CraftBukkit Changes:
78796c9de Add support for Java 21
ddc9a2dad SPIGOT-7475: Don't fire SculkBloomEvent during world generation
caee2311a PR-1245: Add a stream method to Registry to make it easier to use and to avoid unnecessary wrapping
de421cf56 PR-1242: Add more Sculk API (bloom, shriek, bloom event)
00f5a80fb PR-1252: Fix error when generating a tree in water
10219df3a PR-1248: Load GameEvent and MusicInstrument from registry
2023-09-21 18:48:55 +02:00
Lulu13022002
3fd1502717
Add missing deprecation (#8886) 2023-09-21 10:35:38 +02:00
Jake Potrebic
1b1c23010a
Add missing InventoryHolders to inventories (#7400) 2023-09-17 19:16:48 -07:00
The456
581b683931
Fix spigot's Forced-Stats (#9663) 2023-09-17 03:27:56 +02:00
Warrior
a856073368
Fix two beacon bugs (#9675) 2023-09-16 17:36:10 -07:00
Jake Potrebic
ba0e1f54b9
Fix sapling observer detection and grow event (#9654) 2023-09-16 16:53:21 -07:00
Jake Potrebic
3cec9c985f
[ci skip] Add missing javadoc links (#9497) 2023-09-17 01:35:39 +02:00
Lulu13022002
d8af99a82c
Fix silent equipment change for mobs (#9677)
* Fix silent equipment change for mobs

* rebased and added test to make sure all overrides are added

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2023-09-16 16:27:11 -07:00
SoSeDiK
064fb50cc1
Cleanup old async commands patch (#8895) 2023-09-17 00:54:33 +02:00
Warrior
06a741d713
Fix leashed pets teleporting to owner when loaded (#9686) 2023-09-16 15:16:44 -07:00
Warrior
e312ebb1bd
Add DISPLAY tracking range type (#9668) 2023-09-17 00:02:58 +02:00
Warrior
ede9c06814
Fix Projectile#setOwner(null) not clearing owner (#9715)
* Fix Projectile#setOwner(null) not clearing owner

* rebased and merged into mentioned patch

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2023-09-16 14:37:38 -07:00
thelooter
0c8e84c20d
Enforce sign line nullability when setting line with Adventure Method (#9689) 2023-09-16 23:18:51 +02:00
Aeltumn
deb92c2129
Add ItemStack#isEmpty and related methods (#9664)
* Add new patches

* Change from an EMPTY static var to a static method since ItemStack is mutable

* Properly set nullability of return value

* Move annotation changes to different patch

* Send the Kotlin code back to where it came from

* rebased

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2023-09-16 14:18:09 -07:00
MiniDigger | Martin
83cfeb1b37
Improve java version check (#9692) 2023-09-16 23:06:36 +02:00
Jake Potrebic
99b311de54
[ci skip] Clarify where furnace-related events are called (#8753) 2023-09-16 13:55:40 -07:00
Jake Potrebic
eb60bffa98
Create raw chat type as resource file instead of in source (#9226)
Sets up the ability to load new or modified resource files into Paper.

Updates paperweight to 1.5.6

This should work with all run configs, like runDev, runShadow, runReobf as well as correctly build jars for production.
2023-09-15 11:03:42 -07:00
Warrior
29d1c7b602
Call BlockRedstoneEvents for lecterns (#9721) 2023-09-14 23:17:53 +02:00
leguan
7145f41b6e
compression level change with config option (#9711) 2023-09-14 13:11:19 +02:00
TreemanKing
6378792a99
Add Barrel to LootableBlockInventory (#9687) 2023-09-14 13:04:36 +02:00
Duckulus
e68fd7162a
Add missing Piglin Dancing API (#8894) 2023-09-14 12:54:43 +02:00
Lulu13022002
eea0c649ca
Swap some nullable annotations (#9696) 2023-09-14 12:44:12 +02:00
Warrior
1c15111f08
Add missing particle javadocs (#9716) 2023-09-14 12:09:09 +10:00
Nassim Jahnke
517f8fbbac
Fix line of sight distance check 2023-09-12 09:56:24 +10:00
Spottedleaf
fb06829845 Optimise multiple block updates occurring in the same chunk
We can avoid multiple ticket additions for the same ChunkTasks
instance. This will help in situations where significant number of
block updates occur for the same chunk in the same tick, such as
water draining.
2023-09-11 07:15:18 -07:00
violetc
c9cd94f3c6
Fix fixItemsMergingThroughWalls check (#9707) 2023-09-11 14:46:02 +10:00
Nassim Jahnke
e2b197132d
Add missing slot sanity checks for container clicks 2023-09-11 12:03:35 +10:00
Nassim Jahnke
72e87abc2d
Strip raytracing for EntityLiving#hasLineOfSight
Co-authored-by: Paul Sauve <paul@technove.co>
2023-09-10 12:28:03 +10:00
Joe
33bec7f20a Copy NBT in legacy dragon fight converter 2023-09-06 18:33:31 -07:00
Joe
471f4de9c4 Copy NBT in upgrade data neighbor ticks 2023-09-06 18:30:02 -07:00
Lulu13022002
39953cf08d
Take in account waterlogged blocks for scaffolding (#9676) 2023-09-04 17:52:27 +02:00
Md5Lukas
b4e3b3d1dd
Allow non-op players to execute the click event callback (#9652) 2023-08-28 13:21:13 +02:00
Noah van der Aa
b8edb0e130
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9648)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6b34da8f SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender

CraftBukkit Changes:
db4ba2897 SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender
4f7ff4dec PR-1246: Add missing AbstractTestingBase to tests which need them
f70a7b68d SPIGOT-7465, MC-264979: Fresh installations print NoSuchFileException for server.properties
8ef7afef6 PR-1240: Call BlockGrowEvent for vines that are growing on additional sides of an existing vine block

Spigot Changes:
d2eba2c8 Rebuild patches
2023-08-28 13:05:48 +02:00
Martijn
0c0a480d82
Do crystal-portal proximity check before entity lookup (#9611) 2023-08-26 13:23:31 -07:00
Lulu13022002
0e622c79fa
Add sniffer egg api (#9288) 2023-08-26 22:12:46 +02:00
Jake Potrebic
7d13b7066c
Add titleOverride to InventoryOpenEvent (#7540) 2023-08-26 12:28:42 -07:00
Jake Potrebic
6813244fb0
Fix/improve destroy speed API (#9645)
further improvements could be a method that takes in an entity
to account for effects
2023-08-25 10:57:11 -07:00
7c36d82b47 Fix player chunk loader initialization
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-08-25 19:17:10 +02:00
Nassim Jahnke
6f30f08b20 Readd old BlockDamageEvent constructor 2023-08-25 10:19:55 +10:00
Jake Potrebic
e552bebca1
Fix inventory desync (#9640) 2023-08-24 16:53:02 -07:00
Aeltumn
0c8882f7f9
Add OfflinePlayer#isConnected (#9642) 2023-08-24 21:44:31 +10:00
Jake Potrebic
b45ecc93c1
[ci skip] clear out test plugin 2023-08-23 10:05:08 -07:00
Jake Potrebic
b8a0049207
Fix exact choice recipe book clicks (#7822) 2023-08-23 08:20:32 -07:00
Warrior
7a1863ed78
Limit setBurnTime to valid short values (#9623) 2023-08-23 20:54:34 +10:00
Jake Potrebic
a751001ed1
[ci skip] Refactor context records for easier expansion (#9589) 2023-08-23 13:34:57 +10:00
Martijn
fcc5f232f9
Optimize nearest structure border iteration (#9638) 2023-08-23 11:53:42 +10:00
The456
9cbad8ebbf
Expose Hand during BlockCanBuildEvent (#9636) 2023-08-23 10:41:30 +10:00
Bjarne Koll
3716832282
Prevent overfilled bundles from duplicating items (#9633)
Bundles compute the amount to remove from an item based on the formula
(64 - currentWeight) / itemWeight. An overfilled bundle however, with a
currentWeight of > 64 ends up with a negative removal amount for the
item.

This can cause duplication issues on craftbukkit inventory
implementations as they do currently not gracefully handle negative
removal amounts in their remove methods.
2023-08-22 11:57:44 +02:00
Lulu13022002
a712766995
Allow custom damage for trident (#8132) 2023-08-22 16:20:38 +10:00
Lulu13022002
7386a13642
Fix endgateway teleportation offset (#9517) 2023-08-22 16:03:15 +10:00
Jake Potrebic
9395aa6079
Improve performance of mass crafts (#9603) 2023-08-22 15:54:28 +10:00
Rodney
0c7385b569
Add PlayerPickItemEvent (#5590) 2023-08-22 15:22:05 +10:00
SoSeDiK
27d39cac4f
Properly clone custom nbt tags inside ItemMeta (#7849) 2023-08-22 14:59:31 +10:00
Jake Potrebic
fed9042390
More DragonBattle API (#5655) 2023-08-22 14:08:43 +10:00
Joo200
e3f29f4345
MerchantRecipe: add copy constructor (#8703) 2023-08-22 13:48:25 +10:00
aerulion
b29ecd4c22
Expose clicked BlockFace during BlockDamageEvent (#9632) 2023-08-22 13:07:18 +10:00
SoSeDiK
2be57c6943
Expand Pose API (#8781) 2023-08-22 13:05:47 +10:00
caramel
97b9c4a2a4
Fix NPE on Boat#getStatus (#9115) 2023-08-22 12:57:54 +10:00
Jake Potrebic
35ef0537be
[ci skip] update editorconfig and gitattributes (#9608) 2023-08-22 12:16:03 +10:00
Bjarne Koll
281855c877
Remove unused lag-compensate-block-breaking option (#9635)
Removes the unused lag-compensate-block-breaking option from the paper
configuration file as the patch using it has been dropped in 1.19.
2023-08-21 22:08:25 +10:00
Nassim Jahnke
af6142eab3 [ci skip] Update Gradle wrapper 2023-08-21 19:16:46 +10:00
Corey Shupe
00a68b1efe
Player listing API (#8782) 2023-08-21 18:51:31 +10:00
ruViolence
7232506c22
Add entity tracker min Y distance config option (#9406) 2023-08-21 18:05:49 +10:00
Jake Potrebic
1b96c64620
Improve cancelling PreCreatureSpawnEvent with per player mob spawns (#9400) 2023-08-21 17:44:47 +10:00
Yannick Lamprecht
5bf82aa136
Add cancellability to PlayerTrackEntityEvent (#8605) 2023-08-21 17:38:55 +10:00
TonytheMacaroni
88891c37b1
Add Entity Coordinate and Rotation API (#9461) 2023-08-21 17:35:05 +10:00
Will FP
1259b93ba6
Fixed CraftItemStack/CraftItemMeta enchantment level inconsistency (#8792)
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2023-08-21 17:31:52 +10:00
Trevor Bedson
990765bd08
Fire entity death event for ender dragon (#9495) 2023-08-21 17:06:21 +10:00
Nassim Jahnke
45ba65283f [ci skip] Rebuild patches 2023-08-21 14:51:19 +10:00
Gero
f43a19c275
Fix CME in CraftPersistentDataTypeRegistry (#6701) 2023-08-21 14:50:21 +10:00
EpicPlayerA10
d928dda91d
Don't tab-complete namespaced commands if send-namespaced is false (#9366) 2023-08-21 14:50:11 +10:00
galacticwarrior9
bd67b83fd0
Determine lava and water fluid explosion resistance by their block explosion resistance (#9482) 2023-08-21 14:50:02 +10:00
Gameoholic
ed8401c748
Fix rotation for spawning display entities (#9552) 2023-08-21 14:49:53 +10:00
EpicPlayerA10
5b34a09ed0
Add option to disable chorus plant and mushroom block updates (#9442) 2023-08-21 14:49:38 +10:00
Md5Lukas
67a1a8caf8
Fix Inventory#getLocation not working for the composter (#9596) 2023-08-21 14:49:29 +10:00
Jake Potrebic
d12916255a
Properly handle BlockBreakEvent#isDropItems (#8936)
Setting whether a block break dropped items controlled
far more than just whether blocks dropped, like stat increases
food consumption, turtle egg count decreases, ice to water
conversions and beehive releases
2023-08-20 20:49:20 -07:00
Jake Potrebic
666a2147a7
[ci skip] rebuild patches 2023-08-20 14:28:49 -07:00
Jake Potrebic
2bd6ba2c63
Deprecate and replace methods using deprecated StructureType (#8643) 2023-08-20 10:30:45 -07:00
Jake Potrebic
fd4f0c7741
API for an entity's scoreboard name (#9462)
Was obtainable through different methods, but you had to use different
methods depending on the implementation of Entity you were working with.
2023-08-20 09:06:09 -07:00
c903985792 Fix patch order
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2023-08-19 10:42:16 +02:00
b1fab7dde9 Merge remote-tracking branch 'upstream/master' 2023-08-19 10:39:07 +02:00
Nassim Jahnke
eb8f2bb2a1 Fix unknown entity interaction clicked position getter if null 2023-08-19 12:01:06 +10:00
Martijn
307d05bba8
Count down radius-aware dependency tree node parents (#9600) 2023-08-18 12:02:20 +10:00
Jamie
ea1f33cf9a
Delete patch to fix PaperMC/Paper#9612 (#9621) 2023-08-17 15:51:34 -05:00
Nassim Jahnke
73af2d4cea
Add clicked position to PlayerUseUnknownEntityEvent (#9604) 2023-08-16 17:58:07 +10:00
Bjarne Koll
47b805fdf1
Don't let player loot if reloot time is disabled (#9615)
If the reloot time is disabled while reloot is restricted, the player
should not be able to reloot. The previous logic was incorrect and
allowed players to reloot explicitly when the reloot time was disabled.
2023-08-15 21:08:00 -07:00
Warrior
6520ca1c47
Fix main thread priority being lowered (#9488) 2023-08-15 19:37:17 +02:00
Jake Potrebic
a73ed9572e
Updated Upstream (CraftBukkit/Spigot) (#9598)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
b76ceb4f5 PR-1235: Move EntityType return to base Entity class
e795d7490 SPIGOT-7458: Exception when Entity CommandSender executes Vanilla command
46c7fc3b1 SPIGOT-7452: Player#openSign cannot edit
d91e5aa0b SPIGOT-7447: Rewrite --forceUpgrade to minimise diff and properly handle CraftBukkit world layout
921ae06d6 Revert "SPIGOT-7447: Fix --forceUpgrade"

Spigot Changes:
94e187b5 Rebuild patches
3bce7935 SPIGOT-7091: Update bungeecord-chat
2023-08-13 16:32:51 -07:00
Jake Potrebic
93829bba5a
Account for dimension type in portal void damage check (#9602) 2023-08-13 13:30:48 -07:00
Nassim Jahnke
23c44c2b8d [ci skip] Update README 2023-08-13 10:36:26 +10:00
Warrior
02338e5069
Fix DEFAULT getEntitySpawnReason for /summon (#9480) 2023-08-13 01:57:13 +02:00
Nacioszeczek
1dfdbef42b
SculkCatalyst bloom API (#9466) 2023-08-13 01:31:32 +02:00
Jake Potrebic
2df309bd49
Bandaid fix for Effect (#9548)
Effect or LevelEvent needs to be replaced
but ideally after the enum PR has been merged
upstream. Until then, this test and these fixes
should address all the known issues with them
2023-08-12 15:19:34 -07:00
Noah van der Aa
29aaf7bc24
Fix custom statistic criteria creation (#9595) 2023-08-12 23:50:21 +02:00
Jake Potrebic
20a71c58d3
Add restrict-player-reloot-time config (#7652) 2023-08-12 14:26:47 -07:00
montlikadani
3b4839ee32
Fix players are invisible after using setPlayerProfile (#9143)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2023-08-12 16:10:09 +02:00
Warrior
3c41f8f0b3
Cache map ids on item frames (#9584) 2023-08-12 23:33:24 +10:00
Warrior
9bc70e6888
Make the cursor limit option apply to banners (#9554) 2023-08-10 15:22:40 +02:00
Spottedleaf
4179b8f3fa Remove UpgradeData neighbour ticks outside of range
The lists are only supposed to contain ticks for the 1 radius
neighbours of the chunk.
2023-08-09 14:05:57 -07:00
Florian Schmidt
98c567fe6f
Use correct seed on api world load (#9541) 2023-08-08 16:35:15 -07:00
Warrior
a2002a76b8
Fix wild wolves not considering bones interesting (#9579) 2023-08-08 16:15:01 -07:00
Jake Potrebic
93cf3eb832
Respect randomizeData on more entities when spawning (#9483) 2023-08-08 16:07:59 -07:00
Warrior
9ffccd6430
Use correct source for mushroom block spread event (#9587) 2023-08-08 15:51:58 -07:00
Nassim Jahnke
408a9050ba Don't put entities removed during the portal exit event into an invalid state 2023-08-08 17:48:55 +10:00
Nassim Jahnke
ef2b574c6a Clone location in PlayerFailMoveEvent getters 2023-08-08 13:00:17 +10:00
Moulberry
5274ad672b
Add and implement PlayerFailMoveEvent (#9535) 2023-08-08 12:51:09 +10:00
Jake Potrebic
d6d2b6f4e5
Only capture actual tree growth (#6464) 2023-08-05 19:33:18 -07:00
Phillipp Glanz
8fe8ca6658
Add clickable version on version command (#9347)
Co-authored-by: Yannick Lamprecht <1420893+yannicklamprecht@users.noreply.github.com>
2023-08-06 03:26:13 +02:00
Jake Potrebic
31358d5e48
API for updating recipes on clients (#6463) 2023-08-05 18:11:22 -07:00
Bjarne Koll
508a295b44
Only erase allay memory on non-item targets (#9570)
* Only erase allay memory on non-item targets

Spigot incorrectly instanceOf checks the EntityTargetEvent#getTarget
against the internal ItemEntity type and removes the nearest wanted item
memory if said instanceOf check fails, (which is always the case)
causing allays to behave differently as they constantly loose their
target item.

This commit fixes the faulty behaviour by instance performing a check
against the CraftItem type.

* Reduce diff

* fix typo

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2023-08-05 17:31:10 -07:00
Jake Potrebic
2fa8efce9b
Updated Upstream (Bukkit/CraftBukkit) (#9485)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
82af5dc6 SPIGOT-7396: Add PlayerSignOpenEvent
3f0281ca SPIGOT-7063, PR-763: Add DragonBattle#initiateRespawn with custom EnderCrystals
f83c8df4 PR-873: Add PlayerRecipeBookClickEvent
14560d39 SPIGOT-7435: Add TeleportCause#EXIT_BED
2cc6db92 SPIGOT-7422, PR-887: Add API to set sherds on decorated pots
36022f02 PR-883: Add ItemFactory#getSpawnEgg
12eb5c46 PR-881: Update Scoreboard Javadocs, remove explicit exception throwing
f6d8d44a PR-882: Add modern time API methods to ban API
21a7b710 Upgrade some Maven plugins to reduce warnings
11fd1225 PR-886: Deprecate the SmithingRecipe constructor as it now does nothing
dbd1761d SPIGOT-7406: Improve documentation for getDragonBattle

CraftBukkit Changes:
d548daac2 SPIGOT-7446: BlockState#update not updating a spawner's type to null
70e0bc050 SPIGOT-7447: Fix --forceUpgrade
6752f1d63 SPIGOT-7396: Add PlayerSignOpenEvent
847b4cad5 SPIGOT-7063, PR-1071: Add DragonBattle#initiateRespawn with custom EnderCrystals
c335a555f PR-1212: Add PlayerRecipeBookClickEvent
4be756ecb SPIGOT-7445: Fix opening smithing inventory
db70bd6ed SPIGOT-7441: Fix issue placing certain items in creative/op
f7fa6d993 SPIGOT-7435: Add TeleportCause#EXIT_BED
b435e8e8d SPIGOT-7349: Player#setDisplayName not working when message/format unmodified
a2fafdd1d PR-1232: Re-add fix for player rotation
7cf863de1 PR-1233: Remove some old MC bug fixes now fixed in vanilla
08ec344ad Fix ChunkGenerator#generateCaves never being called
5daeb502a SPIGOT-7422, PR-1228: Add API to set sherds on decorated pots
52faa6b32 PR-1224: Add ItemFactory#getSpawnEgg
01cae71b7 SPIGOT-7429: Fix LEFT_CLICK_AIR not working for passable entities and spectators
a94277a18 PR-1223: Remove non-existent scoreboard display name/prefix/suffix limits
36b107660 PR-1225: Add modern time API methods to ban API
59ead25bc Upgrade some Maven plugins to reduce warnings
202fc5c4e Increase outdated build delay
ce545de57 SPIGOT-7398: TextDisplay#setInterpolationDuration incorrectly updates the line width

Spigot Changes:
b41c46db Rebuild patches
3374045a SPIGOT-7431: Fix EntityMountEvent returning opposite entities
0ca4eb66 Rebuild patches
2023-08-05 17:21:59 -07:00
Gameoholic
69a801305d
[ci skip] Fix inventorycloseevent javadocs (#9533)
* Add InventoryCloseEvent safety doc comment, similar to InventoryClickEvent

* Fix inventorycloseevent javadocs

* Fix InventoryCloseEvent and InventoryClickEvent javadocs

* remove extra +

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2023-08-05 12:58:38 -07:00
Jake Potrebic
2c55dd86ff
Expand use of strict advancement dim check (#9545) 2023-08-05 12:26:28 -07:00
Emily
13c9d3c423
Bump net.kyori:ansi to 1.0.3 (#9575) 2023-08-04 14:54:25 -07:00
Jake Potrebic
81619a652e
Fix treasure map config default (#9572) 2023-08-04 08:52:22 -07:00
Emilia Kond
f402f89a67
Bump net.kyori.ansi to 1.0.2 (#9546) 2023-07-29 12:59:46 +10:00
Jake Potrebic
6c7e3c5193
[ci skip] Clarify viewers set mutability in chat events (#9525) 2023-07-28 15:14:19 -07:00
Jake Potrebic
7d1cc6d409
Add Translatable interface to MusicInstrument (#9538) 2023-07-28 15:06:27 -07:00
Jake Potrebic
a40e48f3fd
Add cause to PlayerOpenSignEvent (#9441)
Also fire the event for plugin-opened signs
2023-07-26 17:25:14 +01:00
Spottedleaf
1837f6c677 Prevent entity removals if the entity slices is receiving status updates
If an entity is removed while updating an entity slice, then the
iteration over the entity slice's entities could throw a cryptic
exception. Instead, it is better to prevent the entity removal
with a useful log message.

Fixes https://github.com/PaperMC/Paper/issues/9464
2023-07-25 07:21:45 -07:00
Owen
b14979e352
Remove isRemoved skip on .discard() (#9520) 2023-07-24 19:04:40 +10:00
powercas_gamer
aa93dcfdce
feat: add minimessage tag resolvers overload to CommandSender#sendMessage (#9505) 2023-07-23 01:46:40 -04:00
Sage
42830546f3
Add player whitelist events (#9209) 2023-07-23 00:38:53 -04:00
JLitewski
e19177a2c3
Rewrote Amethyst logic to throw both BlockGrowEvent and BlockSpreadEvent (#9217)
With this patch, it is now possible to further control what plugins can do with Amethyst Blocks.
You can prevent Budding Amethyst blocks from creating shards with the BlockSreadEvent, and
when shards grow, it can be prevented with BlockGrowEvent
2023-07-22 23:54:02 -04:00
Jake Potrebic
2c54b3949f
Don't support hex in book title and author (#9493) 2023-07-22 23:40:52 -04:00
Astralchroma
d8b8f61961
Configurable Region Compression Format (#8505) 2023-07-22 20:13:48 -04:00
Owen
383f0ed924
Remove sign ticking (#9478)
Minecraft now ticks signs in order to validate the playerWhoMayEdit field. This is a horrible idea, as this means that even waxed signs are ticked for essentially no reason. This moves the logic lazily onto the getter.
2023-07-22 17:00:50 -04:00
Jake Potrebic
24d690fe7e
Fix hopper not marking source inv as changed (#9070) 2023-07-22 13:48:23 -07:00
Golfing7
46a36d3b28
Make ExperienceOrb entities call EntitySpawnEvent (#9197) 2023-07-22 16:19:50 -04:00
Roman Alexander
2f8d9db58c
Pathfinder hasPath should check if path is done. (#9231) 2023-07-22 16:04:19 -04:00
Infynyty
b1334b5105
Mark Player.sendSignChange as deprecated (#9382) 2023-07-22 21:38:40 +02:00
Jake Potrebic
c016e039a5
Fix unbreakable flint and steel consumed when igniting creepers (#9509) 2023-07-19 09:16:39 -07:00
Bjarne Koll
40adc2345b
[ci skip] Fix incorrect javadoc in JarLibrary (#9513) 2023-07-19 12:51:58 +01:00
Moulberry
c793bd93be
Allow LEFT_CLICK_AIR in 3.0->4.5 range of entity (#9211) 2023-07-16 17:58:25 +02:00
Jake Potrebic
b533905cc3
fix 2 vanilla issues (#8940)
Fix sheeps eating grass outside ticking chunks
Fix itemframe drops dropping in correct location

Co-authored-by: BillyGalbreath <blake.galbreath@gmail.com>
2023-07-15 16:28:28 -04:00
Jason
fe780d041e
Add back accidentally dropped Wandering Trader patch (#9492) 2023-07-14 16:23:33 -07:00
Jake Potrebic
de3f149185
Fix possible NPE on painting creation (#9391) 2023-07-13 17:22:15 -07:00
Jake Potrebic
22ed60c101
Fix BanList API (#9450) 2023-07-13 14:43:45 -07:00
Jake Potrebic
aefb73c234
Add Owner UUID api for AreaEffectCloud (#9364) 2023-07-13 17:26:42 -04:00
Owen
ece4fd3597
Suppress Item Meta Validation Checks (#9331)
Stops item meta from aggressively throwing exceptions.
2023-07-13 16:59:49 -04:00
Jake Potrebic
836586d59b
Fix missing item types in SlotType for armor change event (#9379)
Also added 2 parameterized tests to make sure this doesn't happen
again.
2023-07-13 13:09:26 -07:00
Owen
92bc19b049
Fix missing item interaction cancelling case (#9427)
Properly cancels brushes now
2023-07-13 15:48:46 -04:00
Lulu13022002
1f8ca77bb6
Prevent desync for poi and pistons (#9270) 2023-07-13 15:22:05 -04:00
Jake Potrebic
a60eeb85f5
Fix mob breaking doors not spawning particles (#9443)
This is a vanilla issue reported as MC-263999
2023-07-13 12:11:27 -07:00
Pedro
a3c760e6af
Handle block state in EntityDamageByBlockEvent (#9396) 2023-07-12 12:12:12 -07:00
Nassim Jahnke
f9473d9928
[ci skip] Add gradle wrapper validation action 2023-07-11 23:25:02 +02:00
Jake Potrebic
b3dc7a3b4b
fix item meta for tadpole buckets (#9473) 2023-07-11 11:52:11 -07:00
chickeneer
805fdd83b3
Add deprecations to SignSide string methods (#9467) 2023-07-11 09:58:08 -07:00
Warrior
6b325cd6a9
Array backed synched entity data (#9460) 2023-07-10 15:27:50 +02:00
Jake Potrebic
5de0f8ac48
Add Sign#getInteractableSideFor (#9388) 2023-07-08 11:04:19 +02:00
Jake Potrebic
e105354330
Fix incorrect new blockdata in EntityChangeBlockEvent (#9445)
Also fixes EntityBreakDoorEvent not having the correct 'to' block data

Also standardizes how to handle EntityChangeBlockEvent before a removeBlock or destroyBlock
call. Always use 'state.getFluidState().createLegacyBlock()' to get the new state instead of
just using the 'air' state.
2023-07-07 10:25:36 -07:00
Jake Potrebic
d7d3f6371e
[ci skip] Use Nullable annotation for Entity source (#9435) 2023-07-06 20:38:46 -07:00
Spottedleaf
48ea66e97f Optimize player lookups for beacons
For larger ranges, it's better to iterate over the player list
than the entity slices.
2023-07-06 20:18:33 -07:00
Shane Freeder
dadd8b5a7c
Don't allow for supporting block checks to load chunks
I cannot test this due to lack of hardware (took 30 minutes getting paper
updated and loaded into IJ on this machine...), however, this is the easiest
patch for now. Ideally, some form of distance check would probably be added to
improve invalidation of this cache.
2023-07-06 02:55:19 +01:00
Lulu13022002
12c970097d
Fix ThrownEggHatchEvent#setHatching (#9448) 2023-07-05 09:46:12 +02:00
Nassim Jahnke
c0936a71bd
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9440)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
01aa02eb PR-858: Add LivingEntity#playHurtAnimation()
9421320f PR-884: Refinements to new ban API for improved compatibility and correctness
37a60b45 SPIGOT-6455, SPIGOT-7030, PR-750: Improve ban API
4eeb174b All smithing inventories are now the new smithing inventory
f2bb168e PR-880: Add methods to get/set FallingBlock CancelDrop
e7a807fa PR-879: Add Player#sendHealthUpdate()
692b8e96 SPIGOT-7370: Remove float value conversion in plugin.yml
2d033390 SPIGOT-7403: Add direct API for waxed signs
16a08373 PR-876: Add missing Raider API and 'no action ticks'

CraftBukkit Changes:
b60a95c8c PR-1189: Add LivingEntity#playHurtAnimation()
95c335c63 PR-1226: Fix VehicleEnterEvent not being called for certain entities
0a0fc3bee PR-1227: Refinements to new ban API for improved compatibility and correctness
0d0b1e5dc Revert bad change to PathfinderGoalSit causing all cats to sit
648196070 SPIGOT-6455, SPIGOT-7030, PR-1054: Improve ban API
31fe848d6 All smithing inventories are now the new smithing inventory
9a919a143 SPIGOT-7416: SmithItemEvent not firing in Smithing Table
9f64f0d22 PR-1221: Add methods to get/set FallingBlock CancelDrop
3be9ac171 PR-1220: Add Player#sendHealthUpdate()
c1279f775 PR-1209: Clean up various patches
c432e4397 Fix Raider#setCelebrating() implementation
504d96665 SPIGOT-7403: Add direct API for waxed signs
c68c1f1b3 PR-1216: Add missing Raider API and 'no action ticks'
85b89c3dd Increase outdated build delay

Spigot Changes:
9ebce8af Rebuild patches
64b565e6 Rebuild patches
2023-07-04 10:22:56 +02:00
Lulu13022002
4356758b64
Call missing BlockDispenseEvents (#8518)
* Call missing BlockDispenseEvent

* Avoid duplicate event

* Show a single item for event

* Move glowstone refill event

* rebased

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2023-07-02 16:12:07 -07:00
Jason
171ba7ccf3
Move Log4j plugins to own source set (#9428) 2023-07-01 22:00:46 -07:00
Jake Potrebic
e16fefb443
[ci skip] add 'accepted' to Done project category (#9429) 2023-07-01 10:24:58 +02:00
Jake Potrebic
f2c1e1366a
Fix default permission for xp command (#9419) 2023-06-30 15:02:25 -07:00
Boy0000
fead63e2ea
Add option to disable NoteBlock and Tripwire updates (#9368) 2023-06-30 16:11:52 +02:00
Nassim Jahnke
225c95025b
Hotfix double entity removal making entity scheduler retire call
The assumption that the setRemoved method will never be called more than once is flawed, considering even vanilla code seems to indicate it might happen. Especially with plugins, throwing an exception is not something reasonably maintainable across all the places it *could* happen.
If it is called a second time after already having been removed due to changing dimensions, that's definitely bad, so no extra check for that
Fixes #9420
2023-06-29 17:41:32 +02:00
Jake Potrebic
437e8da700
Improve command function perm level checks (#9411) 2023-06-28 23:18:28 -07:00
Jake Potrebic
2c9c5e4662
Fix replenishable container entities save/load existing contents (#9417) 2023-06-28 11:06:47 -07:00
Pedro
82cd69fcf4
[ci skip] Update Repo style and change project url in README (#9407) 2023-06-28 10:23:05 +02:00
Jake Potrebic
e4b40ddc22
Fix entity selectors while spectating (#9402) 2023-06-27 14:46:27 -07:00
Jake Potrebic
8582999344
Deprecate duplicate chat completion methods (#9401) 2023-06-27 10:18:59 +02:00
Lulu13022002
cf0f013f53
Avoid duplicate death event call for armorstands (#9223)
* Avoid duplicate death event call for armorstands

* restore vanilla behavior (emit the game event etc...)
2023-06-26 21:22:49 -07:00
Redned
7103f813bc
Only tick item frames if players can see it (#9377)
In the event that an item frame cannot be seen by any players, ticking the item frame every tick is unnecessary. This can be a very hot section of the entity tracker when lots of item frames are present on a server, so this reduces the logic which speeds it up.
2023-06-27 00:26:29 +01:00
Bit
3f6c4b07ac
Add event for player editing sign (#9300)
Addresses https://github.com/PaperMC/Paper/issues/9293
2023-06-26 23:35:32 +01:00
Nassim Jahnke
990be1691b
Iterate over entity array copy for entity scheduler 2023-06-26 18:41:08 +02:00
powercas_gamer
e8bec64217
Fix ugly java logger format for paper plugin dependency loader (#9395) 2023-06-25 09:57:45 +02:00
Owen
b34d4ecd2e
Fix cycle on paper plugin toString (#9392) 2023-06-24 22:37:38 +01:00
Owen
aea9cdd37d
Fix interact event call override (#9387) 2023-06-23 11:03:43 -05:00
50d1701a1c Merge pull request '1.20.1' (#11) from 1.20.1 into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #11
2023-06-23 17:03:40 +02:00
abee30417b 1.20.1 SW Paper (compiles, untested)
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2023-06-23 16:03:44 +02:00
a6457334ec Merge remote-tracking branch 'upstream/master' 2023-06-23 15:31:55 +02:00
Molean
206dd3af05
Fix incorrect phantom spawning entity (#9385) 2023-06-23 12:50:29 +02:00
Samir
b1696788d6
ratelimited packet is logged to console on kick (#9292) 2023-06-21 14:36:14 +01:00
Redned
c613877e54
Fix incorrect crafting result amount for fireworks (#9322)
Although vanilla does not specifically call this method anywhere, this fixes a bug where the result using the Bukkit API returns the wrong amount.
2023-06-21 14:11:50 +01:00
Owen
3756f5bbf5
Properly Cancel Usable Items (#9225)
This fixes the bug causing canceling PlayerInteractEvent to cause items to continue to be used despite being canceled on the server.

For example, items being consumed but never finishing, shields being put up, etc.
The underlying issue of this is that the client modifies their synced data values, and so we have to (forcibly) resend
them in order for the client to reset their using item state.
2023-06-18 18:33:15 -04:00
Nassim Jahnke
1f5bec71f3
Pull Folia API take two 2023-06-18 22:46:52 +02:00
Nassim Jahnke
b1fe756b73
Revert "Move some Folia API to Paper for easy compat (#9360)"
This reverts commit d6d4c78e7d.
2023-06-18 21:47:17 +02:00
Nassim Jahnke
d6d4c78e7d
Move some Folia API to Paper for easy compat (#9360) 2023-06-18 20:02:59 +02:00
Shane Freeder
976b95c74c
Temp: Pre-init PlayerChunkLoaderData in order to prepopulate the BFS lookup cache because potatos (Closes #9338) 2023-06-18 13:49:22 +01:00
Nassim Jahnke
275173e538
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends
255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot

CraftBukkit Changes:
b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends
fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd
44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot
676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
2023-06-18 13:18:11 +02:00
Jake Potrebic
873533b129
Add method to remove all active potion effects (#9361)
* Add method to remove all active potion effects

* use clear instead of removeAll
2023-06-17 21:10:13 -07:00
Riley Park
faf9a65b62 Disable BukkitMirrorTest 2023-06-17 14:20:46 -07:00
Jake Potrebic
072b78a713
Add trail ruins structure set seed in spigot config (#9327)
Also adds a server test to ensure the defaults match and that a seed
exists for each structure set
2023-06-17 12:12:23 -07:00
Jake Potrebic
3a0373901e
Add method to get ungenerated chunk from long key (#9254)
Also added a missing deprecation for a location block key method
2023-06-17 11:43:08 -07:00
Jake Potrebic
c1ea5502d4
Remove more outdated config settings (#9358) 2023-06-17 11:25:22 -07:00
Jake Potrebic
38856661c0
Remove stacktrace on exception from reading server.properties (#9296) 2023-06-16 19:27:45 -07:00
Spottedleaf
a226f44b45 Copy itemstack when sanitizing for datawatcher items
Since the packet is broadcasted for players, it means that
the packet will be sent to multiple players. In this case,
modifying the data results in a possible race condition
where a CME may occur as the packet will be serialized on
many different netty IO threads.
2023-06-16 10:27:59 -07:00
Spottedleaf
f5551380b3 Make sure to post process chunks before they are sent to players
Some TEs need to be post processed after generation to be sent
properly (chests)
2023-06-16 10:25:26 -07:00
Spottedleaf
3f237e869a Fix IntegerUtil#getDivisorNumbers
Use unsigned mod operation for initialization of anc

Also includes
- 5a0cefb45e
- acc8ed9634
2023-06-16 09:05:36 -07:00
powercas_gamer
02e3b5a91a
chore(api): add missing javadoc urls (#9355) 2023-06-16 16:34:49 +01:00
Ollie
17966ddb8e
Update the server logo (#9264)
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
2023-06-16 16:20:31 +01:00
Lulu13022002
f6139de06c
Fix sniffer removeExploredLocation and javadoc (#9311) 2023-06-16 14:33:25 +01:00
Nassim Jahnke
81834ac54a
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
be1f3344 SPIGOT-7326: Add ClickType#isMouseClick()

CraftBukkit Changes:
3b557627c Fix Player#setScoreboard() checking incorrect state
9a21b0b89 SPIGOT-7393: Fix new tile entities not loading Bukkit's PersistentDataContainer

Spigot Changes:
c62f4bd9 Rebuild patches
2023-06-16 13:32:29 +02:00
Phillipp Glanz
fa674f3d35
Don't enforce icanhasbukkit default if alias block exists (#9334) 2023-06-16 12:02:43 +01:00
Jake Potrebic
b134eb406a
Fix incorrect annotation on BrushableBlock#getItem (#9345) 2023-06-16 11:58:09 +01:00
Jake Potrebic
41e6f20420
Updated Upstream (Bukkit/CraftBukkit) (#9342)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fdff0cd4 PR-869: Add Enderman#teleport and Enderman#teleportTowards
dfd86ee7 Improve sendSignChange and related documentation
beced2b2 PR-867: Add Player#sendBlockUpdate to send tile entity updates

CraftBukkit Changes:
ad6d0cffb SPIGOT-7394: Fix another issue with sendSignChange
66c5ce4c7 SPIGOT-7391: Preserve vanilla sign json where not modified by event
ae3824f94 PR-1204: Add Enderman#teleport and Enderman#teleportTowards
5863a2eae Fix sendSignChange not working
4a7eadc97 PR-1201: Add Player#sendBlockUpdate to send tile entity updates
789324e30 Work around issue placing decorated pots
2023-06-16 11:28:31 +01:00
Jason
f7b386ddc7
Use ANSI serializer for console completion descriptions (#9351) 2023-06-15 10:11:09 -07:00
Jake Potrebic
8bc0574fb8
Bump kyori's ansi to fix color bleed (#9346) 2023-06-15 09:24:01 -07:00
Jake Potrebic
bae6096aa2
Re-add dropped patch during 1.20 update (#9344) 2023-06-14 17:52:28 -07:00
Bjarne Koll
837cc25c51
Call BlockEntity#load in new child types (#9340)
BlockEntity#load is responsible for loading the pdc data for block
entities. Some of the new block entities added by mojang do not call
their super method, preventing paper from loading the PDC, which
leads to a loss of data.

This commit adds the super calls to prevent this.
2023-06-14 13:06:50 +02:00
powercas_gamer
62262d73d2
[ci skip] mention adventure in chatcolor deprecation message (#9336)
* mention adventure in chatcolor deprecation message

* expand text

* americans
2023-06-13 20:48:41 -07:00
Jason
2e363c73ba
1.20.1 (#9333) 2023-06-13 09:10:07 +02:00
Jake Potrebic
c287e921a9
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9301) 2023-06-12 16:51:45 -07:00
Jason Penilla
b48e2e352e
Fix dev bundle generation 2023-06-12 16:44:07 -07:00
Emilia Kond
2d09115b3a
Use net.kyori.ansi for console logging (#9313)
Uses the new ANSIComponentSerializer introduced in Adventure 4.14.0 to
serialize components when logging them via the ComponentLogger, or when
sending messages to the console.

This replaces the old solution which uses legacy jank and custom color
conversions, with a new library that handles the conversion and config
2023-06-12 15:00:12 -07:00
Bjarne Koll
87dfff4cfa
Implement BossBarViewer on Player (#9332)
* Implement BossBarViewer on Player

Author: Riley Park <rileysebastianpark@gmail.com>

* Implement BossBar#viewers
2023-06-12 14:43:39 -07:00
Jake Potrebic
de19eb8c4a
fix incorrectly updated move vector checking patch (#9328) 2023-06-12 11:26:43 -07:00
Jake Potrebic
f8cfdd4ba9
Fix SmithingInventory helper slot methods for 1.20 (#9325) 2023-06-12 19:04:53 +02:00
Lulu13022002
eb0693fff7
Fix EntityDeathEvent cancellation (#9323) 2023-06-12 19:03:51 +02:00
Bjarne Koll
f4dfdcbb5b
Fix sendSignChange0's usage of SignText (#9310) 2023-06-11 22:53:28 +02:00
Jake Potrebic
3722877c3c
correctly hide players from entity argument suggestions (#9245) 2023-06-10 18:15:43 -07:00
Lulu13022002
e2e874f549
Add back the source uuid on exp orb for animals breeding (#9289) 2023-06-10 18:01:10 -07:00
Spottedleaf
bc3496ea58 Fix incorrect collision shape for hopper item suck
It shouldn't cost too much more to check the correct shape,
provided that it is cached and we use the overall AABB
to collect possible entities to check against.

The issues with the old check code is that it will use two
getEntitiesOfClass calls plus the addition of streams
_and_ the toAabbs() logic on VoxelShape. The new code
caches toAabbs, uses one getEntitiesOfClass call, and
does not use streams. Then compared to 1.12, we are
only performing two additional AABB checks per item.
2023-06-10 13:42:03 -07:00
Spottedleaf
3d06377b24 Allow double removal from player chunk loader
Unlike Folia, players may be incorrectly be double-removed

Fixes https://github.com/PaperMC/Paper/issues/9299
2023-06-10 08:27:23 -07:00
Owen
2ffb704efa
Don't use event to get block position (#9295) 2023-06-10 02:13:42 -04:00
Jake Potrebic
dc30ee591d
Properly remove the experimental smithing inventory type (#9290) 2023-06-09 20:50:00 +02:00
Jake Potrebic
0284b272d3
Add API for waxed signs (#9291) 2023-06-09 20:32:20 +02:00
Lulu13022002
648c000fb2
Add pitcher plant api (#9286) 2023-06-09 14:23:38 +02:00
Bjarne Koll
4b5f84712b
Minimise EntityFertilizeEggEvent and add sniffer (#9280) 2023-06-09 09:01:08 +02:00
Jake Potrebic
4e3febbfe0
fix missing trigger entity for xp orb from breeding 2023-06-08 23:52:18 -07:00
Jake Potrebic
f9fc44ff9f
add side to PlayerSignCommandPreprocessEvent 2023-06-08 22:57:24 -07:00
Jake Potrebic
9ebf75d894
fix some more 1.20 tracking issues 2023-06-08 22:45:45 -07:00
Jake Potrebic
c9e125f62a
Fix setListenerRange for calibrated sculk sensors 2023-06-08 22:35:56 -07:00
Jason Penilla
9ada4bd7af
Prevent the rcon thread from attempting connections after shutdown 2023-06-08 22:25:23 -07:00
Jake Potrebic
ea9fdc393c
Ignore inline definitions of trim material & pattern 2023-06-08 21:53:37 -07:00
Jake Potrebic
0d969f0a1b
comment out update logic from build.gradle.kts 2023-06-08 21:31:56 -07:00
Jake Potrebic
82c64790f4
Add back Anti-Xray patch (#9283) 2023-06-08 21:29:58 -07:00
Owen1212055
e829a9d8f3
Fix javadoc 2023-06-08 22:53:42 -04:00
Owen1212055
6d74ad155f
Finish tests & bad calls 2023-06-08 22:51:31 -04:00
Jake Potrebic
03c3587e2e
fix not editable sign after openSign 2023-06-08 19:45:58 -07:00
Owen
ccb194bbbb
Move block farther away for Player#setRotation (#8514) 2023-06-08 22:37:59 -04:00
Lulu13022002
3621d76d8f
Fix collision between AABB and a dot (#8733) 2023-06-08 22:17:32 -04:00
Lulu13022002
21f2d158c4
Avoid duplicate poi entries from the first section (#9235) 2023-06-08 22:14:30 -04:00
Jake Potrebic
c9eb393d18
Updated Upstream (Bukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
657df461 PR-686: Add missing trim patterns added in 1.20
2023-06-08 19:10:05 -07:00
Spottedleaf
04509f0234 Fix crash relating to "Already sent chunk"
Forgot to update the distandce field in the single user area map
on update, and additionally used the wrong radius (introduced
last commit) for the broadcast map
2023-06-08 18:00:46 -07:00
Spottedleaf
8ce5219e07 Fix inconsistent chunk sending with vanilla
Vanilla now loads the proper number of chunks for sending
to players. So, we can finally match their behavior after
all these years.
2023-06-08 17:45:54 -07:00
Jake Potrebic
e325e37268
add missing call to EntityInsideBlockEvent 2023-06-08 17:34:35 -07:00
Jake Potrebic
59060aaec3
fix some failing tests 2023-06-08 17:26:05 -07:00
Owen1212055
9d428792c4
Fix breaking pots throwing exception 2023-06-08 20:24:12 -04:00
Jason Penilla
aed9ef0788
Update adventure 2023-06-08 17:22:51 -07:00
Jake Potrebic
318a08c1db
add missing block entity type to CraftBlockStates 2023-06-08 17:04:46 -07:00
Jake Potrebic
a0a2e7287c
fix sculk npe 2023-06-08 16:56:02 -07:00
Spottedleaf
c1def9d852 Updated Upstream (CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
fd92f1e65 SPIGOT-7378: Add BlockDropItemEvent for Suspicious Sand & Gravel drops
cb1b69d13 SPIGOT-7377: Server sends player list twice

Spigot Changes:
16cfc987 Rebuild patches
2023-06-08 16:47:58 -07:00
Spottedleaf
57a592466d Fix boot errors
Thanks kennytv
2023-06-08 16:44:34 -07:00
Spottedleaf
efb4197a1b Fix final compilation issues 2023-06-08 16:35:02 -07:00
Spottedleaf
902691b636 Apply last patch 2023-06-08 16:21:20 -07:00
Spottedleaf
619d7c93d8 Add in some patches 2023-06-08 16:12:34 -07:00
Spottedleaf
cc491a396e Finish updating chunk system patch
Add in locking changes from folia, plus fix some diffs.
I'm sure it'll be error-free.
2023-06-08 16:04:53 -07:00
Jake Potrebic
3fe0e32495
more compile fixes 2023-06-08 14:13:43 -07:00
Jake Potrebic
f0aea8123e
more compile fixes 2023-06-08 13:56:13 -07:00
Jake Potrebic
0a9e232f48
fix some more compile issues 2023-06-08 12:35:20 -07:00
Jake Potrebic
7002799587
fix FullChunkAccess enum move (#9281) 2023-06-08 12:22:12 -07:00
Jake Potrebic
37e689f367
fix more compile errors 2023-06-08 12:00:58 -07:00
Owen1212055
034edecc37
cleanup some descriptions + optimize hoppers patch 2023-06-08 14:10:23 -04:00
Jake Potrebic
b4ae928db9
add some more patches back 2023-06-08 10:48:28 -07:00
Jake Potrebic
870dafe358
add 1 more networking patch and add comments to dropped patches 2023-06-08 10:25:32 -07:00
Jake Potrebic
1a0280ccc0
apply a couple network patches 2023-06-08 09:09:43 -07:00
Jake Potrebic
f80338725e
fix defaulting join-classpath to true for plugin deps 2023-06-08 06:50:41 -07:00
Nassim Jahnke
a6628220d3
Update test plugin 2023-06-08 15:42:13 +02:00
Nassim Jahnke
ad4eb2ec7d
Fix bad fixup 2023-06-08 15:27:41 +02:00
Nassim Jahnke
4af62f6d1d
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2d009e64 Update SnakeYAML javadoc link
b4fd213c Switch Player#updateInventory deprecation for internal API annotation

CraftBukkit Changes:
f3b2b2210 SPIGOT-7376: Exception with getBlockData when hasBlockData is false
725545630 SPIGOT-7375: Fix crash breeding certain entities
b9873b0d4 Update Brigadier version with fix
68b320562 SPIGOT-7266: Found typo in CraftBukkit package
98b4d2ff8 SPIGOT-7372, SPIGOT-7373: Signs can't be edited, issues with SignChangeEvent
5f7bd4d78 SPIGOT-7371: Sign does not open edit text on placement
b4cf99d24 SPIGOT-7371: Fix editing signs with API
a2b6c2744 PR-1200: Implement open sign by side
a345bb940 SPIGOT-7368: Downgrade SpecialSource version

Spigot Changes:
723951c3 Rebuild patches
b655c57d Drop old collision API deprecated since 1.9.4
55b0fed4 Rebuild patches
2023-06-08 15:25:35 +02:00
Noah van der Aa
0cc83ea9b6
1.20: Remove Experimental API status where upstream forgot (#9271) 2023-06-08 15:04:43 +02:00
Bjarne Koll
2873869bb1
Drop manual isEditable copy in CraftSign
Signs no longer have a specific isEdiable state, the entire API in this
regard needs updating/deprecation. The boolean field is completely gone,
replaced by a uuid (which will need a new setEditingPlayer(UUID) method
on the Sign interface), and the current upstream implementation of
setEdiable simply flips the is_waxed state.

This patch is hence not needed as it neither allows editing (which will
be redone in a later patch) nor is required to copy the is_waxed boolean
flag as it lives in the signs compound tag and is covered by applyTo.
2023-06-08 11:35:39 +02:00
Bjarne Koll
1c12701691
Update fluid chunk loading patch 2023-06-08 11:18:51 +02:00
Bjarne Koll
d5682d77c3
Minimize strict-advancement-dimension-checks.patch 2023-06-08 10:53:00 +02:00
Owen1212055
aa1c25c88d
vine boom sound 2023-06-08 04:47:19 -04:00
Owen1212055
bab0b3a7c3
YOU get patches 2023-06-08 04:08:08 -04:00
Owen1212055
b05cd80334
Fix scuffed patches 2023-06-08 03:57:42 -04:00
Owen1212055
605e66c5de
re-patched 2023-06-08 03:40:45 -04:00
Owen1212055
91b45c49ce
Patched 2023-06-08 03:20:03 -04:00
Owen1212055
6d118492b6
Some chunk patches 2023-06-08 02:31:22 -04:00
Spottedleaf
74ad522fc5 Rebase chunk patches 2023-06-07 22:26:06 -07:00
Spottedleaf
819facd7c4 rewrite chunk system checkpoint 2023-06-07 22:26:06 -07:00
Spottedleaf
0c4a1c4496 Clean rebuild
Add to gradle build so that this is automatically done
throughout the update
2023-06-07 22:26:06 -07:00
Jake Potrebic
de18bb96e8
actually update to 1.20 2023-06-07 20:33:11 -07:00
Jake Potrebic
20aaebbd47
update reobf-mappings-patch.tiny 2023-06-07 20:30:34 -07:00
Jake Potrebic
13ab8b77d3
signing off for now 2023-06-07 19:12:38 -07:00
Jake Potrebic
47c5d82017
some more stuffs 2023-06-07 19:04:01 -07:00
Jake Potrebic
1eba407610
finished some more patches 2023-06-07 18:13:54 -07:00
Jake Potrebic
236eabd751
some more patches 2023-06-07 17:54:54 -07:00
Jake Potrebic
c13b259ff2
fix compile errors 2023-06-07 17:30:05 -07:00
Jake Potrebic
ac1a626493
45 more patches 2023-06-07 16:56:33 -07:00
Jake Potrebic
0ca9f14d58
finish some more patches 2023-06-07 16:44:11 -07:00
Noah van der Aa
b1a2378144
1.20: Fix a bunch of compile issues (#9273) 2023-06-07 16:21:20 -07:00
Jake Potrebic
f0889559f3
even moaaar patches 2023-06-07 16:20:26 -07:00
Jake Potrebic
c31a22c563
even moar patches 2023-06-07 15:58:10 -07:00
Jake Potrebic
44e22b45a5
more patches 2023-06-07 15:41:25 -07:00
Jake Potrebic
0b8147f68e
fix a bunch of compile errors 2023-06-07 15:28:06 -07:00
Jake Potrebic
8f7a7ec440
more work and compile fixes 2023-06-07 15:12:41 -07:00
Jake Potrebic
e09a44e169
fix some compile issues 2023-06-07 14:46:56 -07:00
Nassim Jahnke
3c8e176265
Some compile fixes 2023-06-07 23:37:08 +02:00
Nassim Jahnke
838d8afd76
More more more more more more more more work 2023-06-07 23:18:26 +02:00
Nassim Jahnke
c1f313b273
More more more more more more more work 2023-06-07 22:41:26 +02:00
Nassim Jahnke
7f384988cd
More more more more more more work 2023-06-07 22:19:14 +02:00
Nassim Jahnke
3fed7289ed
More more more more more work 2023-06-07 21:54:11 +02:00
Noah van der Aa
94aa4b518a
Fix API compile issues (#9269) 2023-06-07 21:47:39 +02:00
Nassim Jahnke
0ed49782c5
More more more more work 2023-06-07 21:37:42 +02:00
Nassim Jahnke
474a02835d
More more more work 2023-06-07 21:21:43 +02:00
Nassim Jahnke
01f5831171
More more work 2023-06-07 20:49:17 +02:00
Nassim Jahnke
197786ead0
More more work 2023-06-07 20:31:32 +02:00
Nassim Jahnke
c1bbde4bc6
Let's hope this is fine 2023-06-07 20:08:03 +02:00
Nassim Jahnke
3fbb00319f
More work 2023-06-07 19:18:05 +02:00
Nassim Jahnke
965cf53cd5
Start working on 1.20 2023-06-07 19:06:55 +02:00
Owen
bc4a6647c9
Paper Plugins Dependency Format Update (#9160)
* Rework dependency management (WIP)

* Revert "Rework dependency management (WIP)"

This reverts commit e046cd59c68743dc00303b1ab42317bf474abd6a.

* Correctly add soft dependencies to the dependency tree for classloading resolution

* Add support for new dependency config format

* Rebase

* swap load order meaning

* Dependencies should be required by default
2023-06-07 08:41:25 -07:00
Jake Potrebic
175a774247
[ci skip] Use a separate interface for bootstrapping (#9267) 2023-06-07 08:29:28 -07:00
Jake Potrebic
14cfd64d2d
Schedule several things for removal in 1.21 (#9041) 2023-06-07 15:47:32 +02:00
Nassim Jahnke
d8e07590e3
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
5dbedae1 PR-864: Fix Registry#match() failing namespaced inputs
49256865 PR-863: Fix boolean PersistentDataType
9f15450b SPIGOT-7195, SPIGOT-7197: Add DataPack API
ebef5b6a Disable InterfaceIsType Checkstyle check
01d577f5 Slight tweak to boolean PersistentDataType javadoc
d2b99e56 PR-857: Add boolean PersistentDataType

CraftBukkit Changes:
2270366cd PR-1196: Test Registry instances more thoroughly
863dacb7a PR-1191: Do not start on pre-release Java 17
1f2dd8e12 SPIGOT-7362: Properly handle null in CraftBlock#blockFaceToNotch()
dbc70bed5 SPIGOT-7195, SPIGOT-7197: Add DataPack API
2023-06-06 11:09:19 +02:00
Malfrador
956062a5d5
Add transient modifiers (#9244)
This allows adding modifiers as transient. Transient modifiers don't get saved with the NBT data.
Vanilla itself uses transient modifiers for speed modifications like sprinting or powder snow. This just exposes it in the API.
2023-06-05 13:15:18 -04:00
Jake Potrebic
d8d3bd70b0
[ci skip] Add missing deprecations for legacy MaterialData api (#9253) 2023-06-03 11:09:43 -07:00
Jake Potrebic
8a18fc55ab
[ci skip] add 'needs triage' label to invalid on issue close (#9252) 2023-06-03 10:43:38 -07:00
Jake Potrebic
bacbf86ed2
Fixes and additions to projectile API (#9237) 2023-05-31 19:43:51 -07:00
Jake Potrebic
2eda177116
Expand PlayerItemMendEvent (#7382) 2023-05-31 16:58:25 -07:00
Jake Potrebic
ea0b63992c
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9228)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
4727d326 Don't let Sign extend SignSide, mark API as experimental
9b29bdcc PR-845: Add preliminary support for multi sided signs

CraftBukkit Changes:
b346a5f6d PR-1170: Add preliminary support for multi sided signs
86c816189 Update SQLite version
d9324b4bc Fix addition of custom smithing trim / transform recipes

Spigot Changes:
7d7b241e Rebuild patches
2023-05-31 16:36:57 -07:00
Jake Potrebic
fa8fa1ce08
Fix playing adventure sounds on World/Server (#8077) 2023-05-30 18:36:16 -07:00
Lulu13022002
0f91091ccc
Re-implement the compost events (#9192) 2023-05-30 18:07:04 -07:00
Spottedleaf
f9f90791e4
Pull a few Folia patches 2023-05-27 20:34:33 +02:00
Nassim Jahnke
90a0835f43
Fix incremental player saving patch 2023-05-27 20:14:04 +02:00
Lulu13022002
bcd8dc2c11
Use the spigot config for mangrove propagule / torchflower growth (#8597) 2023-05-15 14:25:38 -04:00
Lulu13022002
b6817605ce
Fix note block sound property on player heads (#9158) 2023-05-15 13:32:26 -04:00
Warrior
a61b4845f2
Fix MC-224454 (#9195) 2023-05-15 11:33:15 -04:00
Warrior
4ba5aacc37
More accurate isInOpenWater impl (#9194) 2023-05-15 11:21:57 -04:00
Lulu13022002
5b66d33a77
Call EntityChangeBlockEvent for frogs egg (#9213) 2023-05-15 12:56:12 +02:00
Owen
f8603a46a8
Avoid Lazy Initialization for Enum Fields (#9210) 2023-05-14 20:46:17 -04:00
Noah van der Aa
57fdc668fa
Undeprecate Server#getMap (#9185)
The only way to get a map is via its id, which is not a magic value. This implementation isn't going to be changing anytime soon, so it should be undeprecated.
2023-05-14 20:23:57 -04:00
Jake Potrebic
ab7bc3fb34
Remove javadoc that doesn't apply to Paper (#9206) 2023-05-14 19:20:43 -04:00
booky10
9daa019d6c
Added wither vanilla invulnerability API (#9124) 2023-05-12 15:24:50 -05:00
Redned
1edfefdef8
Add option to flush region files on save (#9149) 2023-05-12 15:07:24 -05:00
Nassim Jahnke
efd47e3a68
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9188)
* Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2fcba9b2 SPIGOT-7347: Add missing documentation and details to ShapedRecipe
c278419d PR-854: Move getHighestBlockYAt methods from World to RegionAccessor
201399fb PR-853: Add API for directly setting Display transformation matrices
ecfa559a PR-849: Add InventoryView#setTitle
653d7edb SPIGOT-519: Add TNTPrimeEvent
22fccc09 PR-846: Add method to get chunk load level
a070a52c PR-844: Add methods to convert Vector to and from JOML vectors
cc7111fe PR-276: Add accessors to Wither's invulnerability ticks
777d24e9 SPIGOT-7209: Accessors and events for player's exp cooldown
ccb2d01b SPIGOT-6308: Deprecate the location name property of map items
cd04a31b PR-780: Add PlayerSpawnChangeEvent
7d1f5b64 SPIGOT-6780: Improve documentation for World#spawnFallingBlock
5696668a SPIGOT-6885: Add test and easier to debug code for reference in yaml configuration comments
2e13cff7 PR-589: Expand the FishHook API
2c7d3da5 PR-279: Minor edits to various Javadocs

CraftBukkit Changes:
01b2e1af4 SPIGOT-7346: Disallow players from executing commands after disconnecting
7fe5ee022 PR-1186: Move getHighestBlockYAt methods from World to RegionAccessor
bcc85ef67 PR-1185: Add API for directly setting Display transformation matrices
a7cfc778f PR-1176: Add InventoryView#setTitle
563d42226 SPIGOT-519: Add TNTPrimeEvent
ccbc6abca Add test for Chunk.LoadLevel mirroring
2926e0513 PR-1171: Add method to get chunk load level
63cad7f84 PR-375: Add accessors to Wither's invulnerability ticks
bfd8b1ac8 SPIGOT-7209: Accessors and events for player's exp cooldown
f92a41c39 PR-1181: Consolidate Location conversion code
10f866759 SPIGOT-6308: Deprecate the location name property of map items
82f7b658a PR-1095: Add PlayerSpawnChangeEvent
b421af7e4 PR-808: Expand the FishHook API
598ad7b3f Increase outdated build delay

Spigot Changes:
d1bd3bd2 Rebuild patches
e4265cc8 SPIGOT-7297: Entity Tracking Range option for Display entities

* Work around javac bug

* Call PlayerSpawnChangeEvent

* Updated Upstream (Bukkit/CraftBukkit/Spigot)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2fcba9b2 SPIGOT-7347: Add missing documentation and details to ShapedRecipe
c278419d PR-854: Move getHighestBlockYAt methods from World to RegionAccessor
201399fb PR-853: Add API for directly setting Display transformation matrices

CraftBukkit Changes:
01b2e1af4 SPIGOT-7346: Disallow players from executing commands after disconnecting
7fe5ee022 PR-1186: Move getHighestBlockYAt methods from World to RegionAccessor
bcc85ef67 PR-1185: Add API for directly setting Display transformation matrices

Spigot Changes:
7da74dae Rebuild patches
2023-05-12 13:10:08 +02:00
Warrior
688409279f
Fix lightning being able to hit spectators (#9193) 2023-05-08 16:17:00 +02:00
Bjarne Koll
1d4c7806ff
Fix BlockPosition#offset(double,double,double) (#9190) 2023-05-07 14:14:34 +02:00
Nassim Jahnke
813d0399f9
Make sure the player didn't disconnect when processing commands 2023-05-06 17:10:22 +02:00
Lulu13022002
9846d0d89e
Fix some NPE for EntityCompostItemEvent (#9169) 2023-05-03 12:07:51 +01:00
Pedro
83da4b6101
Fix DamageSource for Falling Blocks (#9175) 2023-05-03 11:50:59 +01:00
Spottedleaf
4f9575eed8 Break redstone on top of trap doors early
This logic hooks into the neighbour update which should be invoked
as a result of redstone powering the trap door.
2023-05-01 18:32:30 -07:00
Lukas Alt
bcec5b11e6
Fixed large packet handling (#9147)
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
2023-04-27 19:50:14 +01:00
GodOfPro
f4ce997a42
Add Mob Experience reward API (#9122) 2023-04-27 19:49:19 +01:00
Jason
2cccbbe1f4
[ci skip] Update Gradle plugins and wrapper (#9140) 2023-04-26 10:07:13 -07:00
Owen
936205beae
Disable allowListing before received from client (#9167) 2023-04-23 21:24:12 -04:00
Owen
5c4671a9bf
Fix LegacyPluginLoader dependency registration (#9165) 2023-04-23 02:55:10 +01:00
Owen
8e3009e0db
Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9129) 2023-04-22 12:44:40 -05:00
Jakub Zacek
f7717c3712
Fix server ignoring fallback for translatable components (#9134) 2023-04-20 08:05:41 +01:00
Emily
beed22d336
Undo making JavaPlugin#logger field public (#9125) 2023-04-19 16:46:09 +01:00
Luke Chambers
dd216c1f09
Fix Inconsistencies with Paper Plugin Names (#9098) 2023-04-16 11:49:13 -05:00
Jake Potrebic
6d2121efde
Removes some references to deprecated methods/types (#9043) 2023-04-15 18:13:59 -07:00
Warrior
23a443eeaa
Fix demo flag not enabling demo mode (#9103) 2023-04-15 18:30:23 -05:00
Shane Freeder
8d040fad9b
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
465c4964 PR-843: Add damage methods to FallingBlock
46ba7c9f SPIGOT-7335: Fix typo in TextDisplay#TextAlignment enum name

CraftBukkit Changes:
818582f40 PR-1169: Add damage methods to FallingBlock
15a3eac66 SPIGOT-7335: Fix typo in TextDisplay#TextAlignment enum name
f01fb4979 SPIGOT-7336: Fix typo in internal method name
2023-04-14 00:52:42 +01:00
Matt Artist
bd35d605e8
[ci-skip] Fix missing closing quote (#9126) 2023-04-11 17:57:56 -07:00
DungeonDev
e338793603
Optimize hoppers by not trying to merge full items. (#9110)
This can skip many very expensive call to ItemStack.tagMatches.
Makes canMergeItems return false for merging into ItemStacks that are already full.
2023-04-11 15:35:54 +02:00
Jake Potrebic
5ffdff8822
Fix a couple of bed bugs (#9112) 2023-04-10 15:12:22 -07:00
Shane Freeder
e811927394
Revert "Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9068)"
This reverts commit f8d2f823db.
2023-04-10 11:25:04 +01:00
Redned
8be7a60b76
Fix getBrightness and getRawBrightness throwing exception in BlockStateListPopulator (#9111) 2023-04-10 10:06:49 +02:00
caramel
ab72b123ec
Update Adventure to 4.13.1 (#9113) 2023-04-10 10:06:38 +02:00
Nassim Jahnke
058d7c1aa3
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
13eb4146 SPIGOT-5217, SPIGOT-6183: Add RespawnReason to PlayerRespawnEvent

CraftBukkit Changes:
5ee3419b7 SPIGOT-5217, SPIGOT-6183: Add RespawnReason to PlayerRespawnEvent

Spigot Changes:
514cf03a Rebuild patches and add RespawnReason.PLUGIN to Player#respawn
2023-04-10 10:03:36 +02:00
Shane Freeder
b626528da0
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
de5ba402 PR-848: Mark get/setCatType methods deprecated in addition to the enum

CraftBukkit Changes:
50ee87fbc SPIGOT-7333: Correctly handle null in ColorableArmorMeta#setColor()
790be710b SPIGOT-7332: Persistent Data Container of Chunk not saving on stop or restart.
2023-04-09 23:38:03 +01:00
Owen
f8d2f823db
Resolve Plugin Dependency Issues, Improve PluginLoading Compat, Small Loading Issues (#9068) 2023-04-09 23:28:30 +01:00
Jake Potrebic
6a7fef0e4a
Allow entity effect changes off the main thread for worldgen (#8942)
* Allow entity effect modification off the main thread for worldgen

* squash all async catcher patches
2023-04-09 11:38:32 -07:00
Jake Potrebic
f8c01122e6
[ci skip] add missing labels to project status map (#9106) 2023-04-09 09:00:43 +02:00
Shane Freeder
9cda28480e
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
aeb62aa3 Remove obsolete documentation from ArmorMeta#setTrim

CraftBukkit Changes:
cb6f3c028 PR-1173: Change CraftMinecartTNT to public for consistency
2023-04-09 01:13:38 +01:00
Jake Potrebic
b5ce6e3dc5
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9104)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
eb4b416d PR-822: Add experimental armor trim API
33498e1d PR-831: Add a standard of annotations for Minecraft experimental things and API

CraftBukkit Changes:
19de3550d SPIGOT-7315: Bed placement duplicates crops if cancelled
1eb88374e PR-1147: Add experimental armor trim API
c4c0bb0e9 Show clean error for invalidly configured server.properties options
3ae90697f Fix UUID not being updated when changing world of MapView
e43000601 PR-1164, MC-227255, MC-253819: Fix rotation of beehives and bells

Spigot Changes:
d2fdfe39 Rebuild patches
2023-04-09 01:00:50 +01:00
Jake Potrebic
29b17a892d
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9088)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
5efeb7bd Also update compiler version
c13b867a Update some Maven plugin versions
deb28d9f PR-837: Add more bell API
e938d62a PR-819: Allow Player#sendBlockDamage() to specify a source entity
0e75532c PR-818: Add more Guardian API, particularly for its laser
a10155aa PR-839: Add BlockData#rotate and BlockData#mirror
77e690b4 PR-836: Add missing API for explosive minecarts
60722059 PR-832: Allow getting chunks without generating them and optimize chunk data request for ungenerated chunks
0a2c4b4b PR-834: Add Player#sendHurtAnimation()

CraftBukkit Changes:
be8682aa8 Also update compiler version
08e305f5b Update some Maven plugin versions
187bdd463 PR-1160: Add more bell API
2f8e5bc7c PR-1145: Allow Player#sendBlockDamage() to specify a source entity
bcbb61b36 PR-1144: Add more Guardian API, particularly for its laser
722ddff6d PR-1162: Add BlockData#rotate and BlockData#mirror
80998277c PR-1159: Add missing API for explosive minecarts
1fddefce1 PR-1155: Allow getting chunks without generating them and optimize chunk data request for ungenerated chunks
20e8a486f PR-1157: Add Player#sendHurtAnimation()

Spigot Changes:
b31949f2 Rebuild patches
2023-04-07 19:39:13 +01:00
Jake Potrebic
ad6c14c62e
Fix unknown cmd msg for mc namespaced cmds (#9059) 2023-04-06 19:27:41 -05:00
Alex
e9f6e7ae8a
Properly resync player on Player#setPlayerProfile (#9080)
Currently breaking are potion effects and the XP bar, both are now being resent to make the client know about them again.
2023-04-06 18:21:33 -05:00
Shane Freeder
f5677aa472
Fix TPS command output (#9091)
* Fix TPS command output

* Cleanup + rebase

---------

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2023-04-06 18:08:44 -05:00
Lulu13022002
3c8c22323f
Fix some broken block place logic (#9094)
- The dispensed shulker will not play the place sound (due to its logic been removed)
- The hanging sign text editor cannot be cancelled using the BlockPlaceEvent (not consistent with the other regular signs)
- The jukebox logic hasn't been synced with the RecordItem
2023-04-06 17:39:32 -05:00
Jake Potrebic
dab4864a11
[ci skip] add workflow for auto-managing issue board (#8958)
* add workflow for auto-managing issue board

* make concurrency depend on the issue number

* generate token in the action
2023-04-06 14:19:06 -07:00
Warrior
9b77660f07
Port airplane's use array for gamerule storage patch (#9087) 2023-04-06 14:18:45 +02:00
Shane Freeder
9367e6e6b3
Prevent GameEvents being fired from unloaded chunks 2023-04-06 12:42:10 +01:00
BlockyTheDev
e6ef1bae88
[ci skip] Update download urls (#9100) 2023-04-04 17:06:59 -07:00
Harry Devane
497b91939c
Fix ignoreCancelled having no effect on events registered by direct EventExecutor (#9099) 2023-04-04 22:40:31 +01:00
Lulu13022002
641dafd0a8
Cleanup some patches (#9093) 2023-04-04 11:47:16 +02:00
Shane Freeder
08491449ae
Do not send expired keys to players on login (#9090)
This patch will prevent sending expired keys to players when logging into a server, while the client does have some grace period to prevent issues, if a key has expired beyond the grace period, connecting clients will be disconnected from the server upon join. The client should update keys before this key even expires, and a new key will be broadcasted out if we somehow actually get one.
2023-04-03 10:45:02 +01:00
Jake Potrebic
9893e2b734
Deprecate ChatColor (#9069)
All API that uses it is deprecated
2023-04-02 11:53:29 -07:00
elmital
1d2fe64da8
fix: null SpawnReason for new player (#9015) 2023-04-02 13:37:53 -05:00
Cody
50e683de14
Added a config option for ticking markers (#9034) 2023-04-02 13:21:13 -05:00
Jake Potrebic
dc08c74cb3
Remove duplicate animate packet for records (#8600) 2023-04-02 13:05:30 -05:00
Owen
5fb3ab0109
Allow non player entities in scoreboards by default (#9082)
This in general caused much more confusion than needed, and in general, made rather negligible performance gains on collision.
2023-04-02 12:53:11 -05:00
Fejby
1704bf782e
[ci skip] Edit Paper download link in README (#9077) 2023-03-31 18:25:50 +02:00
powercas_gamer
7a96bf2095
Make debug dump file names consistent (#9075) 2023-03-31 13:17:57 +02:00
Shane Freeder
11ab383e4f
Don't use plugin-profiling to enable timings
The paper config has taken precidence over this for a long time
with 0 complaints, and now it's tripping the deprecation warning,
even if timings is disabled in the paper config.
2023-03-31 05:47:59 +01:00
Lulu13022002
06fdc02537
[ci skip] Correct upstream/paper javadoc (#8286) 2023-03-30 21:09:13 -07:00
Nassim Jahnke
bf92f3e4db
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9153f77e PR-841: Remove incorrect ClickType.CONTROL_DROP from ClickType#isShiftClick
bceda6ab PR-840: Adjust annotations in Display entity interface
a6b85ac3 PR-835: Add Jukebox#hasRecord() and #startPlaying(), clarify #setRecord()

CraftBukkit Changes:
e142fb9fd SPIGOT-7188: ChunkSnapshot biome y coordinate doesn't match chunk biome y coord
eff1743b9 SPIGOT-7313: More accurately edit data on Jukeboxes
2023-03-30 15:40:15 +02:00
Riley Park
cbcdfd03e7 Make other link in deprecation message clickable too 2023-03-29 19:35:26 -07:00
Jake Potrebic
ef5fa90932
Fix crash relating to bad recipes in furnace-like tile entities (#9011) 2023-03-30 03:29:38 +01:00
Riley Park
a13759afcc Turn deprecation message into a Component to be used in the command at a later date 2023-03-29 19:15:21 -07:00
Riley Park
32875b429a 8948: Nag when timings is enabled or a plugin creates a new Timing 2023-03-29 12:30:37 -07:00
Jake Potrebic
5c78e77da5
Fix api checking banned ips (#9026) 2023-03-27 20:23:34 -07:00
Nassim Jahnke
9940019ff8
Deprecate public Timings classes for removal (#8949) 2023-03-27 19:58:46 -07:00
Ryan
ce2a36dbd6
Fix PluginMeta#getDisplayName (#9038)
* fix plugin versioning

* fix properly

* fix version command

* ngl idk where my logic was behind this
2023-03-27 19:56:09 -07:00
Jason
bd62f2c2dd
Fix chat messages being logged without formatting to console (#9058) 2023-03-27 10:19:23 -07:00
Jake Potrebic
fbf74ba0ac
Updated Upstream (CraftBukkit) (#9053)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
f92c94517 SPIGOT-7310: PlayerToggleSneakEvent is not called when a player sneaks while riding an entity
b5714184d SPIGOT-7316: Cancelling EntityUnmountEvent does not stop the all effects of the unmounting
e237f8c88 SPIGOT-7312: Entity#setVisibleByDefault on player causes skin reset on this player client
2023-03-26 13:29:41 -07:00
Jake Potrebic
a622ebacd4
Fix beehives generating from using bonemeal (#9052) 2023-03-26 12:07:32 -07:00
Emily
d5abb94e69
Expose Path to jar file in PluginProviderContext (#9030)
* Expose Path to jar file in PluginProviderContext

* rename accessor, reword jd
2023-03-24 23:30:48 -07:00
Jake Potrebic
38be4f873b
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9018)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2c64d8c4 SPIGOT-7309: Add API for jukebox inventories
a6d7e4ca PR-826: Add Sniffer API

CraftBukkit Changes:
93813509b SPIGOT-7309: Add API for jukebox inventories
2d5209e8d PR-1153: Handle teleport reason in spreadplayers command
f5b61387e SPIGOT-7308: Fix NullPointerException when calling Jukebox#setRecord()
388d458a6 SPIGOT-7306: Fix reset of coords in default teleportTo in EntityPlayer
40b87e1af PR-1150: Add Sniffer API and handle EntityItemDropEvent

Spigot Changes:
6ad4b93c SPIGOT-7298: Fix debug stick always permission left click toggle
2023-03-24 13:38:40 -07:00
Jake Potrebic
a0f548f5ec
Don't warn for deprecated PrepareGrindstoneEvent (#9036) 2023-03-24 13:19:17 -07:00
Jake Potrebic
23b0ef524a
[ci skip] rebuild patches 2023-03-23 14:57:03 -07:00
Riley Park
9087a644a3 chore: cleanup annotations in api adventure patch 2023-03-23 10:51:08 -07:00
Nassim Jahnke
92f872c146
Fix bad diff in wandering trader spawn rate patch from .4 update 2023-03-23 14:35:17 +01:00
Jake Potrebic
e8b82590d0
[ci skip] Properly document firing of Entity/BlockExplodeEvent (#9014) 2023-03-20 02:11:23 -07:00
Jake Potrebic
7af4cd3647
Updated Upstream (Bukkit/CraftBukkit) (#9013)
* Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
150a2861 PR-827: Add BlockData#getPlacementMaterial
58c9c8ce SPIGOT-7301: Prevent creating non-openable inventories
3741079b PR-824: Expand upon PotionEffect API to better accommodate infinite durations

CraftBukkit Changes:
e5a7921f0 PR-1149: Add BlockData#getPlacementMaterial
58504fa61 SPIGOT-7302: Fix more issues with EntityDamageByEntity - Fix Projectile damage by dispenser - Fix cases where only exists a direct entity damager
48394703d Increase outdated build delay

* Improve docs for BlockData#getPlacementMaterial
2023-03-20 01:47:10 -07:00
Jake Potrebic
c7520ec49d
Use class loggers without the fqn for non-debug logging (#9012) 2023-03-20 09:23:52 +01:00
JOO200
ff603cb76d
adventure: make calls with generic component lists more usable (#9008)
This should allow the usage of ItemStack#lore and other methods with a List<TextComponent>
2023-03-20 09:18:06 +01:00
Jake Potrebic
7929540ba3
update paperclip to 3.0.3 2023-03-19 22:18:33 -07:00
Jake Potrebic
83948f6f59
Fire reload event after everything has been reloaded (#9003)
This event is going to be more important very shortly (hopefully)
2023-03-19 12:28:28 -07:00
Jake Potrebic
eb0950290d
Fix entity damage event triggers (#8995) 2023-03-19 11:58:34 -07:00
Jason
662b85e00e
Use random UUIDs instead of incrementing long for click callback ids (#9007) 2023-03-19 11:25:45 -07:00
Emily
510082222b
Re-enable multi-release plugin JARs (#9001) 2023-03-19 15:50:13 +01:00
Jake Potrebic
055f7228f0
Add back optimize hoppers (#8999) 2023-03-18 12:03:42 -07:00
Nassim Jahnke
2a024870de
Fix setItem with air on chiseled bookshelves 2023-03-18 18:52:24 +01:00
Jake Potrebic
11f5158eaa
Fix SpawnEggMeta#get/setSpawnedType (#8907) 2023-03-18 10:32:03 -07:00
Jake Potrebic
5730a94208
Updated Upstream (Bukkit/CraftBukkit) (#8991)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2b4582fb SPIGOT-5916: getLastColors does not work with the rgb colors

CraftBukkit Changes:
f7707086d SPIGOT-7299: Fix indirect/anvil damage events and minor improvements
2023-03-18 10:05:04 -07:00
Owen
79db3a2a4b
Add Shearable API (#6796) 2023-03-17 16:11:08 -05:00
Jake Potrebic
02bc2eca34
Fix reobf creating unintentional overrides (#8992) 2023-03-17 19:23:15 +01:00
Jake Potrebic
85a67dadf2
Fix certain inventories returning null Locations (#8985) 2023-03-16 11:47:05 -07:00
XanderDeKeijzer
646f590779
Fix changeGameModeForPlayer to use gameModeForPlayer MC-259571 (#8987) 2023-03-16 17:06:40 +01:00
Nassim Jahnke
5a1e1584aa
Fix text display error on spawn
Fixes #8984
2023-03-16 16:28:48 +01:00
Nassim Jahnke
fe881073af
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2651717c SPIGOT-7292: Support for alpha channel in Color and a few improvements

CraftBukkit Changes:
dbc32ffa0 SPIGOT-7292: Support alpha channel in Display entities
cef8bd993 SPIGOT-7294: Call EntityDamageEvent for Interaction entity
2023-03-16 10:07:12 +01:00
Jake Potrebic
4f933b2405
Fix structure loading 2023-03-15 18:57:33 -07:00
Jake Potrebic
a2918a5fea
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
3a54fb16 SPIGOT-7296: Add ItemFlag#HIDE_ARMOR_TRIM

CraftBukkit Changes:
55056ad80 SPIGOT-7295: Fix Sniffer data defined in incorrect position
2023-03-15 12:59:34 -07:00
Nassim Jahnke
9b0e97b75b
Update DataConverter 2023-03-15 20:19:36 +01:00
Owen
eb0232ef09
Camel EntityToggleSitEvent (#8970) 2023-03-15 15:37:41 +01:00
Nassim Jahnke
73cf1257ca
Update adventure to 4.13.0 2023-03-15 13:21:52 +01:00
Jake Potrebic
647cf31e61
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fdef9473 Correct Material#isFuel for new experimental materials
42811598 SPIGOT-7293: Add Biome#CHERRY_GROVE

CraftBukkit Changes:
968d28df0 Fix availability of experimental datapack features in unit tests
2023-03-15 04:54:45 -07:00
Nassim Jahnke
3bc992d8f2
Updated Upstream (CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
e1fc95c50 Fix crash with 1.20 smithing table
04dfb921d Fix crash with juke boxes
1264a6fb5 Fix crash with composters
2023-03-15 10:33:43 +01:00
Jake Potrebic
72a9f8a9b8
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
02ff2f89 SPIGOT-7292: Deprecate display color APIs while specifics are worked out

CraftBukkit Changes:
703575fc7 SPIGOT-7291: Fix spurious invert in ender pearl disconnect check
2023-03-14 22:27:45 -07:00
Jake Potrebic
92a019385d
HIDE_UPGRADES and fixes for sniffer and new smithing table 2023-03-14 20:04:41 -07:00
Jake Potrebic
28d49a1b58
Fix jukeboxes 2023-03-14 19:17:28 -07:00
Jake Potrebic
2c485d1485
Fix composter throwing UOE with new game event 2023-03-14 18:27:20 -07:00
Jake Potrebic
ffab9f2bc1
Add back item entity global player list check 2023-03-14 17:36:12 -07:00
Jake Potrebic
482dfc2db0
make tests work again 2023-03-14 17:21:35 -07:00
Jake Potrebic
b93379bd7f
Add missing annotation 2023-03-14 17:08:41 -07:00
Jake Potrebic
3e54639d9c
readd exploded block state patch 2023-03-14 17:06:28 -07:00
Jake Potrebic
c225146bc9
Add component methods to TextDisplay entity 2023-03-14 16:52:28 -07:00
Jake Potrebic
94604b6474
Fix icon in timings 2023-03-14 16:44:53 -07:00
Jake Potrebic
dbeef458b2
make tests pass 2023-03-14 16:29:38 -07:00
Jake Potrebic
0f17027652
fix more compile errors 2023-03-14 16:10:18 -07:00
Jake Potrebic
72923817d6
fix some compile errors 2023-03-14 15:13:41 -07:00
Nassim Jahnke
7954d96905
One fix 2023-03-14 22:35:03 +01:00
Nassim Jahnke
7d24f2ef06
Applied all patches 2023-03-14 22:29:14 +01:00
Nassim Jahnke
18d51375b8
More more more more more more more more patches 2023-03-14 22:10:53 +01:00
Nassim Jahnke
1295869b43
More more more more more more more patches 2023-03-14 21:58:00 +01:00
Jake Potrebic
bacf389fc3
Use adventure serializer when serializing an adventure component in a codec (#8967) 2023-03-14 21:27:18 +01:00
Nassim Jahnke
9dccea73fb
More more more more more more patches 2023-03-14 21:25:13 +01:00
Nassim Jahnke
0f5c422d24
More more more more more patches 2023-03-14 20:54:57 +01:00
Jake Potrebic
f4c92b410c
Add more experimental annotations 2023-03-14 12:53:01 -07:00
Nassim Jahnke
0e2d6d6550
More more more more patches 2023-03-14 20:24:52 +01:00
Nassim Jahnke
bdeb519d1b
More more more patches 2023-03-14 19:59:51 +01:00
Jake Potrebic
562e74263b
update adventure docs link in bungeecord-chat javadocs 2023-03-14 11:59:28 -07:00
Jake Potrebic
8149f115ef
update reobf-mappings-patch.tiny 2023-03-14 11:47:04 -07:00
Nassim Jahnke
9a731dc325
More more patches 2023-03-14 19:38:47 +01:00
Jake Potrebic
cf4eac0a17
mark experimental api correctly and add missing isFuel 2023-03-14 11:08:41 -07:00
Nassim Jahnke
2b6be6f1b3
More patches 2023-03-14 19:05:23 +01:00
Nassim Jahnke
2cd29ddbb5
API 'done' 2023-03-14 18:21:11 +01:00
Nassim Jahnke
2ed604cf72
Start working on 1.19.4 2023-03-14 18:11:24 +01:00
Jake Potrebic
155aa36d89
Properly handle load before plugins in legacy loading (#8962) 2023-03-12 11:00:02 -07:00
Moulberry
18470db17f
Fix getTargetEntity not targeting creative players (#8960) 2023-03-12 12:50:02 +00:00
Jake Potrebic
4e994669d3
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8874)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6b3c598b PR-814: Add a method to send multiple equipment changes
181a984b Update Maven shade version to align with CraftBukkit
a5a36e32 Revert "Update Maven shade version to align with CraftBukkit"
7a8f4a42 Update Maven shade version to align with CraftBukkit
58327201 Add support for Java 20

CraftBukkit Changes:
b56426c7a PR-1142: Calculate explosion damage separately for each affected EntityComplexPart
fbe3410af PR-1140: Add a method to send multiple equipment changes
8434e3633 Add support for Java 20
c998a1d23 Increase outdated build delay
4a929b5d6 SPIGOT-7267: Fix EntityType#getTranslationKey() and add unit test
086d8dc8a SPIGOT-7268: CraftMetaPotion reads ShowParticles and ShowIcon properties incorrectly
8ba5e399e SPIGOT-7262: Improve visibility API

Spigot Changes:
a2190e30 Rebuild patches
2023-03-10 12:18:50 -08:00
Owen
4d7269e07c
Correctly Remove Classloaders, Avoid Loading Providers in /paper dumpplugins, Fix library lookup (#8938) 2023-03-06 18:20:11 -06:00
Owen
bf2053a156
Fix Player#setPlayerProfile (#8939) 2023-03-06 17:15:25 -06:00
Jake Potrebic
27c05030e5
Correctly handle ArmorStand invisibility (#8944) 2023-03-06 10:17:03 -08:00
Jake Potrebic
5cc78f2b6f
Use configured log prefix for spigot library loading (#7934) 2023-03-05 11:02:52 -08:00
Noah van der Aa
6f57163e4a
Add CompostItemEvent and EntityCompostItemEvent (#6356) 2023-03-05 11:59:48 -06:00
Noah van der Aa
75280ef51c
Fix cancelling EntityDeathEvent for Armor Stands killed by players (#6478) 2023-03-05 11:48:34 -06:00
Jake Potrebic
541753be25
Fix HumanEntity#drop not updating the client inventory (#6761) 2023-03-04 14:57:02 -08:00
Lulu13022002
e5e75dd008
Include previous spawn angle in SpawnChangeEvent (#8606) 2023-03-04 16:42:10 -06:00
Lulu13022002
f2075c4d3c
Take in account waterlogged block for the event (#8623)
There's some inconsistencies between the EntityChangeBlockEvent and the BlockDestroyEvent. The destroy event has always the right final type but the change block event has always air even for waterlogged blocks. This fix this behavior only for possible case to avoid a bigger patch.
2023-03-04 16:35:26 -06:00
Lulu13022002
3dcf4e4198
Add EntityFertilizeEggEvent (#8041) 2023-03-04 16:23:32 -06:00
Owen
d30cda1273
Add TeleportFlags (#8855)
Abstracts relative teleport flags and instead makes a generic TeleportFlag option. This has the benefit of being able to easily add new flags in the future.
This adds a new flag, which allows you to keep inventories open when teleporting players (vanilla behavior).

These are breaking changes to the teleport api, however, it's still marked as experimental so I find this a fair change.
2023-03-04 16:07:23 -06:00
Moros
8a815a0eae
Fix rendering for translatable death messages (#8534) 2023-03-04 15:56:38 -06:00
Glare
4151f752f1
/paper entity list QOL improvements (#8876)
This PR implements a QOL feature to /paper entity list <entity> where it will allow a user to teleport to chunk.
2023-03-04 15:35:07 -06:00
Jason Penilla
a172880e7d
Update ForgeFlower to 2.0.627.2, fixes dev bundle not applying with Java 19 runtime 2023-03-04 12:01:07 -07:00
Jake Potrebic
e57441254d
Replace ConfiguredStructure api with Structure (#8642) 2023-02-28 08:36:01 -08:00
Viktor Hrekh
f408c253ec
Log message if plugin bootstrap provided external plugin instead of throwing an exception (#8914) 2023-02-28 13:17:49 +01:00
Warrior
dead691e8c
Fix MC-157464 Prevent sleeping villagers moving towards food (#8923) 2023-02-28 13:14:17 +01:00
Lulu13022002
5170d6f159
Update the flag when a captured block state is outdated (#8860) 2023-02-28 13:13:59 +01:00
Emily
b670798876
Close plugin jar file on classloader close and after retrieving name for updating (#8902) 2023-02-28 12:34:33 +01:00
Nassim Jahnke
4ae202eb82
Fix getBlockStateIfLoaded world bounds check
Closes #8922
2023-02-28 12:27:38 +01:00
Jake Potrebic
08e6622b81
fix runServer tasks 2023-02-27 16:30:33 -08:00
Jason
83a1304b37
[ci skip] Update Gradle wrapper to 8.0.1 (#8924) 2023-02-27 15:30:04 -07:00
Nassim Jahnke
ad3e1bc121
Don't log or die on cyclic dependencies of Spigot plugins 2023-02-27 12:09:10 +01:00
Chris
9256248567
[ci skip] Update README and CONTRIBUTING (#8917)
Grammar fixes and other updates
2023-02-26 12:37:41 -07:00
Jason
16fc1a175e
Make PluginProviderContext#getLogger return ComponentLogger, remove PluginProviderContext#getSLF4JLogger (#8921) 2023-02-26 12:13:15 -07:00
Jake Potrebic
fc072c0954
Fix forced respawn with respawn anchor (#8845) 2023-02-26 09:38:42 -08:00
SoSeDiK
2f953a8843
Additional ExplosiveMinecart API (#8896) 2023-02-26 08:01:43 -08:00
Noah van der Aa
e2b8e6b548
chore: update adventure documentation url in javadocs (#8912) 2023-02-26 08:00:55 -08:00
Jake Potrebic
ed44f69c9b
Fix NamespacedKey#equals not accepting other Key types (#8919) 2023-02-26 06:59:52 -08:00
Owen
81d7ff6e31
Properly re-add providers when reloading (#8881) 2023-02-23 12:58:50 -05:00
Nassim Jahnke
88367398d9
Update adventure doc links 2023-02-23 17:55:36 +01:00
Nassim Jahnke
c7a82c1a50
Clean up hopper optimization patch 2023-02-23 17:37:56 +01:00
3097 geänderte Dateien mit 309244 neuen und 226938 gelöschten Zeilen

Datei anzeigen

@ -4,6 +4,10 @@ end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4
ij_any_block_comment_add_space = false
ij_any_block_comment_at_first_column = false
ij_any_line_comment_at_first_column = false
ij_any_line_comment_add_space = true
[*.tiny]
indent_style=tab
@ -16,3 +20,23 @@ indent_size=2
[*.patch]
trim_trailing_whitespace=false
[*.java]
ij_continuation_indent_size = 4
ij_java_class_count_to_use_import_on_demand = 999999
ij_java_insert_inner_class_imports = false
ij_java_names_count_to_use_import_on_demand = 999999
ij_java_imports_layout = *,|,$*
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true
ij_java_method_parameters_new_line_after_left_paren = true
ij_java_method_parameters_right_paren_on_new_line = true
[test-plugin/**/*.java]
ij_java_use_fq_class_names = false
[Paper-Server/src/main/resources/data/**/*.json]
indent_size = 2
[paper-api-generator/generated/**/*.java]
ij_java_imports_layout = $*,|,*

2
.gitattributes vendored
Datei anzeigen

@ -1,4 +1,4 @@
* text=auto
* text=auto eol=lf
*.sh text eol=lf
gradlew text eol=lf

42
.github/DISCUSSION_TEMPLATE/ideas.yml vendored Normale Datei
Datei anzeigen

@ -0,0 +1,42 @@
labels: ["status: needs triage"]
body:
- type: markdown
attributes:
value: |
Thank you for filling out a feature request for Paper! Please be as detailed as possible so that we may consider and review the request easier.
We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add.
Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in Paper.
- type: textarea
attributes:
label: Is your feature request related to a problem?
description: Please give some context for this request. Why do you want it added?
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like.
description: A clear and concise description of what you want.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered.
description: List any alternatives you might have tried to get the feature you want.
validations:
required: true
- type: textarea
attributes:
label: Other
description: Add any other context or screenshots about the feature request below.
validations:
required: false
- type: markdown
attributes:
value: |
Before submitting this feature request, please search our issue tracker to ensure your feature has not
already been requested.

Datei anzeigen

@ -44,10 +44,10 @@ body:
```
> version
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
[20:34:42 INFO]: Checking version, please wait...
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
[20:34:42 INFO]: You are running the latest version
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
```
</details>
@ -68,7 +68,7 @@ body:
value: |
Before submitting this issue, please ensure the following:
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads).
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads/paper).
2. You searched for and ensured there isn't already an open issue regarding this.
3. Your version of Minecraft is supported by Paper.

Datei anzeigen

@ -1,8 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Feature Request
url: https://github.com/PaperMC/Paper/discussions/new?category=ideas
about: Suggest an idea for Paper
- name: PaperMC Discord
url: https://discord.gg/papermc
about: If you are having issues with timings or have other minor issues, come ask us on our Discord server!
about: If you are having issues with spark or have other minor issues, come ask us on our Discord server!
- name: Exploit Report
url: https://discord.gg/papermc
about: |

Datei anzeigen

@ -1,44 +0,0 @@
name: Feature Request
description: Suggest an idea for Paper
labels: [ "status: needs triage", "type: feature" ]
body:
- type: markdown
attributes:
value: |
Thank you for filling out a feature request for Paper! Please be as detailed as possible so that we may consider and review the request easier.
We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add.
Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in Paper.
- type: textarea
attributes:
label: Is your feature request related to a problem?
description: Please give some context for this request. Why do you want it added?
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like.
description: A clear and concise description of what you want.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered.
description: List any alternatives you might have tried to get the feature you want.
validations:
required: true
- type: textarea
attributes:
label: Other
description: Add any other context or screenshots about the feature request below.
validations:
required: false
- type: markdown
attributes:
value: |
Before submitting this feature request, please search our issue tracker to ensure your feature has not
already been requested.

Datei anzeigen

@ -10,9 +10,9 @@ body:
- type: input
attributes:
label: Timings or Profile link
description: We ask that all timings/profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.
placeholder: "Example: https://timings.aikar.co/?id=6b48586fbbdd48e585ca0ebb07c59dd0"
label: Profile link
description: We ask that all profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.
placeholder: "Example: https://spark.lucko.me/XsN0hxGfsi"
validations:
required: true
@ -56,10 +56,10 @@ body:
```
> version
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
[20:34:42 INFO]: Checking version, please wait...
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
[20:34:42 INFO]: You are running the latest version
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
```
</details>
@ -79,6 +79,6 @@ body:
value: |
Before submitting this issue, please ensure the following:
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads).
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads/paper).
2. You searched for and ensured there isn't already an open issue regarding this.
3. Your version of Minecraft is supported by Paper.

Datei anzeigen

@ -44,10 +44,10 @@ body:
```
> version
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
[20:34:42 INFO]: Checking version, please wait...
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
[20:34:42 INFO]: You are running the latest version
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
```
</details>
@ -68,7 +68,7 @@ body:
value: |
Before submitting this issue, please ensure the following:
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads).
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads/paper).
2. Your version of Minecraft is supported by Paper.
If your server crash log contains `DO NOT REPORT THIS TO PAPER`, please ask in our

Datei anzeigen

@ -21,28 +21,41 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [17]
java: [21]
fail-fast: true
steps:
- uses: actions/checkout@v3
- if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
- if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: JDK ${{ matrix.java }}
uses: actions/setup-java@v3.6.0
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
distribution: 'zulu'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/actions/setup-gradle@v3
- name: Configure Build
uses: actions/github-script@v6
uses: actions/github-script@v7
id: determine
env:
REF_NAME: "${{ github.ref_name }}"
REF_TYPE: "${{ github.ref_type }}"
EVENT: "${{ toJSON(github.event) }}"
EVENT_TYPE: "${{ github.event_name }}"
with:
script: |
const {owner, repo} = context.repo;
const event_name = "${{ github.event_name }}";
const event = ${{ toJSON(github.event) }};
const ref_type = "${{ github.ref_type }}";
const ref_name = "${{ github.ref_name }}";
const event_name = `${process.env.EVENT_TYPE}`;
const event = JSON.parse(`${process.env.EVENT}`);
const ref_type = `${process.env.REF_TYPE}`;
const ref_name = `${process.env.REF_NAME}`;
const result = {
action: "build"
};
@ -68,19 +81,38 @@ jobs:
- name: Apply Patches
run: |
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 --stacktrace
- name: Build
run: ./gradlew build --stacktrace
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (${{ matrix.java }})
path: |
**/build/test-results/test/TEST-*.xml
- name: Create Paperclip Jar
if: fromJSON(steps.determine.outputs.result).action == 'paperclip'
run: ./gradlew createReobfPaperclipJar --stacktrace
run: ./gradlew createMojmapPaperclipJar --stacktrace
- name: Upload Paperclip Jar
if: fromJSON(steps.determine.outputs.result).action == 'paperclip'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: paper-${{ fromJSON(steps.determine.outputs.result).pr }}
path: build/libs/paper-paperclip-*-reobf.jar
path: build/libs/paper-paperclip-*-mojmap.jar
event_file:
name: "Event File"
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}

Datei anzeigen

@ -6,9 +6,22 @@ on:
jobs:
run:
if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'master' }}
if: |
github.repository != github.event.pull_request.head.repo.full_name &&
(
github.head_ref == 'master' ||
github.event.pull_request.head.repo.owner.type != 'User'
)
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
id: "master_branch"
if: github.head_ref == 'master'
with:
comment: "Please do not open pull requests from the `master` branch, create a new branch instead."
- uses: superbrothers/close-pull-request@v3
id: "org_account"
if: github.event.pull_request.head.repo.owner.type != 'User' && steps.master_branch.outcome == 'skipped'
with:
comment: "Please do not open pull requests from non-user accounts like organizations. Create a fork on a user account instead."

Datei anzeigen

@ -17,7 +17,15 @@ jobs:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
env:
BRANCH_NAME: "${{ github.event.workflow_run.head_branch }}"
PR_OWNER: "${{ github.event.workflow_run.head_repository.owner.login }}"
PR_SHA: "${{ github.event.workflow_run.head_sha }}"
RUN_ID: "${{ github.event.workflow_run.id }}"
REPO_ID: "${{ github.event.repository.id }}"
EVENT_TYPE: "${{ github.event.workflow_run.event}}"
PULL_REQUESTS: "${{ toJSON(github.event.workflow_run.pull_requests) }}"
with:
# This snippet is public-domain, taken from
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
@ -37,17 +45,17 @@ jobs:
}
const { owner, repo } = context.repo;
const run_id = ${{ github.event.workflow_run.id }};
const repo_id = ${{ github.event.repository.id }};
const run_id = `${process.env.RUN_ID}`;
const repo_id = `${process.env.REPO_ID}`;
let pulls = [];
const event_type = "${{ github.event.workflow_run.event}}";
const event_type = `${process.env.EVENT_TYPE}`;
if (event_type === "push") { // if push, it's from the same repo which means `pull_requests` is populated
pulls = ${{ toJSON(github.event.workflow_run.pull_requests) }};
pulls = JSON.parse(`${process.env.PULL_REQUESTS}`);
} else {
const pr_branch = "${{ github.event.workflow_run.head_branch }}";
const pr_sha = "${{ github.event.workflow_run.head_sha }}";
const pr_owner = "${{ github.event.workflow_run.head_repository.owner.login }}";
const pr_branch = `${process.env.BRANCH_NAME}`;
const pr_sha = `${process.env.PR_SHA}`;
const pr_owner = `${process.env.PR_OWNER}`;
const { data } = await github.rest.pulls.list({ owner, repo, head: `${pr_owner}:${pr_branch}`, state: "open" });
core.debug(JSON.stringify(data, null, 2));
pulls = data.filter((pr) => pr.head.sha === pr_sha && pr.labels.find((l) => l.name === "build-pr-jar"));

76
.github/workflows/projects.yml vendored Normale Datei
Datei anzeigen

@ -0,0 +1,76 @@
name: Update Projects
on:
issues:
types:
- labeled
- unlabeled
- closed
- reopened
jobs:
bugs:
if: "github.event_name == 'issues' && contains(github.event.*.labels.*.name, 'type: bug')"
concurrency:
group: update-bugs-project-${{ github.event.issue.number }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: "authenticate"
id: "authenticate"
uses: "tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92" # v1
with:
app_id: "${{ secrets.PROJECTS_APP_ID }}"
installation_id: "36153445"
private_key: "${{ secrets.PROJECTS_PRIVATE_KEY }}"
- uses: PaperMC/update-projects-action@v0.2.0
name: Update open issue
if: github.event.issue.state == 'open'
with:
github-token: "${{ steps.authenticate.outputs.token }}"
project-url: https://github.com/orgs/PaperMC/projects/5/views/2
column-field: Status
label-to-column-map: |
{
"resolution: awaiting response": "⌛ Awaiting Response",
"resolution: cannot reproduce": "Invalid",
"resolution: duplicate": "Invalid",
"resolution: incomplete": "Invalid",
"resolution: invalid": "Invalid",
"resolution: superseded": "Invalid",
"resolution: unsupported": "Invalid",
"resolution: won't fix": "Invalid",
"resolution: works as intended": "Invalid",
"status: accepted": "✅ Accepted",
"status: blocked": "Needs Work",
"status: defer upstream": "Needs Work",
"status: in progress": "Needs Work",
"status: input wanted": "Needs Work",
"status: needs triage": "🕑 Needs Triage",
"status: rebase required": "Needs Work",
"status: unlikely": "✅ Accepted"
}
- uses: PaperMC/update-projects-action@v0.2.0
name: Update closed issue
if: github.event.issue.state == 'closed'
with:
github-token: "${{ steps.authenticate.outputs.token }}"
project-url: https://github.com/orgs/PaperMC/projects/5/views/2
column-field: Status
clear-on-no-match: false
# include "status: needs triage" below to catch any closed issues without setting a resolution
label-to-column-map: |
{
"resolution: cannot reproduce": "Invalid",
"resolution: duplicate": "Invalid",
"resolution: incomplete": "Invalid",
"resolution: invalid": "Invalid",
"resolution: superseded": "Invalid",
"resolution: unsupported": "Invalid",
"resolution: won't fix": "Invalid",
"resolution: works as intended": "Invalid",
"status: accepted": "Done",
"status: needs triage": "Invalid"
}

32
.github/workflows/test_results.yml vendored Normale Datei
Datei anzeigen

@ -0,0 +1,32 @@
name: Test Results
on:
workflow_run:
workflows: [ "Build Paper" ]
types:
- completed
permissions: { }
jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
permissions:
checks: write
# for downloading test result artifacts
actions: read
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@v3
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
comment_mode: off

2
.gitignore vendored
Datei anzeigen

@ -61,6 +61,7 @@ out/
# other stuff
run/
logs/
Paper-Server
Paper-API
@ -72,3 +73,4 @@ paperclip.properties
!gradle/wrapper/gradle-wrapper.jar
test-plugin.settings.gradle.kts
paper-api-generator.settings.gradle.kts

Datei anzeigen

@ -4,11 +4,11 @@ PaperMC is happy you're willing to contribute to our projects. We are usually
very lenient with all submitted PRs, but there are still some guidelines you
can follow to make the approval process go more smoothly.
## Use a Personal Fork and not Organization
## Use a Personal Fork and not an Organization
Paper will routinely modify your PR, whether it's a quick rebase or to take care
of any minor nitpicks we might have. Often, it's better for us to solve these
problems for you than make you go back and forth trying to fix it yourself.
problems for you than make you go back and forth trying to fix them yourself.
Unfortunately, if you use an organization for your PR, it prevents Paper from
modifying it. This requires us to manually merge your PR, resulting in us
@ -27,12 +27,12 @@ which can be obtained in (most) package managers such as `apt` (Debian / Ubuntu;
you will most likely use this for WSL), `homebrew` (macOS / Linux), and more:
- `git` (package `git` everywhere);
- A Java 17 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
- A Java 21 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
- [Adoptium](https://adoptium.net/) has builds for most operating systems.
- Paper requires JDK 17 to build, however makes use of Gradle's
- Paper requires JDK 21 to build, however, makes use of Gradle's
[Toolchains](https://docs.gradle.org/current/userguide/toolchains.html)
feature to allow building with only JRE 8 or later installed. (Gradle will
automatically provision JDK 17 for compilation if it cannot find an existing
feature to allow building with only JRE 11 or later installed. (Gradle will
automatically provision JDK 21 for compilation if it cannot find an existing
install).
If you're on Windows, check
@ -42,11 +42,11 @@ If you're compiling with Docker, you can use Adoptium's
[`eclipse-temurin`](https://hub.docker.com/_/eclipse-temurin/) images like so:
```console
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:17.0.1_12-jdk bash
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:21.0.3_9-jdk bash
Pulling image...
root@abcdefg1234:/# javac -version
javac 17.0.1
javac 21.0.3
```
## Understanding Patches
@ -67,7 +67,7 @@ Assuming you have already forked the repository:
1. Clone your fork to your local machine;
2. Type `./gradlew applyPatches` in a terminal to apply the changes from upstream.
On Windows, leave out the `./` at the beginning for all `gradlew` commands;
On Windows, replace the `./` with `.\` at the beginning for all `gradlew` commands;
3. cd into `Paper-Server` for server changes, and `Paper-API` for API changes.
<!--You can also run `./paper server` or `./paper api` for these same directories
respectively.
@ -184,7 +184,7 @@ These steps assume the `origin` remote is your fork of this repository and `upst
1. Checkout feature/fix branch and rebase on master: `git checkout patch-branch && git rebase master`.
1. Apply updated patches: `./gradlew applyPatches`.
1. If there are conflicts, fix them.
1. If your PR creates new patches instead of modifying exist ones, in both the `Paper-Server` and `Paper-API` directories, ensure your newly-created patch is the last commit by either:
1. If your PR creates new patches instead of modifying existing ones, in both the `Paper-Server` and `Paper-API` directories, ensure your newly-created patch is the last commit by either:
* Renaming the patch file with a large 4-digit number in front (e.g. 9999-Patch-to-add-some-new-stuff.patch), and re-applying patches.
* Running `git rebase --interactive base` and moving the commits to the end.
1. Rebuild patches: `./gradlew rebuildPatches`.
@ -204,37 +204,58 @@ when making and submitting changes.
## Formatting
All modifications to non-Paper files should be marked.
All modifications to non-Paper files should be marked. The one exception to this is
when modifying javadoc comments, which should not have these markers.
- Multi-line changes start with `// Paper start` and end with `// Paper end`;
- You can put a comment with an explanation if it isn't obvious, like this:
`// Paper start - reason`.
- The comments should generally be about the reason the change was made, what
it was before, or what the change is.
- Multi-line messages should start with `// Paper start` and use `/* Multi
line message here */` for the message itself.
- One-line changes should have `// Paper` or `// Paper - reason`.
- You need to add a comment with a short and identifiable description of the patch:
`// Paper start - <COMMIT DESCRIPTION>`
- The comments should generally be about the reason the change was made, what
it was before, or what the change is.
- After the general commit description, you can add additional information either
after a `;` or in the next line.
- Multi-line changes start with `// Paper start - <COMMIT DESCRIPTION>` and end
with `// Paper end - <COMMIT DESCRIPTION>`.
- One-line changes should have `// Paper - <COMMIT DESCRIPTION>` at the end of the line.
Here's an example of how to mark changes by Paper:
```java
entity.getWorld().dontbeStupid(); // Paper - was beStupid() which is bad
entity.getWorld().dontBeStupid(); // Paper - Was beStupid(), which is bad
entity.getFriends().forEach(Entity::explode);
entity.a();
entity.b();
// Paper start - use plugin-set spawn
entity.updateFriends();
// Paper start - Use plugin-set spawn
// entity.getWorld().explode(entity.getWorld().getSpawn());
Location spawnLocation = ((CraftWorld)entity.getWorld()).getSpawnLocation();
entity.getWorld().explode(new BlockPosition(spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ()));
// Paper end
// Paper end - Use plugin-set spawn
```
We generally follow usual Java style (aka. Oracle style), or what is programmed
We generally follow the usual Java style (aka. Oracle style), or what is programmed
into most IDEs and formatters by default. There are a few notes, however:
- It is fine to go over 80 lines as long as it doesn't hurt readability.
There are exceptions, especially in Spigot-related files
- When in doubt or the code around your change is in a clearly different style,
use the same style as the surrounding code.
- Usage of the `var` keyword is heavily discouraged, as it makes reading patch files
a lot harder and can lead to confusion during updates due to changed return types.
The only exception to this is if a line would otherwise be way too long/filled with
hard to parse generics in a case where the base type itself is already obvious
### Imports
When adding new imports to a class in a file not created by the current patch, use the fully qualified class name
instead of adding a new import to the top of the file. If you are using a type a significant number of times, you
can add an import with a comment. However, if its only used a couple of times, the FQN is preferred to prevent future
patch conflicts in the import section of the file.
```java
import org.bukkit.event.Event;
// don't add import here, use FQN like below
public class SomeEvent extends Event {
public final org.bukkit.Location newLocation; // Paper - add location
}
```
## Access Transformers
Sometimes, vanilla or CraftBukkit code already contains a field, method, or type you want to access
@ -302,7 +323,7 @@ Subject: [PATCH] revert serverside behavior of keepalives
This patch intends to bump up the time that a client has to reply to the
server back to 30 seconds as per pre 1.12.2, which allowed clients
more than enough time to reply potentially allowing them to be less
tempermental due to lag spikes on the network thread, e.g. that caused
temperamental due to lag spikes on the network thread, e.g. that caused
by plugins that are interacting with netty.
We also add a system property to allow people to tweak how long the server
@ -478,4 +499,4 @@ everything like usual.
> in Windows like described here:
> <https://docs.microsoft.com/en-us/windows/wsl/filesystems#view-your-current-directory-in-windows-file-explorer>
[MappingViewer]: https://nms.screamingsandals.org/
[MappingViewer]: https://mappings.cephx.dev/

Datei anzeigen

@ -55,4 +55,13 @@ TheFruxz <cedricspitzer@outlook.de>
Kieran Wallbanks <kieran.wallbanks@gmail.com>
Denery <dorofeevij@gmail.com>
Jakubk15 <jakubk15@protonmail.com>
Redned <redned235@gmail.com>
Luke Chambers <consolelogluke@gmail.com>
Emily <emilia.lopezf.1999@gmail.com>
dawon <dawon@dawon.eu>
Ollie <69084614+olijeffers0n@users.noreply.github.com>
Oliwier Miodun <naczs@blueflow.pl>
aerulion <aerulion@gmail.com>
Lukas Planz <lukas.planz@web.de>
granny <contact@granny.dev>
```

Datei anzeigen

@ -1,36 +0,0 @@
plugins {
`java-library`
`maven-publish`
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
implementation(project(":paper-api"))
api("com.mojang:brigadier:1.0.18")
compileOnly("it.unimi.dsi:fastutil:8.5.6")
compileOnly("org.jetbrains:annotations:23.0.0")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.ow2.asm:asm-tree:9.2")
}
configure<PublishingExtension> {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}
tasks.check {
dependsOn(scanJar)
}

Datei anzeigen

@ -1,14 +0,0 @@
package com.destroystokyo.paper.brigadier;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import java.util.function.Predicate;
/**
* Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s.
*
* @param <S> command source type
*/
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
}

Datei anzeigen

@ -1,21 +0,0 @@
package com.destroystokyo.paper.brigadier;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.Nullable;
public interface BukkitBrigadierCommandSource {
@Nullable
Entity getBukkitEntity();
@Nullable
World getBukkitWorld();
@Nullable
Location getBukkitLocation();
CommandSender getBukkitSender();
}

Datei anzeigen

@ -1,72 +0,0 @@
package com.destroystokyo.paper.event.brigadier;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.mojang.brigadier.tree.RootCommandNode;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands.
* You may manipulate this CommandNode to change what the client sees.
*
* <p>This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.</p>
*
* <p>This event will fire before {@link org.bukkit.event.player.PlayerCommandSendEvent}, so no filtering has been done by
* other plugins yet.</p>
*
* <p>WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync.
* It is important that you check event.isAsynchronous() and event.hasFiredAsync() to ensure you only act once.
* If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.</p>
*
* <p>Your logic should look like this:
* {@code if (event.isAsynchronous() || !event.hasFiredAsync()) { // do stuff }}</p>
*
* <p>If your logic is not safe to run asynchronously, only react to the synchronous version.</p>
*
* <p>This is a draft/experimental API and is subject to change.</p>
*/
@ApiStatus.Experimental
public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
private final RootCommandNode<S> node;
private final boolean hasFiredAsync;
public AsyncPlayerSendCommandsEvent(Player player, RootCommandNode<S> node, boolean hasFiredAsync) {
super(player, !Bukkit.isPrimaryThread());
this.node = node;
this.hasFiredAsync = hasFiredAsync;
}
/**
* Gets the full Root Command Node being sent to the client, which is mutable.
*
* @return the root command node
*/
public RootCommandNode<S> getCommandNode() {
return node;
}
/**
* Gets if this event has already fired asynchronously.
*
* @return whether this event has already fired asynchronously
*/
public boolean hasFiredAsync() {
return hasFiredAsync;
}
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

Datei anzeigen

@ -1,84 +0,0 @@
package com.destroystokyo.paper.event.brigadier;
import com.mojang.brigadier.suggestion.Suggestions;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
/**
* Called when sending {@link Suggestions} to the client. Will be called asynchronously if a plugin
* marks the {@link com.destroystokyo.paper.event.server.AsyncTabCompleteEvent} event handled asynchronously,
* otherwise called synchronously.
*/
public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private Suggestions suggestions;
private final String buffer;
public AsyncPlayerSendSuggestionsEvent(Player player, Suggestions suggestions, String buffer) {
super(player, !Bukkit.isPrimaryThread());
this.suggestions = suggestions;
this.buffer = buffer;
}
/**
* Gets the input buffer sent to request these suggestions.
*
* @return the input buffer
*/
public String getBuffer() {
return buffer;
}
/**
* Gets the suggestions to be sent to client.
*
* @return the suggestions
*/
public Suggestions getSuggestions() {
return suggestions;
}
/**
* Sets the suggestions to be sent to client.
*
* @param suggestions suggestions
*/
public void setSuggestions(Suggestions suggestions) {
this.suggestions = suggestions;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Cancels sending suggestions to the client.
* {@inheritDoc}
*/
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

Datei anzeigen

@ -1,168 +0,0 @@
package com.destroystokyo.paper.event.brigadier;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommand;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.mojang.brigadier.tree.RootCommandNode;
import org.bukkit.command.Command;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.server.ServerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired anytime the server synchronizes Bukkit commands to Brigadier.
*
* <p>Allows a plugin to control the command node structure for its commands.
* This is done at Plugin Enable time after commands have been registered, but may also
* run at a later point in the server lifetime due to plugins, a server reload, etc.</p>
*
* <p>This is a draft/experimental API and is subject to change.</p>
*/
@ApiStatus.Experimental
public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final String commandLabel;
private final Command command;
private final BukkitBrigadierCommand<S> brigadierCommand;
private final RootCommandNode<S> root;
private final ArgumentCommandNode<S, String> defaultArgs;
private LiteralCommandNode<S> literal;
private boolean rawCommand = false;
private boolean cancelled = false;
public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
this.commandLabel = commandLabel;
this.brigadierCommand = brigadierCommand;
this.command = command;
this.root = root;
this.literal = literal;
this.defaultArgs = defaultArgs;
}
/**
* Gets the command label of the {@link Command} being registered.
*
* @return the command label
*/
public String getCommandLabel() {
return this.commandLabel;
}
/**
* Gets the {@link BukkitBrigadierCommand} for the {@link Command} being registered. This can be used
* as the {@link com.mojang.brigadier.Command command executor} or
* {@link com.mojang.brigadier.suggestion.SuggestionProvider} of a {@link com.mojang.brigadier.tree.CommandNode}
* to delegate to the {@link Command} being registered.
*
* @return the {@link BukkitBrigadierCommand}
*/
public BukkitBrigadierCommand<S> getBrigadierCommand() {
return this.brigadierCommand;
}
/**
* Gets the {@link Command} being registered.
*
* @return the {@link Command}
*/
public Command getCommand() {
return this.command;
}
/**
* Gets the {@link RootCommandNode} which is being registered to.
*
* @return the {@link RootCommandNode}
*/
public RootCommandNode<S> getRoot() {
return this.root;
}
/**
* Gets the Bukkit APIs default arguments node (greedy string), for if
* you wish to reuse it.
*
* @return default arguments node
*/
public ArgumentCommandNode<S, String> getDefaultArgs() {
return this.defaultArgs;
}
/**
* Gets the {@link LiteralCommandNode} to be registered for the {@link Command}.
*
* @return the {@link LiteralCommandNode}
*/
public LiteralCommandNode<S> getLiteral() {
return this.literal;
}
/**
* Sets the {@link LiteralCommandNode} used to register this command. The default literal is mutable, so
* this is primarily if you want to completely replace the object.
*
* @param literal new node
*/
public void setLiteral(LiteralCommandNode<S> literal) {
this.literal = literal;
}
/**
* Gets whether this command should is treated as "raw".
*
* @see #setRawCommand(boolean)
* @return whether this command is treated as "raw"
*/
public boolean isRawCommand() {
return this.rawCommand;
}
/**
* Sets whether this command should be treated as "raw".
*
* <p>A "raw" command will only use the node provided by this event for
* sending the command tree to the client. For execution purposes, the default
* greedy string execution of a standard Bukkit {@link Command} is used.</p>
*
* <p>On older versions of Paper, this was the default and only behavior of this
* event.</p>
*
* @param rawCommand whether this command should be treated as "raw"
*/
public void setRawCommand(final boolean rawCommand) {
this.rawCommand = rawCommand;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isCancelled() {
return this.cancelled;
}
/**
* Cancels registering this command to Brigadier, but will remain in Bukkit Command Map. Can be used to hide a
* command from all players.
*
* {@inheritDoc}
*/
@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}

Datei anzeigen

@ -1,42 +0,0 @@
package io.papermc.paper.brigadier;
import com.mojang.brigadier.Message;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import net.kyori.adventure.text.TextComponent;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Helper methods to bridge the gaps between Brigadier and Paper-MojangAPI.
*/
public final class PaperBrigadier {
private PaperBrigadier() {
throw new RuntimeException("PaperBrigadier is not to be instantiated!");
}
/**
* Create a new Brigadier {@link Message} from a {@link ComponentLike}.
*
* <p>Mostly useful for creating rich suggestion tooltips in combination with other Paper-MojangAPI APIs.</p>
*
* @param componentLike The {@link ComponentLike} to use for the {@link Message} contents
* @return A new Brigadier {@link Message}
*/
public static @NonNull Message message(final @NonNull ComponentLike componentLike) {
return PaperBrigadierProvider.instance().message(componentLike);
}
/**
* Create a new {@link Component} from a Brigadier {@link Message}.
*
* <p>If the {@link Message} was created from a {@link Component}, it will simply be
* converted back, otherwise a new {@link TextComponent} will be created with the
* content of {@link Message#getString()}</p>
*
* @param message The {@link Message} to create a {@link Component} from
* @return The created {@link Component}
*/
public static @NonNull Component componentFromMessage(final @NonNull Message message) {
return PaperBrigadierProvider.instance().componentFromMessage(message);
}
}

Datei anzeigen

@ -1,30 +0,0 @@
package io.papermc.paper.brigadier;
import com.mojang.brigadier.Message;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.ComponentLike;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import static java.util.Objects.requireNonNull;
interface PaperBrigadierProvider {
final class Holder {
private static @MonotonicNonNull PaperBrigadierProvider INSTANCE;
}
static @NonNull PaperBrigadierProvider instance() {
return requireNonNull(Holder.INSTANCE, "PaperBrigadierProvider has not yet been initialized!");
}
static void initialize(final @NonNull PaperBrigadierProvider instance) {
if (Holder.INSTANCE != null) {
throw new IllegalStateException("PaperBrigadierProvider has already been initialized!");
}
Holder.INSTANCE = instance;
}
@NonNull Message message(@NonNull ComponentLike componentLike);
@NonNull Component componentFromMessage(@NonNull Message message);
}

Datei anzeigen

@ -4,48 +4,47 @@ Paper [![Paper Build Status](https://img.shields.io/github/actions/workflow/stat
[![Open Collective](https://img.shields.io/opencollective/all/papermc?label=OpenCollective%20Sponsors)](https://opencollective.com/papermc)
===========
High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies.
The most widely used, high-performance Minecraft server that aims to fix gameplay and mechanics inconsistencies.
**Support and Project Discussion:**
- [Our forums](https://forums.papermc.io/), [Discord](https://discord.gg/papermc), or [IRC](https://webchat.esper.net/?channels=paper)
- [Our forums](https://forums.papermc.io/) or [Discord](https://discord.gg/papermc)
How To (Server Admins)
------
Paperclip is a jar file that you can download and run just like a normal jar file.
Download Paper from our [downloads page](https://papermc.io/downloads).
Download Paper from our [downloads page](https://papermc.io/downloads/paper).
Run the Paperclip jar directly from your server. Just like old times
* Documentation on using Paper: [docs.papermc.io](https://docs.papermc.io)
* For a sneak peek at upcoming features, [see here](https://github.com/PaperMC/Paper/projects)
* Documentation on using Paper: [docs.papermc.io](https://docs.papermc.io)
* For a sneak peek at upcoming features, [see here](https://github.com/PaperMC/Paper/projects)
How To (Plugin Developers)
------
* See our API patches [here](patches/api)
* See upcoming, pending, and recently added API [here](https://github.com/PaperMC/Paper/projects/6)
* Paper API javadocs here: [papermc.io/javadocs](https://papermc.io/javadocs/)
* Maven Repo (for paper-api):
* See our API patches [here](patches/api)
* See upcoming, pending, and recently added API [here](https://github.com/orgs/PaperMC/projects/2/views/4)
* Paper API javadocs here: [papermc.io/javadocs](https://papermc.io/javadocs/)
#### Repository (for paper-api)
##### Maven
```xml
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
```
* Artifact Information:
```xml
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```
**Or alternatively, with Gradle:**
* Repository:
```
##### Gradle
```kotlin
repositories {
maven {
@ -54,19 +53,19 @@ repositories {
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
```
How To (Compiling Jar From Source)
------
To compile Paper, you need JDK 17 and an internet connection.
To compile Paper, you need JDK 21 and an internet connection.
Clone this repo, run `./gradlew applyPatches`, then `./gradlew createReobfBundlerJar` from your terminal. You can find the compiled jar in the project root's `build/libs` directory.
Clone this repo, run `./gradlew applyPatches`, then `./gradlew createMojmapBundlerJar` from your terminal. You can find the compiled jar in the project root's `build/libs` directory.
To get a full list of tasks, run `./gradlew tasks`.
@ -76,9 +75,9 @@ See [Contributing](CONTRIBUTING.md)
Support Us
------
First of all, thank you for considering helping out, we really appreciate that!
First of all, thank you for considering helping out, we really appreciate that!
PaperMC has various recurring expenses, mostly related to infrastructure. Paper uses [Open Collective](https://opencollective.com/) via the [Open Source Collective fiscal host](https://opencollective.com/opensource) to manage expenses. Open Collective allows us to be extremely transparent, so you can always see how your donations are used. You can read more about financially supporting PaperMC [on our website](https://papermc.io/sponsors).
PaperMC has various recurring expenses, mostly related to infrastructure. Paper uses [Open Collective](https://opencollective.com/) via the [Open Source Collective fiscal host](https://opencollective.com/opensource) to manage expenses. Open Collective allows us to be extremely transparent, so you can always see how your donations are used. You can read more about financially supporting PaperMC [on our website](https://papermc.io/sponsors).
You can find our collective [here](https://opencollective.com/papermc), or you can donate via GitHub Sponsors [here](https://github.com/sponsors/PaperMC), which will also go towards the collective.

Datei anzeigen

@ -8,3 +8,8 @@
# 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
# To import minecraft data files, like the default chat type, use `mc_data` as the prefix:
# mc_data chat_type/chat.json
# mc_data dimension_type/overworld.json
#

Datei anzeigen

@ -12,3 +12,7 @@ public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/Tick
# AT remap issue? todo 1.18
public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch;
public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag;
# TODO 1.20 remapSpigotAt.at doesn't remap the return type for this method for some reason
public net/minecraft/world/entity/Display$TextDisplay getText()Lnet/minecraft/network/chat/Component;
public net/minecraft/world/entity/Display$BlockDisplay getBlockState()Lnet/minecraft/world/level/block/state/BlockState;

Datei anzeigen

@ -14,15 +14,15 @@ tiny 2 0 mojang+yarn spigot
# CraftBukkit changes type
c net/minecraft/server/level/ServerLevel net/minecraft/server/level/WorldServer
f Lnet/minecraft/world/level/storage/PrimaryLevelData; serverLevelData N
f Lnet/minecraft/world/level/storage/PrimaryLevelData; serverLevelData K
c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chunk
f Lnet/minecraft/server/level/ServerLevel; level q
f Lnet/minecraft/server/level/ServerLevel; level r
# See mappings-patch.tiny
c net/minecraft/server/level/ChunkMap net/minecraft/server/level/PlayerChunkMap
f Lnet/minecraft/server/level/ChunkMap$ChunkDistanceManager; distanceManager G
# Paper changes type
c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials
f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId e
# The method is made public by Spigot, which then causes accidental overrides
c net/minecraft/world/entity/Entity net/minecraft/world/entity/Entity
m ()Z isInRain isInRain0

Datei anzeigen

@ -1,11 +1,17 @@
import io.papermc.paperweight.PaperweightException
import io.papermc.paperweight.tasks.BaseTask
import io.papermc.paperweight.util.*
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.io.ByteArrayOutputStream
import java.nio.file.Path
import java.util.regex.Pattern
import kotlin.io.path.*
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
id("io.papermc.paperweight.core") version "1.5.1"
id("io.papermc.paperweight.core") version "1.7.1"
}
allprojects {
@ -14,7 +20,7 @@ allprojects {
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion = JavaLanguageVersion.of(21)
}
}
}
@ -24,7 +30,7 @@ val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
subprojects {
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
options.release = 21
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
@ -61,31 +67,31 @@ repositories {
}
dependencies {
paramMappings("net.fabricmc:yarn:1.19.3+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
decompiler("net.minecraftforge:forgeflower:2.0.605.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")
paperclip("io.papermc:paperclip:3.0.2")
paramMappings("net.fabricmc:yarn:1.21.1+build.3:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
decompiler("org.vineflower:vineflower:1.10.1")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")
paperclip("io.papermc:paperclip:3.0.3")
}
paperweight {
minecraftVersion.set(providers.gradleProperty("mcVersion"))
serverProject.set(project(":paper-server"))
minecraftVersion = providers.gradleProperty("mcVersion")
serverProject = project(":paper-server")
paramMappingsRepo.set(paperMavenPublicUrl)
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
paramMappingsRepo = paperMavenPublicUrl
remapRepo = paperMavenPublicUrl
decompileRepo = paperMavenPublicUrl
craftBukkit {
fernFlowerJar.set(layout.file(spigotDecompiler.elements.map { it.single().asFile }))
fernFlowerJar = layout.file(spigotDecompiler.elements.map { it.single().asFile })
}
paper {
spigotApiPatchDir.set(layout.projectDirectory.dir("patches/api"))
spigotServerPatchDir.set(layout.projectDirectory.dir("patches/server"))
spigotApiPatchDir = layout.projectDirectory.dir("patches/api")
spigotServerPatchDir = layout.projectDirectory.dir("patches/server")
mappingsPatch.set(layout.projectDirectory.file("build-data/mappings-patch.tiny"))
reobfMappingsPatch.set(layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny"))
mappingsPatch = layout.projectDirectory.file("build-data/mappings-patch.tiny")
reobfMappingsPatch = layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny")
reobfPackagesToFix.addAll(
"co.aikar.timings",
@ -102,8 +108,7 @@ paperweight {
}
tasks.generateDevelopmentBundle {
apiCoordinates.set("io.papermc.paper:paper-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
apiCoordinates = "io.papermc.paper:paper-api"
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
@ -131,11 +136,6 @@ allprojects {
}
}
tasks.collectAtsFromPatches {
// Uncomment while updating for a new Minecraft version
//extraPatchDir.set(layout.projectDirectory.dir("patches/unapplied/server"))
}
tasks.register("printMinecraftVersion") {
doLast {
println(providers.gradleProperty("mcVersion").get().trim())
@ -147,3 +147,149 @@ tasks.register("printPaperVersion") {
println(project.version)
}
}
// see gradle.properties
if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) {
tasks.collectAtsFromPatches {
val dir = layout.projectDirectory.dir("patches/unapplied/server")
if (dir.path.isDirectory()) {
extraPatchDir = dir
}
}
tasks.withType<io.papermc.paperweight.tasks.RebuildGitPatches>().configureEach {
filterPatches = false
}
tasks.register("continueServerUpdate", RebasePatches::class) {
description = "Moves the next X patches from unapplied to applied, and applies them. X being the number of patches that apply cleanly, plus the terminal failure if any."
projectDir = project.projectDir
appliedPatches = file("patches/server")
unappliedPatches = file("patches/unapplied/server")
applyTaskName = "applyServerPatches"
patchedDir = "Paper-Server"
}
}
@UntrackedTask(because = "Does not make sense to track state")
abstract class RebasePatches : BaseTask() {
@get:Internal
abstract val projectDir: DirectoryProperty
@get:InputFiles
abstract val appliedPatches: DirectoryProperty
@get:InputFiles
abstract val unappliedPatches: DirectoryProperty
@get:Input
abstract val applyTaskName: Property<String>
@get:Input
abstract val patchedDir: Property<String>
private fun unapplied(): List<Path> =
unappliedPatches.path.listDirectoryEntries("*.patch").sortedBy { it.name }
private fun appliedLoc(patch: Path): Path = appliedPatches.path.resolve(unappliedPatches.path.relativize(patch))
companion object {
val regex = Pattern.compile("Patch failed at ([0-9]{4}) (.*)")
val continuationRegex = Pattern.compile("^\\s{1}.+\$")
const val subjectPrefix = "Subject: [PATCH] "
}
@TaskAction
fun run() {
val patchedDirPath = projectDir.path.resolve(patchedDir.get())
if (patchedDirPath.isDirectory()) {
val status = Git(patchedDirPath)("status").getText()
if (status.contains("You are in the middle of an am session.")) {
throw PaperweightException("Cannot continue update when $patchedDirPath is in the middle of an am session.")
}
}
val unapplied = unapplied()
for (patch in unapplied) {
patch.copyTo(appliedLoc(patch))
}
val out = ByteArrayOutputStream()
val proc = ProcessBuilder()
.directory(projectDir.path)
.command("./gradlew", applyTaskName.get())
.redirectErrorStream(true)
.start()
val f = redirect(proc.inputStream, out)
val exit = proc.waitFor()
f.get()
if (exit != 0) {
val outStr = String(out.toByteArray())
val matcher = regex.matcher(outStr)
if (!matcher.find()) error("Could not determine failure point")
val failedSubjectFragment = matcher.group(2)
val failed = unapplied.single { p ->
p.useLines { lines ->
val collect = mutableListOf<String>()
for (line in lines) {
if (line.startsWith(subjectPrefix)) {
collect += line
} else if (collect.size == 1) {
if (continuationRegex.matcher(line).matches()) {
collect += line
} else {
break
}
}
}
val subjectLine = collect.joinToString("").substringAfter(subjectPrefix)
subjectLine.startsWith(failedSubjectFragment)
}
}
// delete successful & failure point from unapplied patches dir
for (path in unapplied) {
path.deleteIfExists()
if (path == failed) {
break
}
}
// delete failed from patches dir
var started = false
for (path in unapplied) {
if (path == failed) {
started = true
continue
}
if (started) {
appliedLoc(path).deleteIfExists()
}
}
// Delete the build file before resetting the AM session in case it has compilation errors
patchedDirPath.resolve("build.gradle.kts").deleteIfExists()
// Apply again to reset the am session (so it ends on the failed patch, to allow us to rebuild after fixing it)
val apply2 = ProcessBuilder()
.directory(projectDir.path)
.command("./gradlew", applyTaskName.get())
.redirectErrorStream(true)
.start()
val f1 = redirect(apply2.inputStream, System.out)
apply2.waitFor()
f1.get()
logger.lifecycle(outStr)
logger.lifecycle("Patch failed at $failed; See Git output above.")
} else {
unapplied.forEach { it.deleteIfExists() }
logger.lifecycle("All patches applied!")
}
val git = Git(projectDir.path)
git("add", appliedPatches.path.toString() + "/*").runSilently()
git("add", unappliedPatches.path.toString() + "/*").runSilently()
}
}

Datei anzeigen

@ -1,6 +1,9 @@
group=io.papermc.paper
version=1.19.3-R0.1-SNAPSHOT
mcVersion=1.19.3
version=1.21.1-R0.1-SNAPSHOT
mcVersion=1.21.1
# Set to true while updating Minecraft version
updatingMinecraft=false
org.gradle.caching=true
org.gradle.parallel=true

Binäre Datei nicht angezeigt.

Datei anzeigen

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

31
gradlew vendored
Datei anzeigen

@ -55,7 +55,7 @@
# 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
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -133,10 +131,13 @@ location of your Java installation."
fi
else
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.
if ! command -v java >/dev/null 2>&1
then
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
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# 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.
# 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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

20
gradlew.bat vendored
Datei anzeigen

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

Datei anzeigen

@ -0,0 +1,35 @@
import io.papermc.paperweight.PaperweightSourceGeneratorHelper
import io.papermc.paperweight.extension.PaperweightSourceGeneratorExt
plugins {
java
}
plugins.apply(PaperweightSourceGeneratorHelper::class)
extensions.configure(PaperweightSourceGeneratorExt::class) {
atFile.set(projectDir.toPath().resolve("wideners.at").toFile())
}
dependencies {
implementation("com.squareup:javapoet:1.13.0")
implementation(project(":paper-api"))
implementation("io.github.classgraph:classgraph:4.8.47")
implementation("org.jetbrains:annotations:24.0.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.register<JavaExec>("generate") {
dependsOn(tasks.check)
mainClass.set("io.papermc.generator.Main")
classpath(sourceSets.main.map { it.runtimeClasspath })
args(projectDir.toPath().resolve("generated").toString())
}
tasks.test {
useJUnitPlatform()
}
group = "io.papermc.paper"
version = "1.0-SNAPSHOT"

Datei anzeigen

@ -0,0 +1,443 @@
package com.destroystokyo.paper.entity.ai;
import com.destroystokyo.paper.entity.RangedEntity;
import io.papermc.paper.entity.SchoolableFish;
import io.papermc.paper.generated.GeneratedFrom;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.AbstractSkeleton;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Dolphin;
import org.bukkit.entity.Drowned;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Evoker;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Illager;
import org.bukkit.entity.Illusioner;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.Llama;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Phantom;
import org.bukkit.entity.PolarBear;
import org.bukkit.entity.PufferFish;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Raider;
import org.bukkit.entity.Shulker;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.SkeletonHorse;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Spellcaster;
import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Strider;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.Turtle;
import org.bukkit.entity.Vex;
import org.bukkit.entity.Vindicator;
import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.Wither;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Vanilla keys for Mob Goals.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
GoalKey<AbstractHorse> RUN_AROUND_LIKE_CRAZY = create("run_around_like_crazy", AbstractHorse.class);
GoalKey<AbstractSkeleton> ABSTRACT_SKELETON_MELEE = create("abstract_skeleton_melee", AbstractSkeleton.class);
GoalKey<AbstractVillager> LOOK_AT_TRADING_PLAYER = create("look_at_trading_player", AbstractVillager.class);
GoalKey<AbstractVillager> TRADE_WITH_PLAYER = create("trade_with_player", AbstractVillager.class);
GoalKey<Animals> BREED = create("breed", Animals.class);
GoalKey<Animals> FOLLOW_PARENT = create("follow_parent", Animals.class);
GoalKey<Bee> BEE_ATTACK = create("bee_attack", Bee.class);
GoalKey<Bee> BEE_BECOME_ANGRY = create("bee_become_angry", Bee.class);
GoalKey<Bee> BEE_ENTER_HIVE = create("bee_enter_hive", Bee.class);
GoalKey<Bee> BEE_GO_TO_HIVE = create("bee_go_to_hive", Bee.class);
GoalKey<Bee> BEE_GO_TO_KNOWN_FLOWER = create("bee_go_to_known_flower", Bee.class);
GoalKey<Bee> BEE_GROW_CROP = create("bee_grow_crop", Bee.class);
GoalKey<Bee> BEE_HURT_BY_OTHER = create("bee_hurt_by_other", Bee.class);
GoalKey<Bee> BEE_LOCATE_HIVE = create("bee_locate_hive", Bee.class);
GoalKey<Bee> BEE_POLLINATE = create("bee_pollinate", Bee.class);
GoalKey<Bee> BEE_WANDER = create("bee_wander", Bee.class);
GoalKey<Blaze> BLAZE_ATTACK = create("blaze_attack", Blaze.class);
GoalKey<Cat> CAT_AVOID_ENTITY = create("cat_avoid_entity", Cat.class);
GoalKey<Cat> CAT_LIE_ON_BED = create("cat_lie_on_bed", Cat.class);
GoalKey<Cat> CAT_RELAX_ON_OWNER = create("cat_relax_on_owner", Cat.class);
GoalKey<Cat> CAT_SIT_ON_BLOCK = create("cat_sit_on_block", Cat.class);
GoalKey<Cat> CAT_TEMPT = create("cat_tempt", Cat.class);
GoalKey<Creature> AVOID_ENTITY = create("avoid_entity", Creature.class);
GoalKey<Creature> BREATH_AIR = create("breath_air", Creature.class);
GoalKey<Creature> DROWNED_GO_TO_WATER = create("drowned_go_to_water", Creature.class);
GoalKey<Creature> FLEE_SUN = create("flee_sun", Creature.class);
GoalKey<Creature> FOLLOW_BOAT = create("follow_boat", Creature.class);
GoalKey<Creature> GOLEM_RANDOM_STROLL_IN_VILLAGE = create("golem_random_stroll_in_village", Creature.class);
GoalKey<Creature> HURT_BY = create("hurt_by", Creature.class);
GoalKey<Creature> MELEE_ATTACK = create("melee_attack", Creature.class);
GoalKey<Creature> MOVE_BACK_TO_VILLAGE = create("move_back_to_village", Creature.class);
GoalKey<Creature> MOVE_THROUGH_VILLAGE = create("move_through_village", Creature.class);
GoalKey<Creature> MOVE_TOWARDS = create("move_towards", Creature.class);
GoalKey<Creature> MOVE_TOWARDS_RESTRICTION = create("move_towards_restriction", Creature.class);
GoalKey<Creature> PANIC = create("panic", Creature.class);
GoalKey<Creature> PARROT_WANDER = create("parrot_wander", Creature.class);
GoalKey<Creature> RANDOM_STROLL = create("random_stroll", Creature.class);
GoalKey<Creature> RANDOM_SWIMMING = create("random_swimming", Creature.class);
GoalKey<Creature> REMOVE_BLOCK = create("remove_block", Creature.class);
GoalKey<Creature> RESTRICT_SUN = create("restrict_sun", Creature.class);
GoalKey<Creature> STROLL_THROUGH_VILLAGE = create("stroll_through_village", Creature.class);
GoalKey<Creature> TEMPT = create("tempt", Creature.class);
GoalKey<Creature> TRY_FIND_WATER = create("try_find_water", Creature.class);
GoalKey<Creature> WATER_AVOIDING_RANDOM_FLYING = create("water_avoiding_random_flying", Creature.class);
GoalKey<Creature> WATER_AVOIDING_RANDOM_STROLL = create("water_avoiding_random_stroll", Creature.class);
GoalKey<Creeper> SWELL = create("swell", Creeper.class);
GoalKey<Dolphin> DOLPHIN_JUMP = create("dolphin_jump", Dolphin.class);
GoalKey<Dolphin> DOLPHIN_SWIM_TO_TREASURE = create("dolphin_swim_to_treasure", Dolphin.class);
GoalKey<Dolphin> DOLPHIN_SWIM_WITH_PLAYER = create("dolphin_swim_with_player", Dolphin.class);
GoalKey<Dolphin> PLAY_WITH_ITEMS = create("play_with_items", Dolphin.class);
GoalKey<Drowned> DROWNED_ATTACK = create("drowned_attack", Drowned.class);
GoalKey<Drowned> DROWNED_GO_TO_BEACH = create("drowned_go_to_beach", Drowned.class);
GoalKey<Drowned> DROWNED_SWIM_UP = create("drowned_swim_up", Drowned.class);
GoalKey<Enderman> ENDERMAN_FREEZE_WHEN_LOOKED_AT = create("enderman_freeze_when_looked_at", Enderman.class);
GoalKey<Enderman> ENDERMAN_LEAVE_BLOCK = create("enderman_leave_block", Enderman.class);
GoalKey<Enderman> ENDERMAN_LOOK_FOR_PLAYER = create("enderman_look_for_player", Enderman.class);
GoalKey<Enderman> ENDERMAN_TAKE_BLOCK = create("enderman_take_block", Enderman.class);
GoalKey<Evoker> EVOKER_ATTACK_SPELL = create("evoker_attack_spell", Evoker.class);
GoalKey<Evoker> EVOKER_CASTING_SPELL = create("evoker_casting_spell", Evoker.class);
GoalKey<Evoker> EVOKER_SUMMON_SPELL = create("evoker_summon_spell", Evoker.class);
GoalKey<Evoker> EVOKER_WOLOLO_SPELL = create("evoker_wololo_spell", Evoker.class);
GoalKey<Fish> FISH_SWIM = create("fish_swim", Fish.class);
GoalKey<Fox> DEFEND_TRUSTED = create("defend_trusted", Fox.class);
GoalKey<Fox> FACEPLANT = create("faceplant", Fox.class);
GoalKey<Fox> FOX_BREED = create("fox_breed", Fox.class);
GoalKey<Fox> FOX_EAT_BERRIES = create("fox_eat_berries", Fox.class);
GoalKey<Fox> FOX_FLOAT = create("fox_float", Fox.class);
GoalKey<Fox> FOX_FOLLOW_PARENT = create("fox_follow_parent", Fox.class);
GoalKey<Fox> FOX_LOOK_AT_PLAYER = create("fox_look_at_player", Fox.class);
GoalKey<Fox> FOX_MELEE_ATTACK = create("fox_melee_attack", Fox.class);
GoalKey<Fox> FOX_PANIC = create("fox_panic", Fox.class);
GoalKey<Fox> FOX_POUNCE = create("fox_pounce", Fox.class);
GoalKey<Fox> FOX_SEARCH_FOR_ITEMS = create("fox_search_for_items", Fox.class);
GoalKey<Fox> FOX_STROLL_THROUGH_VILLAGE = create("fox_stroll_through_village", Fox.class);
GoalKey<Fox> PERCH_AND_SEARCH = create("perch_and_search", Fox.class);
GoalKey<Fox> SEEK_SHELTER = create("seek_shelter", Fox.class);
GoalKey<Fox> SLEEP = create("sleep", Fox.class);
GoalKey<Fox> STALK_PREY = create("stalk_prey", Fox.class);
GoalKey<Ghast> GHAST_LOOK = create("ghast_look", Ghast.class);
GoalKey<Ghast> GHAST_SHOOT_FIREBALL = create("ghast_shoot_fireball", Ghast.class);
GoalKey<Ghast> RANDOM_FLOAT_AROUND = create("random_float_around", Ghast.class);
GoalKey<Guardian> GUARDIAN_ATTACK = create("guardian_attack", Guardian.class);
GoalKey<Illager> RAIDER_OPEN_DOOR = create("raider_open_door", Illager.class);
GoalKey<Illusioner> ILLUSIONER_BLINDNESS_SPELL = create("illusioner_blindness_spell", Illusioner.class);
GoalKey<Illusioner> ILLUSIONER_MIRROR_SPELL = create("illusioner_mirror_spell", Illusioner.class);
GoalKey<IronGolem> DEFEND_VILLAGE = create("defend_village", IronGolem.class);
GoalKey<IronGolem> OFFER_FLOWER = create("offer_flower", IronGolem.class);
GoalKey<Llama> LLAMA_ATTACK_WOLF = create("llama_attack_wolf", Llama.class);
GoalKey<Llama> LLAMA_FOLLOW_CARAVAN = create("llama_follow_caravan", Llama.class);
GoalKey<Llama> LLAMA_HURT_BY = create("llama_hurt_by", Llama.class);
GoalKey<Llama> TRADER_LLAMA_DEFEND_WANDERING_TRADER = create("trader_llama_defend_wandering_trader", Llama.class);
GoalKey<Mob> BREAK_DOOR = create("break_door", Mob.class);
GoalKey<Mob> CLIMB_ON_TOP_OF_POWDER_SNOW = create("climb_on_top_of_powder_snow", Mob.class);
GoalKey<Mob> EAT_BLOCK = create("eat_block", Mob.class);
GoalKey<Mob> FLOAT = create("float", Mob.class);
GoalKey<Mob> FOLLOW_MOB = create("follow_mob", Mob.class);
GoalKey<Mob> INTERACT = create("interact", Mob.class);
GoalKey<Mob> LEAP_AT = create("leap_at", Mob.class);
GoalKey<Mob> LOOK_AT_PLAYER = create("look_at_player", Mob.class);
GoalKey<Mob> NEAREST_ATTACKABLE = create("nearest_attackable", Mob.class);
GoalKey<Mob> OCELOT_ATTACK = create("ocelot_attack", Mob.class);
GoalKey<Mob> OPEN_DOOR = create("open_door", Mob.class);
GoalKey<Mob> RANDOM_LOOK_AROUND = create("random_look_around", Mob.class);
GoalKey<Mob> RESET_UNIVERSAL_ANGER = create("reset_universal_anger", Mob.class);
GoalKey<Mob> USE_ITEM = create("use_item", Mob.class);
GoalKey<Mob> VINDICATOR_BREAK_DOOR = create("vindicator_break_door", Mob.class);
GoalKey<Monster> RANGED_BOW_ATTACK = create("ranged_bow_attack", Monster.class);
GoalKey<Monster> RANGED_CROSSBOW_ATTACK = create("ranged_crossbow_attack", Monster.class);
GoalKey<Ocelot> OCELOT_AVOID_ENTITY = create("ocelot_avoid_entity", Ocelot.class);
GoalKey<Ocelot> OCELOT_TEMPT = create("ocelot_tempt", Ocelot.class);
GoalKey<Panda> PANDA_ATTACK = create("panda_attack", Panda.class);
GoalKey<Panda> PANDA_AVOID = create("panda_avoid", Panda.class);
GoalKey<Panda> PANDA_BREED = create("panda_breed", Panda.class);
GoalKey<Panda> PANDA_HURT_BY = create("panda_hurt_by", Panda.class);
GoalKey<Panda> PANDA_LIE_ON_BACK = create("panda_lie_on_back", Panda.class);
GoalKey<Panda> PANDA_LOOK_AT_PLAYER = create("panda_look_at_player", Panda.class);
GoalKey<Panda> PANDA_PANIC = create("panda_panic", Panda.class);
GoalKey<Panda> PANDA_ROLL = create("panda_roll", Panda.class);
GoalKey<Panda> PANDA_SIT = create("panda_sit", Panda.class);
GoalKey<Panda> PANDA_SNEEZE = create("panda_sneeze", Panda.class);
GoalKey<Parrot> LAND_ON_OWNERS_SHOULDER = create("land_on_owners_shoulder", Parrot.class);
GoalKey<Phantom> PHANTOM_ATTACK_PLAYER = create("phantom_attack_player", Phantom.class);
GoalKey<Phantom> PHANTOM_ATTACK_STRATEGY = create("phantom_attack_strategy", Phantom.class);
GoalKey<Phantom> PHANTOM_CIRCLE_AROUND_ANCHOR = create("phantom_circle_around_anchor", Phantom.class);
GoalKey<Phantom> PHANTOM_SWEEP_ATTACK = create("phantom_sweep_attack", Phantom.class);
GoalKey<PolarBear> POLAR_BEAR_ATTACK_PLAYERS = create("polar_bear_attack_players", PolarBear.class);
GoalKey<PolarBear> POLAR_BEAR_HURT_BY = create("polar_bear_hurt_by", PolarBear.class);
GoalKey<PolarBear> POLAR_BEAR_MELEE_ATTACK = create("polar_bear_melee_attack", PolarBear.class);
GoalKey<PufferFish> PUFFERFISH_PUFF = create("pufferfish_puff", PufferFish.class);
GoalKey<Rabbit> RABBIT_AVOID_ENTITY = create("rabbit_avoid_entity", Rabbit.class);
GoalKey<Rabbit> RABBIT_PANIC = create("rabbit_panic", Rabbit.class);
GoalKey<Rabbit> RAID_GARDEN = create("raid_garden", Rabbit.class);
GoalKey<Raider> HOLD_GROUND_ATTACK = create("hold_ground_attack", Raider.class);
GoalKey<Raider> LONG_DISTANCE_PATROL = create("long_distance_patrol", Raider.class);
GoalKey<Raider> NEAREST_ATTACKABLE_WITCH = create("nearest_attackable_witch", Raider.class);
GoalKey<Raider> NEAREST_HEALABLE_RAIDER = create("nearest_healable_raider", Raider.class);
GoalKey<Raider> OBTAIN_RAID_LEADER_BANNER = create("obtain_raid_leader_banner", Raider.class);
GoalKey<Raider> PATHFIND_TO_RAID = create("pathfind_to_raid", Raider.class);
GoalKey<Raider> RAIDER_CELEBRATION = create("raider_celebration", Raider.class);
GoalKey<Raider> RAIDER_MOVE_THROUGH_VILLAGE = create("raider_move_through_village", Raider.class);
GoalKey<RangedEntity> DROWNED_TRIDENT_ATTACK = create("drowned_trident_attack", RangedEntity.class);
GoalKey<RangedEntity> RANGED_ATTACK = create("ranged_attack", RangedEntity.class);
GoalKey<SchoolableFish> FOLLOW_FLOCK_LEADER = create("follow_flock_leader", SchoolableFish.class);
GoalKey<Shulker> SHULKER_ATTACK = create("shulker_attack", Shulker.class);
GoalKey<Shulker> SHULKER_DEFENSE_ATTACK = create("shulker_defense_attack", Shulker.class);
GoalKey<Shulker> SHULKER_NEAREST_ATTACK = create("shulker_nearest_attack", Shulker.class);
GoalKey<Shulker> SHULKER_PEEK = create("shulker_peek", Shulker.class);
GoalKey<Silverfish> SILVERFISH_MERGE_WITH_STONE = create("silverfish_merge_with_stone", Silverfish.class);
GoalKey<Silverfish> SILVERFISH_WAKE_UP_FRIENDS = create("silverfish_wake_up_friends", Silverfish.class);
GoalKey<SkeletonHorse> SKELETON_TRAP = create("skeleton_trap", SkeletonHorse.class);
GoalKey<Slime> SLIME_ATTACK = create("slime_attack", Slime.class);
GoalKey<Slime> SLIME_FLOAT = create("slime_float", Slime.class);
GoalKey<Slime> SLIME_KEEP_ON_JUMPING = create("slime_keep_on_jumping", Slime.class);
GoalKey<Slime> SLIME_RANDOM_DIRECTION = create("slime_random_direction", Slime.class);
GoalKey<Spellcaster> SPELLCASTER_CASTING_SPELL = create("spellcaster_casting_spell", Spellcaster.class);
GoalKey<Spider> SPIDER = create("spider", Spider.class);
GoalKey<Spider> SPIDER_ATTACK = create("spider_attack", Spider.class);
GoalKey<Squid> SQUID_FLEE = create("squid_flee", Squid.class);
GoalKey<Squid> SQUID_RANDOM_MOVEMENT = create("squid_random_movement", Squid.class);
GoalKey<Strider> STRIDER_GO_TO_LAVA = create("strider_go_to_lava", Strider.class);
GoalKey<Tameable> FOLLOW_OWNER = create("follow_owner", Tameable.class);
GoalKey<Tameable> NON_TAME_RANDOM = create("non_tame_random", Tameable.class);
GoalKey<Tameable> OWNER_HURT = create("owner_hurt", Tameable.class);
GoalKey<Tameable> OWNER_HURT_BY = create("owner_hurt_by", Tameable.class);
GoalKey<Tameable> SIT_WHEN_ORDERED_TO = create("sit_when_ordered_to", Tameable.class);
GoalKey<Tameable> TAMABLE_ANIMAL_PANIC = create("tamable_animal_panic", Tameable.class);
GoalKey<Turtle> TURTLE_BREED = create("turtle_breed", Turtle.class);
GoalKey<Turtle> TURTLE_GO_HOME = create("turtle_go_home", Turtle.class);
GoalKey<Turtle> TURTLE_GO_TO_WATER = create("turtle_go_to_water", Turtle.class);
GoalKey<Turtle> TURTLE_LAY_EGG = create("turtle_lay_egg", Turtle.class);
GoalKey<Turtle> TURTLE_PANIC = create("turtle_panic", Turtle.class);
GoalKey<Turtle> TURTLE_RANDOM_STROLL = create("turtle_random_stroll", Turtle.class);
GoalKey<Turtle> TURTLE_TRAVEL = create("turtle_travel", Turtle.class);
GoalKey<Vex> VEX_CHARGE_ATTACK = create("vex_charge_attack", Vex.class);
GoalKey<Vex> VEX_COPY_OWNER = create("vex_copy_owner", Vex.class);
GoalKey<Vex> VEX_RANDOM_MOVE = create("vex_random_move", Vex.class);
GoalKey<Vindicator> VINDICATOR_JOHNNY_ATTACK = create("vindicator_johnny_attack", Vindicator.class);
GoalKey<WanderingTrader> WANDER_TO_POSITION = create("wander_to_position", WanderingTrader.class);
GoalKey<Wither> WITHER_DO_NOTHING = create("wither_do_nothing", Wither.class);
GoalKey<Wolf> BEG = create("beg", Wolf.class);
GoalKey<Wolf> WOLF_AVOID_ENTITY = create("wolf_avoid_entity", Wolf.class);
GoalKey<Zombie> ZOMBIE_ATTACK = create("zombie_attack", Zombie.class);
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
final @NonNull Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key));
}
}

Datei anzeigen

@ -0,0 +1,490 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.block.Biome;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#BIOME}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class BiomeKeys {
/**
* {@code minecraft:badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BADLANDS = create(key("badlands"));
/**
* {@code minecraft:bamboo_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BAMBOO_JUNGLE = create(key("bamboo_jungle"));
/**
* {@code minecraft:basalt_deltas}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BASALT_DELTAS = create(key("basalt_deltas"));
/**
* {@code minecraft:beach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BEACH = create(key("beach"));
/**
* {@code minecraft:birch_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> BIRCH_FOREST = create(key("birch_forest"));
/**
* {@code minecraft:cherry_grove}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> CHERRY_GROVE = create(key("cherry_grove"));
/**
* {@code minecraft:cold_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> COLD_OCEAN = create(key("cold_ocean"));
/**
* {@code minecraft:crimson_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> CRIMSON_FOREST = create(key("crimson_forest"));
/**
* {@code minecraft:dark_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DARK_FOREST = create(key("dark_forest"));
/**
* {@code minecraft:deep_cold_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_COLD_OCEAN = create(key("deep_cold_ocean"));
/**
* {@code minecraft:deep_dark}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_DARK = create(key("deep_dark"));
/**
* {@code minecraft:deep_frozen_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_FROZEN_OCEAN = create(key("deep_frozen_ocean"));
/**
* {@code minecraft:deep_lukewarm_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_LUKEWARM_OCEAN = create(key("deep_lukewarm_ocean"));
/**
* {@code minecraft:deep_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DEEP_OCEAN = create(key("deep_ocean"));
/**
* {@code minecraft:desert}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DESERT = create(key("desert"));
/**
* {@code minecraft:dripstone_caves}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> DRIPSTONE_CAVES = create(key("dripstone_caves"));
/**
* {@code minecraft:end_barrens}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> END_BARRENS = create(key("end_barrens"));
/**
* {@code minecraft:end_highlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> END_HIGHLANDS = create(key("end_highlands"));
/**
* {@code minecraft:end_midlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> END_MIDLANDS = create(key("end_midlands"));
/**
* {@code minecraft:eroded_badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> ERODED_BADLANDS = create(key("eroded_badlands"));
/**
* {@code minecraft:flower_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FLOWER_FOREST = create(key("flower_forest"));
/**
* {@code minecraft:forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FOREST = create(key("forest"));
/**
* {@code minecraft:frozen_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FROZEN_OCEAN = create(key("frozen_ocean"));
/**
* {@code minecraft:frozen_peaks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FROZEN_PEAKS = create(key("frozen_peaks"));
/**
* {@code minecraft:frozen_river}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> FROZEN_RIVER = create(key("frozen_river"));
/**
* {@code minecraft:grove}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> GROVE = create(key("grove"));
/**
* {@code minecraft:ice_spikes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> ICE_SPIKES = create(key("ice_spikes"));
/**
* {@code minecraft:jagged_peaks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> JAGGED_PEAKS = create(key("jagged_peaks"));
/**
* {@code minecraft:jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> JUNGLE = create(key("jungle"));
/**
* {@code minecraft:lukewarm_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> LUKEWARM_OCEAN = create(key("lukewarm_ocean"));
/**
* {@code minecraft:lush_caves}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> LUSH_CAVES = create(key("lush_caves"));
/**
* {@code minecraft:mangrove_swamp}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> MANGROVE_SWAMP = create(key("mangrove_swamp"));
/**
* {@code minecraft:meadow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> MEADOW = create(key("meadow"));
/**
* {@code minecraft:mushroom_fields}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> MUSHROOM_FIELDS = create(key("mushroom_fields"));
/**
* {@code minecraft:nether_wastes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> NETHER_WASTES = create(key("nether_wastes"));
/**
* {@code minecraft:ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OCEAN = create(key("ocean"));
/**
* {@code minecraft:old_growth_birch_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OLD_GROWTH_BIRCH_FOREST = create(key("old_growth_birch_forest"));
/**
* {@code minecraft:old_growth_pine_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OLD_GROWTH_PINE_TAIGA = create(key("old_growth_pine_taiga"));
/**
* {@code minecraft:old_growth_spruce_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> OLD_GROWTH_SPRUCE_TAIGA = create(key("old_growth_spruce_taiga"));
/**
* {@code minecraft:plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> PLAINS = create(key("plains"));
/**
* {@code minecraft:river}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> RIVER = create(key("river"));
/**
* {@code minecraft:savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SAVANNA = create(key("savanna"));
/**
* {@code minecraft:savanna_plateau}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SAVANNA_PLATEAU = create(key("savanna_plateau"));
/**
* {@code minecraft:small_end_islands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SMALL_END_ISLANDS = create(key("small_end_islands"));
/**
* {@code minecraft:snowy_beach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_BEACH = create(key("snowy_beach"));
/**
* {@code minecraft:snowy_plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_PLAINS = create(key("snowy_plains"));
/**
* {@code minecraft:snowy_slopes}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_SLOPES = create(key("snowy_slopes"));
/**
* {@code minecraft:snowy_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SNOWY_TAIGA = create(key("snowy_taiga"));
/**
* {@code minecraft:soul_sand_valley}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SOUL_SAND_VALLEY = create(key("soul_sand_valley"));
/**
* {@code minecraft:sparse_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SPARSE_JUNGLE = create(key("sparse_jungle"));
/**
* {@code minecraft:stony_peaks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> STONY_PEAKS = create(key("stony_peaks"));
/**
* {@code minecraft:stony_shore}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> STONY_SHORE = create(key("stony_shore"));
/**
* {@code minecraft:sunflower_plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SUNFLOWER_PLAINS = create(key("sunflower_plains"));
/**
* {@code minecraft:swamp}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> SWAMP = create(key("swamp"));
/**
* {@code minecraft:taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> TAIGA = create(key("taiga"));
/**
* {@code minecraft:the_end}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> THE_END = create(key("the_end"));
/**
* {@code minecraft:the_void}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> THE_VOID = create(key("the_void"));
/**
* {@code minecraft:warm_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WARM_OCEAN = create(key("warm_ocean"));
/**
* {@code minecraft:warped_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WARPED_FOREST = create(key("warped_forest"));
/**
* {@code minecraft:windswept_forest}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_FOREST = create(key("windswept_forest"));
/**
* {@code minecraft:windswept_gravelly_hills}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_GRAVELLY_HILLS = create(key("windswept_gravelly_hills"));
/**
* {@code minecraft:windswept_hills}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_HILLS = create(key("windswept_hills"));
/**
* {@code minecraft:windswept_savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WINDSWEPT_SAVANNA = create(key("windswept_savanna"));
/**
* {@code minecraft:wooded_badlands}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Biome> WOODED_BADLANDS = create(key("wooded_badlands"));
private BiomeKeys() {
}
/**
* Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<Biome> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.BIOME, key);
}
}

Datei anzeigen

@ -0,0 +1,371 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.damage.DamageType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class DamageTypeKeys {
/**
* {@code minecraft:arrow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> ARROW = create(key("arrow"));
/**
* {@code minecraft:bad_respawn_point}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> BAD_RESPAWN_POINT = create(key("bad_respawn_point"));
/**
* {@code minecraft:cactus}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> CACTUS = create(key("cactus"));
/**
* {@code minecraft:campfire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> CAMPFIRE = create(key("campfire"));
/**
* {@code minecraft:cramming}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> CRAMMING = create(key("cramming"));
/**
* {@code minecraft:dragon_breath}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> DRAGON_BREATH = create(key("dragon_breath"));
/**
* {@code minecraft:drown}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> DROWN = create(key("drown"));
/**
* {@code minecraft:dry_out}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> DRY_OUT = create(key("dry_out"));
/**
* {@code minecraft:explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> EXPLOSION = create(key("explosion"));
/**
* {@code minecraft:fall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALL = create(key("fall"));
/**
* {@code minecraft:falling_anvil}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALLING_ANVIL = create(key("falling_anvil"));
/**
* {@code minecraft:falling_block}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALLING_BLOCK = create(key("falling_block"));
/**
* {@code minecraft:falling_stalactite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FALLING_STALACTITE = create(key("falling_stalactite"));
/**
* {@code minecraft:fireball}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FIREBALL = create(key("fireball"));
/**
* {@code minecraft:fireworks}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FIREWORKS = create(key("fireworks"));
/**
* {@code minecraft:fly_into_wall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FLY_INTO_WALL = create(key("fly_into_wall"));
/**
* {@code minecraft:freeze}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> FREEZE = create(key("freeze"));
/**
* {@code minecraft:generic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> GENERIC = create(key("generic"));
/**
* {@code minecraft:generic_kill}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> GENERIC_KILL = create(key("generic_kill"));
/**
* {@code minecraft:hot_floor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> HOT_FLOOR = create(key("hot_floor"));
/**
* {@code minecraft:in_fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> IN_FIRE = create(key("in_fire"));
/**
* {@code minecraft:in_wall}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> IN_WALL = create(key("in_wall"));
/**
* {@code minecraft:indirect_magic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> INDIRECT_MAGIC = create(key("indirect_magic"));
/**
* {@code minecraft:lava}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> LAVA = create(key("lava"));
/**
* {@code minecraft:lightning_bolt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> LIGHTNING_BOLT = create(key("lightning_bolt"));
/**
* {@code minecraft:magic}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MAGIC = create(key("magic"));
/**
* {@code minecraft:mob_attack}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MOB_ATTACK = create(key("mob_attack"));
/**
* {@code minecraft:mob_attack_no_aggro}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MOB_ATTACK_NO_AGGRO = create(key("mob_attack_no_aggro"));
/**
* {@code minecraft:mob_projectile}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> MOB_PROJECTILE = create(key("mob_projectile"));
/**
* {@code minecraft:on_fire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> ON_FIRE = create(key("on_fire"));
/**
* {@code minecraft:out_of_world}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> OUT_OF_WORLD = create(key("out_of_world"));
/**
* {@code minecraft:outside_border}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> OUTSIDE_BORDER = create(key("outside_border"));
/**
* {@code minecraft:player_attack}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> PLAYER_ATTACK = create(key("player_attack"));
/**
* {@code minecraft:player_explosion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> PLAYER_EXPLOSION = create(key("player_explosion"));
/**
* {@code minecraft:sonic_boom}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> SONIC_BOOM = create(key("sonic_boom"));
/**
* {@code minecraft:spit}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> SPIT = create(key("spit"));
/**
* {@code minecraft:stalagmite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> STALAGMITE = create(key("stalagmite"));
/**
* {@code minecraft:starve}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> STARVE = create(key("starve"));
/**
* {@code minecraft:sting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> STING = create(key("sting"));
/**
* {@code minecraft:sweet_berry_bush}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> SWEET_BERRY_BUSH = create(key("sweet_berry_bush"));
/**
* {@code minecraft:thorns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> THORNS = create(key("thorns"));
/**
* {@code minecraft:thrown}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> THROWN = create(key("thrown"));
/**
* {@code minecraft:trident}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> TRIDENT = create(key("trident"));
/**
* {@code minecraft:unattributed_fireball}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> UNATTRIBUTED_FIREBALL = create(key("unattributed_fireball"));
/**
* {@code minecraft:wind_charge}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> WIND_CHARGE = create(key("wind_charge"));
/**
* {@code minecraft:wither}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> WITHER = create(key("wither"));
/**
* {@code minecraft:wither_skull}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<DamageType> WITHER_SKULL = create(key("wither_skull"));
private DamageTypeKeys() {
}
/**
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<DamageType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
}
}

Datei anzeigen

@ -0,0 +1,329 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class EnchantmentKeys {
/**
* {@code minecraft:aqua_affinity}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> AQUA_AFFINITY = create(key("aqua_affinity"));
/**
* {@code minecraft:bane_of_arthropods}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BANE_OF_ARTHROPODS = create(key("bane_of_arthropods"));
/**
* {@code minecraft:binding_curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BINDING_CURSE = create(key("binding_curse"));
/**
* {@code minecraft:blast_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BLAST_PROTECTION = create(key("blast_protection"));
/**
* {@code minecraft:breach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> BREACH = create(key("breach"));
/**
* {@code minecraft:channeling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> CHANNELING = create(key("channeling"));
/**
* {@code minecraft:density}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> DENSITY = create(key("density"));
/**
* {@code minecraft:depth_strider}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> DEPTH_STRIDER = create(key("depth_strider"));
/**
* {@code minecraft:efficiency}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> EFFICIENCY = create(key("efficiency"));
/**
* {@code minecraft:feather_falling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FEATHER_FALLING = create(key("feather_falling"));
/**
* {@code minecraft:fire_aspect}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FIRE_ASPECT = create(key("fire_aspect"));
/**
* {@code minecraft:fire_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FIRE_PROTECTION = create(key("fire_protection"));
/**
* {@code minecraft:flame}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FLAME = create(key("flame"));
/**
* {@code minecraft:fortune}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FORTUNE = create(key("fortune"));
/**
* {@code minecraft:frost_walker}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> FROST_WALKER = create(key("frost_walker"));
/**
* {@code minecraft:impaling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> IMPALING = create(key("impaling"));
/**
* {@code minecraft:infinity}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> INFINITY = create(key("infinity"));
/**
* {@code minecraft:knockback}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> KNOCKBACK = create(key("knockback"));
/**
* {@code minecraft:looting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LOOTING = create(key("looting"));
/**
* {@code minecraft:loyalty}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LOYALTY = create(key("loyalty"));
/**
* {@code minecraft:luck_of_the_sea}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LUCK_OF_THE_SEA = create(key("luck_of_the_sea"));
/**
* {@code minecraft:lure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> LURE = create(key("lure"));
/**
* {@code minecraft:mending}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> MENDING = create(key("mending"));
/**
* {@code minecraft:multishot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> MULTISHOT = create(key("multishot"));
/**
* {@code minecraft:piercing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PIERCING = create(key("piercing"));
/**
* {@code minecraft:power}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> POWER = create(key("power"));
/**
* {@code minecraft:projectile_protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PROJECTILE_PROTECTION = create(key("projectile_protection"));
/**
* {@code minecraft:protection}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PROTECTION = create(key("protection"));
/**
* {@code minecraft:punch}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> PUNCH = create(key("punch"));
/**
* {@code minecraft:quick_charge}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> QUICK_CHARGE = create(key("quick_charge"));
/**
* {@code minecraft:respiration}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> RESPIRATION = create(key("respiration"));
/**
* {@code minecraft:riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> RIPTIDE = create(key("riptide"));
/**
* {@code minecraft:sharpness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SHARPNESS = create(key("sharpness"));
/**
* {@code minecraft:silk_touch}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SILK_TOUCH = create(key("silk_touch"));
/**
* {@code minecraft:smite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SMITE = create(key("smite"));
/**
* {@code minecraft:soul_speed}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SOUL_SPEED = create(key("soul_speed"));
/**
* {@code minecraft:sweeping_edge}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SWEEPING_EDGE = create(key("sweeping_edge"));
/**
* {@code minecraft:swift_sneak}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> SWIFT_SNEAK = create(key("swift_sneak"));
/**
* {@code minecraft:thorns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> THORNS = create(key("thorns"));
/**
* {@code minecraft:unbreaking}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> UNBREAKING = create(key("unbreaking"));
/**
* {@code minecraft:vanishing_curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> VANISHING_CURSE = create(key("vanishing_curse"));
/**
* {@code minecraft:wind_burst}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Enchantment> WIND_BURST = create(key("wind_burst"));
private EnchantmentKeys() {
}
private static @NonNull TypedKey<Enchantment> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
}
}

Datei anzeigen

@ -0,0 +1,455 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.GameEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#GAME_EVENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class GameEventKeys {
/**
* {@code minecraft:block_activate}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_ACTIVATE = create(key("block_activate"));
/**
* {@code minecraft:block_attach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_ATTACH = create(key("block_attach"));
/**
* {@code minecraft:block_change}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_CHANGE = create(key("block_change"));
/**
* {@code minecraft:block_close}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_CLOSE = create(key("block_close"));
/**
* {@code minecraft:block_deactivate}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_DEACTIVATE = create(key("block_deactivate"));
/**
* {@code minecraft:block_destroy}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_DESTROY = create(key("block_destroy"));
/**
* {@code minecraft:block_detach}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_DETACH = create(key("block_detach"));
/**
* {@code minecraft:block_open}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_OPEN = create(key("block_open"));
/**
* {@code minecraft:block_place}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> BLOCK_PLACE = create(key("block_place"));
/**
* {@code minecraft:container_close}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> CONTAINER_CLOSE = create(key("container_close"));
/**
* {@code minecraft:container_open}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> CONTAINER_OPEN = create(key("container_open"));
/**
* {@code minecraft:drink}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> DRINK = create(key("drink"));
/**
* {@code minecraft:eat}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> EAT = create(key("eat"));
/**
* {@code minecraft:elytra_glide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ELYTRA_GLIDE = create(key("elytra_glide"));
/**
* {@code minecraft:entity_action}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_ACTION = create(key("entity_action"));
/**
* {@code minecraft:entity_damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_DAMAGE = create(key("entity_damage"));
/**
* {@code minecraft:entity_die}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_DIE = create(key("entity_die"));
/**
* {@code minecraft:entity_dismount}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_DISMOUNT = create(key("entity_dismount"));
/**
* {@code minecraft:entity_interact}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_INTERACT = create(key("entity_interact"));
/**
* {@code minecraft:entity_mount}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_MOUNT = create(key("entity_mount"));
/**
* {@code minecraft:entity_place}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ENTITY_PLACE = create(key("entity_place"));
/**
* {@code minecraft:equip}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> EQUIP = create(key("equip"));
/**
* {@code minecraft:explode}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> EXPLODE = create(key("explode"));
/**
* {@code minecraft:flap}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> FLAP = create(key("flap"));
/**
* {@code minecraft:fluid_pickup}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> FLUID_PICKUP = create(key("fluid_pickup"));
/**
* {@code minecraft:fluid_place}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> FLUID_PLACE = create(key("fluid_place"));
/**
* {@code minecraft:hit_ground}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> HIT_GROUND = create(key("hit_ground"));
/**
* {@code minecraft:instrument_play}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> INSTRUMENT_PLAY = create(key("instrument_play"));
/**
* {@code minecraft:item_interact_finish}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ITEM_INTERACT_FINISH = create(key("item_interact_finish"));
/**
* {@code minecraft:item_interact_start}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> ITEM_INTERACT_START = create(key("item_interact_start"));
/**
* {@code minecraft:jukebox_play}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> JUKEBOX_PLAY = create(key("jukebox_play"));
/**
* {@code minecraft:jukebox_stop_play}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> JUKEBOX_STOP_PLAY = create(key("jukebox_stop_play"));
/**
* {@code minecraft:lightning_strike}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> LIGHTNING_STRIKE = create(key("lightning_strike"));
/**
* {@code minecraft:note_block_play}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> NOTE_BLOCK_PLAY = create(key("note_block_play"));
/**
* {@code minecraft:prime_fuse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> PRIME_FUSE = create(key("prime_fuse"));
/**
* {@code minecraft:projectile_land}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> PROJECTILE_LAND = create(key("projectile_land"));
/**
* {@code minecraft:projectile_shoot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> PROJECTILE_SHOOT = create(key("projectile_shoot"));
/**
* {@code minecraft:resonate_1}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_1 = create(key("resonate_1"));
/**
* {@code minecraft:resonate_2}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_2 = create(key("resonate_2"));
/**
* {@code minecraft:resonate_3}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_3 = create(key("resonate_3"));
/**
* {@code minecraft:resonate_4}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_4 = create(key("resonate_4"));
/**
* {@code minecraft:resonate_5}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_5 = create(key("resonate_5"));
/**
* {@code minecraft:resonate_6}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_6 = create(key("resonate_6"));
/**
* {@code minecraft:resonate_7}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_7 = create(key("resonate_7"));
/**
* {@code minecraft:resonate_8}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_8 = create(key("resonate_8"));
/**
* {@code minecraft:resonate_9}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_9 = create(key("resonate_9"));
/**
* {@code minecraft:resonate_10}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_10 = create(key("resonate_10"));
/**
* {@code minecraft:resonate_11}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_11 = create(key("resonate_11"));
/**
* {@code minecraft:resonate_12}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_12 = create(key("resonate_12"));
/**
* {@code minecraft:resonate_13}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_13 = create(key("resonate_13"));
/**
* {@code minecraft:resonate_14}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_14 = create(key("resonate_14"));
/**
* {@code minecraft:resonate_15}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> RESONATE_15 = create(key("resonate_15"));
/**
* {@code minecraft:sculk_sensor_tendrils_clicking}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> SCULK_SENSOR_TENDRILS_CLICKING = create(key("sculk_sensor_tendrils_clicking"));
/**
* {@code minecraft:shear}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> SHEAR = create(key("shear"));
/**
* {@code minecraft:shriek}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> SHRIEK = create(key("shriek"));
/**
* {@code minecraft:splash}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> SPLASH = create(key("splash"));
/**
* {@code minecraft:step}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> STEP = create(key("step"));
/**
* {@code minecraft:swim}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> SWIM = create(key("swim"));
/**
* {@code minecraft:teleport}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> TELEPORT = create(key("teleport"));
/**
* {@code minecraft:unequip}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<GameEvent> UNEQUIP = create(key("unequip"));
private GameEventKeys() {
}
private static @NonNull TypedKey<GameEvent> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.GAME_EVENT, key);
}
}

Datei anzeigen

@ -0,0 +1,91 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MusicInstrument;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class InstrumentKeys {
/**
* {@code minecraft:admire_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> ADMIRE_GOAT_HORN = create(key("admire_goat_horn"));
/**
* {@code minecraft:call_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> CALL_GOAT_HORN = create(key("call_goat_horn"));
/**
* {@code minecraft:dream_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> DREAM_GOAT_HORN = create(key("dream_goat_horn"));
/**
* {@code minecraft:feel_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> FEEL_GOAT_HORN = create(key("feel_goat_horn"));
/**
* {@code minecraft:ponder_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> PONDER_GOAT_HORN = create(key("ponder_goat_horn"));
/**
* {@code minecraft:seek_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> SEEK_GOAT_HORN = create(key("seek_goat_horn"));
/**
* {@code minecraft:sing_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> SING_GOAT_HORN = create(key("sing_goat_horn"));
/**
* {@code minecraft:yearn_goat_horn}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<MusicInstrument> YEARN_GOAT_HORN = create(key("yearn_goat_horn"));
private InstrumentKeys() {
}
private static @NonNull TypedKey<MusicInstrument> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.INSTRUMENT, key);
}
}

Datei anzeigen

@ -0,0 +1,308 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.potion.PotionEffectType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class MobEffectKeys {
/**
* {@code minecraft:absorption}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> ABSORPTION = create(key("absorption"));
/**
* {@code minecraft:bad_omen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> BAD_OMEN = create(key("bad_omen"));
/**
* {@code minecraft:blindness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> BLINDNESS = create(key("blindness"));
/**
* {@code minecraft:conduit_power}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> CONDUIT_POWER = create(key("conduit_power"));
/**
* {@code minecraft:darkness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> DARKNESS = create(key("darkness"));
/**
* {@code minecraft:dolphins_grace}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> DOLPHINS_GRACE = create(key("dolphins_grace"));
/**
* {@code minecraft:fire_resistance}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> FIRE_RESISTANCE = create(key("fire_resistance"));
/**
* {@code minecraft:glowing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> GLOWING = create(key("glowing"));
/**
* {@code minecraft:haste}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HASTE = create(key("haste"));
/**
* {@code minecraft:health_boost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HEALTH_BOOST = create(key("health_boost"));
/**
* {@code minecraft:hero_of_the_village}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HERO_OF_THE_VILLAGE = create(key("hero_of_the_village"));
/**
* {@code minecraft:hunger}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> HUNGER = create(key("hunger"));
/**
* {@code minecraft:infested}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INFESTED = create(key("infested"));
/**
* {@code minecraft:instant_damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INSTANT_DAMAGE = create(key("instant_damage"));
/**
* {@code minecraft:instant_health}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INSTANT_HEALTH = create(key("instant_health"));
/**
* {@code minecraft:invisibility}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> INVISIBILITY = create(key("invisibility"));
/**
* {@code minecraft:jump_boost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> JUMP_BOOST = create(key("jump_boost"));
/**
* {@code minecraft:levitation}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> LEVITATION = create(key("levitation"));
/**
* {@code minecraft:luck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> LUCK = create(key("luck"));
/**
* {@code minecraft:mining_fatigue}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> MINING_FATIGUE = create(key("mining_fatigue"));
/**
* {@code minecraft:nausea}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> NAUSEA = create(key("nausea"));
/**
* {@code minecraft:night_vision}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> NIGHT_VISION = create(key("night_vision"));
/**
* {@code minecraft:oozing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> OOZING = create(key("oozing"));
/**
* {@code minecraft:poison}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> POISON = create(key("poison"));
/**
* {@code minecraft:raid_omen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> RAID_OMEN = create(key("raid_omen"));
/**
* {@code minecraft:regeneration}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> REGENERATION = create(key("regeneration"));
/**
* {@code minecraft:resistance}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> RESISTANCE = create(key("resistance"));
/**
* {@code minecraft:saturation}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SATURATION = create(key("saturation"));
/**
* {@code minecraft:slow_falling}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SLOW_FALLING = create(key("slow_falling"));
/**
* {@code minecraft:slowness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SLOWNESS = create(key("slowness"));
/**
* {@code minecraft:speed}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> SPEED = create(key("speed"));
/**
* {@code minecraft:strength}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> STRENGTH = create(key("strength"));
/**
* {@code minecraft:trial_omen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> TRIAL_OMEN = create(key("trial_omen"));
/**
* {@code minecraft:unluck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> UNLUCK = create(key("unluck"));
/**
* {@code minecraft:water_breathing}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WATER_BREATHING = create(key("water_breathing"));
/**
* {@code minecraft:weakness}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WEAKNESS = create(key("weakness"));
/**
* {@code minecraft:weaving}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WEAVING = create(key("weaving"));
/**
* {@code minecraft:wind_charged}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WIND_CHARGED = create(key("wind_charged"));
/**
* {@code minecraft:wither}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<PotionEffectType> WITHER = create(key("wither"));
private MobEffectKeys() {
}
private static @NonNull TypedKey<PotionEffectType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.MOB_EFFECT, key);
}
}

Datei anzeigen

@ -0,0 +1,280 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.Structure;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class StructureKeys {
/**
* {@code minecraft:ancient_city}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> ANCIENT_CITY = create(key("ancient_city"));
/**
* {@code minecraft:bastion_remnant}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> BASTION_REMNANT = create(key("bastion_remnant"));
/**
* {@code minecraft:buried_treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> BURIED_TREASURE = create(key("buried_treasure"));
/**
* {@code minecraft:desert_pyramid}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> DESERT_PYRAMID = create(key("desert_pyramid"));
/**
* {@code minecraft:end_city}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> END_CITY = create(key("end_city"));
/**
* {@code minecraft:fortress}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> FORTRESS = create(key("fortress"));
/**
* {@code minecraft:igloo}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> IGLOO = create(key("igloo"));
/**
* {@code minecraft:jungle_pyramid}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> JUNGLE_PYRAMID = create(key("jungle_pyramid"));
/**
* {@code minecraft:mansion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> MANSION = create(key("mansion"));
/**
* {@code minecraft:mineshaft}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> MINESHAFT = create(key("mineshaft"));
/**
* {@code minecraft:mineshaft_mesa}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> MINESHAFT_MESA = create(key("mineshaft_mesa"));
/**
* {@code minecraft:monument}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> MONUMENT = create(key("monument"));
/**
* {@code minecraft:nether_fossil}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> NETHER_FOSSIL = create(key("nether_fossil"));
/**
* {@code minecraft:ocean_ruin_cold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> OCEAN_RUIN_COLD = create(key("ocean_ruin_cold"));
/**
* {@code minecraft:ocean_ruin_warm}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> OCEAN_RUIN_WARM = create(key("ocean_ruin_warm"));
/**
* {@code minecraft:pillager_outpost}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> PILLAGER_OUTPOST = create(key("pillager_outpost"));
/**
* {@code minecraft:ruined_portal}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL = create(key("ruined_portal"));
/**
* {@code minecraft:ruined_portal_desert}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL_DESERT = create(key("ruined_portal_desert"));
/**
* {@code minecraft:ruined_portal_jungle}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL_JUNGLE = create(key("ruined_portal_jungle"));
/**
* {@code minecraft:ruined_portal_mountain}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL_MOUNTAIN = create(key("ruined_portal_mountain"));
/**
* {@code minecraft:ruined_portal_nether}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL_NETHER = create(key("ruined_portal_nether"));
/**
* {@code minecraft:ruined_portal_ocean}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL_OCEAN = create(key("ruined_portal_ocean"));
/**
* {@code minecraft:ruined_portal_swamp}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> RUINED_PORTAL_SWAMP = create(key("ruined_portal_swamp"));
/**
* {@code minecraft:shipwreck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> SHIPWRECK = create(key("shipwreck"));
/**
* {@code minecraft:shipwreck_beached}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> SHIPWRECK_BEACHED = create(key("shipwreck_beached"));
/**
* {@code minecraft:stronghold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> STRONGHOLD = create(key("stronghold"));
/**
* {@code minecraft:swamp_hut}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> SWAMP_HUT = create(key("swamp_hut"));
/**
* {@code minecraft:trail_ruins}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> TRAIL_RUINS = create(key("trail_ruins"));
/**
* {@code minecraft:trial_chambers}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> TRIAL_CHAMBERS = create(key("trial_chambers"));
/**
* {@code minecraft:village_desert}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> VILLAGE_DESERT = create(key("village_desert"));
/**
* {@code minecraft:village_plains}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> VILLAGE_PLAINS = create(key("village_plains"));
/**
* {@code minecraft:village_savanna}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> VILLAGE_SAVANNA = create(key("village_savanna"));
/**
* {@code minecraft:village_snowy}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> VILLAGE_SNOWY = create(key("village_snowy"));
/**
* {@code minecraft:village_taiga}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Structure> VILLAGE_TAIGA = create(key("village_taiga"));
private StructureKeys() {
}
/**
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<Structure> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.STRUCTURE, key);
}
}

Datei anzeigen

@ -0,0 +1,147 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.generator.structure.StructureType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class StructureTypeKeys {
/**
* {@code minecraft:buried_treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> BURIED_TREASURE = create(key("buried_treasure"));
/**
* {@code minecraft:desert_pyramid}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> DESERT_PYRAMID = create(key("desert_pyramid"));
/**
* {@code minecraft:end_city}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> END_CITY = create(key("end_city"));
/**
* {@code minecraft:fortress}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> FORTRESS = create(key("fortress"));
/**
* {@code minecraft:igloo}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> IGLOO = create(key("igloo"));
/**
* {@code minecraft:jigsaw}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> JIGSAW = create(key("jigsaw"));
/**
* {@code minecraft:jungle_temple}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> JUNGLE_TEMPLE = create(key("jungle_temple"));
/**
* {@code minecraft:mineshaft}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> MINESHAFT = create(key("mineshaft"));
/**
* {@code minecraft:nether_fossil}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> NETHER_FOSSIL = create(key("nether_fossil"));
/**
* {@code minecraft:ocean_monument}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> OCEAN_MONUMENT = create(key("ocean_monument"));
/**
* {@code minecraft:ocean_ruin}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> OCEAN_RUIN = create(key("ocean_ruin"));
/**
* {@code minecraft:ruined_portal}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> RUINED_PORTAL = create(key("ruined_portal"));
/**
* {@code minecraft:shipwreck}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> SHIPWRECK = create(key("shipwreck"));
/**
* {@code minecraft:stronghold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> STRONGHOLD = create(key("stronghold"));
/**
* {@code minecraft:swamp_hut}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> SWAMP_HUT = create(key("swamp_hut"));
/**
* {@code minecraft:woodland_mansion}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<StructureType> WOODLAND_MANSION = create(key("woodland_mansion"));
private StructureTypeKeys() {
}
private static @NonNull TypedKey<StructureType> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
}
}

Datei anzeigen

@ -0,0 +1,112 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class TrimMaterialKeys {
/**
* {@code minecraft:amethyst}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> AMETHYST = create(key("amethyst"));
/**
* {@code minecraft:copper}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> COPPER = create(key("copper"));
/**
* {@code minecraft:diamond}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> DIAMOND = create(key("diamond"));
/**
* {@code minecraft:emerald}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> EMERALD = create(key("emerald"));
/**
* {@code minecraft:gold}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> GOLD = create(key("gold"));
/**
* {@code minecraft:iron}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> IRON = create(key("iron"));
/**
* {@code minecraft:lapis}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> LAPIS = create(key("lapis"));
/**
* {@code minecraft:netherite}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> NETHERITE = create(key("netherite"));
/**
* {@code minecraft:quartz}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> QUARTZ = create(key("quartz"));
/**
* {@code minecraft:redstone}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimMaterial> REDSTONE = create(key("redstone"));
private TrimMaterialKeys() {
}
/**
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<TrimMaterial> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
}
}

Datei anzeigen

@ -0,0 +1,168 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#TRIM_PATTERN}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class TrimPatternKeys {
/**
* {@code minecraft:bolt}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> BOLT = create(key("bolt"));
/**
* {@code minecraft:coast}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> COAST = create(key("coast"));
/**
* {@code minecraft:dune}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> DUNE = create(key("dune"));
/**
* {@code minecraft:eye}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> EYE = create(key("eye"));
/**
* {@code minecraft:flow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> FLOW = create(key("flow"));
/**
* {@code minecraft:host}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> HOST = create(key("host"));
/**
* {@code minecraft:raiser}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> RAISER = create(key("raiser"));
/**
* {@code minecraft:rib}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> RIB = create(key("rib"));
/**
* {@code minecraft:sentry}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> SENTRY = create(key("sentry"));
/**
* {@code minecraft:shaper}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> SHAPER = create(key("shaper"));
/**
* {@code minecraft:silence}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> SILENCE = create(key("silence"));
/**
* {@code minecraft:snout}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> SNOUT = create(key("snout"));
/**
* {@code minecraft:spire}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> SPIRE = create(key("spire"));
/**
* {@code minecraft:tide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> TIDE = create(key("tide"));
/**
* {@code minecraft:vex}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> VEX = create(key("vex"));
/**
* {@code minecraft:ward}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> WARD = create(key("ward"));
/**
* {@code minecraft:wayfinder}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> WAYFINDER = create(key("wayfinder"));
/**
* {@code minecraft:wild}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<TrimPattern> WILD = create(key("wild"));
private TrimPatternKeys() {
}
/**
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<TrimPattern> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
}
}

Datei anzeigen

@ -0,0 +1,105 @@
package io.papermc.paper.registry.keys;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import net.kyori.adventure.key.Key;
import org.bukkit.entity.Wolf;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class WolfVariantKeys {
/**
* {@code minecraft:ashen}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> ASHEN = create(key("ashen"));
/**
* {@code minecraft:black}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> BLACK = create(key("black"));
/**
* {@code minecraft:chestnut}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> CHESTNUT = create(key("chestnut"));
/**
* {@code minecraft:pale}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> PALE = create(key("pale"));
/**
* {@code minecraft:rusty}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> RUSTY = create(key("rusty"));
/**
* {@code minecraft:snowy}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> SNOWY = create(key("snowy"));
/**
* {@code minecraft:spotted}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> SPOTTED = create(key("spotted"));
/**
* {@code minecraft:striped}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> STRIPED = create(key("striped"));
/**
* {@code minecraft:woods}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TypedKey<Wolf.Variant> WOODS = create(key("woods"));
private WolfVariantKeys() {
}
/**
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
*
* @param key the value's key in the registry
* @return a new typed key
*/
@ApiStatus.Experimental
public static @NonNull TypedKey<Wolf.Variant> create(final @NonNull Key key) {
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
}
}

Datei anzeigen

@ -0,0 +1,323 @@
package io.papermc.paper.registry.keys.tags;
import static net.kyori.adventure.key.Key.key;
import io.papermc.paper.generated.GeneratedFrom;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.key.Key;
import org.bukkit.MinecraftExperimental;
import org.bukkit.enchantments.Enchantment;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
/**
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
*
* @apiNote The fields provided here are a direct representation of
* what is available from the vanilla game source. They may be
* changed (including removals) on any Minecraft version
* bump, so cross-version compatibility is not provided on the
* same level as it is on most of the other API.
*/
@SuppressWarnings({
"unused",
"SpellCheckingInspection"
})
@GeneratedFrom("1.21.1")
@ApiStatus.Experimental
public final class EnchantmentTagKeys {
/**
* {@code #minecraft:curse}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> CURSE = create(key("curse"));
/**
* {@code #minecraft:double_trade_price}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price"));
/**
* {@code #minecraft:exclusive_set/armor}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_ARMOR = create(key("exclusive_set/armor"));
/**
* {@code #minecraft:exclusive_set/boots}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots"));
/**
* {@code #minecraft:exclusive_set/bow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
/**
* {@code #minecraft:exclusive_set/crossbow}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow"));
/**
* {@code #minecraft:exclusive_set/damage}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage"));
/**
* {@code #minecraft:exclusive_set/mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining"));
/**
* {@code #minecraft:exclusive_set/riptide}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
/**
* {@code #minecraft:in_enchanting_table}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
/**
* {@code #minecraft:non_treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> NON_TREASURE = create(key("non_treasure"));
/**
* {@code #minecraft:on_mob_spawn_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment"));
/**
* {@code #minecraft:on_random_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
/**
* {@code #minecraft:on_traded_equipment}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
/**
* {@code #minecraft:prevents_bee_spawns_when_mining}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining"));
/**
* {@code #minecraft:prevents_decorated_pot_shattering}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
/**
* {@code #minecraft:prevents_ice_melting}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
/**
* {@code #minecraft:prevents_infested_spawns}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
/**
* {@code #minecraft:smelts_loot}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
/**
* {@code #minecraft:tooltip_order}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
/**
* {@code #minecraft:tradeable}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
/**
* {@code #minecraft:trades/desert_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common"));
/**
* {@code #minecraft:trades/desert_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
/**
* {@code #minecraft:trades/jungle_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_JUNGLE_COMMON = create(key("trades/jungle_common"));
/**
* {@code #minecraft:trades/jungle_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_JUNGLE_SPECIAL = create(key("trades/jungle_special"));
/**
* {@code #minecraft:trades/plains_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common"));
/**
* {@code #minecraft:trades/plains_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
/**
* {@code #minecraft:trades/savanna_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SAVANNA_COMMON = create(key("trades/savanna_common"));
/**
* {@code #minecraft:trades/savanna_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
/**
* {@code #minecraft:trades/snow_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SNOW_COMMON = create(key("trades/snow_common"));
/**
* {@code #minecraft:trades/snow_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
/**
* {@code #minecraft:trades/swamp_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_COMMON = create(key("trades/swamp_common"));
/**
* {@code #minecraft:trades/swamp_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
/**
* {@code #minecraft:trades/taiga_common}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
/**
* {@code #minecraft:trades/taiga_special}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
@ApiStatus.Experimental
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
/**
* {@code #minecraft:treasure}
*
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
*/
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
private EnchantmentTagKeys() {
}
/**
* Creates a tag key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
*
* @param key the tag key's key
* @return a new tag key
*/
@ApiStatus.Experimental
public static @NonNull TagKey<Enchantment> create(final @NonNull Key key) {
return TagKey.create(RegistryKey.ENCHANTMENT, key);
}
}

Datei anzeigen

@ -0,0 +1,52 @@
package io.papermc.generator;
import io.papermc.generator.types.GeneratedKeyType;
import io.papermc.generator.types.GeneratedTagKeyType;
import io.papermc.generator.types.SourceGenerator;
import io.papermc.generator.types.goal.MobGoalGenerator;
import io.papermc.paper.registry.RegistryKey;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import org.bukkit.GameEvent;
import org.bukkit.MusicInstrument;
import org.bukkit.block.Biome;
import org.bukkit.damage.DamageType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Wolf;
import org.bukkit.generator.structure.Structure;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.ItemType;
import org.bukkit.inventory.meta.trim.TrimMaterial;
import org.bukkit.inventory.meta.trim.TrimPattern;
import org.bukkit.potion.PotionEffectType;
public interface Generators {
SourceGenerator[] API = {
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, false),
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false),
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
simpleKey("DamageTypeKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, true),
simpleKey("WolfVariantKeys", Wolf.Variant.class, Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, true),
simpleKey("ItemTypeKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM, false),
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
simpleTagKey("ItemTypeTagKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM),
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
};
private static <T, A> SourceGenerator simpleKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
return new GeneratedKeyType<>(className, apiType, "io.papermc.paper.registry.keys", registryKey, apiRegistryKey, publicCreateKeyMethod);
}
private static <T, A> SourceGenerator simpleTagKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey) {
return new GeneratedTagKeyType<>(className, apiType, "io.papermc.paper.registry.keys.tags", registryKey, apiRegistryKey, true);
}
}

Datei anzeigen

@ -0,0 +1,79 @@
package io.papermc.generator;
import com.google.common.util.concurrent.MoreExecutors;
import com.mojang.logging.LogUtils;
import io.papermc.generator.types.SourceGenerator;
import io.papermc.generator.utils.TagCollector;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import net.minecraft.SharedConstants;
import net.minecraft.commands.Commands;
import net.minecraft.core.LayeredRegistryAccess;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.server.WorldLoader;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey;
import net.minecraft.world.flag.FeatureFlags;
import org.apache.commons.io.file.PathUtils;
import org.slf4j.Logger;
public final class Main {
private static final Logger LOGGER = LogUtils.getLogger();
public static final RegistryAccess.Frozen REGISTRY_ACCESS;
public static final Map<TagKey<?>, String> EXPERIMENTAL_TAGS;
static {
SharedConstants.tryDetectVersion();
Bootstrap.bootStrap();
Bootstrap.validate();
final PackRepository resourceRepository = ServerPacksSource.createVanillaTrustedRepository();
resourceRepository.reload();
final MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, resourceRepository.getAvailablePacks().stream().map(Pack::open).toList());
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
REGISTRY_ACCESS = layers.compositeAccess().freeze();
final ReloadableServerResources datapack = ReloadableServerResources.loadResources(resourceManager, layers, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
datapack.updateRegistryTags();
EXPERIMENTAL_TAGS = TagCollector.grabExperimental(resourceManager);
}
private Main() {
}
public static void main(final String[] args) {
LOGGER.info("Running API generators...");
generate(Paths.get(args[0]), Generators.API);
// LOGGER.info("Running Server generators...");
// generate(Paths.get(args[1]), Generators.SERVER);
}
private static void generate(Path output, SourceGenerator[] generators) {
try {
if (Files.exists(output)) {
PathUtils.deleteDirectory(output);
}
Files.createDirectories(output);
for (final SourceGenerator generator : generators) {
generator.writeToFile(output);
}
LOGGER.info("Files written to {}", output.toAbsolutePath());
} catch (final Exception ex) {
throw new RuntimeException(ex);
}
}
}

Datei anzeigen

@ -0,0 +1,193 @@
package io.papermc.generator.types;
import com.google.common.collect.Sets;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.CollectingContext;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.TypedKey;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.flag.FeatureElement;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import static com.squareup.javapoet.TypeSpec.classBuilder;
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
import static io.papermc.generator.utils.Annotations.NOT_NULL;
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
import static java.util.Objects.requireNonNull;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
@DefaultQualifier(NonNull.class)
public class GeneratedKeyType<T, A> extends SimpleGenerator {
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream()
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static {
final Map<RegistryKey<?>, String> map = new HashMap<>();
try {
for (final Field field : RegistryKey.class.getFields()) {
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
continue;
}
map.put((RegistryKey<?>) field.get(null), field.getName());
}
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
private static final String CREATE_JAVADOC = """
Creates a key for {@link $T} in the registry {@code $L}.
@param key the value's key in the registry
@return a new typed key
""";
private final Class<A> apiType;
private final ResourceKey<? extends Registry<T>> registryKey;
private final RegistryKey<A> apiRegistryKey;
private final boolean publicCreateKeyMethod;
public GeneratedKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
super(keysClassName, pkg);
this.apiType = apiType;
this.registryKey = registryKey;
this.apiRegistryKey = apiRegistryKey;
this.publicCreateKeyMethod = publicCreateKeyMethod;
}
private MethodSpec.Builder createMethod(final TypeName returnType) {
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
.addParameter(keyParam)
.addCode("return $T.create($T.$L, $N);", TypedKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
.returns(returnType.annotated(NOT_NULL));
if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
}
private TypeSpec.Builder keyHolderType() {
return classBuilder(this.className)
.addModifiers(PUBLIC, FINAL)
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
.addAnnotations(Annotations.CLASS_HEADER)
.addMethod(MethodSpec.constructorBuilder()
.addModifiers(PRIVATE)
.build()
);
}
@Override
protected TypeSpec getTypeSpec() {
final TypeName typedKey = ParameterizedTypeName.get(TypedKey.class, this.apiType);
final TypeSpec.Builder typeBuilder = this.keyHolderType();
final MethodSpec.Builder createMethod = this.createMethod(typedKey);
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
final Set<ResourceKey<T>> experimental = this.collectExperimentalKeys(registry);
boolean allExperimental = true;
for (final Holder.Reference<T> reference : registry.holders().sorted(Formatting.alphabeticKeyOrder(reference -> reference.key().location().getPath())).toList()) {
final ResourceKey<T> key = reference.key();
final String keyPath = key.location().getPath();
final String fieldName = Formatting.formatKeyAsField(keyPath);
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), keyPath)
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString());
if (experimental.contains(key)) {
fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
allExperimental = false;
}
typeBuilder.addField(fieldBuilder.build());
}
if (allExperimental) {
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
}
return typeBuilder.addMethod(createMethod.build()).build();
}
private Set<ResourceKey<T>> collectExperimentalKeys(final Registry<T> registry) {
if (FeatureElement.FILTERED_REGISTRIES.contains(registry.key())) {
return this.collectExperimentalKeysBuiltIn(registry);
} else {
return this.collectExperimentalKeysDataDriven(registry);
}
}
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
final HolderLookup.RegistryLookup<T> filteredLookup = registry.asLookup().filterElements(v -> {
return false; // Update for Experimental API
});
return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
}
@SuppressWarnings("unchecked")
private Set<ResourceKey<T>> collectExperimentalKeysDataDriven(final Registry<T> registry) {
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> experimentalBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) EXPERIMENTAL_REGISTRY_ENTRIES.get(this.registryKey);
if (experimentalBootstrap == null) {
return Collections.emptySet();
}
final Set<ResourceKey<T>> experimental = Collections.newSetFromMap(new IdentityHashMap<>());
final CollectingContext<T> experimentalCollector = new CollectingContext<>(experimental, registry);
experimentalBootstrap.run(experimentalCollector);
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> vanillaBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) VANILLA_REGISTRY_ENTRIES.get(this.registryKey);
if (vanillaBootstrap != null) {
final Set<ResourceKey<T>> vanilla = Collections.newSetFromMap(new IdentityHashMap<>());
final CollectingContext<T> vanillaCollector = new CollectingContext<>(vanilla, registry);
vanillaBootstrap.run(vanillaCollector);
return Sets.difference(experimental, vanilla);
}
return experimental;
}
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.addStaticImport(Key.class, "key");
}
}

Datei anzeigen

@ -0,0 +1,137 @@
package io.papermc.generator.types;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.papermc.generator.Main;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import io.papermc.paper.registry.RegistryKey;
import io.papermc.paper.registry.tag.TagKey;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import net.kyori.adventure.key.Key;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import org.bukkit.MinecraftExperimental;
import static com.squareup.javapoet.TypeSpec.classBuilder;
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
import static io.papermc.generator.utils.Annotations.NOT_NULL;
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
import static java.util.Objects.requireNonNull;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
static {
final Map<RegistryKey<?>, String> map = new HashMap<>();
try {
for (final Field field : RegistryKey.class.getFields()) {
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
continue;
}
map.put((RegistryKey<?>) field.get(null), field.getName());
}
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
private static final String CREATE_JAVADOC = """
Creates a tag key for {@link $T} in the registry {@code $L}.
@param key the tag key's key
@return a new tag key
""";
private final Class<A> apiType;
private final ResourceKey<? extends Registry<T>> registryKey;
private final RegistryKey<A> apiRegistryKey;
private final boolean publicCreateKeyMethod;
public GeneratedTagKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
super(keysClassName, pkg);
this.apiType = apiType;
this.registryKey = registryKey;
this.apiRegistryKey = apiRegistryKey;
this.publicCreateKeyMethod = publicCreateKeyMethod;
}
private MethodSpec.Builder createMethod(final TypeName returnType) {
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
.addParameter(keyParam)
.addCode("return $T.create($T.$L, $N);", TagKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
.returns(returnType.annotated(NOT_NULL));
if (this.publicCreateKeyMethod) {
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
}
return create;
}
private TypeSpec.Builder keyHolderType() {
return classBuilder(this.className)
.addModifiers(PUBLIC, FINAL)
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
.addAnnotations(Annotations.CLASS_HEADER)
.addMethod(MethodSpec.constructorBuilder()
.addModifiers(PRIVATE)
.build()
);
}
@Override
protected TypeSpec getTypeSpec() {
final TypeName tagKey = ParameterizedTypeName.get(TagKey.class, this.apiType);
final TypeSpec.Builder typeBuilder = this.keyHolderType();
final MethodSpec.Builder createMethod = this.createMethod(tagKey);
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
final AtomicBoolean allExperimental = new AtomicBoolean(true);
registry.getTagNames().sorted(Formatting.alphabeticKeyOrder(nmsTagKey -> nmsTagKey.location().getPath())).forEach(nmsTagKey -> {
final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath());
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath())
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), "#" + nmsTagKey.location());
if (Main.EXPERIMENTAL_TAGS.containsKey(nmsTagKey)) {
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.TRADE_REBALANCE)); // Update for Experimental API
} else {
allExperimental.set(false);
}
typeBuilder.addField(fieldBuilder.build());
});
if (allExperimental.get()) {
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
} else {
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
}
return typeBuilder.addMethod(createMethod.build()).build();
}
@Override
protected JavaFile.Builder file(final JavaFile.Builder builder) {
return builder
.addStaticImport(Key.class, "key");
}
}

Datei anzeigen

@ -0,0 +1,35 @@
package io.papermc.generator.types;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
public abstract class SimpleGenerator implements SourceGenerator {
protected final String className;
protected final String packageName;
protected SimpleGenerator(String className, String packageName) {
this.className = className;
this.packageName = packageName;
}
protected abstract TypeSpec getTypeSpec();
protected abstract JavaFile.Builder file(JavaFile.Builder builder);
@Override
public void writeToFile(Path parent) throws IOException {
JavaFile.Builder builder = JavaFile.builder(this.packageName, this.getTypeSpec());
this.file(builder)
.indent(" ")
.skipJavaLangImports(true);
builder.build().writeTo(parent, StandardCharsets.UTF_8);
}
}

Datei anzeigen

@ -0,0 +1,9 @@
package io.papermc.generator.types;
import java.io.IOException;
import java.nio.file.Path;
public interface SourceGenerator {
void writeToFile(Path parent) throws IOException;
}

Datei anzeigen

@ -0,0 +1,143 @@
package io.papermc.generator.types.goal;
import com.destroystokyo.paper.entity.RangedEntity;
import com.destroystokyo.paper.entity.ai.GoalKey;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ScanResult;
import io.papermc.generator.types.SimpleGenerator;
import io.papermc.generator.utils.Annotations;
import io.papermc.generator.utils.Formatting;
import io.papermc.generator.utils.Javadocs;
import java.util.Comparator;
import java.util.List;
import javax.lang.model.element.Modifier;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.goal.WrappedGoal;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Cat;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Dolphin;
import org.bukkit.entity.Drowned;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Evoker;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Llama;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.PolarBear;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Raider;
import org.bukkit.entity.Ravager;
import org.bukkit.entity.Shulker;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.SkeletonHorse;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Spellcaster;
import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.TraderLlama;
import org.bukkit.entity.Turtle;
import org.bukkit.entity.Vex;
import org.bukkit.entity.Vindicator;
import org.bukkit.entity.WanderingTrader;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.jetbrains.annotations.Nullable;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PRIVATE;
import static javax.lang.model.element.Modifier.PUBLIC;
import static javax.lang.model.element.Modifier.STATIC;
@DefaultQualifier(NonNull.class)
public class MobGoalGenerator extends SimpleGenerator {
private static final String CLASS_HEADER = Javadocs.getVersionDependentClassHeader("Mob Goals");
public MobGoalGenerator(final String keysClassName, final String pkg) {
super(keysClassName, pkg);
}
@Override
protected TypeSpec getTypeSpec() {
TypeVariableName type = TypeVariableName.get("T", Mob.class);
TypeSpec.Builder typeBuilder = TypeSpec.interfaceBuilder(this.className)
.addSuperinterface(ParameterizedTypeName.get(ClassName.get(com.destroystokyo.paper.entity.ai.Goal.class), type))
.addModifiers(PUBLIC)
.addTypeVariable(type)
.addAnnotations(Annotations.CLASS_HEADER)
.addJavadoc(CLASS_HEADER);
TypeName mobType = ParameterizedTypeName.get(ClassName.get(Class.class), type)
.annotated(Annotations.NOT_NULL);
TypeName keyType = TypeName.get(String.class)
.annotated(Annotations.NOT_NULL);
ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
ParameterSpec typeParam = ParameterSpec.builder(mobType, "type", FINAL).build();
MethodSpec.Builder createMethod = MethodSpec.methodBuilder("create")
.addModifiers(PRIVATE, STATIC)
.addParameter(keyParam)
.addParameter(typeParam)
.addCode("return $T.of($N, $T.minecraft($N));", GoalKey.class, typeParam, NamespacedKey.class, keyParam)
.addTypeVariable(type)
.returns(ParameterizedTypeName.get(ClassName.get(GoalKey.class), type).annotated(Annotations.NOT_NULL));
List<Class<Goal>> classes;
try (ScanResult scanResult = new ClassGraph().enableAllInfo().whitelistPackages("net.minecraft").scan()) {
classes = scanResult.getSubclasses(Goal.class.getName()).loadClasses(Goal.class);
}
List<GoalKey<Mob>> vanillaNames = classes.stream()
.filter(clazz -> !java.lang.reflect.Modifier.isAbstract(clazz.getModifiers()))
.filter(clazz -> !WrappedGoal.class.equals(clazz)) // TODO - properly fix
.map(goalClass -> MobGoalNames.getKey(goalClass.getName(), goalClass))
.filter((key) -> !MobGoalNames.isIgnored(key.getNamespacedKey().getKey()))
.sorted(Comparator.<GoalKey<?>, String>comparing(o -> o.getEntityClass().getSimpleName())
.thenComparing(vanillaGoalKey -> vanillaGoalKey.getNamespacedKey().getKey())
)
.toList();
for (final GoalKey<?> goalKey : vanillaNames) {
TypeName typedKey = ParameterizedTypeName.get(GoalKey.class, goalKey.getEntityClass());
NamespacedKey key = goalKey.getNamespacedKey();
String keyPath = key.getKey();
String fieldName = Formatting.formatKeyAsField(keyPath);
FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
.initializer("$N($S, $T.class)", createMethod.build(), keyPath, goalKey.getEntityClass());
typeBuilder.addField(fieldBuilder.build());
}
return typeBuilder.addMethod(createMethod.build()).build();
}
@Override
protected JavaFile.Builder file(JavaFile.Builder builder) {
return builder;
}
record DeprecatedEntry(Class<?> entity, String entryName, @Nullable String removalVersion,
@Nullable String removedVersion) {
}
}

Datei anzeigen

@ -0,0 +1,333 @@
package io.papermc.generator.types.goal;
import com.destroystokyo.paper.entity.RangedEntity;
import com.destroystokyo.paper.entity.ai.GoalKey;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.AbstractFish;
import net.minecraft.world.entity.animal.AbstractGolem;
import net.minecraft.world.entity.animal.AbstractSchoolingFish;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.animal.Pufferfish;
import net.minecraft.world.entity.animal.ShoulderRidingEntity;
import net.minecraft.world.entity.animal.SnowGolem;
import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
import net.minecraft.world.entity.boss.wither.WitherBoss;
import net.minecraft.world.entity.monster.AbstractIllager;
import net.minecraft.world.entity.monster.EnderMan;
import net.minecraft.world.entity.monster.PatrollingMonster;
import net.minecraft.world.entity.monster.RangedAttackMob;
import net.minecraft.world.entity.monster.SpellcasterIllager;
import net.minecraft.world.entity.monster.ZombifiedPiglin;
import net.minecraft.world.entity.monster.piglin.AbstractPiglin;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.AbstractHorse;
import org.bukkit.entity.AbstractSkeleton;
import org.bukkit.entity.AbstractVillager;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Ambient;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.Cat;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cod;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Dolphin;
import org.bukkit.entity.Donkey;
import org.bukkit.entity.Drowned;
import org.bukkit.entity.ElderGuardian;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Endermite;
import org.bukkit.entity.Evoker;
import org.bukkit.entity.Fish;
import org.bukkit.entity.Flying;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
import org.bukkit.entity.Golem;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Hoglin;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Husk;
import org.bukkit.entity.Illager;
import org.bukkit.entity.Illusioner;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.Llama;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Mule;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Phantom;
import org.bukkit.entity.Pig;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Piglin;
import org.bukkit.entity.PiglinAbstract;
import org.bukkit.entity.PiglinBrute;
import org.bukkit.entity.Pillager;
import org.bukkit.entity.PolarBear;
import org.bukkit.entity.PufferFish;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Raider;
import org.bukkit.entity.Ravager;
import org.bukkit.entity.Salmon;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Shulker;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.SkeletonHorse;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.Spellcaster;
import org.bukkit.entity.Spider;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Stray;
import org.bukkit.entity.Strider;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.TraderLlama;
import org.bukkit.entity.TropicalFish;
import org.bukkit.entity.Turtle;
import org.bukkit.entity.Vex;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Vindicator;
import org.bukkit.entity.WanderingTrader;
import org.bukkit.entity.WaterMob;
import org.bukkit.entity.Witch;
import org.bukkit.entity.Wither;
import org.bukkit.entity.WitherSkeleton;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zoglin;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.ZombieHorse;
import org.bukkit.entity.ZombieVillager;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
public class MobGoalNames {
private static final Map<Class<? extends Goal>, Class<? extends Mob>> entityClassCache = new HashMap<>();
public static final Map<Class<? extends net.minecraft.world.entity.Mob>, Class<? extends Mob>> bukkitMap = new HashMap<>();
static {
//<editor-fold defaultstate="collapsed" desc="bukkitMap Entities">
bukkitMap.put(net.minecraft.world.entity.Mob.class, Mob.class);
bukkitMap.put(net.minecraft.world.entity.AgeableMob.class, Ageable.class);
bukkitMap.put(AmbientCreature.class, Ambient.class);
bukkitMap.put(Animal.class, Animals.class);
bukkitMap.put(net.minecraft.world.entity.ambient.Bat.class, Bat.class);
bukkitMap.put(net.minecraft.world.entity.animal.Bee.class, Bee.class);
bukkitMap.put(net.minecraft.world.entity.monster.Blaze.class, Blaze.class);
bukkitMap.put(net.minecraft.world.entity.animal.Cat.class, Cat.class);
bukkitMap.put(net.minecraft.world.entity.monster.CaveSpider.class, CaveSpider.class);
bukkitMap.put(net.minecraft.world.entity.animal.Chicken.class, Chicken.class);
bukkitMap.put(net.minecraft.world.entity.animal.Cod.class, Cod.class);
bukkitMap.put(net.minecraft.world.entity.animal.Cow.class, Cow.class);
bukkitMap.put(PathfinderMob.class, Creature.class);
bukkitMap.put(net.minecraft.world.entity.monster.Creeper.class, Creeper.class);
bukkitMap.put(net.minecraft.world.entity.animal.Dolphin.class, Dolphin.class);
bukkitMap.put(net.minecraft.world.entity.monster.Drowned.class, Drowned.class);
bukkitMap.put(net.minecraft.world.entity.boss.enderdragon.EnderDragon.class, EnderDragon.class);
bukkitMap.put(EnderMan.class, Enderman.class);
bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
bukkitMap.put(AbstractFish.class, Fish.class);
bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
bukkitMap.put(FlyingMob.class, Flying.class);
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);
bukkitMap.put(net.minecraft.world.entity.monster.Giant.class, Giant.class);
bukkitMap.put(AbstractGolem.class, Golem.class);
bukkitMap.put(net.minecraft.world.entity.monster.Guardian.class, Guardian.class);
bukkitMap.put(net.minecraft.world.entity.monster.ElderGuardian.class, ElderGuardian.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Horse.class, Horse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.AbstractHorse.class, AbstractHorse.class);
bukkitMap.put(AbstractChestedHorse.class, ChestedHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Donkey.class, Donkey.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Mule.class, Mule.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.SkeletonHorse.class, SkeletonHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.ZombieHorse.class, ZombieHorse.class);
bukkitMap.put(net.minecraft.world.entity.animal.camel.Camel.class, org.bukkit.entity.Camel.class);
bukkitMap.put(AbstractIllager.class, Illager.class);
bukkitMap.put(net.minecraft.world.entity.monster.Illusioner.class, Illusioner.class);
bukkitMap.put(SpellcasterIllager.class, Spellcaster.class);
bukkitMap.put(net.minecraft.world.entity.animal.IronGolem.class, IronGolem.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.Llama.class, Llama.class);
bukkitMap.put(net.minecraft.world.entity.animal.horse.TraderLlama.class, TraderLlama.class);
bukkitMap.put(net.minecraft.world.entity.monster.MagmaCube.class, MagmaCube.class);
bukkitMap.put(net.minecraft.world.entity.monster.Monster.class, Monster.class);
bukkitMap.put(PatrollingMonster.class, Raider.class); // close enough
bukkitMap.put(net.minecraft.world.entity.animal.MushroomCow.class, MushroomCow.class);
bukkitMap.put(net.minecraft.world.entity.animal.Ocelot.class, Ocelot.class);
bukkitMap.put(net.minecraft.world.entity.animal.Panda.class, Panda.class);
bukkitMap.put(net.minecraft.world.entity.animal.Parrot.class, Parrot.class);
bukkitMap.put(ShoulderRidingEntity.class, Parrot.class); // close enough
bukkitMap.put(net.minecraft.world.entity.monster.Phantom.class, Phantom.class);
bukkitMap.put(net.minecraft.world.entity.animal.Pig.class, Pig.class);
bukkitMap.put(ZombifiedPiglin.class, PigZombie.class);
bukkitMap.put(net.minecraft.world.entity.monster.Pillager.class, Pillager.class);
bukkitMap.put(net.minecraft.world.entity.animal.PolarBear.class, PolarBear.class);
bukkitMap.put(Pufferfish.class, PufferFish.class);
bukkitMap.put(net.minecraft.world.entity.animal.Rabbit.class, Rabbit.class);
bukkitMap.put(net.minecraft.world.entity.raid.Raider.class, Raider.class);
bukkitMap.put(net.minecraft.world.entity.monster.Ravager.class, Ravager.class);
bukkitMap.put(net.minecraft.world.entity.animal.Salmon.class, Salmon.class);
bukkitMap.put(net.minecraft.world.entity.animal.Sheep.class, Sheep.class);
bukkitMap.put(net.minecraft.world.entity.monster.Shulker.class, Shulker.class);
bukkitMap.put(net.minecraft.world.entity.monster.Silverfish.class, Silverfish.class);
bukkitMap.put(net.minecraft.world.entity.monster.Skeleton.class, Skeleton.class);
bukkitMap.put(net.minecraft.world.entity.monster.AbstractSkeleton.class, AbstractSkeleton.class);
bukkitMap.put(net.minecraft.world.entity.monster.Stray.class, Stray.class);
bukkitMap.put(net.minecraft.world.entity.monster.WitherSkeleton.class, WitherSkeleton.class);
bukkitMap.put(net.minecraft.world.entity.monster.Slime.class, Slime.class);
bukkitMap.put(SnowGolem.class, Snowman.class);
bukkitMap.put(net.minecraft.world.entity.monster.Spider.class, Spider.class);
bukkitMap.put(net.minecraft.world.entity.animal.Squid.class, Squid.class);
bukkitMap.put(TamableAnimal.class, Tameable.class);
bukkitMap.put(net.minecraft.world.entity.animal.TropicalFish.class, TropicalFish.class);
bukkitMap.put(net.minecraft.world.entity.animal.Turtle.class, Turtle.class);
bukkitMap.put(net.minecraft.world.entity.monster.Vex.class, Vex.class);
bukkitMap.put(net.minecraft.world.entity.npc.Villager.class, Villager.class);
bukkitMap.put(net.minecraft.world.entity.npc.AbstractVillager.class, AbstractVillager.class);
bukkitMap.put(net.minecraft.world.entity.npc.WanderingTrader.class, WanderingTrader.class);
bukkitMap.put(net.minecraft.world.entity.monster.Vindicator.class, Vindicator.class);
bukkitMap.put(WaterAnimal.class, WaterMob.class);
bukkitMap.put(net.minecraft.world.entity.monster.Witch.class, Witch.class);
bukkitMap.put(WitherBoss.class, Wither.class);
bukkitMap.put(net.minecraft.world.entity.animal.Wolf.class, Wolf.class);
bukkitMap.put(net.minecraft.world.entity.monster.Zombie.class, Zombie.class);
bukkitMap.put(net.minecraft.world.entity.monster.Husk.class, Husk.class);
bukkitMap.put(net.minecraft.world.entity.monster.ZombieVillager.class, ZombieVillager.class);
bukkitMap.put(net.minecraft.world.entity.monster.hoglin.Hoglin.class, Hoglin.class);
bukkitMap.put(net.minecraft.world.entity.monster.piglin.Piglin.class, Piglin.class);
bukkitMap.put(AbstractPiglin.class, PiglinAbstract.class);
bukkitMap.put(net.minecraft.world.entity.monster.piglin.PiglinBrute.class, PiglinBrute.class);
bukkitMap.put(net.minecraft.world.entity.monster.Strider.class, Strider.class);
bukkitMap.put(net.minecraft.world.entity.monster.Zoglin.class, Zoglin.class);
bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, org.bukkit.entity.GlowSquid.class);
bukkitMap.put(net.minecraft.world.entity.animal.axolotl.Axolotl.class, org.bukkit.entity.Axolotl.class);
bukkitMap.put(net.minecraft.world.entity.animal.goat.Goat.class, org.bukkit.entity.Goat.class);
bukkitMap.put(net.minecraft.world.entity.animal.frog.Frog.class, org.bukkit.entity.Frog.class);
bukkitMap.put(net.minecraft.world.entity.animal.frog.Tadpole.class, org.bukkit.entity.Tadpole.class);
bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class);
bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class);
bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, org.bukkit.entity.Sniffer.class);
bukkitMap.put(net.minecraft.world.entity.monster.breeze.Breeze.class, org.bukkit.entity.Breeze.class);
bukkitMap.put(net.minecraft.world.entity.animal.armadillo.Armadillo.class, org.bukkit.entity.Armadillo.class);
bukkitMap.put(net.minecraft.world.entity.monster.Bogged.class, org.bukkit.entity.Bogged.class);
//</editor-fold>
}
private static final BiMap<String, String> deobfuscationMap = HashBiMap.create();
static final Set<String> ignored = new HashSet<>();
static {
deobfuscationMap.put("abstract_skeleton_1", "abstract_skeleton_melee");
ignored.add("goal_selector_1");
ignored.add("goal_selector_2");
ignored.add("selector_1");
ignored.add("selector_2");
ignored.add("wrapped");
}
public static String getUsableName(String name) {
final String original = name;
name = name.substring(name.lastIndexOf(".") + 1);
boolean flag = false;
// inner classes
if (name.contains("$")) {
String cut = name.substring(name.indexOf("$") + 1);
if (cut.length() <= 2) {
name = name.replace("Entity", "");
name = name.replace("$", "_");
flag = true;
} else {
// mapped, wooo
name = cut;
}
}
name = name.replace("PathfinderGoal", "");
name = name.replace("TargetGoal", "");
name = name.replace("Goal", "");
StringBuilder sb = new StringBuilder();
for (char c : name.toCharArray()) {
if (c >= 'A' && c <= 'Z') {
sb.append("_");
sb.append(Character.toLowerCase(c));
} else {
sb.append(c);
}
}
name = sb.toString();
name = name.replaceFirst("_", "");
if (flag && !deobfuscationMap.containsKey(name.toLowerCase(Locale.ROOT)) && !ignored.contains(name)) {
System.out.println("need to map " + original + " (" + name.toLowerCase(Locale.ROOT) + ")");
}
// did we rename this key?
return deobfuscationMap.getOrDefault(name, name);
}
public static boolean isIgnored(String name) {
return ignored.contains(name);
}
public static <T extends Mob> GoalKey<T> getKey(String clazzName, Class<? extends Goal> goalClass) {
String name = getUsableName(clazzName);
if (MobGoalNames.isIgnored(name)) {
//noinspection unchecked
return (GoalKey<T>) GoalKey.of(Mob.class, NamespacedKey.minecraft(name));
}
return GoalKey.of(getEntity(goalClass), NamespacedKey.minecraft(name));
}
public static <T extends Mob> Class<T> getEntity(Class<? extends Goal> goalClass) {
//noinspection unchecked
return (Class<T>) entityClassCache.computeIfAbsent(goalClass, key -> {
for (Constructor<?> ctor : key.getDeclaredConstructors()) {
for (int i = 0; i < ctor.getParameterCount(); i++) {
Class<?> param = ctor.getParameterTypes()[i];
if (net.minecraft.world.entity.Mob.class.isAssignableFrom(param)) {
//noinspection unchecked
return toBukkitClass((Class<? extends net.minecraft.world.entity.Mob>) param);
} else if (RangedAttackMob.class.isAssignableFrom(param)) {
return RangedEntity.class;
}
}
}
throw new RuntimeException("Can't figure out applicable entity for mob goal " + goalClass); // maybe just return EntityInsentient?
});
}
public static Class<? extends Mob> toBukkitClass(Class<? extends net.minecraft.world.entity.Mob> nmsClass) {
Class<? extends Mob> bukkitClass = bukkitMap.get(nmsClass);
if (bukkitClass == null) {
throw new RuntimeException("Can't figure out applicable bukkit entity for nms entity " + nmsClass); // maybe just return Mob?
}
return bukkitClass;
}
}

Datei anzeigen

@ -0,0 +1,64 @@
package io.papermc.generator.utils;
import com.squareup.javapoet.AnnotationSpec;
import java.util.ArrayList;
import java.util.List;
import io.papermc.paper.generated.GeneratedFrom;
import net.minecraft.SharedConstants;
import org.bukkit.MinecraftExperimental;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
public final class Annotations {
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
final List<AnnotationSpec> annotationSpecs = new ArrayList<>();
annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build());
if (requiredFeatureFlag != null) {
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class)
.addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name())
.build());
} else {
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build());
}
return annotationSpecs;
}
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
if (forRemoval) {
annotationSpec.addMember("forRemoval", "$L", true);
}
if (version != null) {
annotationSpec.addMember("since", "$S", version);
}
return annotationSpec.build();
}
public static AnnotationSpec scheduledRemoval(final @Nullable String version) {
return AnnotationSpec.builder(ApiStatus.ScheduledForRemoval.class)
.addMember("inVersion", "$S", version)
.build();
}
@ApiStatus.Experimental
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NonNull.class).build();
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
.addMember("value", "$S", "unused")
.addMember("value", "$S", "SpellCheckingInspection")
.build();
private static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
.addMember("value", "$S", SharedConstants.getCurrentVersion().getName())
.build();
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
SUPPRESS_WARNINGS,
GENERATED_FROM
);
private Annotations() {
}
}

Datei anzeigen

@ -0,0 +1,28 @@
package io.papermc.generator.utils;
import com.mojang.serialization.Lifecycle;
import io.papermc.generator.Main;
import java.util.Set;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.resources.ResourceKey;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class)
public record CollectingContext<T>(Set<ResourceKey<T>> registered,
Registry<T> registry) implements BootstrapContext<T> {
@Override
public Holder.Reference<T> register(final ResourceKey<T> resourceKey, final @NonNull T t, final Lifecycle lifecycle) {
this.registered.add(resourceKey);
return Holder.Reference.createStandAlone(this.registry.holderOwner(), resourceKey);
}
@Override
public <S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> resourceKey) {
return Main.REGISTRY_ACCESS.registryOrThrow(resourceKey).asLookup();
}
}

Datei anzeigen

@ -0,0 +1,59 @@
package io.papermc.generator.utils;
import java.util.Optional;
import org.apache.commons.lang3.math.NumberUtils;
import java.util.Comparator;
import java.util.Locale;
import java.util.OptionalInt;
import java.util.function.Function;
import java.util.regex.Pattern;
public final class Formatting {
private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]");
public static String formatKeyAsField(String path) {
return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ROOT)).replaceAll("_");
}
public static Optional<String> formatTagKey(String tagDir, String resourcePath) {
int tagsIndex = resourcePath.indexOf(tagDir);
int dotIndex = resourcePath.lastIndexOf('.');
if (tagsIndex == -1 || dotIndex == -1) {
return Optional.empty();
}
return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json
}
public static Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
public static <T> Comparator<T> alphabeticKeyOrder(Function<T, String> mapper) {
return (o1, o2) -> {
String path1 = mapper.apply(o1);
String path2 = mapper.apply(o2);
OptionalInt trailingInt1 = tryParseTrailingInt(path1);
OptionalInt trailingInt2 = tryParseTrailingInt(path2);
if (trailingInt1.isPresent() && trailingInt2.isPresent()) {
return Integer.compare(trailingInt1.getAsInt(), trailingInt2.getAsInt());
}
return path1.compareTo(path2);
};
}
private static OptionalInt tryParseTrailingInt(String path) {
int delimiterIndex = path.lastIndexOf('_');
if (delimiterIndex != -1) {
String score = path.substring(delimiterIndex + 1);
if (NumberUtils.isDigits(score)) {
return OptionalInt.of(Integer.parseInt(score));
}
}
return OptionalInt.empty();
}
private Formatting() {
}
}

Datei anzeigen

@ -0,0 +1,27 @@
package io.papermc.generator.utils;
public final class Javadocs {
public static String getVersionDependentClassHeader(String headerIdentifier) {
return """
Vanilla keys for %s.
@apiNote The fields provided here are a direct representation of
what is available from the vanilla game source. They may be
changed (including removals) on any Minecraft version
bump, so cross-version compatibility is not provided on the
same level as it is on most of the other API.
""".formatted(headerIdentifier);
}
public static String getVersionDependentField(String headerIdentifier) {
return """
%s
@apiNote This field is version-dependant and may be removed in future Minecraft versions
""".formatted(headerIdentifier);
}
private Javadocs() {
}
}

Datei anzeigen

@ -0,0 +1,79 @@
package io.papermc.generator.utils;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.mojang.logging.LogUtils;
import io.papermc.generator.Main;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.packs.PackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.BuiltInPackSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagKey;
import org.slf4j.Logger;
// collect all the tags by grabbing the json from the data-packs
// another (probably) way is to hook into the data generator like the typed keys generator
public final class TagCollector {
private static final Logger LOGGER = LogUtils.getLogger();
public static Map<TagKey<?>, String> grabExperimental(final MultiPackResourceManager resourceManager) {
Map<TagKey<?>, String> result = new IdentityHashMap<>();
// collect all vanilla tags
Multimap<ResourceKey<? extends Registry<?>>, String> vanillaTags = HashMultimap.create();
PackResources vanillaPack = resourceManager.listPacks()
.filter(packResources -> packResources.packId().equals(BuiltInPackSource.VANILLA_ID))
.findFirst()
.orElseThrow();
collectFromPack(vanillaPack, (entry, path) -> vanillaTags.put(entry.key(), path));
// then distinct with other data-pack tags to know for sure newly created tags and so experimental one
resourceManager.listPacks().forEach(pack -> {
String packId = pack.packId();
if (packId.equals(BuiltInPackSource.VANILLA_ID)) return;
collectFromPack(pack, (entry, path) -> {
if (vanillaTags.get(entry.key()).contains(path)) {
return;
}
result.put(entry.value().getTagNames()
.filter(tagKey -> tagKey.location().getPath().equals(path))
.findFirst()
.orElseThrow(), packId);
});
});
return Collections.unmodifiableMap(result);
}
private static void collectFromPack(PackResources pack, BiConsumer<RegistryAccess.RegistryEntry<?>, String> output) {
Set<String> namespaces = pack.getNamespaces(PackType.SERVER_DATA);
for (String namespace : namespaces) {
Main.REGISTRY_ACCESS.registries().forEach(entry -> {
// this is probably expensive but can't find another way around and data-pack loader has similar logic
// the issue is that registry key can have parent/key (and custom folder too) but tag key can also have parent/key so parsing become a mess
// without having at least one of the two values
String tagDir = Registries.tagsDirPath(entry.key());
pack.listResources(PackType.SERVER_DATA, namespace, tagDir, (id, supplier) -> {
Formatting.formatTagKey(tagDir, id.getPath()).ifPresentOrElse(path -> output.accept(entry, path), () -> {
LOGGER.warn("Unable to parse the path: {}/{}/{}.json in the data-pack {} into a tag key", namespace, tagDir, id.getPath(), pack.packId());
});
});
});
}
}
private TagCollector() {
}
}

Datei anzeigen

@ -0,0 +1,37 @@
package io.papermc.generator;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ScanResult;
import io.papermc.generator.types.goal.MobGoalNames;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.fail;
public class MobGoalConverterTest {
@Test
public void testBukkitMap() {
final List<Class<Mob>> classes;
try (ScanResult scanResult = new ClassGraph().enableAllInfo().whitelistPackages(Entity.class.getPackageName()).scan()) {
classes = scanResult.getSubclasses(Mob.class.getName()).loadClasses(Mob.class);
}
assertFalse(classes.isEmpty(), "There are supposed to be more than 0 mob classes!");
List<String> missingClasses = new ArrayList<>();
for (Class<Mob> nmsClass : classes) {
if (!MobGoalNames.bukkitMap.containsKey(nmsClass)) {
missingClasses.add(nmsClass.getCanonicalName());
}
}
if (!missingClasses.isEmpty()) {
fail("Missing some entity classes in the bukkit map: " + String.join(", ", missingClasses));
}
}
}

Datei anzeigen

@ -0,0 +1,7 @@
public net/minecraft/server/WorldLoader loadAndReplaceLayer(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/core/LayeredRegistryAccess;Lnet/minecraft/server/RegistryLayer;Ljava/util/List;)Lnet/minecraft/core/LayeredRegistryAccess;
# for auto-marking experimental stuff
public net/minecraft/core/RegistrySetBuilder entries
public net/minecraft/core/RegistrySetBuilder$RegistryStub
public net/minecraft/data/registries/UpdateOneTwentyOneRegistries BUILDER
public net/minecraft/data/registries/VanillaRegistries BUILDER

Datei anzeigen

@ -8,7 +8,7 @@ apply if there are changes made to it from upstream - thus notifying us
that changes were made.
diff --git a/.gitignore b/.gitignore
index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff61819431e6a5e65 100644
index 5dd700a956e915c00b25d91dea8d6f285ddab72b..97e78e27ee0eea2c8b24886eeb19164d552323fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
@ -17,7 +17,7 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943
# Eclipse stuff
/.classpath
/.project
@@ -31,3 +33,7 @@
@@ -32,3 +34,7 @@
*.ipr
*.iws
.idea/
@ -27,10 +27,10 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943
+/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae492b18556d
index 0000000000000000000000000000000000000000..6271e2bad0ed937c2c46a8c8fdf186c46b0b620e
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,81 @@
@@ -0,0 +1,91 @@
+plugins {
+ `java-library`
+ `maven-publish`
@ -41,25 +41,30 @@ index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae49
+ withJavadocJar()
+}
+
+val annotationsVersion = "24.1.0"
+val bungeeCordChatVersion = "1.20-R0.2"
+
+dependencies {
+ // api dependencies are listed transitively to API consumers
+ api("com.google.guava:guava:31.1-jre")
+ api("com.google.code.gson:gson:2.10")
+ api("net.md-5:bungeecord-chat:1.16-R0.4")
+ api("org.yaml:snakeyaml:1.33")
+ api("com.google.guava:guava:32.1.2-jre")
+ api("com.google.code.gson:gson:2.10.1")
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion")
+ api("org.yaml:snakeyaml:2.2")
+ api("org.joml:joml:1.10.5")
+
+ compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+ compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
+
+ val annotations = "org.jetbrains:annotations-java5:23.0.0"
+ val annotations = "org.jetbrains:annotations-java5:$annotationsVersion"
+ compileOnly(annotations)
+ testCompileOnly(annotations)
+
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
+ testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.ow2.asm:asm-tree:9.3")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
+ testImplementation("org.hamcrest:hamcrest:2.2")
+ testImplementation("org.mockito:mockito-core:5.11.0")
+ testImplementation("org.ow2.asm:asm-tree:9.7")
+}
+
+configure<PublishingExtension> {
@ -95,11 +100,12 @@ index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae49
+ options.use()
+ options.isDocFilesSubDirs = true
+ options.links(
+ "https://guava.dev/releases/31.0.1-jre/api/docs/",
+ "https://javadoc.io/doc/org.yaml/snakeyaml/1.33/",
+ "https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/",
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
+ "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-java5/$annotationsVersion/",
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/",
+ )
+ options.tags("apiNote:a:API Note:")
+
+ // workaround for https://github.com/gradle/gradle/issues/4046
+ inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
@ -112,12 +118,16 @@ index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae49
+ }
+ }
+}
+
+tasks.test {
+ useJUnitPlatform()
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 389f3761876d2a667309d317d1a99b545f36771a..0000000000000000000000000000000000000000
index 2c5ac393cffbe61330c5aa95115e7e906c0775d3..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,252 +0,0 @@
@@ -1,267 +0,0 @@
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@ -125,7 +135,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
-
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
- <version>1.19.3-R0.1-SNAPSHOT</version>
- <version>1.21.1-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>Spigot-API</name>
@ -134,8 +144,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
-
- <properties>
- <skipTests>true</skipTests>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.release>17</maven.compiler.release>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
@ -155,72 +164,85 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>31.1-jre</version>
- <version>32.1.2-jre</version>
- <scope>compile</scope>
- </dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.10</version>
- <version>2.10.1</version>
- <scope>compile</scope>
- </dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
- <dependency>
- <groupId>org.joml</groupId>
- <artifactId>joml</artifactId>
- <version>1.10.5</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>net.md-5</groupId>
- <artifactId>bungeecord-chat</artifactId>
- <version>1.16-R0.4</version>
- <version>1.20-R0.2</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.33</version>
- <version>2.2</version>
- <scope>compile</scope>
- </dependency>
- <!-- not part of the API proper -->
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-resolver-provider</artifactId>
- <version>3.8.5</version>
- <version>3.9.6</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-connector-basic</artifactId>
- <version>1.7.3</version>
- <version>1.9.18</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.resolver</groupId>
- <artifactId>maven-resolver-transport-http</artifactId>
- <version>1.7.3</version>
- <version>1.9.18</version>
- <scope>provided</scope>
- </dependency>
- <!-- annotations -->
- <dependency>
- <groupId>org.jetbrains</groupId>
- <artifactId>annotations-java5</artifactId>
- <version>23.0.0</version>
- <version>24.1.0</version>
- <scope>provided</scope>
- </dependency>
- <!-- testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.2</version>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>5.10.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-library</artifactId>
- <version>1.3</version>
- <artifactId>hamcrest</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>5.11.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-tree</artifactId>
- <version>9.3</version>
- <version>9.7</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
@ -230,7 +252,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- <plugin>
- <groupId>net.md-5</groupId>
- <artifactId>scriptus</artifactId>
- <version>0.4.1</version>
- <version>0.5.0</version>
- <executions>
- <execution>
- <phase>initialize</phase>
@ -243,23 +265,16 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.10.1</version>
- <version>3.13.0</version>
- <configuration>
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
- <compilerId>eclipse</compilerId>
- <!-- default changed with version 3.11.0 -->
- <showWarnings>false</showWarnings>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-compiler-eclipse</artifactId>
- <version>2.12.0</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.2.2</version>
- <version>3.4.1</version>
- <configuration>
- <archive>
- <manifest>
@ -274,7 +289,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.2.4</version>
- <version>3.5.3</version>
- <executions>
- <execution>
- <phase>package</phase>
@ -294,21 +309,32 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- </filters>
- <!-- when downloading via Maven we can pull depends individually -->
- <shadedArtifactAttached>true</shadedArtifactAttached>
- <!-- In 3.3.0 and later, shadedArtifactAttached causes dependant projects to use dependency reduced pom (bug?) -->
- <createDependencyReducedPom>false</createDependencyReducedPom>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>3.4.0</version>
- <version>3.6.3</version>
- <configuration>
- <links>
- <link>https://guava.dev/releases/31.0.1-jre/api/docs/</link>
- <link>https://javadoc.io/doc/org.yaml/snakeyaml/1.30/</link>
- <link>https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/</link>
- <link>https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/</link>
- <link>https://guava.dev/releases/32.1.2-jre/api/docs/</link>
- </links>
- <tags>
- <tag>
- <name>apiNote</name>
- <placement>a</placement>
- <head>API Note:</head>
- </tag>
- </tags>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>3.2.5</version>
- </plugin>
- </plugins>
- </build>
-
@ -323,7 +349,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <version>3.1.2</version>
- <version>3.3.1</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
@ -334,7 +360,6 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- </executions>
- <configuration>
- <configLocation>checkstyle.xml</configLocation>
- <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
- </configuration>
- <dependencies>
@ -348,7 +373,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.21</version>
- <version>1.23</version>
- <executions>
- <execution>
- <phase>process-classes</phase>

Datei anzeigen

@ -5,50 +5,54 @@ Subject: [PATCH] Build system changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 9686f621c7b837a7a38ffb2fea10ae492b18556d..2b3288057d67e5add4e22e6b7072527057bcd808 100644
index 6271e2bad0ed937c2c46a8c8fdf186c46b0b620e..a918fd14c95e714e935758d60bccd72755e00b11 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -14,15 +14,27 @@ dependencies {
api("com.google.code.gson:gson:2.10")
api("net.md-5:bungeecord-chat:1.16-R0.4")
api("org.yaml:snakeyaml:1.33")
@@ -18,15 +18,26 @@ dependencies {
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion")
api("org.yaml:snakeyaml:2.2")
api("org.joml:joml:1.10.5")
+ // Paper start
+ api("com.googlecode.json-simple:json-simple:1.1.1") {
+ isTransitive = false // includes junit
+ }
+ // Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+ compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
- val annotations = "org.jetbrains:annotations-java5:23.0.0"
+ val annotations = "org.jetbrains:annotations:23.0.0" // Paper - we don't want Java 5 annotations...
- val annotations = "org.jetbrains:annotations-java5:$annotationsVersion"
+ val annotations = "org.jetbrains:annotations:$annotationsVersion" // Paper - we don't want Java 5 annotations...
compileOnly(annotations)
testCompileOnly(annotations)
+ // Paper start - add checker
+ val checkerQual = "org.checkerframework:checker-qual:3.21.0"
+ val checkerQual = "org.checkerframework:checker-qual:3.33.0"
+ compileOnlyApi(checkerQual)
+ testCompileOnly(checkerQual)
+ // Paper end
+
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
@@ -64,7 +76,7 @@ tasks.withType<Javadoc> {
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.hamcrest:hamcrest:2.2")
@@ -69,8 +80,12 @@ tasks.withType<Javadoc> {
options.links(
"https://guava.dev/releases/31.0.1-jre/api/docs/",
"https://javadoc.io/doc/org.yaml/snakeyaml/1.33/",
- "https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/",
+ "https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations
"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
"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-java5/$annotationsVersion/",
+ "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 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",
+ // Paper end
)
options.tags("apiNote:a:API Note:")
@@ -79,3 +91,14 @@ tasks.withType<Javadoc> {
}
}
@@ -89,3 +104,14 @@ tasks.withType<Javadoc> {
tasks.test {
useJUnitPlatform()
}
+
+// Paper start

Datei anzeigen

@ -3,54 +3,31 @@ From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 17 Mar 2019 23:04:30 +0000
Subject: [PATCH] Test changes
- convert to mockito for mocking of types
- Allow use of TYPE_USE annotations
- Ignore package-private methods for nullability annotations
- Add excludes for classes which don't pass
- Disable stupid BukkitMirrorTest
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 2b3288057d67e5add4e22e6b7072527057bcd808..4b3453f8dab6008b6fad6245fb7205da33b4bfb8 100644
index a918fd14c95e714e935758d60bccd72755e00b11..768024b2b4584fd7dd86f068c0e79c89ffc5faa1 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -34,6 +34,7 @@ dependencies {
compileOnlyApi(checkerQual)
testCompileOnly(checkerQual)
// Paper end
+ testImplementation("org.mockito:mockito-core:4.9.0") // Paper - add mockito
@@ -105,6 +105,12 @@ tasks.test {
useJUnitPlatform()
}
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
diff --git a/src/test/java/io/papermc/paper/testing/EmptyRegistry.java b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..ba9ddce87a9f385e729a5c2cf7c5eec120e388a7
--- /dev/null
+++ b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java
@@ -0,0 +1,23 @@
+package io.papermc.paper.testing;
+
+import java.util.Collections;
+import java.util.Iterator;
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public record EmptyRegistry() implements Registry<Keyed> {
+
+ @NotNull
+ @Override
+ public Iterator<Keyed> iterator() {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public @Nullable Keyed get(@NotNull final NamespacedKey key) {
+ return null;
+ }
+// Paper start - compile tests with -parameters for better junit parameterized test names
+tasks.compileTestJava {
+ options.compilerArgs.add("-parameters")
+}
+// Paper end
+
// Paper start
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
diff --git a/src/test/java/io/papermc/paper/testing/EmptyTag.java b/src/test/java/io/papermc/paper/testing/EmptyTag.java
new file mode 100644
index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f559ebc18
@ -88,65 +65,26 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f
+ return Collections.emptySet();
+ }
+}
diff --git a/src/test/java/io/papermc/paper/testing/TestServer.java b/src/test/java/io/papermc/paper/testing/TestServer.java
new file mode 100644
index 0000000000000000000000000000000000000000..756acf231b1b076b08046d86992ba7ce7f62a94f
--- /dev/null
+++ b/src/test/java/io/papermc/paper/testing/TestServer.java
@@ -0,0 +1,48 @@
+package io.papermc.paper.testing;
+
+import java.util.logging.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Server;
+import org.bukkit.command.SimpleCommandMap;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.plugin.SimplePluginManager;
+
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public final class TestServer {
+
+ @SuppressWarnings("removal")
+ public static void setup() {
+ //noinspection ConstantValue
+ if (Bukkit.getServer() != null) {
+ return;
+ }
+
+ final Server dummyServer = mock(Server.class);
+
+ final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
+ when(dummyServer.getLogger()).thenReturn(logger);
+ when(dummyServer.getName()).thenReturn(TestServer.class.getSimpleName());
+ when(dummyServer.getVersion()).thenReturn("Version_" + TestServer.class.getPackage().getImplementationVersion());
+ when(dummyServer.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion());
+
+
+ final Thread currentThread = Thread.currentThread();
+ when(dummyServer.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
+
+ when(dummyServer.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new EmptyTag());
+
+ final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer));
+ when(dummyServer.getPluginManager()).thenReturn(pluginManager);
+
+ when(dummyServer.getRegistry(any())).thenAnswer(ignored -> new EmptyRegistry());
+ when(dummyServer.getScoreboardCriteria(anyString())).thenReturn(null);
+
+ Bukkit.setServer(dummyServer);
+ }
+
+}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c84891b8b0fd 100644
index 64e7aef6220097edefdff3b98a771b988365930d..d9091ba1e5a55e03adca98305233cce9d6888609 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -40,7 +40,17 @@ public class AnnotationTest {
@@ -29,7 +29,13 @@ public class AnnotationTest {
"Lorg/jetbrains/annotations/Nullable;",
"Lorg/jetbrains/annotations/NotNull;",
"Lorg/jetbrains/annotations/Contract;",
- "Lorg/bukkit/UndefinedNullability;"
+ "Lorg/bukkit/UndefinedNullability;",
+ // Paper start
+ "Lorg/checkerframework/checker/nullness/qual/MonotonicNonNull;",
+ "Lorg/checkerframework/checker/nullness/qual/NonNull;",
+ "Lorg/checkerframework/checker/nullness/qual/Nullable;",
+ "Lorg/checkerframework/checker/nullness/qual/PolyNull;",
+ // Paper end
};
private static final String[] EXCLUDED_CLASSES = {
@@ -40,7 +46,17 @@ public class AnnotationTest {
"org/bukkit/util/io/Wrapper",
"org/bukkit/plugin/java/PluginClassLoader",
// Generic functional interface
@ -165,7 +103,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
};
@Test
@@ -67,14 +77,40 @@ public class AnnotationTest {
@@ -67,14 +83,48 @@ public class AnnotationTest {
}
if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) {
@ -176,7 +114,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
+ } else if (method.invisibleTypeAnnotations != null) {
+ dance: for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
+ warn = false;
+ break dance; // cha cha real smooth
+ }
@ -197,7 +135,15 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
+ if (method.invisibleTypeAnnotations != null) {
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
+ continue dancing;
+ }
+ }
+ }
+ if (method.visibleTypeAnnotations != null) {
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.visibleTypeAnnotations) {
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
+ continue dancing;
+ }
+ }
@ -206,7 +152,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
ParameterNode paramNode = parameters == null ? null : parameters.get(i);
String paramName = paramNode == null ? null : paramNode.name;
@@ -91,13 +127,18 @@ public class AnnotationTest {
@@ -91,13 +141,18 @@ public class AnnotationTest {
Collections.sort(errors);
@ -224,12 +170,12 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
+ builder.append("\t").append(message).append("\n");
}
- Assert.fail("There " + errors.size() + " are missing annotation(s)");
+ Assert.fail(builder.toString());
- fail("There " + errors.size() + " are missing annotation(s)");
+ fail(builder.toString());
}
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
@@ -140,6 +181,11 @@ public class AnnotationTest {
@@ -140,6 +195,11 @@ public class AnnotationTest {
// Exceptions are excluded
return false;
}
@ -241,7 +187,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
for (String excludedClass : EXCLUDED_CLASSES) {
if (excludedClass.equals(clazz.name)) {
@@ -152,7 +198,7 @@ public class AnnotationTest {
@@ -152,7 +212,7 @@ public class AnnotationTest {
private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map<String, ClassNode> allClasses) {
// Exclude private, synthetic and deprecated methods
@ -250,7 +196,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
return false;
}
@@ -170,11 +216,30 @@ public class AnnotationTest {
@@ -170,11 +230,30 @@ public class AnnotationTest {
if ("<init>".equals(method.name) && isAnonymous(clazz)) {
return false;
}
@ -282,232 +228,31 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
if (annotations == null) {
return false;
}
diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java
deleted file mode 100644
index 701a17c10f31cd345238a3c568264178ce372faa..0000000000000000000000000000000000000000
--- a/src/test/java/org/bukkit/TestServer.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.bukkit;
-
-import com.google.common.collect.ImmutableMap;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.logging.Logger;
-import org.bukkit.command.SimpleCommandMap;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.SimplePluginManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-public final class TestServer implements InvocationHandler {
- private static interface MethodHandler {
- Object handle(TestServer server, Object[] args);
- }
-
- private static final Map<Method, MethodHandler> methods;
-
- static {
- try {
- ImmutableMap.Builder<Method, MethodHandler> methodMap = ImmutableMap.builder();
- methodMap.put(
- Server.class.getMethod("isPrimaryThread"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return Thread.currentThread().equals(server.creatingThread);
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getPluginManager"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return server.pluginManager;
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getLogger"),
- new MethodHandler() {
- final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
- @Override
- public Object handle(TestServer server, Object[] args) {
- return logger;
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getName"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return TestServer.class.getSimpleName();
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getVersion"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return "Version_" + TestServer.class.getPackage().getImplementationVersion();
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getBukkitVersion"),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return "BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion();
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getRegistry", Class.class),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- return new Registry() {
- @NotNull
- @Override
- public Iterator iterator() {
- return null;
- }
-
- @Nullable
- @Override
- public Keyed get(@NotNull NamespacedKey key) {
- return null;
- }
- };
- }
- }
- );
- methodMap.put(
- Server.class.getMethod("getScoreboardCriteria", String.class),
- new MethodHandler() {
- @Override
- public Object handle(TestServer server, Object[] args) {
- // Does not need to return anything. Exists solely to test CriteriaTest which has static init fields
- return null;
- }
- }
- );
- methods = methodMap.build();
-
- TestServer server = new TestServer();
- Server instance = Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(server);
- Bukkit.setServer(instance);
- server.pluginManager = new SimplePluginManager(instance, new SimpleCommandMap(instance));
- } catch (Throwable t) {
- throw new Error(t);
- }
- }
-
- private Thread creatingThread = Thread.currentThread();
- private PluginManager pluginManager;
- private TestServer() {};
-
- public static Server getInstance() {
- return Bukkit.getServer();
- }
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) {
- MethodHandler handler = methods.get(method);
- if (handler != null) {
- return handler.handle(this, args);
- }
- throw new UnsupportedOperationException(String.valueOf(method));
- }
-}
diff --git a/src/test/java/org/bukkit/TestWorld.java b/src/test/java/org/bukkit/TestWorld.java
index ab34f1199921d415fa2ca6e281a8125c9e6d7173..f64d024f5bbf9482aaddb56597b23b04c66f21bf 100644
--- a/src/test/java/org/bukkit/TestWorld.java
+++ b/src/test/java/org/bukkit/TestWorld.java
@@ -18,7 +18,7 @@ public final class TestWorld implements InvocationHandler {
diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/bukkit/BukkitMirrorTest.java
index 89ca06ebecdaadd5dfc7bc74473ca15ad36f6eff..5974ceea58940e1799f3589eac0e39b925a42c3b 100644
--- a/src/test/java/org/bukkit/BukkitMirrorTest.java
+++ b/src/test/java/org/bukkit/BukkitMirrorTest.java
@@ -9,6 +9,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
static {
try {
- TestServer.getInstance();
+ io.papermc.paper.testing.TestServer.setup(); // Paper
+@org.junit.jupiter.api.Disabled // Paper
public class BukkitMirrorTest {
ImmutableMap.Builder<Method, MethodHandler> methodMap = ImmutableMap.builder();
methodMap.put(
diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java
index d402cb59f508205ebe9ee450594826b04cecb90b..09886568ae6167141b463b6262565fa212af3385 100644
--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java
+++ b/src/test/java/org/bukkit/event/SyntheticEventTest.java
@@ -1,6 +1,5 @@
package org.bukkit.event;
public static Stream<Arguments> data() {
diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java
index 5709d52ed4ac4ce8dd8b0569281279f7305c5fb9..a47ee3ce660ec4467b5ed6a4b41fb2d19179a189 100644
--- a/src/test/java/org/bukkit/support/TestServer.java
+++ b/src/test/java/org/bukkit/support/TestServer.java
@@ -72,6 +72,11 @@ public final class TestServer {
UnsafeValues unsafeValues = mock(withSettings().stubOnly());
when(instance.getUnsafe()).thenReturn(unsafeValues);
-import org.bukkit.TestServer;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.plugin.TestPlugin;
@@ -12,14 +11,15 @@ public class SyntheticEventTest {
@SuppressWarnings("deprecation")
@Test
public void test() {
- final JavaPluginLoader loader = new JavaPluginLoader(TestServer.getInstance());
+ io.papermc.paper.testing.TestServer.setup(); // Paper
+ final JavaPluginLoader loader = new JavaPluginLoader(org.bukkit.Bukkit.getServer()); // Paper
TestPlugin plugin = new TestPlugin(getClass().getName()) {
@Override
public PluginLoader getPluginLoader() {
return loader;
}
};
- SimplePluginManager pluginManager = new SimplePluginManager(TestServer.getInstance(), null);
+ SimplePluginManager pluginManager = new SimplePluginManager(org.bukkit.Bukkit.getServer(), null); // Paper
TestEvent event = new TestEvent(false);
Impl impl = new Impl();
diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
index f188cd4f3b07027c30d41f1162db77a506b7b6bb..c46ed2acb82db814d660459b705dd49e6d44240f 100644
--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java
+++ b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
@@ -2,7 +2,6 @@ package org.bukkit.plugin;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import org.bukkit.TestServer;
import org.bukkit.event.Event;
import org.bukkit.event.TestEvent;
import org.bukkit.permissions.Permission;
@@ -14,7 +13,7 @@ public class PluginManagerTest {
volatile Object value = null;
+ // Paper start - testing changes
+ when(instance.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.testing.EmptyTag());
+ when(instance.getScoreboardCriteria(anyString())).thenReturn(null);
+ // Paper end - testing changes
+
Bukkit.setServer(instance);
}
- private static final PluginManager pm = TestServer.getInstance().getPluginManager();
+ private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper
private final MutableObject store = new MutableObject();
diff --git a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
index eb94b6f4d58cd9f66b07791c57af7e359992e28c..a93f28e2f987a36e2c7e4f7d31506b750bdb222b 100644
--- a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
+++ b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
@@ -2,7 +2,6 @@ package org.bukkit.scoreboard;
import org.bukkit.Material;
import org.bukkit.Statistic;
-import org.bukkit.TestServer;
import org.bukkit.entity.EntityType;
import org.junit.Assert;
import org.junit.Test;
@@ -11,7 +10,7 @@ public class CriteriaTest {
@Test
public void testStatistic() {
- TestServer.getInstance();
+ io.papermc.paper.testing.TestServer.setup(); // Paper
Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, Material.STONE)); // Generic statistic with block
Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, EntityType.CREEPER)); // Generic statistic with entity type

Datei anzeigen

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 1 Apr 2016 00:02:47 -0400
Subject: [PATCH] Add FastUtil to Bukkit
Doesn't expose to plugins, just allows Paper-API to use it for optimization
diff --git a/build.gradle.kts b/build.gradle.kts
index 044b7c49b569e1170108c912e9307f7fec278762..f0423df165bf7d0f3fad21d26b64f31ba3e6aeee 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -18,6 +18,7 @@ dependencies {
api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit
}
+ api("it.unimi.dsi:fastutil:8.5.6")
// Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")

Datei anzeigen

@ -0,0 +1,343 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 26 May 2023 18:14:44 -0700
Subject: [PATCH] Code Generation
Currently includes generated key holder classes for types
used in the Registry Modification API
diff --git a/build.gradle.kts b/build.gradle.kts
index 768024b2b4584fd7dd86f068c0e79c89ffc5faa1..f11a22ab01e97e51619c96f2d8a78a99297efc59 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,6 +1,7 @@
plugins {
`java-library`
`maven-publish`
+ idea // Paper
}
java {
@@ -45,6 +46,22 @@ dependencies {
testImplementation("org.ow2.asm:asm-tree:9.7")
}
+// Paper start
+val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
+idea {
+ module {
+ generatedSourceDirs.add(generatedApiPath.toFile())
+ }
+}
+sourceSets {
+ main {
+ java {
+ srcDir(generatedApiPath)
+ }
+ }
+}
+// Paper end
+
configure<PublishingExtension> {
publications.create<MavenPublication>("maven") {
from(components["java"])
@@ -121,3 +138,14 @@ tasks.check {
dependsOn(scanJar)
}
// Paper end
+// Paper start
+val scanJarForOldGeneratedCode = tasks.register("scanJarForOldGeneratedCode", io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) {
+ mcVersion.set(providers.gradleProperty("mcVersion"))
+ annotation.set("Lio/papermc/paper/generated/GeneratedFrom;")
+ jarToScan.set(tasks.jar.flatMap { it.archiveFile })
+ classpath.from(configurations.compileClasspath)
+}
+tasks.check {
+ dependsOn(scanJarForOldGeneratedCode)
+}
+// Paper end
diff --git a/src/main/java/io/papermc/paper/generated/GeneratedFrom.java b/src/main/java/io/papermc/paper/generated/GeneratedFrom.java
new file mode 100644
index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048e3d93484
--- /dev/null
+++ b/src/main/java/io/papermc/paper/generated/GeneratedFrom.java
@@ -0,0 +1,21 @@
+package io.papermc.paper.generated;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Used to mark classes which are generated from
+ * a specific version of minecraft.
+ */
+@ApiStatus.Internal
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface GeneratedFrom {
+
+ String value();
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..76daccf4ea502e1747a6f9176dc16fd20c561286
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
@@ -0,0 +1,147 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Keyed;
+import org.bukkit.Art;
+import org.bukkit.Fluid;
+import org.bukkit.GameEvent;
+import org.bukkit.JukeboxSong;
+import org.bukkit.MusicInstrument;
+import org.bukkit.Particle;
+import org.bukkit.Sound;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.block.Biome;
+import org.bukkit.block.BlockType;
+import org.bukkit.block.banner.PatternType;
+import org.bukkit.damage.DamageType;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Cat;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Frog;
+import org.bukkit.entity.Villager;
+import org.bukkit.entity.Wolf;
+import org.bukkit.entity.memory.MemoryKey;
+import org.bukkit.generator.structure.Structure;
+import org.bukkit.generator.structure.StructureType;
+import org.bukkit.inventory.ItemType;
+import org.bukkit.inventory.meta.trim.TrimMaterial;
+import org.bukkit.inventory.meta.trim.TrimPattern;
+import org.bukkit.map.MapCursor;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionType;
+import org.jetbrains.annotations.ApiStatus;
+
+import static io.papermc.paper.registry.RegistryKeyImpl.create;
+
+/**
+ * Identifier for a specific registry. For use with
+ * {@link TypedKey} and the registry modification API.
+ * <p>
+ * There are 2 types of registries, identified as "built-in"
+ * or "data-driven". The former are not changeable by datapacks (which
+ * doesn't necessarily mean they aren't changeable in the API) and
+ * are loaded first. "Data-driven" registries are all created by
+ * reading in data from the vanilla and other datapacks.
+ *
+ * @param <T> the value type
+ */
+@SuppressWarnings("unused")
+public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
+
+ /* ******************* *
+ * Built-in Registries *
+ * ******************* */
+ /**
+ * Built-in registry for game events
+ * @see io.papermc.paper.registry.keys.GameEventKeys
+ */
+ RegistryKey<GameEvent> GAME_EVENT = create("game_event");
+ /**
+ * Built-in registry for structure types.
+ * @see io.papermc.paper.registry.keys.StructureTypeKeys
+ */
+ RegistryKey<StructureType> STRUCTURE_TYPE = create("worldgen/structure_type");
+ /**
+ * Built-in registry for instruments.
+ * @see io.papermc.paper.registry.keys.InstrumentKeys
+ */
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
+ /**
+ * Built-in registry for potion effect types (mob effects).
+ * @see io.papermc.paper.registry.keys.MobEffectKeys
+ */
+ RegistryKey<PotionEffectType> MOB_EFFECT = create("mob_effect");
+ /**
+ * @apiNote DO NOT USE
+ */
+ @ApiStatus.Internal
+ RegistryKey<BlockType> BLOCK = create("block");
+ /**
+ * @apiNote DO NOT USE
+ */
+ @ApiStatus.Internal
+ RegistryKey<ItemType> ITEM = create("item");
+
+
+ /* ********************** *
+ * Data-driven Registries *
+ * ********************** */
+ /**
+ * Data-driven registry for biomes.
+ * @see io.papermc.paper.registry.keys.BiomeKeys
+ */
+ RegistryKey<Biome> BIOME = create("worldgen/biome");
+ /**
+ * Data-driven registry for structures.
+ * @see io.papermc.paper.registry.keys.StructureKeys
+ */
+ RegistryKey<Structure> STRUCTURE = create("worldgen/structure");
+ /**
+ * Data-driven registry for trim materials.
+ * @see io.papermc.paper.registry.keys.TrimMaterialKeys
+ */
+ RegistryKey<TrimMaterial> TRIM_MATERIAL = create("trim_material");
+ /**
+ * Data-driven registry for trim patterns.
+ * @see io.papermc.paper.registry.keys.TrimPatternKeys
+ */
+ RegistryKey<TrimPattern> TRIM_PATTERN = create("trim_pattern");
+ /**
+ * Data-driven registry for damage types.
+ * @see io.papermc.paper.registry.keys.DamageTypeKeys
+ */
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
+ /**
+ * Data-driven registry for wolf variants.
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
+ */
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
+ /**
+ * Data-driven registry for enchantments.
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
+ */
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
+ /**
+ * Data-driven registry for jukebox songs.
+ */
+ @ApiStatus.Experimental
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
+
+
+ /* ******************* *
+ * API-only Registries *
+ * ******************* */
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
+ RegistryKey<Attribute> ATTRIBUTE = create("attribute");
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern");
+ RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
+ RegistryKey<PotionType> POTION = create("potion");
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
+ RegistryKey<Villager.Profession> VILLAGER_PROFESSION = create("villager_profession");
+ RegistryKey<Villager.Type> VILLAGER_TYPE = create("villager_type");
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type");
+ RegistryKey<Fluid> FLUID = create("fluid");
+ RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
+ RegistryKey<MapCursor.Type> MAP_DECORATION_TYPE = create("map_decoration_type");
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..791813220b2504214b1adecc69093cd600fb0f8c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
@@ -0,0 +1,24 @@
+package io.papermc.paper.registry;
+
+import com.google.common.collect.Sets;
+import java.util.Set;
+import net.kyori.adventure.key.Key;
+import org.intellij.lang.annotations.Subst;
+import org.jetbrains.annotations.NotNull;
+
+record RegistryKeyImpl<T>(@NotNull Key key) implements RegistryKey<T> {
+
+ static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
+
+ static <T> RegistryKey<T> create(@Subst("some_key") final String key) {
+ final RegistryKey<T> registryKey = createInternal(key);
+ REGISTRY_KEYS.add(registryKey);
+ return registryKey;
+ }
+
+ // creates the key without adding to the internal set of keys
+ static <T> RegistryKey<T> createInternal(@Subst("some_key") final String key) {
+ return new RegistryKeyImpl<>(Key.key(Key.MINECRAFT_NAMESPACE, key));
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/registry/TypedKey.java b/src/main/java/io/papermc/paper/registry/TypedKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..6f5a062ba7ee7173468ecea3c1855a233bf3855e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/TypedKey.java
@@ -0,0 +1,44 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Key;
+import net.kyori.adventure.key.Keyed;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a key for a value in a specific registry.
+ *
+ * @param <T> the value type for the registry
+ */
+@ApiStatus.Experimental
+public sealed interface TypedKey<T> extends Keyed permits TypedKeyImpl {
+
+ /**
+ * Gets the key for the value in the registry.
+ *
+ * @return the value's key
+ */
+ @Override
+ @NotNull Key key();
+
+ /**
+ * Gets the registry key for the value this key
+ * represents.
+ *
+ * @return the registry key
+ */
+ @NotNull RegistryKey<T> registryKey();
+
+ /**
+ * Create a typed key from a key and a registry key.
+ *
+ * @param registryKey the registry this key is for
+ * @param key the key for the value in the registry
+ * @param <T> value type
+ * @return a new key for the value key and registry key
+ */
+ @ApiStatus.Experimental
+ static <T> @NotNull TypedKey<T> create(final @NotNull RegistryKey<T> registryKey, final @NotNull Key key) {
+ return new TypedKeyImpl<>(key, registryKey);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a97b3359c4ece5c29131da7c3f208aaa8fab66e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
@@ -0,0 +1,8 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Key;
+import net.kyori.adventure.key.Keyed;
+import org.jetbrains.annotations.NotNull;
+
+record TypedKeyImpl<T>(@NotNull Key key, @NotNull RegistryKey<T> registryKey) implements TypedKey<T> {
+}
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
index a86b87e4c3332202e40e484c3f9c6562b419c70f..305532968f9f7dd497c77259ed147ea2f081bc74 100644
--- a/src/main/java/org/bukkit/MinecraftExperimental.java
+++ b/src/main/java/org/bukkit/MinecraftExperimental.java
@@ -47,5 +47,6 @@ public @interface MinecraftExperimental {
@ApiStatus.Internal
public enum Requires {
+ BUNDLE, TRADE_REBALANCE // Paper
}
}

Datei anzeigen

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 1 Apr 2016 00:02:47 -0400
Subject: [PATCH] Add FastUtil to Bukkit
Doesn't expose to plugins, just allows Paper-API to use it for optimization
diff --git a/build.gradle.kts b/build.gradle.kts
index f11a22ab01e97e51619c96f2d8a78a99297efc59..2f266350a787a4cfdfda1b0e760bfb7604cac43c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -23,6 +23,7 @@ dependencies {
api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit
}
+ api("it.unimi.dsi:fastutil:8.5.6")
// Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1,370 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Thu, 3 Mar 2016 13:20:33 -0700
Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/build.gradle.kts b/build.gradle.kts
index 558fa62d87af1103efa703ef9114481cb928cf8d..359e7bd7e3c76cec89d638f940006dc9c944f98b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -39,6 +39,9 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
+
+ implementation("org.ow2.asm:asm:9.2")
+ implementation("org.ow2.asm:asm-commons:9.2")
// Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b28e9b1daba7834af67dbc193dd656bedd9a994
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
@@ -0,0 +1,42 @@
+package com.destroystokyo.paper.event.executor;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+
+import com.destroystokyo.paper.util.SneakyThrow;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventException;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class MethodHandleEventExecutor implements EventExecutor {
+ private final Class<? extends Event> eventClass;
+ private final MethodHandle handle;
+
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull MethodHandle handle) {
+ this.eventClass = eventClass;
+ this.handle = handle;
+ }
+
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
+ this.eventClass = eventClass;
+ try {
+ m.setAccessible(true);
+ this.handle = MethodHandles.lookup().unreflect(m);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Unable to set accessible", e);
+ }
+ }
+
+ @Override
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
+ if (!eventClass.isInstance(event)) return;
+ try {
+ handle.invoke(listener, event);
+ } catch (Throwable t) {
+ SneakyThrow.sneaky(t);
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..c83672427324bd068ed52916f700b68446a226f6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
@@ -0,0 +1,43 @@
+package com.destroystokyo.paper.event.executor;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import com.destroystokyo.paper.util.SneakyThrow;
+import com.google.common.base.Preconditions;
+
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventException;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class StaticMethodHandleEventExecutor implements EventExecutor {
+ private final Class<? extends Event> eventClass;
+ private final MethodHandle handle;
+
+ public StaticMethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
+ Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
+ Preconditions.checkArgument(eventClass != null, "eventClass is null");
+ this.eventClass = eventClass;
+ try {
+ m.setAccessible(true);
+ this.handle = MethodHandles.lookup().unreflect(m);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Unable to set accessible", e);
+ }
+ }
+
+ @Override
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
+ if (!eventClass.isInstance(event)) return;
+ try {
+ handle.invoke(event);
+ } catch (Throwable throwable) {
+ SneakyThrow.sneaky(throwable);
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
new file mode 100644
index 0000000000000000000000000000000000000000..084c31af1a7ba32bb4c3dc8f16f67fd09ce0b6a4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
@@ -0,0 +1,54 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.GeneratorAdapter;
+
+import static org.objectweb.asm.Opcodes.*;
+
+public class ASMEventExecutorGenerator {
+
+ private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
+
+ @NotNull
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
+ // Generate constructor
+ GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null), ACC_PUBLIC, "<init>", "()V");
+ methodGenerator.loadThis();
+ methodGenerator.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V", false); // Invoke the super class (Object) constructor
+ methodGenerator.returnValue();
+ methodGenerator.endMethod();
+ // Generate the execute method
+ methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR, null, null), ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR);
+ methodGenerator.loadArg(0);
+ methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
+ methodGenerator.loadArg(1);
+ methodGenerator.checkCast(Type.getType(m.getParameterTypes()[0]));
+ methodGenerator.visitMethodInsn(m.getDeclaringClass().isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL, Type.getInternalName(m.getDeclaringClass()), m.getName(), Type.getMethodDescriptor(m), m.getDeclaringClass().isInterface());
+ // The only purpose of this switch statement is to generate the correct pop instruction, should the event handler method return something other than void.
+ // Non-void event handlers will be unsupported in a future release.
+ switch (Type.getType(m.getReturnType()).getSize()) {
+ // case 0 is omitted because the only type that has size 0 is void - no pop instruction needed.
+ case 1 -> methodGenerator.pop(); // handles reference types and most primitives
+ case 2 -> methodGenerator.pop2(); // handles long and double
+ }
+ methodGenerator.returnValue();
+ methodGenerator.endMethod();
+ writer.visitEnd();
+ return writer.toByteArray();
+ }
+
+ public static AtomicInteger NEXT_ID = new AtomicInteger(1);
+ @NotNull
+ public static String generateName() {
+ int id = NEXT_ID.getAndIncrement();
+ return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
new file mode 100644
index 0000000000000000000000000000000000000000..f79685b48bb581277a6891927988b6f7a4389dc4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
@@ -0,0 +1,34 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import org.jetbrains.annotations.NotNull;
+
+public interface ClassDefiner {
+
+ /**
+ * Returns if the defined classes can bypass access checks
+ *
+ * @return if classes bypass access checks
+ */
+ public default boolean isBypassAccessChecks() {
+ return false;
+ }
+
+ /**
+ * Define a class
+ *
+ * @param parentLoader the parent classloader
+ * @param name the name of the class
+ * @param data the class data to load
+ * @return the defined class
+ * @throws ClassFormatError if the class data is invalid
+ * @throws NullPointerException if any of the arguments are null
+ */
+ @NotNull
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
+
+ @NotNull
+ public static ClassDefiner getInstance() {
+ return SafeClassDefiner.INSTANCE;
+ }
+
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
new file mode 100644
index 0000000000000000000000000000000000000000..ac99477e9f2c08041aeff31abc1d1edee58d0a67
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
@@ -0,0 +1,66 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import com.google.common.base.Preconditions;
+
+import com.google.common.collect.MapMaker;
+import org.jetbrains.annotations.NotNull;
+import org.objectweb.asm.Type;
+
+public class SafeClassDefiner implements ClassDefiner {
+ /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
+
+ private SafeClassDefiner() {}
+
+ private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
+
+ @NotNull
+ @Override
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
+ GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
+ synchronized (loader.getClassLoadingLock(name)) {
+ Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
+ Class<?> c = loader.define(name, data);
+ assert c.getName().equals(name);
+ return c;
+ }
+ }
+
+ private static class GeneratedClassLoader extends ClassLoader {
+ static {
+ ClassLoader.registerAsParallelCapable();
+ }
+
+ protected GeneratedClassLoader(@NotNull ClassLoader parent) {
+ super(parent);
+ }
+
+ private Class<?> define(@NotNull String name, byte[] data) {
+ synchronized (getClassLoadingLock(name)) {
+ assert !hasClass(name);
+ Class<?> c = defineClass(name, data, 0, data.length);
+ resolveClass(c);
+ return c;
+ }
+ }
+
+ @Override
+ @NotNull
+ public Object getClassLoadingLock(@NotNull String name) {
+ return super.getClassLoadingLock(name);
+ }
+
+ public boolean hasClass(@NotNull String name) {
+ synchronized (getClassLoadingLock(name)) {
+ try {
+ Class.forName(name);
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java
index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137befa646455 100644
--- a/src/main/java/org/bukkit/plugin/EventExecutor.java
+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java
@@ -5,9 +5,75 @@ import org.bukkit.event.EventException;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
+// Paper start
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+
+import com.destroystokyo.paper.event.executor.MethodHandleEventExecutor;
+import com.destroystokyo.paper.event.executor.StaticMethodHandleEventExecutor;
+import com.destroystokyo.paper.event.executor.asm.ASMEventExecutorGenerator;
+import com.destroystokyo.paper.event.executor.asm.ClassDefiner;
+import com.google.common.base.Preconditions;
+// Paper end
+
/**
* Interface which defines the class for event call backs to plugins
*/
public interface EventExecutor {
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException;
+
+ // Paper start
+ ConcurrentMap<Method, Class<? extends EventExecutor>> eventExecutorMap = new ConcurrentHashMap<Method, Class<? extends EventExecutor>>() {
+ @NotNull
+ @Override
+ public Class<? extends EventExecutor> computeIfAbsent(@NotNull Method key, @NotNull Function<? super Method, ? extends Class<? extends EventExecutor>> mappingFunction) {
+ Class<? extends EventExecutor> executorClass = get(key);
+ if (executorClass != null)
+ return executorClass;
+
+ //noinspection SynchronizationOnLocalVariableOrMethodParameter
+ synchronized (key) {
+ executorClass = get(key);
+ if (executorClass != null)
+ return executorClass;
+
+ return super.computeIfAbsent(key, mappingFunction);
+ }
+ }
+ };
+
+ @NotNull
+ public static EventExecutor create(@NotNull Method m, @NotNull Class<? extends Event> eventClass) {
+ Preconditions.checkNotNull(m, "Null method");
+ Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount());
+ Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass);
+ ClassDefiner definer = ClassDefiner.getInstance();
+ if (Modifier.isStatic(m.getModifiers())) {
+ return new StaticMethodHandleEventExecutor(eventClass, m);
+ } else if (definer.isBypassAccessChecks() || Modifier.isPublic(m.getDeclaringClass().getModifiers()) && Modifier.isPublic(m.getModifiers())) {
+ // get the existing generated EventExecutor class for the Method or generate one
+ Class<? extends EventExecutor> executorClass = eventExecutorMap.computeIfAbsent(m, (__) -> {
+ String name = ASMEventExecutorGenerator.generateName();
+ byte[] classData = ASMEventExecutorGenerator.generateEventExecutor(m, name);
+ return definer.defineClass(m.getDeclaringClass().getClassLoader(), name, classData).asSubclass(EventExecutor.class);
+ });
+
+ try {
+ EventExecutor asmExecutor = executorClass.newInstance();
+ // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception)
+ return (listener, event) -> {
+ if (!eventClass.isInstance(event)) return;
+ asmExecutor.execute(listener, event);
+ };
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new AssertionError("Unable to initialize generated event executor", e);
+ }
+ } else {
+ return new MethodHandleEventExecutor(eventClass, m);
+ }
+ }
+ // Paper end
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -0,0 +1,367 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Thu, 3 Mar 2016 13:20:33 -0700
Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/build.gradle.kts b/build.gradle.kts
index af3514113abdf3f42c41f1e7ff0f930cc1a417f5..ed0b67ac322aa22b191cd35502ae5b4f20af19f8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -47,6 +47,9 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
+
+ implementation("org.ow2.asm:asm:9.7")
+ implementation("org.ow2.asm:asm-commons:9.7")
// Paper end
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b28e9b1daba7834af67dbc193dd656bedd9a994
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
@@ -0,0 +1,42 @@
+package com.destroystokyo.paper.event.executor;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+
+import com.destroystokyo.paper.util.SneakyThrow;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventException;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class MethodHandleEventExecutor implements EventExecutor {
+ private final Class<? extends Event> eventClass;
+ private final MethodHandle handle;
+
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull MethodHandle handle) {
+ this.eventClass = eventClass;
+ this.handle = handle;
+ }
+
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
+ this.eventClass = eventClass;
+ try {
+ m.setAccessible(true);
+ this.handle = MethodHandles.lookup().unreflect(m);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Unable to set accessible", e);
+ }
+ }
+
+ @Override
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
+ if (!eventClass.isInstance(event)) return;
+ try {
+ handle.invoke(listener, event);
+ } catch (Throwable t) {
+ SneakyThrow.sneaky(t);
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
new file mode 100644
index 0000000000000000000000000000000000000000..827f2b27f70a7ec0bc11d039305c3e58c02a4ef4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
@@ -0,0 +1,42 @@
+package com.destroystokyo.paper.event.executor;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import com.destroystokyo.paper.util.SneakyThrow;
+import com.google.common.base.Preconditions;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.EventException;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class StaticMethodHandleEventExecutor implements EventExecutor {
+ private final Class<? extends Event> eventClass;
+ private final MethodHandle handle;
+
+ public StaticMethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
+ Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
+ Preconditions.checkArgument(eventClass != null, "eventClass is null");
+ this.eventClass = eventClass;
+ try {
+ m.setAccessible(true);
+ this.handle = MethodHandles.lookup().unreflect(m);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Unable to set accessible", e);
+ }
+ }
+
+ @Override
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
+ if (!eventClass.isInstance(event)) return;
+ try {
+ handle.invoke(event);
+ } catch (Throwable throwable) {
+ SneakyThrow.sneaky(throwable);
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
new file mode 100644
index 0000000000000000000000000000000000000000..084c31af1a7ba32bb4c3dc8f16f67fd09ce0b6a4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
@@ -0,0 +1,54 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.bukkit.plugin.EventExecutor;
+import org.jetbrains.annotations.NotNull;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.GeneratorAdapter;
+
+import static org.objectweb.asm.Opcodes.*;
+
+public class ASMEventExecutorGenerator {
+
+ private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
+
+ @NotNull
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
+ // Generate constructor
+ GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null), ACC_PUBLIC, "<init>", "()V");
+ methodGenerator.loadThis();
+ methodGenerator.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V", false); // Invoke the super class (Object) constructor
+ methodGenerator.returnValue();
+ methodGenerator.endMethod();
+ // Generate the execute method
+ methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR, null, null), ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR);
+ methodGenerator.loadArg(0);
+ methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
+ methodGenerator.loadArg(1);
+ methodGenerator.checkCast(Type.getType(m.getParameterTypes()[0]));
+ methodGenerator.visitMethodInsn(m.getDeclaringClass().isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL, Type.getInternalName(m.getDeclaringClass()), m.getName(), Type.getMethodDescriptor(m), m.getDeclaringClass().isInterface());
+ // The only purpose of this switch statement is to generate the correct pop instruction, should the event handler method return something other than void.
+ // Non-void event handlers will be unsupported in a future release.
+ switch (Type.getType(m.getReturnType()).getSize()) {
+ // case 0 is omitted because the only type that has size 0 is void - no pop instruction needed.
+ case 1 -> methodGenerator.pop(); // handles reference types and most primitives
+ case 2 -> methodGenerator.pop2(); // handles long and double
+ }
+ methodGenerator.returnValue();
+ methodGenerator.endMethod();
+ writer.visitEnd();
+ return writer.toByteArray();
+ }
+
+ public static AtomicInteger NEXT_ID = new AtomicInteger(1);
+ @NotNull
+ public static String generateName() {
+ int id = NEXT_ID.getAndIncrement();
+ return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
new file mode 100644
index 0000000000000000000000000000000000000000..f79685b48bb581277a6891927988b6f7a4389dc4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
@@ -0,0 +1,34 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import org.jetbrains.annotations.NotNull;
+
+public interface ClassDefiner {
+
+ /**
+ * Returns if the defined classes can bypass access checks
+ *
+ * @return if classes bypass access checks
+ */
+ public default boolean isBypassAccessChecks() {
+ return false;
+ }
+
+ /**
+ * Define a class
+ *
+ * @param parentLoader the parent classloader
+ * @param name the name of the class
+ * @param data the class data to load
+ * @return the defined class
+ * @throws ClassFormatError if the class data is invalid
+ * @throws NullPointerException if any of the arguments are null
+ */
+ @NotNull
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
+
+ @NotNull
+ public static ClassDefiner getInstance() {
+ return SafeClassDefiner.INSTANCE;
+ }
+
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
new file mode 100644
index 0000000000000000000000000000000000000000..abcc966d8ee01d73c1d1480237ab46fa0ab55fdc
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
@@ -0,0 +1,64 @@
+package com.destroystokyo.paper.event.executor.asm;
+
+import java.util.concurrent.ConcurrentMap;
+
+import com.google.common.base.Preconditions;
+
+import com.google.common.collect.MapMaker;
+import org.jetbrains.annotations.NotNull;
+
+public class SafeClassDefiner implements ClassDefiner {
+ /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
+
+ private SafeClassDefiner() {}
+
+ private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
+
+ @NotNull
+ @Override
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
+ GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
+ synchronized (loader.getClassLoadingLock(name)) {
+ Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
+ Class<?> c = loader.define(name, data);
+ assert c.getName().equals(name);
+ return c;
+ }
+ }
+
+ private static class GeneratedClassLoader extends ClassLoader {
+ static {
+ ClassLoader.registerAsParallelCapable();
+ }
+
+ protected GeneratedClassLoader(@NotNull ClassLoader parent) {
+ super(parent);
+ }
+
+ private Class<?> define(@NotNull String name, byte[] data) {
+ synchronized (getClassLoadingLock(name)) {
+ assert !hasClass(name);
+ Class<?> c = defineClass(name, data, 0, data.length);
+ resolveClass(c);
+ return c;
+ }
+ }
+
+ @Override
+ @NotNull
+ public Object getClassLoadingLock(@NotNull String name) {
+ return super.getClassLoadingLock(name);
+ }
+
+ public boolean hasClass(@NotNull String name) {
+ synchronized (getClassLoadingLock(name)) {
+ try {
+ Class.forName(name);
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java
index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137befa646455 100644
--- a/src/main/java/org/bukkit/plugin/EventExecutor.java
+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java
@@ -5,9 +5,75 @@ import org.bukkit.event.EventException;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
+// Paper start
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
+
+import com.destroystokyo.paper.event.executor.MethodHandleEventExecutor;
+import com.destroystokyo.paper.event.executor.StaticMethodHandleEventExecutor;
+import com.destroystokyo.paper.event.executor.asm.ASMEventExecutorGenerator;
+import com.destroystokyo.paper.event.executor.asm.ClassDefiner;
+import com.google.common.base.Preconditions;
+// Paper end
+
/**
* Interface which defines the class for event call backs to plugins
*/
public interface EventExecutor {
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException;
+
+ // Paper start
+ ConcurrentMap<Method, Class<? extends EventExecutor>> eventExecutorMap = new ConcurrentHashMap<Method, Class<? extends EventExecutor>>() {
+ @NotNull
+ @Override
+ public Class<? extends EventExecutor> computeIfAbsent(@NotNull Method key, @NotNull Function<? super Method, ? extends Class<? extends EventExecutor>> mappingFunction) {
+ Class<? extends EventExecutor> executorClass = get(key);
+ if (executorClass != null)
+ return executorClass;
+
+ //noinspection SynchronizationOnLocalVariableOrMethodParameter
+ synchronized (key) {
+ executorClass = get(key);
+ if (executorClass != null)
+ return executorClass;
+
+ return super.computeIfAbsent(key, mappingFunction);
+ }
+ }
+ };
+
+ @NotNull
+ public static EventExecutor create(@NotNull Method m, @NotNull Class<? extends Event> eventClass) {
+ Preconditions.checkNotNull(m, "Null method");
+ Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount());
+ Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass);
+ ClassDefiner definer = ClassDefiner.getInstance();
+ if (Modifier.isStatic(m.getModifiers())) {
+ return new StaticMethodHandleEventExecutor(eventClass, m);
+ } else if (definer.isBypassAccessChecks() || Modifier.isPublic(m.getDeclaringClass().getModifiers()) && Modifier.isPublic(m.getModifiers())) {
+ // get the existing generated EventExecutor class for the Method or generate one
+ Class<? extends EventExecutor> executorClass = eventExecutorMap.computeIfAbsent(m, (__) -> {
+ String name = ASMEventExecutorGenerator.generateName();
+ byte[] classData = ASMEventExecutorGenerator.generateEventExecutor(m, name);
+ return definer.defineClass(m.getDeclaringClass().getClassLoader(), name, classData).asSubclass(EventExecutor.class);
+ });
+
+ try {
+ EventExecutor asmExecutor = executorClass.newInstance();
+ // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception)
+ return (listener, event) -> {
+ if (!eventClass.isInstance(event)) return;
+ asmExecutor.execute(listener, event);
+ };
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new AssertionError("Unable to initialize generated event executor", e);
+ }
+ } else {
+ return new MethodHandleEventExecutor(eventClass, m);
+ }
+ }
+ // Paper end
}

Datei anzeigen

@ -1,422 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 20 Mar 2022 10:42:28 -0700
Subject: [PATCH] Add Position
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
new file mode 100644
index 0000000000000000000000000000000000000000..f164d32cfbd5bfd84f3067a149d34bb1185a7e00
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
@@ -0,0 +1,98 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Axis;
+import org.bukkit.block.BlockFace;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A position represented with integers.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ * @see FinePosition
+ */
+@ApiStatus.Experimental
+public interface BlockPosition extends Position {
+
+ @Override
+ default double x() {
+ return this.blockX();
+ }
+
+ @Override
+ default double y() {
+ return this.blockY();
+ }
+
+ @Override
+ default double z() {
+ return this.blockZ();
+ }
+
+ @Override
+ default boolean isBlock() {
+ return true;
+ }
+
+ @Override
+ default boolean isFine() {
+ return false;
+ }
+
+ @Override
+ default @NotNull BlockPosition toBlock() {
+ return this;
+ }
+
+ @Override
+ default @NotNull BlockPosition offset(int x, int y, int z) {
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
+ }
+
+ @Override
+ default @NotNull FinePosition offset(double x, double y, double z) {
+ return new FinePositionImpl(this.blockX() + z, this.blockY() + y, this.blockZ() + z);
+ }
+
+ /**
+ * Returns a block position offset by 1 in the direction specified.
+ *
+ * @param blockFace the block face to offset towards
+ * @return the offset block position
+ */
+ @Contract(value = "_ -> new", pure = true)
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace) {
+ return this.offset(blockFace, 1);
+ }
+
+ /**
+ * Returns a block position offset in the direction specified
+ * multiplied by the amount.
+ *
+ * @param blockFace the block face to offset towards
+ * @param amount the number of times to move in that direction
+ * @return the offset block position
+ */
+ @Contract(pure = true)
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace, int amount) {
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
+ }
+
+ /**
+ * Returns a block position offset by the amount along
+ * the specified axis.
+ *
+ * @param axis the axis to offset along
+ * @param amount the amount to offset along that axis
+ * @return the offset block position
+ */
+ @Contract(pure = true)
+ default @NotNull BlockPosition offset(@NotNull Axis axis, int amount) {
+ return amount == 0 ? this : switch (axis) {
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount);
+ };
+ }
+}
diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb5a3f26c7ba56c6715827f52c0013a860ec7d9a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
@@ -0,0 +1,4 @@
+package io.papermc.paper.math;
+
+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition {
+}
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
new file mode 100644
index 0000000000000000000000000000000000000000..d8df70d731573cf2446044925f218876d62fd7cf
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
@@ -0,0 +1,56 @@
+package io.papermc.paper.math;
+
+import org.bukkit.util.NumberConversions;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A position represented with doubles.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ * @see BlockPosition
+ */
+@ApiStatus.Experimental
+public interface FinePosition extends Position {
+
+ @Override
+ default int blockX() {
+ return NumberConversions.floor(this.x());
+ }
+
+ @Override
+ default int blockY() {
+ return NumberConversions.floor(this.y());
+ }
+
+ @Override
+ default int blockZ() {
+ return NumberConversions.floor(this.z());
+ }
+
+ @Override
+ default boolean isBlock() {
+ return false;
+ }
+
+ @Override
+ default boolean isFine() {
+ return true;
+ }
+
+ @Override
+ default @NotNull BlockPosition toBlock() {
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
+ }
+
+ @Override
+ default @NotNull FinePosition offset(int x, int y, int z) {
+ return this.offset((double) x, y, z);
+ }
+
+ @Override
+ default @NotNull FinePosition offset(double x, double y, double z) {
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda8100fb72d0
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
@@ -0,0 +1,4 @@
+package io.papermc.paper.math;
+
+record FinePositionImpl(double x, double y, double z) implements FinePosition {
+}
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
new file mode 100644
index 0000000000000000000000000000000000000000..300da713dcc303b340efad70efe57facf5422964
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/Position.java
@@ -0,0 +1,184 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ */
+@ApiStatus.Experimental
+public interface Position {
+
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0);
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockX();
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockY();
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockZ();
+
+ /**
+ * Gets the x value for this position
+ *
+ * @return the x value
+ */
+ double x();
+
+ /**
+ * Gets the y value for this position
+ *
+ * @return the y value
+ */
+ double y();
+
+ /**
+ * Gets the z value for this position
+ *
+ * @return the z value
+ */
+ double z();
+
+ /**
+ * Checks of this position represents a {@link BlockPosition}
+ *
+ * @return true if block
+ */
+ boolean isBlock();
+
+ /**
+ * Checks if this position represents a {@link FinePosition}
+ *
+ * @return true if fine
+ */
+ boolean isFine();
+
+ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
+ * @param y y value to offset
+ * @param z z value to offset
+ * @return the offset position
+ */
+ @NotNull Position offset(int x, int y, int z);
+
+ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
+ * @param y y value to offset
+ * @param z z value to offset
+ * @return the offset position
+ */
+ @NotNull FinePosition offset(double x, double y, double z);
+
+ /**
+ * Returns a new position at the center of the block position this represents
+ *
+ * @return a new center position
+ */
+ @Contract(value = "-> new", pure = true)
+ default @NotNull FinePosition toCenter() {
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
+ }
+
+ /**
+ * Returns the block position of this position
+ * or itself if it already is a block position
+ *
+ * @return the block position
+ */
+ @Contract(pure = true)
+ @NotNull BlockPosition toBlock();
+
+ /**
+ * Converts this position to a vector
+ *
+ * @return a new vector
+ */
+ @Contract(value = "-> new", pure = true)
+ default @NotNull Vector toVector() {
+ return new Vector(this.x(), this.y(), this.z());
+ }
+
+ /**
+ * Creates a new location object at this position with the specified world
+ *
+ * @param world the world for the location object
+ * @return a new location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ default @NotNull Location toLocation(@NotNull World world) {
+ return new Location(world, this.x(), this.y(), this.z());
+ }
+
+ /**
+ * Creates a position at the coordinates
+ *
+ * @param x x coord
+ * @param y y coord
+ * @param z z coord
+ * @return a position with those coords
+ */
+ @Contract(value = "_, _, _ -> new", pure = true)
+ static @NotNull BlockPosition block(int x, int y, int z) {
+ return new BlockPositionImpl(x, y, z);
+ }
+
+ /**
+ * Creates a position from the location.
+ *
+ * @param location the location to copy the position of
+ * @return a new position at that location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ static @NotNull BlockPosition block(@NotNull Location location) {
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ }
+
+ /**
+ * Creates a position at the coordinates
+ *
+ * @param x x coord
+ * @param y y coord
+ * @param z z coord
+ * @return a position with those coords
+ */
+ @Contract(value = "_, _, _ -> new", pure = true)
+ static @NotNull FinePosition fine(double x, double y, double z) {
+ return new FinePositionImpl(x, y, z);
+ }
+
+ /**
+ * Creates a position from the location.
+ *
+ * @param location the location to copy the position of
+ * @return a new position at that location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ static @NotNull FinePosition fine(@NotNull Location location) {
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
+ }
+}
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 7c4db051472fb6a6c6d24092dc6f75487356690a..3b99f359f556e6f2c341d55fa69b7462e69b6546 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
* magnitude than 360 are valid, but may be normalized to any other equivalent
* representation by the implementation.
*/
-public class Location implements Cloneable, ConfigurationSerializable {
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
private Reference<World> world;
private double x;
private double y;
@@ -706,4 +706,26 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
return pitch;
}
+
+ // Paper - add Position
+ @Override
+ public double x() {
+ return this.getX();
+ }
+
+ @Override
+ public double y() {
+ return this.getY();
+ }
+
+ @Override
+ public double z() {
+ return this.getZ();
+ }
+
+ @Override
+ public @NotNull Location toLocation(@NotNull World world) {
+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
+ }
+ // Paper end
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -0,0 +1,434 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 20 Mar 2022 10:42:28 -0700
Subject: [PATCH] Add Position
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0fdabce4af640da2a406412e67020761ded3ac1
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
@@ -0,0 +1,98 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Axis;
+import org.bukkit.block.BlockFace;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A position represented with integers.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ * @see FinePosition
+ */
+@ApiStatus.Experimental
+public interface BlockPosition extends Position {
+
+ @Override
+ default double x() {
+ return this.blockX();
+ }
+
+ @Override
+ default double y() {
+ return this.blockY();
+ }
+
+ @Override
+ default double z() {
+ return this.blockZ();
+ }
+
+ @Override
+ default boolean isBlock() {
+ return true;
+ }
+
+ @Override
+ default boolean isFine() {
+ return false;
+ }
+
+ @Override
+ default @NotNull BlockPosition toBlock() {
+ return this;
+ }
+
+ @Override
+ default @NotNull BlockPosition offset(int x, int y, int z) {
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
+ }
+
+ @Override
+ default @NotNull FinePosition offset(double x, double y, double z) {
+ return new FinePositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
+ }
+
+ /**
+ * Returns a block position offset by 1 in the direction specified.
+ *
+ * @param blockFace the block face to offset towards
+ * @return the offset block position
+ */
+ @Contract(value = "_ -> new", pure = true)
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace) {
+ return this.offset(blockFace, 1);
+ }
+
+ /**
+ * Returns a block position offset in the direction specified
+ * multiplied by the amount.
+ *
+ * @param blockFace the block face to offset towards
+ * @param amount the number of times to move in that direction
+ * @return the offset block position
+ */
+ @Contract(pure = true)
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace, int amount) {
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
+ }
+
+ /**
+ * Returns a block position offset by the amount along
+ * the specified axis.
+ *
+ * @param axis the axis to offset along
+ * @param amount the amount to offset along that axis
+ * @return the offset block position
+ */
+ @Contract(pure = true)
+ default @NotNull BlockPosition offset(@NotNull Axis axis, int amount) {
+ return amount == 0 ? this : switch (axis) {
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount);
+ };
+ }
+}
diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb5a3f26c7ba56c6715827f52c0013a860ec7d9a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
@@ -0,0 +1,4 @@
+package io.papermc.paper.math;
+
+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition {
+}
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
new file mode 100644
index 0000000000000000000000000000000000000000..d8df70d731573cf2446044925f218876d62fd7cf
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
@@ -0,0 +1,56 @@
+package io.papermc.paper.math;
+
+import org.bukkit.util.NumberConversions;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A position represented with doubles.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ * @see BlockPosition
+ */
+@ApiStatus.Experimental
+public interface FinePosition extends Position {
+
+ @Override
+ default int blockX() {
+ return NumberConversions.floor(this.x());
+ }
+
+ @Override
+ default int blockY() {
+ return NumberConversions.floor(this.y());
+ }
+
+ @Override
+ default int blockZ() {
+ return NumberConversions.floor(this.z());
+ }
+
+ @Override
+ default boolean isBlock() {
+ return false;
+ }
+
+ @Override
+ default boolean isFine() {
+ return true;
+ }
+
+ @Override
+ default @NotNull BlockPosition toBlock() {
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
+ }
+
+ @Override
+ default @NotNull FinePosition offset(int x, int y, int z) {
+ return this.offset((double) x, y, z);
+ }
+
+ @Override
+ default @NotNull FinePosition offset(double x, double y, double z) {
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda8100fb72d0
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
@@ -0,0 +1,4 @@
+package io.papermc.paper.math;
+
+record FinePositionImpl(double x, double y, double z) implements FinePosition {
+}
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
new file mode 100644
index 0000000000000000000000000000000000000000..26bc5a0fa67855af87c8fd4cd8229b4d9f242740
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/Position.java
@@ -0,0 +1,191 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ */
+@ApiStatus.Experimental
+public interface Position {
+
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0);
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockX();
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockY();
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockZ();
+
+ /**
+ * Gets the x value for this position
+ *
+ * @return the x value
+ */
+ double x();
+
+ /**
+ * Gets the y value for this position
+ *
+ * @return the y value
+ */
+ double y();
+
+ /**
+ * Gets the z value for this position
+ *
+ * @return the z value
+ */
+ double z();
+
+ /**
+ * Checks of this position represents a {@link BlockPosition}
+ *
+ * @return true if block
+ */
+ boolean isBlock();
+
+ /**
+ * Checks if this position represents a {@link FinePosition}
+ *
+ * @return true if fine
+ */
+ boolean isFine();
+
+ /**
+ * Checks if each component of this position is finite.
+ */
+ default boolean isFinite() {
+ return Double.isFinite(this.x()) && Double.isFinite(this.y()) && Double.isFinite(this.z());
+ }
+
+ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
+ * @param y y value to offset
+ * @param z z value to offset
+ * @return the offset position
+ */
+ @NotNull Position offset(int x, int y, int z);
+
+ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
+ * @param y y value to offset
+ * @param z z value to offset
+ * @return the offset position
+ */
+ @NotNull FinePosition offset(double x, double y, double z);
+
+ /**
+ * Returns a new position at the center of the block position this represents
+ *
+ * @return a new center position
+ */
+ @Contract(value = "-> new", pure = true)
+ default @NotNull FinePosition toCenter() {
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
+ }
+
+ /**
+ * Returns the block position of this position
+ * or itself if it already is a block position
+ *
+ * @return the block position
+ */
+ @Contract(pure = true)
+ @NotNull BlockPosition toBlock();
+
+ /**
+ * Converts this position to a vector
+ *
+ * @return a new vector
+ */
+ @Contract(value = "-> new", pure = true)
+ default @NotNull Vector toVector() {
+ return new Vector(this.x(), this.y(), this.z());
+ }
+
+ /**
+ * Creates a new location object at this position with the specified world
+ *
+ * @param world the world for the location object
+ * @return a new location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ default @NotNull Location toLocation(@NotNull World world) {
+ return new Location(world, this.x(), this.y(), this.z());
+ }
+
+ /**
+ * Creates a position at the coordinates
+ *
+ * @param x x coord
+ * @param y y coord
+ * @param z z coord
+ * @return a position with those coords
+ */
+ @Contract(value = "_, _, _ -> new", pure = true)
+ static @NotNull BlockPosition block(int x, int y, int z) {
+ return new BlockPositionImpl(x, y, z);
+ }
+
+ /**
+ * Creates a position from the location.
+ *
+ * @param location the location to copy the position of
+ * @return a new position at that location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ static @NotNull BlockPosition block(@NotNull Location location) {
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ }
+
+ /**
+ * Creates a position at the coordinates
+ *
+ * @param x x coord
+ * @param y y coord
+ * @param z z coord
+ * @return a position with those coords
+ */
+ @Contract(value = "_, _, _ -> new", pure = true)
+ static @NotNull FinePosition fine(double x, double y, double z) {
+ return new FinePositionImpl(x, y, z);
+ }
+
+ /**
+ * Creates a position from the location.
+ *
+ * @param location the location to copy the position of
+ * @return a new position at that location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ static @NotNull FinePosition fine(@NotNull Location location) {
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
+ }
+}
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 7c4db051472fb6a6c6d24092dc6f75487356690a..85c342fc50f2fe0ce9a1b3980df9e088c3dea92d 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
* magnitude than 360 are valid, but may be normalized to any other equivalent
* representation by the implementation.
*/
-public class Location implements Cloneable, ConfigurationSerializable {
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
private Reference<World> world;
private double x;
private double y;
@@ -706,4 +706,31 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
return pitch;
}
+
+ // Paper - add Position
+ @Override
+ public double x() {
+ return this.getX();
+ }
+
+ @Override
+ public double y() {
+ return this.getY();
+ }
+
+ @Override
+ public double z() {
+ return this.getZ();
+ }
+
+ @Override
+ public boolean isFinite() {
+ return io.papermc.paper.math.FinePosition.super.isFinite() && Float.isFinite(this.getYaw()) && Float.isFinite(this.getPitch());
+ }
+
+ @Override
+ public @NotNull Location toLocation(@NotNull World world) {
+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
+ }
+ // Paper end
}

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -1,96 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 18 May 2021 14:42:26 -0700
Subject: [PATCH] Add command line option to load extra plugin jars not in the
plugins folder
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -76,6 +76,20 @@ public final class Bukkit {
return server;
}
+ /**
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
+ *
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
+ * directory manually when determining the location in which to store their data and configuration files.</p>
+ *
+ * @return plugins directory
+ */
+ @NotNull
+ public static File getPluginsFolder() {
+ return server.getPluginsFolder();
+ }
+
/**
* Attempts to set the {@link Server} singleton.
* <p>
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
+ /**
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
+ *
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
+ * directory manually when determining the location in which to store their data and configuration files.</p>
+ *
+ * @return plugins directory
+ */
+ @NotNull
+ File getPluginsFolder();
+
/**
* Used for all administrative messages, such as an operator using a
* command.
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index f13dcbe448111b24b36105d25527ba87ccc9334e..3fcb73a0fc2daaeb76dd4c6757afce52c5b3118b 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -116,9 +116,22 @@ public final class SimplePluginManager implements PluginManager {
@Override
@NotNull
public Plugin[] loadPlugins(@NotNull File directory) {
+ // Paper start - extra jars
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
+ }
+ @NotNull
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
+ // Paper end
if (true) {
List<Plugin> pluginList = new ArrayList<>();
java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory));
+ for (File file : extraPluginJars) {
+ try {
+ pluginList.add(this.paperPluginManager.loadPlugin(file));
+ } catch (Exception e) {
+ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
+ }
+ }
return pluginList.toArray(new Plugin[0]);
}
Preconditions.checkArgument(directory != null, "Directory cannot be null");
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 02062284dbc1a6c923ceffa5e4d6a3be8c7429d3..88d852c1a729ffd5951da803da424b31591c9f9a 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -93,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader {
throw new InvalidPluginException(ex);
}
- final File parentFile = file.getParentFile();
+ final File parentFile = this.server.getPluginsFolder(); // Paper
final File dataFolder = new File(parentFile, description.getName());
@SuppressWarnings("deprecation")
final File oldDataFolder = new File(parentFile, description.getRawName());

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -0,0 +1,96 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 18 May 2021 14:42:26 -0700
Subject: [PATCH] Add command line option to load extra plugin jars not in the
plugins folder
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 6ecab28705afc0e3652677b516d8a5398e8b2666..db51751d2dc1ac419e8fac32466ad3a7727fa2fe 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -83,6 +83,20 @@ public final class Bukkit {
return server;
}
+ /**
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
+ *
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
+ * directory manually when determining the location in which to store their data and configuration files.</p>
+ *
+ * @return plugins directory
+ */
+ @NotNull
+ public static File getPluginsFolder() {
+ return server.getPluginsFolder();
+ }
+
/**
* Attempts to set the {@link Server} singleton.
* <p>
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f4b2ad91c7a46af5fc16f31369d155e4e3ab3aae..638e98416fdf7ac065abe058d625b1c924be5abb 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -68,6 +68,18 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
+ /**
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
+ *
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
+ * directory manually when determining the location in which to store their data and configuration files.</p>
+ *
+ * @return plugins directory
+ */
+ @NotNull
+ File getPluginsFolder();
+
/**
* Used for all administrative messages, such as an operator using a
* command.
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 6018574cd15b802833613beefa88da15dc2730cb..e7b1895d3918487d711afcbe41d76863d85c0a62 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -117,9 +117,22 @@ public final class SimplePluginManager implements PluginManager {
@Override
@NotNull
public Plugin[] loadPlugins(@NotNull File directory) {
+ // Paper start - extra jars
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
+ }
+ @NotNull
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
+ // Paper end
if (true) {
List<Plugin> pluginList = new ArrayList<>();
java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory));
+ for (File file : extraPluginJars) {
+ try {
+ pluginList.add(this.paperPluginManager.loadPlugin(file));
+ } catch (Exception e) {
+ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
+ }
+ }
return pluginList.toArray(new Plugin[0]);
}
Preconditions.checkArgument(directory != null, "Directory cannot be null");
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index de6b6188587fd254ab96cbc1f95fda2056d9cbe2..eaefbb00e9993d54906cc8cf35cf753c0d6c7707 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -93,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader {
throw new InvalidPluginException(ex);
}
- final File parentFile = file.getParentFile();
+ final File parentFile = this.server.getPluginsFolder(); // Paper
final File dataFolder = new File(parentFile, description.getName());
@SuppressWarnings("deprecation")
final File oldDataFolder = new File(parentFile, description.getRawName());

Datei anzeigen

@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Mon, 29 Feb 2016 17:22:34 -0600
Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 705644a2e0d209ef717470da07d34fafc88a0640..1c3d9ac922c189adc139c2646b4bdc97dbfadb43 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1875,6 +1875,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper
public String getLocale();
+ // Paper start
+ /**
+ * Get whether the player can affect mob spawning
+ *
+ * @return if the player can affect mob spawning
+ */
+ public boolean getAffectsSpawning();
+
+ /**
+ * Set whether the player can affect mob spawning
+ *
+ * @param affects Whether the player can affect mob spawning
+ */
+ public void setAffectsSpawning(boolean affects);
+ // Paper end
+
/**
* Update the list of commands sent to the client.
* <br>

Datei anzeigen

@ -1,49 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 17:24:57 -0600
Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 71a09ed2b9863d2d339967f41ab6373ec27429d3..397f57f0ab4844fb88c60681bf6e6e3db8a98945 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1891,6 +1891,17 @@ public final class Bukkit {
return server.getEntity(uuid);
}
+ // Paper start
+ /**
+ * Gets the current server TPS
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public static double[] getTPS() {
+ return server.getTPS();
+ }
+ // Paper end
+
/**
* Get the advancement specified by this key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index a4f8035b40eebff8afe01788781128b04247f28c..3f3531e208472a0e76f76e2b1a08a699527cef8f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1605,6 +1605,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
Entity getEntity(@NotNull UUID uuid);
+ // Paper start
+ /**
+ * Gets the current server TPS
+ *
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public double[] getTPS();
+ // Paper end
+
/**
* Get the advancement specified by this key.
*

Datei anzeigen

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Mon, 29 Feb 2016 17:22:34 -0600
Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 3594b0eb4068c83c93efe948a8ef4ba217edce17..1ba2f706a62ee6962451305b1895654453b485cd 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2583,6 +2583,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper
public String getLocale();
+ // Paper start
+ /**
+ * Get whether the player can affect mob spawning
+ *
+ * @return if the player can affect mob spawning
+ */
+ public boolean getAffectsSpawning();
+
+ /**
+ * Set whether the player can affect mob spawning
+ *
+ * @param affects Whether the player can affect mob spawning
+ */
+ public void setAffectsSpawning(boolean affects);
+ // Paper end
+
/**
* Update the list of commands sent to the client.
* <br>

Datei anzeigen

@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 17:24:57 -0600
Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index d978c72cdbc10792f852a4ba372518073893d02b..5780003631beae773231afe3afc6b834bfe1f84d 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2108,6 +2108,17 @@ public final class Bukkit {
return server.getEntity(uuid);
}
+ // Paper start
+ /**
+ * Gets the current server TPS
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public static double[] getTPS() {
+ return server.getTPS();
+ }
+ // Paper end
+
/**
* Get the advancement specified by this key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8949b8e29ae7f412481291630a5cb7b5b8809842..ba28d9f3213ca4b5f15178dc637bff37a8896edc 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1797,6 +1797,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
Entity getEntity(@NotNull UUID uuid);
+ // Paper start
+ /**
+ * Gets the current server TPS
+ *
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
+ */
+ @NotNull
+ public double[] getTPS();
+ // Paper end
+
/**
* Get the advancement specified by this key.
*

Datei anzeigen

@ -1,177 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Mon, 27 May 2019 01:10:06 -0500
Subject: [PATCH] Version Command 2.0
diff --git a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
new file mode 100644
index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c716339346
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
@@ -0,0 +1,45 @@
+package com.destroystokyo.paper.util;
+
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.Bukkit;
+import org.jetbrains.annotations.NotNull;
+
+public interface VersionFetcher {
+ /**
+ * Amount of time to cache results for in milliseconds
+ * <p>
+ * Negative values will never cache.
+ *
+ * @return cache time
+ */
+ long getCacheTime();
+
+ /**
+ * Gets the version message to cache and show to command senders.
+ *
+ * <p>NOTE: This is run in a new thread separate from that of the command processing thread</p>
+ *
+ * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
+ * @return the message to show when requesting a version
+ */
+ @NotNull
+ Component getVersionMessage(@NotNull String serverVersion);
+
+ class DummyVersionFetcher implements VersionFetcher {
+
+ @Override
+ public long getCacheTime() {
+ return -1;
+ }
+
+ @NotNull
+ @Override
+ public Component getVersionMessage(@NotNull String serverVersion) {
+ Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
+ Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
+ new Throwable().printStackTrace();
+ return Component.text("Unable to check for updates. No version provider set.", NamedTextColor.RED);
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index daf3ac72cae4d19c0273058dc6a1e1afe9a47f77..24fad8e59a3a5a174d24505cedda2a3fd52115b1 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -114,5 +114,12 @@ public interface UnsafeValues {
* @return name
*/
String getTimingsServerName();
+
+ /**
+ * Called once by the version command on first use, then cached.
+ */
+ default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
+ return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
+ }
// Paper end
}
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 04b4fb6859df0221f8f9f92c5a7ac2dda1073355..b50f614806f4634960d383e8a33f094c2f46935f 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -1,5 +1,6 @@
package org.bukkit.command.defaults;
+import com.destroystokyo.paper.util.VersionFetcher; // Paper - version supplier
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -26,6 +27,15 @@ import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
public class VersionCommand extends BukkitCommand {
+ private VersionFetcher versionFetcher;
+ private VersionFetcher getVersionFetcher() { // lazy load because unsafe isn't available at command registration
+ if (versionFetcher == null) {
+ versionFetcher = Bukkit.getUnsafe().getVersionFetcher();
+ }
+
+ return versionFetcher;
+ }
+
public VersionCommand(@NotNull String name) {
super(name);
@@ -40,7 +50,7 @@ public class VersionCommand extends BukkitCommand {
if (!testPermission(sender)) return true;
if (args.length == 0) {
- sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
+ //sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); // Paper - moved to setVersionMessage
sendVersion(sender);
} else {
StringBuilder name = new StringBuilder();
@@ -146,14 +156,14 @@ public class VersionCommand extends BukkitCommand {
private final ReentrantLock versionLock = new ReentrantLock();
private boolean hasVersion = false;
- private String versionMessage = null;
+ private net.kyori.adventure.text.Component versionMessage = null; // Paper
private final Set<CommandSender> versionWaiters = new HashSet<CommandSender>();
private boolean versionTaskStarted = false;
private long lastCheck = 0;
private void sendVersion(@NotNull CommandSender sender) {
if (hasVersion) {
- if (System.currentTimeMillis() - lastCheck > 21600000) {
+ if (System.currentTimeMillis() - lastCheck > getVersionFetcher().getCacheTime()) { // Paper - use version supplier
lastCheck = System.currentTimeMillis();
hasVersion = false;
} else {
@@ -168,7 +178,7 @@ public class VersionCommand extends BukkitCommand {
return;
}
versionWaiters.add(sender);
- sender.sendMessage("Checking version, please wait...");
+ sender.sendMessage(net.kyori.adventure.text.Component.text("Checking version, please wait...", net.kyori.adventure.text.format.NamedTextColor.WHITE, net.kyori.adventure.text.format.TextDecoration.ITALIC)); // Paper
if (!versionTaskStarted) {
versionTaskStarted = true;
new Thread(new Runnable() {
@@ -186,6 +196,13 @@ public class VersionCommand extends BukkitCommand {
private void obtainVersion() {
String version = Bukkit.getVersion();
+ // Paper start
+ if (version.startsWith("null")) { // running from ide?
+ setVersionMessage(net.kyori.adventure.text.Component.text("Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
+ return;
+ }
+ setVersionMessage(getVersionFetcher().getVersionMessage(version));
+ /*
if (version == null) version = "Custom";
String[] parts = version.substring(0, version.indexOf(' ')).split("-");
if (parts.length == 4) {
@@ -215,11 +232,24 @@ public class VersionCommand extends BukkitCommand {
} else {
setVersionMessage("Unknown version, custom build?");
}
+ */
+ // Paper end
}
- private void setVersionMessage(@NotNull String msg) {
+ // Paper start
+ private void setVersionMessage(final @NotNull net.kyori.adventure.text.Component msg) {
lastCheck = System.currentTimeMillis();
- versionMessage = msg;
+ final net.kyori.adventure.text.Component message = net.kyori.adventure.text.TextComponent.ofChildren(
+ net.kyori.adventure.text.Component.text("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")", net.kyori.adventure.text.format.NamedTextColor.WHITE),
+ net.kyori.adventure.text.Component.newline(),
+ msg
+ );
+ this.versionMessage = net.kyori.adventure.text.Component.text()
+ .append(message)
+ .hoverEvent(net.kyori.adventure.text.Component.text("Click to copy to clipboard", net.kyori.adventure.text.format.NamedTextColor.WHITE))
+ .clickEvent(net.kyori.adventure.text.event.ClickEvent.copyToClipboard(net.kyori.adventure.text.serializer.plain.PlainComponentSerializer.plain().serialize(message)))
+ .build();
+ // Paper end
versionLock.lock();
try {
hasVersion = true;

Datei anzeigen

@ -1,66 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 17:50:31 -0600
Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index bdcf5219ff1e4d4c0dc8a3423bc17b453b779473..a4dfac73b8510f0dddd65751b8430be1abdabbdd 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -698,5 +698,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.customName())));
}
+
+ /**
+ * Gets the location where this entity originates from.
+ * <p>
+ * This value can be null if the entity hasn't yet been added to the world.
+ *
+ * @return Location where entity originates or null if not yet added
+ */
+ @Nullable
+ Location getOrigin();
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index 64f9d3fd870d65afd2ee9a85625b149163eee144..14cb0d770561151570ab4399ca5facff43076819 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -54,4 +54,15 @@ public interface FallingBlock extends Entity {
* @param hurtEntities whether entities will be damaged by this block.
*/
void setHurtEntities(boolean hurtEntities);
+
+ /**
+ * Gets the source block location of the FallingBlock
+ *
+ * @return the source block location the FallingBlock was spawned from
+ * @deprecated replaced by {@link Entity#getOrigin()}
+ */
+ @Deprecated
+ default org.bukkit.Location getSourceLoc() {
+ return this.getOrigin();
+ }
}
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
index a23cfdf66877f0a61eae700de084c76e6ee7b431..0813bd913c8fdb2001963ce3e82c07c2af105418 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -53,4 +53,15 @@ public interface TNTPrimed extends Explosive {
* @param source the source of this primed TNT
*/
public void setSource(@Nullable Entity source);
+
+ /**
+ * Gets the source block location of the TNTPrimed
+ *
+ * @return the source block location the TNTPrimed was spawned from
+ * @deprecated replaced by {@link Entity#getOrigin()}
+ */
+ @Deprecated
+ default org.bukkit.Location getSourceLoc() {
+ return this.getOrigin();
+ }
}

Datei anzeigen

@ -0,0 +1,528 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Mon, 27 May 2019 01:10:06 -0500
Subject: [PATCH] Expose server build information
Co-authored-by: Professor Bloodstone <git@bloodstone.dev>
Co-authored-by: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Co-authored-by: masmc05 <masmc05@gmail.com>
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
diff --git a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
new file mode 100644
index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c716339346
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
@@ -0,0 +1,45 @@
+package com.destroystokyo.paper.util;
+
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.bukkit.Bukkit;
+import org.jetbrains.annotations.NotNull;
+
+public interface VersionFetcher {
+ /**
+ * Amount of time to cache results for in milliseconds
+ * <p>
+ * Negative values will never cache.
+ *
+ * @return cache time
+ */
+ long getCacheTime();
+
+ /**
+ * Gets the version message to cache and show to command senders.
+ *
+ * <p>NOTE: This is run in a new thread separate from that of the command processing thread</p>
+ *
+ * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
+ * @return the message to show when requesting a version
+ */
+ @NotNull
+ Component getVersionMessage(@NotNull String serverVersion);
+
+ class DummyVersionFetcher implements VersionFetcher {
+
+ @Override
+ public long getCacheTime() {
+ return -1;
+ }
+
+ @NotNull
+ @Override
+ public Component getVersionMessage(@NotNull String serverVersion) {
+ Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
+ Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
+ new Throwable().printStackTrace();
+ return Component.text("Unable to check for updates. No version provider set.", NamedTextColor.RED);
+ }
+ }
+}
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..9df9d09aa477d4cd3c496ba0933c816df1ef0964
--- /dev/null
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
@@ -0,0 +1,121 @@
+package io.papermc.paper;
+
+import java.time.Instant;
+import java.util.Optional;
+import java.util.OptionalInt;
+import net.kyori.adventure.key.Key;
+import net.kyori.adventure.util.Services;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Information about the current server build.
+ */
+@ApiStatus.NonExtendable
+public interface ServerBuildInfo {
+ /**
+ * The brand id for Paper.
+ */
+ Key BRAND_PAPER_ID = Key.key("papermc", "paper");
+
+ /**
+ * Gets the {@code ServerBuildInfo}.
+ *
+ * @return the {@code ServerBuildInfo}
+ */
+ static @NotNull ServerBuildInfo buildInfo() {
+ //<editor-fold defaultstate="collapsed" desc="Holder">
+ final class Holder {
+ static final Optional<ServerBuildInfo> INSTANCE = Services.service(ServerBuildInfo.class);
+ }
+ //</editor-fold>
+ return Holder.INSTANCE.orElseThrow();
+ }
+
+ /**
+ * Gets the brand id of the server.
+ *
+ * @return the brand id of the server (e.g. "papermc:paper")
+ */
+ @NotNull Key brandId();
+
+ /**
+ * Checks if the current server supports the specified brand.
+ *
+ * @param brandId the brand to check (e.g. "papermc:folia")
+ * @return {@code true} if the server supports the specified brand
+ */
+ @ApiStatus.Experimental
+ boolean isBrandCompatible(final @NotNull Key brandId);
+
+ /**
+ * Gets the brand name of the server.
+ *
+ * @return the brand name of the server (e.g. "Paper")
+ */
+ @NotNull String brandName();
+
+ /**
+ * Gets the Minecraft version id.
+ *
+ * @return the Minecraft version id (e.g. "1.20.4", "1.20.2-pre2", "23w31a")
+ */
+ @NotNull String minecraftVersionId();
+
+ /**
+ * Gets the Minecraft version name.
+ *
+ * @return the Minecraft version name (e.g. "1.20.4", "1.20.2 Pre-release 2", "23w31a")
+ */
+ @NotNull String minecraftVersionName();
+
+ /**
+ * Gets the build number.
+ *
+ * @return the build number
+ */
+ @NotNull OptionalInt buildNumber();
+
+ /**
+ * Gets the build time.
+ *
+ * @return the build time
+ */
+ @NotNull Instant buildTime();
+
+ /**
+ * Gets the git commit branch.
+ *
+ * @return the git commit branch
+ */
+ @NotNull Optional<String> gitBranch();
+
+ /**
+ * Gets the git commit hash.
+ *
+ * @return the git commit hash
+ */
+ @NotNull Optional<String> gitCommit();
+
+ /**
+ * Creates a string representation of the server build information.
+ *
+ * @param representation the type of representation
+ * @return a string
+ */
+ @NotNull String asString(final @NotNull StringRepresentation representation);
+
+ /**
+ * String representation types.
+ */
+ enum StringRepresentation {
+ /**
+ * A simple version string, in format {@code <minecraftVersionId>-<buildNumber>-<gitCommit>}.
+ */
+ VERSION_SIMPLE,
+ /**
+ * A simple version string, in format {@code <minecraftVersionId>-<buildNumber>-<gitBranch>@<gitCommit> (<buildTime>)}.
+ */
+ VERSION_FULL,
+ }
+}
diff --git a/src/main/java/io/papermc/paper/util/JarManifests.java b/src/main/java/io/papermc/paper/util/JarManifests.java
new file mode 100644
index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b306076343
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/JarManifests.java
@@ -0,0 +1,37 @@
+package io.papermc.paper.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.jar.Manifest;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@ApiStatus.Internal
+public final class JarManifests {
+ private JarManifests() {
+ }
+
+ private static final Map<ClassLoader, Manifest> MANIFESTS = Collections.synchronizedMap(new WeakHashMap<>());
+
+ public static @Nullable Manifest manifest(final @NotNull Class<?> clazz) {
+ return MANIFESTS.computeIfAbsent(clazz.getClassLoader(), classLoader -> {
+ final String classLocation = "/" + clazz.getName().replace(".", "/") + ".class";
+ final URL resource = clazz.getResource(classLocation);
+ if (resource == null) {
+ return null;
+ }
+ final String classFilePath = resource.toString().replace("\\", "/");
+ final String archivePath = classFilePath.substring(0, classFilePath.length() - classLocation.length());
+ try (final InputStream stream = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) {
+ return new Manifest(stream);
+ } catch (final IOException ex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5780003631beae773231afe3afc6b834bfe1f84d..a005d5f8879262c763d8c4fbd09b9a99810d5e8c 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -110,13 +110,26 @@ public final class Bukkit {
}
Bukkit.server = server;
- server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")");
+ // Paper start - add git information
+ server.getLogger().info(getVersionMessage());
+ }
+ /**
+ * Gets message describing the version server is running.
+ *
+ * @return message describing the version server is running
+ */
+ @NotNull
+ public static String getVersionMessage() {
+ final io.papermc.paper.ServerBuildInfo version = io.papermc.paper.ServerBuildInfo.buildInfo();
+ return "This server is running " + getName() + " version " + version.asString(io.papermc.paper.ServerBuildInfo.StringRepresentation.VERSION_FULL) + " (Implementing API version " + getBukkitVersion() + ")";
+ // Paper end
}
/**
* Gets the name of this server implementation.
*
* @return name of this server implementation
+ * @see io.papermc.paper.ServerBuildInfo#brandName()
*/
@NotNull
public static String getName() {
@@ -127,6 +140,7 @@ public final class Bukkit {
* Gets the version string of this server implementation.
*
* @return version of this server implementation
+ * @see io.papermc.paper.ServerBuildInfo
*/
@NotNull
public static String getVersion() {
@@ -143,6 +157,20 @@ public final class Bukkit {
return server.getBukkitVersion();
}
+ // Paper start - expose game version
+ /**
+ * Gets the version of game this server implements
+ *
+ * @return version of game
+ * @see io.papermc.paper.ServerBuildInfo#minecraftVersionId()
+ * @see io.papermc.paper.ServerBuildInfo#minecraftVersionName()
+ */
+ @NotNull
+ public static String getMinecraftVersion() {
+ return server.getMinecraftVersion();
+ }
+ // Paper end
+
/**
* Gets a view of all currently logged in players. This {@linkplain
* Collections#unmodifiableCollection(Collection) view} is a reused
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ba28d9f3213ca4b5f15178dc637bff37a8896edc..8a07f21eeb04fb54032ce377a1478f60303e1824 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -120,6 +120,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public String getBukkitVersion();
+ // Paper start - expose game version
+ /**
+ * Gets the version of game this server implements
+ *
+ * @return version of game
+ */
+ @NotNull
+ String getMinecraftVersion();
+ // Paper end
+
/**
* Gets a view of all currently logged in players. This {@linkplain
* Collections#unmodifiableCollection(Collection) view} is a reused
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 12ef99f1c91b92a133611c5f5aeaaeebd02ce232..6e67fdb091a006d2d13bc2d93db4d55348af4c8f 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -163,5 +163,12 @@ public interface UnsafeValues {
*/
@Deprecated(forRemoval = true)
String getTimingsServerName();
+
+ /**
+ * Called once by the version command on first use, then cached.
+ */
+ default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
+ return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
+ }
// Paper end
}
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 263208d3cba36cb80c9ee4e3022ef702ea113df2..e64bb57f74e6d6f78927be228825b3e0bdf41f48 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -25,8 +25,25 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
+// Paper start - version command 2.0
+import com.destroystokyo.paper.util.VersionFetcher;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.format.TextDecoration;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+// Paper end - version command 2.0
public class VersionCommand extends BukkitCommand {
+ private VersionFetcher versionFetcher; // Paper - version command 2.0
+ private VersionFetcher getVersionFetcher() { // lazy load because unsafe isn't available at command registration
+ if (versionFetcher == null) {
+ versionFetcher = Bukkit.getUnsafe().getVersionFetcher();
+ }
+
+ return versionFetcher;
+ }
+
public VersionCommand(@NotNull String name) {
super(name);
@@ -41,7 +58,7 @@ public class VersionCommand extends BukkitCommand {
if (!testPermission(sender)) return true;
if (args.length == 0) {
- sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
+ //sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); // Paper - moved to setVersionMessage
sendVersion(sender);
} else {
StringBuilder name = new StringBuilder();
@@ -80,8 +97,17 @@ public class VersionCommand extends BukkitCommand {
private void describeToSender(@NotNull Plugin plugin, @NotNull CommandSender sender) {
PluginDescriptionFile desc = plugin.getDescription();
- sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());
-
+ // Paper start - version command 2.0
+ sender.sendMessage(
+ Component.text()
+ .append(Component.text(desc.getName(), NamedTextColor.GREEN))
+ .append(Component.text(" version "))
+ .append(Component.text(desc.getVersion(), NamedTextColor.GREEN)
+ .hoverEvent(Component.text("Click to copy to clipboard", NamedTextColor.WHITE))
+ .clickEvent(ClickEvent.copyToClipboard(desc.getVersion()))
+ )
+ );
+ // Paper end - version command 2.0
if (desc.getDescription() != null) {
sender.sendMessage(desc.getDescription());
}
@@ -147,14 +173,14 @@ public class VersionCommand extends BukkitCommand {
private final ReentrantLock versionLock = new ReentrantLock();
private boolean hasVersion = false;
- private String versionMessage = null;
+ private Component versionMessage = null; // Paper
private final Set<CommandSender> versionWaiters = new HashSet<CommandSender>();
private boolean versionTaskStarted = false;
private long lastCheck = 0;
private void sendVersion(@NotNull CommandSender sender) {
if (hasVersion) {
- if (System.currentTimeMillis() - lastCheck > 21600000) {
+ if (System.currentTimeMillis() - lastCheck > getVersionFetcher().getCacheTime()) { // Paper - use version supplier
lastCheck = System.currentTimeMillis();
hasVersion = false;
} else {
@@ -169,7 +195,7 @@ public class VersionCommand extends BukkitCommand {
return;
}
versionWaiters.add(sender);
- sender.sendMessage("Checking version, please wait...");
+ sender.sendMessage(Component.text("Checking version, please wait...", NamedTextColor.WHITE, TextDecoration.ITALIC)); // Paper
if (!versionTaskStarted) {
versionTaskStarted = true;
new Thread(new Runnable() {
@@ -187,6 +213,13 @@ public class VersionCommand extends BukkitCommand {
private void obtainVersion() {
String version = Bukkit.getVersion();
+ // Paper start
+ if (version.startsWith("null")) { // running from ide?
+ setVersionMessage(Component.text("Unknown version, custom build?", NamedTextColor.YELLOW));
+ return;
+ }
+ setVersionMessage(getVersionFetcher().getVersionMessage(version));
+ /*
if (version == null) version = "Custom";
String[] parts = version.substring(0, version.indexOf(' ')).split("-");
if (parts.length == 4) {
@@ -216,11 +249,24 @@ public class VersionCommand extends BukkitCommand {
} else {
setVersionMessage("Unknown version, custom build?");
}
+ */
+ // Paper end
}
- private void setVersionMessage(@NotNull String msg) {
+ // Paper start
+ private void setVersionMessage(final @NotNull Component msg) {
lastCheck = System.currentTimeMillis();
- versionMessage = msg;
+ final Component message = Component.textOfChildren(
+ Component.text(Bukkit.getVersionMessage(), NamedTextColor.WHITE),
+ Component.newline(),
+ msg
+ );
+ this.versionMessage = Component.text()
+ .append(message)
+ .hoverEvent(Component.text("Click to copy to clipboard", NamedTextColor.WHITE))
+ .clickEvent(ClickEvent.copyToClipboard(PlainTextComponentSerializer.plainText().serialize(message)))
+ .build();
+ // Paper end
versionLock.lock();
try {
hasVersion = true;
diff --git a/src/test/java/io/papermc/paper/TestServerBuildInfo.java b/src/test/java/io/papermc/paper/TestServerBuildInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..17be27a869c1047a7a9440fb8f3717260d4abbd0
--- /dev/null
+++ b/src/test/java/io/papermc/paper/TestServerBuildInfo.java
@@ -0,0 +1,59 @@
+package io.papermc.paper;
+
+import java.time.Instant;
+import java.util.Optional;
+import java.util.OptionalInt;
+import net.kyori.adventure.key.Key;
+import org.jetbrains.annotations.NotNull;
+
+public class TestServerBuildInfo implements ServerBuildInfo {
+ @Override
+ public @NotNull Key brandId() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isBrandCompatible(final @NotNull Key brandId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull String brandName() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull String minecraftVersionId() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull String minecraftVersionName() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull OptionalInt buildNumber() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull Instant buildTime() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull Optional<String> gitBranch() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull Optional<String> gitCommit() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull String asString(final @NotNull StringRepresentation representation) {
+ return "";
+ }
+}
diff --git a/src/test/resources/META-INF/services/io.papermc.paper.ServerBuildInfo b/src/test/resources/META-INF/services/io.papermc.paper.ServerBuildInfo
new file mode 100644
index 0000000000000000000000000000000000000000..64e2f8559b9c5a52e0a3229d3d12f65e9af145b3
--- /dev/null
+++ b/src/test/resources/META-INF/services/io.papermc.paper.ServerBuildInfo
@@ -0,0 +1 @@
+io.papermc.paper.TestServerBuildInfo

Datei anzeigen

@ -1,62 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Isaac Moore <rmsy@me.com>
Date: Mon, 29 Feb 2016 18:02:25 -0600
Subject: [PATCH] Add PlayerLocaleChangeEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..29dd763a99ce7c6ecb176b9fb346a400369d48a0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
@@ -0,0 +1,50 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+
+/**
+ * Called when the locale of the player is changed.
+ *
+ * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
+ */
+@Deprecated
+public class PlayerLocaleChangeEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final String oldLocale;
+ private final String newLocale;
+
+ public PlayerLocaleChangeEvent(final Player player, final String oldLocale, final String newLocale) {
+ super(player);
+ this.oldLocale = oldLocale;
+ this.newLocale = newLocale;
+ }
+
+ /**
+ * Gets the locale the player switched from.
+ *
+ * @return player's old locale
+ */
+ public String getOldLocale() {
+ return oldLocale;
+ }
+
+ /**
+ * Gets the locale the player is changed to.
+ *
+ * @return player's new locale
+ */
+ public String getNewLocale() {
+ return newLocale;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

Datei anzeigen

@ -0,0 +1,66 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Mon, 29 Feb 2016 17:50:31 -0600
Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index c78fb359bd28b8dc1ba242642ec612e856525993..4e1fb0974d061d5bb64899cac576318d2e6f8bf6 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -791,5 +791,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.customName())));
}
+
+ /**
+ * Gets the location where this entity originates from.
+ * <p>
+ * This value can be null if the entity hasn't yet been added to the world.
+ *
+ * @return Location where entity originates or null if not yet added
+ */
+ @Nullable
+ Location getOrigin();
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
index d96fd494b523491fcf1ac54d164351fd487f65d6..ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9 100644
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
@@ -126,4 +126,15 @@ public interface FallingBlock extends Entity {
* @param damage the max damage to set. Must be >= 0
*/
void setMaxDamage(int damage);
+
+ /**
+ * Gets the source block location of the FallingBlock
+ *
+ * @return the source block location the FallingBlock was spawned from
+ * @deprecated replaced by {@link Entity#getOrigin()}
+ */
+ @Deprecated
+ default org.bukkit.Location getSourceLoc() {
+ return this.getOrigin();
+ }
}
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
index a23cfdf66877f0a61eae700de084c76e6ee7b431..0813bd913c8fdb2001963ce3e82c07c2af105418 100644
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
@@ -53,4 +53,15 @@ public interface TNTPrimed extends Explosive {
* @param source the source of this primed TNT
*/
public void setSource(@Nullable Entity source);
+
+ /**
+ * Gets the source block location of the TNTPrimed
+ *
+ * @return the source block location the TNTPrimed was spawned from
+ * @deprecated replaced by {@link Entity#getOrigin()}
+ */
+ @Deprecated
+ default org.bukkit.Location getSourceLoc() {
+ return this.getOrigin();
+ }
}

Datei anzeigen

@ -8,12 +8,12 @@ Add per player no-tick, tick, and send view distances.
Also add send/no-tick view distance to World.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a4562f26bdb4 100644
index 9732929b666b0a5e1a2a41c8e8794cc4f2535e41..0a3a66e04f8785874f10a76603bff46469543688 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2698,6 +2698,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
int getSimulationDistance();
// Spigot end
@@ -2968,6 +2968,66 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@NotNull
public Set<FeatureFlag> getFeatureFlags();
+ // Paper start - view distance api
+ /**
@ -38,7 +38,9 @@ index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a456
+ * @deprecated Use {@link #getViewDistance()}
+ */
+ @Deprecated
+ int getNoTickViewDistance();
+ default int getNoTickViewDistance() {
+ return this.getViewDistance();
+ }
+
+ /**
+ * Sets the no-tick view distance for this world.
@ -50,7 +52,9 @@ index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a456
+ * @deprecated Use {@link #setViewDistance(int)}
+ */
+ @Deprecated
+ void setNoTickViewDistance(int viewDistance);
+ default void setNoTickViewDistance(int viewDistance) {
+ this.setViewDistance(viewDistance);
+ }
+
+ /**
+ * Gets the sending view distance for this world.
@ -71,14 +75,14 @@ index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a456
+ void setSendViewDistance(int viewDistance);
+ // Paper end - view distance api
+
// Spigot start
public class Spigot {
/**
* Gets all generated structures that intersect the chunk at the given
* coordinates. <br>
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352e0cfa993 100644
index 1ba2f706a62ee6962451305b1895654453b485cd..7d530bd0e4d833da760d1cf82aba966b7fb480b1 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1889,6 +1889,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2597,6 +2597,82 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param affects Whether the player can affect mob spawning
*/
public void setAffectsSpawning(boolean affects);
@ -123,7 +127,9 @@ index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352
+ * @deprecated Use {@link #getViewDistance()}
+ */
+ @Deprecated
+ public int getNoTickViewDistance();
+ default int getNoTickViewDistance() {
+ return this.getViewDistance();
+ }
+
+ /**
+ * Sets the no-ticking view distance for this player.
@ -135,7 +141,9 @@ index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352
+ * @deprecated Use {@link #setViewDistance(int)}
+ */
+ @Deprecated
+ public void setNoTickViewDistance(int viewDistance);
+ default void setNoTickViewDistance(int viewDistance) {
+ this.setViewDistance(viewDistance);
+ }
+
+ /**
+ * Gets the sending view distance for this player.

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add BeaconEffectEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091a46b56ac
index 0000000000000000000000000000000000000000..7270c1feece2dc15a4a0503c4bca93a1288f8f13
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
@@ -0,0 +1,86 @@
@@ -0,0 +1,91 @@
+package com.destroystokyo.paper.event.block;
+
+import org.bukkit.block.Block;
@ -18,18 +18,23 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.bukkit.potion.PotionEffect;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a beacon effect is being applied to a player.
+ */
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private PotionEffect effect;
+ private Player player;
+ private boolean primary;
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final Player player;
+ private final boolean primary;
+ private PotionEffect effect;
+
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
+ super(block);
+ this.effect = effect;
@ -37,16 +42,6 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
+ this.primary = primary;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ /**
+ * Gets the potion effect being applied.
+ *
@ -54,7 +49,7 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
+ */
+ @NotNull
+ public PotionEffect getEffect() {
+ return effect;
+ return this.effect;
+ }
+
+ /**
@ -73,26 +68,36 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
+ */
+ @NotNull
+ public Player getPlayer() {
+ return player;
+ return this.player;
+ }
+
+ /**
+ * Gets whether the effect is a primary beacon effect.
+ *
+ * @return true if this event represents a primary effect
+ * @return {@code true} if this event represents a primary effect
+ */
+ public boolean isPrimary() {
+ return primary;
+ return this.primary;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ return HANDLER_LIST;
+ }
+}

Datei anzeigen

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com>
Date: Mon, 29 Feb 2016 18:13:58 -0600
Subject: [PATCH] Add PlayerInitialSpawnEvent
For modifying a player's initial spawn location as they join the server
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..626e97bbcaa19d55475a0fc8770412d437af2733
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
@@ -0,0 +1,17 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.NotNull;
+import org.spigotmc.event.player.PlayerSpawnLocationEvent;
+
+/**
+ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API
+ */
+@Deprecated
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
+
+ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) {
+ super(who, spawnLocation);
+ }
+}

Datei anzeigen

@ -0,0 +1,50 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Mon, 29 Feb 2016 19:48:59 -0600
Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a005d5f8879262c763d8c4fbd09b9a99810d5e8c..26f3ac9c15ff554becfe8ea53a48f67b2de60ed6 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2337,6 +2337,19 @@ public final class Bukkit {
return server.getUnsafe();
}
+
+ // Paper start
+ /**
+ * Gets the active {@link org.bukkit.command.CommandMap}
+ *
+ * @return the active command map
+ */
+ @NotNull
+ public static org.bukkit.command.CommandMap getCommandMap() {
+ return server.getCommandMap();
+ }
+ // Paper end
+
@NotNull
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8a07f21eeb04fb54032ce377a1478f60303e1824..d78481bf17818415524f14417caf86d5684b2235 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1817,6 +1817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public double[] getTPS();
// Paper end
+ // Paper start
+ /**
+ * Gets the active {@link org.bukkit.command.CommandMap}
+ *
+ * @return the active command map
+ */
+ @NotNull
+ org.bukkit.command.CommandMap getCommandMap();
+
/**
* Get the advancement specified by this key.
*

Datei anzeigen

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Mon, 29 Feb 2016 19:48:59 -0600
Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 397f57f0ab4844fb88c60681bf6e6e3db8a98945..1035ce181415a19f8d6460f70d3d900e3f7017d3 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2092,6 +2092,19 @@ public final class Bukkit {
return server.getUnsafe();
}
+
+ // Paper start
+ /**
+ * Gets the active {@link org.bukkit.command.CommandMap}
+ *
+ * @return the active command map
+ */
+ @NotNull
+ public static org.bukkit.command.CommandMap getCommandMap() {
+ return server.getCommandMap();
+ }
+ // Paper end
+
@NotNull
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 3f3531e208472a0e76f76e2b1a08a699527cef8f..6a7b91af3e738613cf79c13e2844efe9a2efd254 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1615,6 +1615,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public double[] getTPS();
// Paper end
+ // Paper start
+ /**
+ * Gets the active {@link org.bukkit.command.CommandMap}
+ *
+ * @return the active command map
+ */
+ @NotNull
+ org.bukkit.command.CommandMap getCommandMap();
+
/**
* Get the advancement specified by this key.
*

Datei anzeigen

@ -0,0 +1,124 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 19:54:32 -0600
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
Change Javadoc to be accurate
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index fe074fe9553f61bdd72b64830532a78415348781..4c5327da1468cb1f9af00a99e7e79f578c47ee2a 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -472,6 +472,30 @@ public final class Bukkit {
return server.broadcastMessage(message);
}
+ // Paper start
+ /**
+ * Sends the component to all online players.
+ *
+ * @param component the component to send
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
+ */
+ @Deprecated
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ server.broadcast(component);
+ }
+
+ /**
+ * Sends an array of components as a single message to all online players.
+ *
+ * @param components the components to send
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
+ */
+ @Deprecated
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ server.broadcast(components);
+ }
+ // Paper end
+
/**
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9545da2adacaf0bd719c2baef929588cd1042d25..19b75704ed9eee0c929df417e1e5d0ea3718e2f8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -383,6 +383,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Deprecated // Paper
public int broadcastMessage(@NotNull String message);
+ // Paper start
+ /**
+ * Sends the component to all online players.
+ *
+ * @param component the component to send
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
+ */
+ @Deprecated
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ spigot().broadcast(component);
+ }
+
+ /**
+ * Sends an array of components as a single message to all online players.
+ *
+ * @param components the components to send
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
+ */
+ @Deprecated
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ spigot().broadcast(components);
+ }
+ // Paper end
+
/**
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7d530bd0e4d833da760d1cf82aba966b7fb480b1..f9bacbfa223826b3b54525648080fda306a1ec36 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1214,6 +1214,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendMap(@NotNull MapView map);
+ // Paper start
+ /**
+ * Sends the component to the player
+ *
+ * @param component the components to send
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
+ */
+ @Override
+ @Deprecated
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
+ spigot().sendMessage(component);
+ }
+
+ /**
+ * Sends an array of components as a single message to the player
+ *
+ * @param components the components to send
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
+ */
+ @Override
+ @Deprecated
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
+ spigot().sendMessage(components);
+ }
+
+ /**
+ * Sends an array of components as a single message to the specified screen position of this player
+ *
+ * @param position the screen position
+ * @param components the components to send
+ */
+ public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
+ spigot().sendMessage(position, components);
+ }
+ // Paper end
+
/**
* Send a hurt animation. This fakes incoming damage towards the player from
* the given yaw relative to the player's direction.

Datei anzeigen

@ -0,0 +1,583 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 20:24:35 -0600
Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..9377ee1c2368ce058397037952d17bc010f66957
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
@@ -0,0 +1,45 @@
+package com.destroystokyo.paper.event.server;
+
+import org.bukkit.Bukkit;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import com.destroystokyo.paper.exception.ServerException;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called whenever an exception is thrown in a recoverable section of the server.
+ */
+public class ServerExceptionEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ @NotNull private final ServerException exception;
+
+ @ApiStatus.Internal
+ public ServerExceptionEvent(@NotNull ServerException exception) {
+ super(!Bukkit.isPrimaryThread());
+ this.exception = exception;
+ }
+
+ /**
+ * Gets the wrapped exception that was thrown.
+ *
+ * @return Exception thrown
+ */
+ @NotNull
+ public ServerException getException() {
+ return this.exception;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
new file mode 100644
index 0000000000000000000000000000000000000000..6fb39af0479a818f7f1465bcdfe505ab4ff7da1a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
@@ -0,0 +1,64 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Thrown when a command throws an exception
+ */
+public class ServerCommandException extends ServerException {
+
+ private final Command command;
+ private final CommandSender commandSender;
+ private final String[] arguments;
+
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(cause);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ this.commandSender = checkNotNull(commandSender, "commandSender");
+ this.arguments = checkNotNull(arguments, "arguments");
+ this.command = checkNotNull(command, "command");
+ }
+
+ /**
+ * Gets the command which threw the exception
+ *
+ * @return exception throwing command
+ */
+ public Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Gets the command sender which executed the command request
+ *
+ * @return command sender of exception thrown command request
+ */
+ public CommandSender getCommandSender() {
+ return commandSender;
+ }
+
+ /**
+ * Gets the arguments which threw the exception for the command
+ *
+ * @return arguments of exception thrown command request
+ */
+ public String[] getArguments() {
+ return arguments;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
new file mode 100644
index 0000000000000000000000000000000000000000..410b24139535cd5d8439ad581c43c61b5757fbf6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
@@ -0,0 +1,52 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.Listener;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Exception thrown when a server event listener throws an exception
+ */
+public class ServerEventException extends ServerPluginException {
+
+ private final Listener listener;
+ private final Event event;
+
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(message, cause, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(cause, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ this.listener = checkNotNull(listener, "listener");
+ this.event = checkNotNull(event, "event");
+ }
+
+ /**
+ * Gets the listener which threw the exception
+ *
+ * @return event listener
+ */
+ public Listener getListener() {
+ return listener;
+ }
+
+ /**
+ * Gets the event which caused the exception
+ *
+ * @return event
+ */
+ public Event getEvent() {
+ return event;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
new file mode 100644
index 0000000000000000000000000000000000000000..c06ea3942447d4824b83ff839cb449fb818dede1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
@@ -0,0 +1,23 @@
+package com.destroystokyo.paper.exception;
+
+/**
+ * Wrapper exception for all exceptions that are thrown by the server.
+ */
+public class ServerException extends Exception {
+
+ public ServerException(String message) {
+ super(message);
+ }
+
+ public ServerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerException(Throwable cause) {
+ super(cause);
+ }
+
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
new file mode 100644
index 0000000000000000000000000000000000000000..2c3effca7c9d6c904cbe248d312b74e2cd360acf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
@@ -0,0 +1,36 @@
+package com.destroystokyo.paper.exception;
+
+import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+
+/**
+ * Thrown when the internal server throws a recoverable exception.
+ */
+public class ServerInternalException extends ServerException {
+
+ public ServerInternalException(String message) {
+ super(message);
+ }
+
+ public ServerInternalException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServerInternalException(Throwable cause) {
+ super(cause);
+ }
+
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ public static void reportInternalException(Throwable cause) {
+ try {
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
+ ;
+ } catch (Throwable t) {
+ Bukkit.getLogger().log(Level.WARNING, "Exception posting ServerExceptionEvent", t); // Don't want to rethrow!
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
new file mode 100644
index 0000000000000000000000000000000000000000..f016ba3b1b62e554a9bacbb9635f2dbe441b3c4e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
@@ -0,0 +1,20 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.plugin.Plugin;
+
+/**
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
+ */
+public class ServerPluginEnableDisableException extends ServerPluginException {
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
+ super(message, cause, responsiblePlugin);
+ }
+
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
+ super(cause, responsiblePlugin);
+ }
+
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
new file mode 100644
index 0000000000000000000000000000000000000000..be3f92e3c6bcefe8b78da701b75121275001882e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
@@ -0,0 +1,36 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
+ */
+public class ServerPluginException extends ServerException {
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
+ super(message, cause);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
+ super(cause);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
+ }
+
+ private final Plugin responsiblePlugin;
+
+ /**
+ * Gets the plugin which is directly responsible for the exception being thrown
+ *
+ * @return plugin which is responsible for the exception throw
+ */
+ public Plugin getResponsiblePlugin() {
+ return responsiblePlugin;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
new file mode 100644
index 0000000000000000000000000000000000000000..2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
@@ -0,0 +1,64 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+import static com.google.common.base.Preconditions.*;
+
+/**
+ * Thrown when an incoming plugin message channel throws an exception
+ */
+public class ServerPluginMessageException extends ServerPluginException {
+
+ private final Player player;
+ private final String channel;
+ private final byte[] data;
+
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(message, cause, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(cause, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
+ this.player = checkNotNull(player, "player");
+ this.channel = checkNotNull(channel, "channel");
+ this.data = checkNotNull(data, "data");
+ }
+
+ /**
+ * Gets the channel to which the error occurred from receiving data from
+ *
+ * @return exception channel
+ */
+ public String getChannel() {
+ return channel;
+ }
+
+ /**
+ * Gets the data to which the error occurred from
+ *
+ * @return exception data
+ */
+ public byte[] getData() {
+ return data;
+ }
+
+ /**
+ * Gets the player which the plugin message causing the exception originated from
+ *
+ * @return exception player
+ */
+ public Player getPlayer() {
+ return player;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
new file mode 100644
index 0000000000000000000000000000000000000000..2d0b2d4a9b3e5bdeec0e4ea7ab69858d86aa3715
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
@@ -0,0 +1,37 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.scheduler.BukkitTask;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Thrown when a plugin's scheduler fails with an exception
+ */
+public class ServerSchedulerException extends ServerPluginException {
+
+ private final BukkitTask task;
+
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
+ super(message, cause, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
+ super(cause, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
+ this.task = checkNotNull(task, "task");
+ }
+
+ /**
+ * Gets the task which threw the exception
+ *
+ * @return exception throwing task
+ */
+ public BukkitTask getTask() {
+ return task;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
new file mode 100644
index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078cd9521a1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
@@ -0,0 +1,22 @@
+package com.destroystokyo.paper.exception;
+
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+
+/**
+ * Called when a tab-complete request throws an exception
+ */
+public class ServerTabCompleteException extends ServerCommandException {
+
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, command, commandSender, arguments);
+ }
+
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
+ super(cause, command, commandSender, arguments);
+ }
+
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 36fc2c35395c72f8b81a2a2f3265fd205384ce26..c7fa1d235cea78bda4656ed66b8d42b119cc50fb 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -156,11 +156,14 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
} // target.timings.stopTiming(); // Spigot // Paper
} catch (CommandException ex) {
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
//target.timings.stopTiming(); // Spigot // Paper
throw ex;
} catch (Throwable ex) {
//target.timings.stopTiming(); // Spigot // Paper
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
+ throw new CommandException(msg, ex);
}
// return true as command was handled
@@ -239,7 +242,9 @@ public class SimpleCommandMap implements CommandMap {
} catch (CommandException ex) {
throw ex;
} catch (Throwable ex) {
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
+ throw new CommandException(msg, ex);
}
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index e7b1895d3918487d711afcbe41d76863d85c0a62..003bece642b682985625db93cad93026352bfc66 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -528,7 +528,8 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while enabling "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin);
}
HandlerList.bakeAll();
@@ -551,32 +552,37 @@ public final class SimplePluginManager implements PluginManager {
try {
plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while disabling "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
server.getScheduler().cancelTasks(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
server.getServicesManager().unregisterAll(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
HandlerList.unregisterAll(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
server.getMessenger().unregisterIncomingPluginChannel(plugin);
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for "
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
}
try {
@@ -589,6 +595,13 @@ public final class SimplePluginManager implements PluginManager {
}
}
+ // Paper start
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
+ server.getLogger().log(Level.SEVERE, msg, ex);
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
+ }
+ // Paper end
+
@Override
public void clearPlugins() {
if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper
@@ -654,7 +667,13 @@ public final class SimplePluginManager implements PluginManager {
));
}
} catch (Throwable ex) {
- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
+ // Paper start - error reporting
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
+ server.getLogger().log(Level.SEVERE, msg, ex);
+ if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
+ }
+ // Paper end
}
}
}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen