Commit graph

9106 commits

Author SHA1 Message Date
Nassim Jahnke
70b02c9d2e [ci skip] Add section on nullability annotations (#11461) 2024-10-02 14:32:20 +02:00
Jake Potrebic
ec8b5b419f Use components properly in ProfileWhitelistVerifyEvent (#11456) 2024-10-02 05:32:05 -07:00
Nassim Jahnke
8d3c6e1052 Fix hex color check 2024-10-02 13:49:39 +02:00
Jake Potrebic
0adf5876db Finish converting most of the undeprecated api to jspecify 2024-09-30 11:44:36 -07:00
Jake Potrebic
29a25df60e Finish converting all events to jspecify annotations 2024-09-29 16:48:34 -07:00
Bjarne Koll
fa97c59a4e Do not NPE on uuid resolution in player profile (#11449)
Band-aid fix for the player profile api resolution for a profile with
name but without uuid. The real solution is a proper refactoring of the
completeFromCache and complete method internally, however this needs
further consideration regarding existing faulty behaviour around name
lookups from uuid-only profiles.
2024-09-30 00:26:44 +02:00
Axionize
6e485c3409 Configurable per-world void damage offset/damage(#11436) 2024-09-29 18:06:13 -04:00
Noah van der Aa
74e7902624 Add PlayerInsertLecternBookEvent [1.20 port] (#7305)
* Add PlayerInsertLecternBookEvent

* Rebase

Additionally, moves the event call higher up and removes the lectern
block state clone from the event.

* jSpecify

* Shrink correctly

* style fixups

* move methods

* rename param to cancel

* fix javadocs

* more javadoc fixes

* fix co-author on patch from yesterday

* last fix

---------

Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-09-29 23:28:48 +02:00
Jake Potrebic
64e918335c Begin switching to JSpecify annotations (#11448)
* Begin switching to JSpecify annotations

* more

* fixes
2024-09-29 12:52:13 -07:00
Jake Potrebic
fa1f6a5d78 Call bucket events for cauldrons (#7486) 2024-09-28 15:04:11 -07:00
Esoteric Enderman
96dde2d730 Add API for explosions to damage the explosion cause (#11180)
This intends to give plugin developers more control over explosions created using the World#createExplosion method, specifically by adding the option for explosions to damage the explosion cause (not the default behavior, and previously impossible to do, as far as I know). This is done by overloading existing methods with an extra `excludeSourceFromDamage` parameter.

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-09-28 20:32:56 +01:00
Tamion
afe5fc14c8 Add startingBrewTime (#11406)
* add startingBrewTime

* casting

* requests

* comments and fix setBrewTime

* a

* b

* move to own class

* rename

* missing Paper comment

* missing experimentals

* rebased

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-09-28 21:14:20 +02:00
Jake Potrebic
a1cb6c43d2 Improve entity effect API (#11444) 2024-09-28 11:05:45 -07:00
Jason Penilla
35d43942e2 Update paperweight to 1.7.3 (#11445) 2024-09-28 08:03:58 -07:00
Jake Potrebic
eba36b62bd Fix console completions on invalid commands (#7603) 2024-09-27 11:05:15 -07:00
masmc05
d89b0fb649 Add enchantWithLevels with tag specification (#11438)
* Add enchantWithLevels with tag specification

* Finalise

---------

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-09-27 21:04:57 +03:00
Jake Potrebic
e1c46e67a5 fix ItemStack#removeEnchantments creating non-stackable items (#11442) 2024-09-27 10:58:11 -07:00
Jake Potrebic
c40eeeefec Remove redundant fillUsableCommands call (#11425) 2024-09-27 09:49:18 -07:00
Jake Potrebic
ddd068d513 Deprecate for removal Block#isValidTool (#11439)
The method's implementation uses Block#getDrops
which re-computes the drops from the loot table each
call leading to isValidTool returning different values
with subsequent calls.
2024-09-27 09:28:04 -07:00
Brokkonaut
fb91090522 Call EntityDropItemEvent when a container item drops its contents (#11441) 2024-09-27 18:27:14 +02:00
Stefano
4ffc9d9c0c Adjust HAProxy's existance to log for console masters (#11433) 2024-09-27 18:19:29 +02:00
Jake Potrebic
ae51e7b8ff use correct types for preloading CraftRegistry
also add a check in CraftRegistryEntry constructor to
make sure preload class isn't in net.minecraft package
2024-09-26 14:20:09 -07:00
Jake Potrebic
ee957a53ba Fix tag lifecycle event handlers not disabling /reload 2024-09-24 19:33:30 -07:00
Jake Potrebic
653a12cc46 Add missing key files and cleanup registry definition order 2024-09-23 17:36:29 -07:00
Jake Potrebic
660700a1d3 make MenuType implement FeatureDependant 2024-09-23 15:03:52 -07:00
Jake Potrebic
f137f3cf13 Only call EntityPortalExitEvent if entity is actually in a portal 2024-09-22 14:35:04 -07:00
Jake Potrebic
802cb228d7 Expand out datapack API (#10828)
* Expand out datapack API

* add getTitle

* better enable check
2024-09-22 14:28:45 -07:00
TreemanKing
8f59e0a8a4 Fix Color Particle API (#10895)
* fix: check datatype of particles rather than particle-type

* feature: add ARGB channels

It keeps the functionality of the original color(int).

* fix: order

* fixes

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-09-23 07:06:40 +10:00
Nassim Jahnke
300db3cfd0 Fixup command precprocess cancellation (#11424) 2024-09-22 21:25:37 +02:00
Nassim Jahnke
e53a1f5e22 Add ItemStack array serialization methods (#10387) 2024-09-22 21:02:06 +02:00
Oliver Janka
36472a9173 Add velocity forwarding secret env override (#10127)
Previously, the velocity forwarding secret could only be configured via
the configuration option in the global paper configuration.
This makes configuring/passing such a value rather difficult for
containerized/orchestrated servers as these configuration files are
usually part of the server data volume itself and hence cannot be
sourced from a secret.

This commit enables administrators to define the PAPER_VELOCITY_SECRET
environment variable, which will override any potentially configured
velocity secret.
2024-09-22 20:25:27 +02:00
Bjarne Koll
e371c168d8 Deprecate BlockType#isInteractable (#11427)
While BlockType is still marked as internal, it mirrors the already
paper-deprecated method #isInteractable.

The commit marks said method as deprecated if/when BlockType becomes
experimental/non-internal.
2024-09-22 20:09:41 +02:00
Lulu13022002
b54562400c Update launchProjectile API (#11300) 2024-09-21 21:19:02 +02:00
Jake Potrebic
5b9ea906ed Create TileStateInventoryHolder (#11420)
Adds a missing interface to centralize getSnapshotInventory methods.
2024-09-21 11:09:29 -07:00
Bjarne Koll
a3916fd4da Correctly launch WindCharges (#11418)
The launch API on LivingEntity only respected the WindCharge type, not
its near-clone BreezeWindCharge.

This commit correctly accounts for BreezeWindCharge in
CraftLivingEntity.
2024-09-21 20:08:31 +02:00
Newwind
2bb8e69297 Disable pretty printing for advancement saving (#11419) 2024-09-21 19:01:22 +01:00
Bjarne Koll
1b174804c7 Return null in getRegistry(Class) for unknown type (#11422)
The Bukkit#getRegistry(Class) method contract specifies that it returns
null for unknown registry types. The current implementation however
requires the passed class to be mappable to a known registry key.

For types like Material, which have a SimpleRegistry in bukkit's
Registry interface, no server side registry exists and such the type
cannot be mapped to a registry key.

The commit correctly returns null for types that are not mappable to a
registry key instead of throwing a NullPointerException.
2024-09-21 19:57:08 +02:00
Bjarne Koll
f65939c6bd Remove wall-time / unused skip tick protection (#11412)
Spigot still maintains some partial implementation of "tick skipping", a
practice in which the MinecraftServer.currentTick field is updated not
by an increment of one per actual tick, but instead set to
System.currentTimeMillis() / 50. This behaviour means that the tracked
tick may "skip" a tick value in case a previous tick took more than the
expected 50ms.

To compensate for this in important paths, spigot/craftbukkit
implements "wall-time". Instead of incrementing/decrementing ticks on
block entities/entities by one for each call to their tick() method,
they instead increment/decrement important values, like
an ItemEntity's age or pickupDelay, by the difference of
`currentTick - lastTick`, where `lastTick` is the value of
`currentTick` during the last tick() call.

These "fixes" however do not play nicely with minecraft's simulation
distance as entities/block entities implementing the above behaviour
would "catch up" their values when moving from a non-ticking chunk to a
ticking one as their `lastTick` value remains stuck on the last tick in
a ticking chunk and hence lead to a large "catch up" once ticked again.

Paper completely removes the "tick skipping" behaviour (See patch
"Further-improve-server-tick-loop"), making the above precautions
completely unnecessary, which also rids paper of the previous described
incompatibility with non-ticking chunks.
2024-09-19 16:36:07 +02:00
Shane Freeder
5d6137bcc9 Only mark decorations dirty if a removal actually occurs (#11413)
* Only mark decorations dirty if a removal actually occurs

Vanilla calls this method blindly inside of a loop which erroniously marks
map data files as being dirty even if nothing has actually changed.

* Merge into existing patch

---------

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-09-19 15:27:33 +01:00
4real
d90c4f37f6 Validate slot in PlayerInventory#setSlot (#11399) 2024-09-17 17:57:32 +03:00
Bjarne Koll
85d19c8d5b Prevent NPE when serializing unresolved profile (#11407)
In the recent upstream update, the paper player profile was updated to
correctly return null for both name and id if constructed as such. This
change however broke the serialisation logic, as it depended on the name
never being null.

The commit moves the checks over to the newly introduced emptyName/UUID
fields that track if the profile was constructed with a null name or
uuid to differentiate it against an empty string or the NIL_UUID.
2024-09-16 20:53:00 +02:00
Tamion
8569d1f04b Fix enable-player-collisions playing sounds when set to false (#11390) 2024-09-15 22:26:23 +02:00
Tamion
11d73159d4 Fix TrialSpawner forgetting assigned mob when placed by player (#11381) 2024-09-15 22:20:38 +02:00
Jake Potrebic
7669a1097e Set default drop behavior for player deaths (#11380) 2024-09-15 12:51:35 -07:00
Bjarne Koll
aee3dfd092 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11405)
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:
1fc1020a PR-1049: Add MenuType API
8ae2e3be PR-1055: Expand riptiding API
cac68bfb SPIGOT-7890: AttributeModifier#getUniqueId() doesn't match the UUID passed to its constructor
7004fcf2 SPIGOT-7886: Fix mistake in AttributeModifier UUID shim
1ac7f950 PR-1054: Add FireworkMeta#hasPower
4cfb565f SPIGOT-7873: Add powered state for skulls

CraftBukkit Changes:
bbb30e7a8 SPIGOT-7894: NPE when sending tile entity update
ba21e9472 SPIGOT-7895: PlayerItemBreakEvent not firing
0fb24bbe0 SPIGOT-7875: Fix PlayerItemConsumeEvent cancellation causing client-side desync
815066449 SPIGOT-7891: Can't remove second ingredient of MerchantRecipe
45c206f2c PR-1458: Add MenuType API
19c8ef9ae SPIGOT-7867: Merchant instanceof AbstractVillager always returns false
4e006d28f PR-1468: Expand riptiding API
bd8aded7d Ignore checks in CraftPlayerProfile for ResolvableProfile used in profile components
8679620b5 SPIGOT-7889: Fix tool component deserialisation without speed and/or correct-for-drops
8d5222691 SPIGOT-7882, PR-1467: Fix conversion of name in Profile Component to empty if it is missing
63f91669a SPIGOT-7887: Remove duplicate ProjectileHitEvent for fireballs
7070de8c8 SPIGOT-7878: Server#getLootTable does not return null on invalid loot table
060ee6cae SPIGOT-7876: Can't kick player or disconnect player in PlayerLoginEvent when checking for cookies
7ccb86cc0 PR-1465: Add FireworkMeta#hasPower
804ad6491 SPIGOT-7873: Add powered state for skulls
f9610cdcb Improve minecart movement

Spigot Changes:
a759b629 Rebuild patches

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2024-09-15 21:39:53 +02:00
Nassim Jahnke
2ac5a53f6b Update spark 2024-09-12 19:54:34 +02:00
Jason Penilla
0b7b70d405 Fix PaperServerListPingEvent#getPlayerSample not being populated or used (#11387) 2024-09-10 10:52:30 -07:00
Jake Potrebic
d503cbe01f deprecate isEnabledByFeature in Item/BlockType 2024-09-09 19:19:46 -07:00
Fabrizio La Rosa
5bfe411ab7 Add Decorated Pot Cracked API (#11365) 2024-09-08 22:12:36 +02:00
masmc05
988b902234 Add Item serialization as json api (#11235)
* Item serialization as json

* Add ItemStackAdapter for Gson

* A javadoc note at #serialize() and #deserialize()

* Rebase

* Move serialize closer to deserialize

* Add explaining comment about SERIALIZE_CUSTOM_AS_SNBT usage

* Apply lynxplay requests

* Forgot `@NotNull`

* Very important diff was removed

* Rebase

* Javadocs

---------

Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2024-09-08 22:58:30 +03:00