The exit location passed to PlayerTeleportEvent/PlayerTeleportEndGatewayEvent in ServerPlayer#teleport(TeleportTransition) needs to be cloned, as it is later compared in case it was changed. Not cloning it results in the ability for plugins to mutate it but such changes will be ignored, as the instance of the Location being the same results in a successful equality check.
It is not necessary to clone the location in other instantiations of the event (or subclasses) as those are not compared afterwards to change the outcome.
The recent commit 121a7bf4eb added
the interface FeatureElement to the GameRules.Type class to expose the
stored feature flags of gamerules.
This however messed with the reobf mappings spigot uses, as the now
overridden method requiredFeatures needs to be mapped to the same
obfuscated name as FeatureElement#requiredFeatures.
To avoid having this in the mappings patch, the commit removes the
inheritance again and instead exposes a wrapper method.
Ports the follow commits from spigot to paper.
All credits to go the respective commit authors listed below.
Bukkit: 47480cd07c0957a94b220f3087b851594b063e54
CraftBukkit: c6c8165aa0d5679b9b015b209c1645a222f8c3a6
CraftBukkit: d275d3b96e041f6421f3bb7de1e6022ea8be5456
By: md_5 <git@md-5.net>
By: Doc <nachito94@msn.com>
Mojangs EQUIPMENT_SLOT_MAPPING uses an Int2ObjectArrayMap and hence
technically does provide iteration stability, however it is filled from
a MapN, which destroys the well order of the entries.
To iterate from smallest to largest inventory index correctly, this
commit introduces a sorted array based on the EQUIPMENT_SLOT_MAPPING.
* Update adventure to 4.19.0
The update only includes a new configuration for MiniMessage,
specifically one to prevent it from emitting virtual components.
As virtual components break the generated component tree, items quickly
become unstackable with items generated before adventure 4.18.
Plugin developers may construct their own mini message instance which
will emit virtual components if they so choose.
* Bump to adventure 4.20.0
* Add QOL open method to InventoryView
* Check to ensure the opening isn't a InventoryMenu, allow HorseMenus
* Fix instanceof against API instaed of AbstractContainerMenu
* [ci skip] Remove suggested comment
* Refine recipe management API documentation.
Improve Javadoc clarity for recipe addition methods, specifying client update behavior and stability considerations. Adjust formatting for better readability and consistency.
* Fix typo in original javadoc
---------
Co-authored-by: david <mrminecraft00@gmail.com>
* CraftServerTickManager - silence feedback when sprinting
* CraftServerTickManager - forgot secondary note
* ServerTickRateManager - only set to silent if not already sprinting
Set the old pos/rot to be the same as the current pos/rot for new
entities as the default value for the old pos/rot is zero.
Fixes https://github.com/PaperMC/Folia/issues/302
This reverts commit ab984a0711.
The block damage is null *and has been* null in cases where the block
has already been cleared. Consumers are supposed to use the
getDamagerBlockState instead.
Always passes the respective block to a damage source when passing a
block state. While we could technically use the damageSourcePosition
here by, we'd have to translate it back to a block position by
subtracting .5 from all its components.
Such behaviour however relies on the caller logic's mutation of the
damageSourcePosition and will break once this position is not the centre
of the block.
Passing in the block at the specific callsite is a lot more future
proof.
While the running server will still be using the recently introduced
copy-mechanic for vanilla command namespacing, the data converter logic
relies on the fact that namespaced aliases were redirects as well.
To not break the converted, the commands type now takes a modern flag
only set by the running server.
While the paper command system no longer uses redirects for namespaced
registration, vanilla still does. This means that removal of vanilla
redirecting target nodes still causes issues, e.g. the removal of the
vanilla 'msg' node in favour of a command alias one.
Redirecting nodes like tell, minecraft:msg and minecraft:tell are broken
by this and need to by flattened before sending them to the client.
* Mention missing impl
* Clean the implementation out of years old code
* Change the jd comment
* Move to default method
---------
Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
Marked ItemStack parameter as `@Nullable` to explicitly indicate it can be null. This improves clarity, avoids nullability problems, and aligns with the method's documented behavior for handling null values.
Clarify that disabling auto-save does not stop all saving operations. This addition explicitly mentions that the world will still save on shutdown and explains the intended purpose of the method.
Player info packets carry chat state to other clients since the
introduction of chat signatures. Queuing these packets while force
pushing chat packets allows for potentially inverted packet order, which
may cause chain corruption on clients.
Fixes compilation issues for plugins from recent API addition with double-annotated parameter (JetBrains annotations are type-use and parameter, so nonnull array of nonnull elements ends up with duplicates)
If the player is not affected by movement through blocks, then
storing the movement would eventually invoke logic to apply effects
caused by moving through such blocks. For example, moving through
a portal in spectator mode and then later switching to creative mode
would portal the player.
This allows plugins to access chunks slightly outside of the
max world border (such as ones which may be loaded naturally
by players) without tripping any logs.
This method was used pre 1.17 era where an Entity was explicitly
tied to a (then called) Chunk's entity slices. If an entity
was not inside a Chunk, then it was considered invalid as
it was not possible to save the entity.
In 1.17+, entities are now tied to a separately tracked entity
section management system. This system is far more reliable now
as it no longer requires a full chunk load to properly track
entities for saving. As a result, an Entity if inside the world
is always attached to some entity chunk section (except in rare
cases in Vanilla which are fixed in Moonrise).
As a result, whether the chunk the entity is in is loaded is no
longer an indication of whether they are tracked in the world
and we can reliably infer that the entity is correctly in the
world through the valid field alone.
Additionally drop the isInWorld() check, as valid=true implies
isInWorld=true. More importantly, the isInWorld() check invokes
getHandle which may trip a thread check on Folia. This will fix
World#getEntities() and friends exploding on Folia.
However, World#getEntities() on Folia still cannot reliably return
all entities in the world as actions such as cross-region
(not cross-world) teleporting will remove entities from the world.
This allows the watchdog thread to be seen as the
primary thread during shutdown, which prevents it
from tripping thread checks in various areas.
Fixes https://github.com/PaperMC/Paper/issues/12030
The windows file system does not write metadata unless
the FileChannel is explicitly flushed with metaData=true.
Note: Setting SYNC (not DSYNC) on the FileChannel does not appear
to write the metadata.
Specifically, we are interested in writing the last modified
timestamp so that fs watchers can detect when RegionFiles are
modified.
Enchantment shouldn't support direct holders despite the ctor
accepting a Holder type. We want to limit the types
to ones that are actually used as direct holders in the game
Bukkits entity remove event is called at a different time than the
existing paper event, specifically it is called after an entity has been
stored during chunk unloads.
This means that, while the bukkit event can have a defined reason, it
does not allow modification to the entity data. In this regard it
differs from the paper implementation and prevents developers from using
the paper event as an alternative.
Co-authored-by: TonytheMacaroni <tonythemacaroni123@gmail.com>
This diff was accidentally dropped when updating to hard fork.
This diff importantly:
- Does not return true if the async catcher is disabled
- Does not return true during shutdown
- Returns true for any instance of TickThread (enables
watchdog and Folia threads to be considered main)
Reimplementation of the itemstack obfuscation config that
leverages the component patch map codec to drop
unwanted components on items or replaces them with
sanitized versions.
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>