13
0
geforkt von Mirrors/Paper
Commit graph

3816 Commits

Autor SHA1 Nachricht Datum
CraftBukkit/Spigot
5868631388 Update SQLite for Mac M1 support
By: md_5 <git@md-5.net>
2021-01-02 08:44:43 +11:00
CraftBukkit/Spigot
cf47c45e20 #707, SPIGOT-5063, SPIGOT-5304, SPIGOT-5656, SPIGOT-3206, SPIGOT-5350, SPIGOT-5980, SPIGOT-4672: Persist the exact internal text representation where possible.
Issues resolved by this:
* SPIGOT-5063: Internal text representation of ItemStacks changes during ItemStack serialization. This issue was initially primarily concerned with the conversion between color text attributes to legacy color codes.
* SPIGOT-5304: Internal text representation of ItemStacks changes when opening the inventory (in creative mode). In particularly, this issue is also concerned with the conversion between plain text representations to non-plain ones.
* SPIGOT-5656: Internal text representation of ItemStacks changes during ItemStack serialization. This issue is particularly concerned with reordering of text attributes in the text's Json representation.
* SPIGOT-3206: Internal text representation of book pages changes during ItemStack serialization.
* SPIGOT-5350: Any non-plain text features are stripped from books during ItemStack serialization.
* SPIGOT-5980: Written books are marked as 'resolved' during ItemStack serialization and on various inventory interactions, even though they aren't, and thereby breaking any non-resolved page contents.
* SPIGOT-4672: Since item display names are serialized in their internal Json representation, any translatable components get properly persisted as well now.

---------

Minecraft uses text components to represent text. Internally Minecraft stores these components as Json formatted Strings and dynamically parses the text components from this Json representation whenever required.

In some cases Minecraft will create the text components and then convert them to Json itself for the internal storage. In other cases the Json representation is specified by users (eg. in Minecraft give commands, loot tables, mob equipment specified via Minecraft's summon commands, etc.).
There are many different ways in which the same text components can be represented in Json. When Minecraft compares objects which store this textual information, it takes the exact Json representation into account to determine whether the objects are considered equal. For example, ItemStacks will not match (and therefore not stack) if there is a difference in this internal Json representation for at least one if the item's text attributes (such as display name, lore, book pages, etc.). And when specifying nbt data in command selectors (eg. to only match entities/players which hold an item with specific name), the selector compares the raw Json representation as well.

As long as the Json representation is valid and can be parsed, Minecraft will not modify or normalize it.
However, under various circumstances Spigot converts this text information from the internal Json representation to text components (and in some cases even to plain text with legacy color codes) and then later tries to convert the text from these representations back to text components in the Json representation. Because this backwards conversion is in many cases not able to reproduce the original Json representation, the internal data of some affected Minecraft objects (ItemStacks, TileEntities, Entities, etc.) will in some cases get modified.

One especially notable situation in which this issue can come up is Bukkit's configuration serialization of ItemStacks: When a plugin serializes and later deserializes ItemStacks with display name, localized name, lore, or book pages of signed books, Spigot would convert these textual ItemStack attributes to plain text with legacy color codes and later try to convert those back to chat components in the Json representation. If the reconstructed Json representation does not match the original representation, the deserialized ItemStacks would no longer match nor stack with any original ItemStacks.

This case is particularly common if the original ItemStacks are created by users via some vanilla Minecraft mechanism (eg. Minecraft's give command, loot tables, mob equipment specified via Minecraft's summon command, etc.) and the used internal text representation for the created ItemStacks does not match the text representation produced by Spigot. This is also quite likely to be case, because the internal text representation produced by Spigot can sometimes be slightly verbose and, until recently, contained legacy color codes which cannot be used in Minecraft commands in-game.
However, this issue is not limited to items created by users, but affects items created by Minecraft itself as well.

Other cases in which Spigot itself (without any plugins involved) will convert between these text representations include dragging items around inside the inventory or opening the inventory while in creative mode. In these cases Spigot creates Bukkit representations of the affected items for use in Bukkit events and then, after the events have been handled, converts these Bukkit representations back to Minecraft items. See for example SPIGOT-5656 and SPIGOT-5304.

The idea of these changes is to avoid this back and forth conversion between the internal Json representation and the text component or plain text representations in various situations in which it is not actually required:
* CraftMetaItem stores the raw original Json representation for the display name, localized name, lore and pages of signed books now. As long as no plugin modifies these text attributes via the API, they can be reapplied in their original form to an ItemStack.
* The configuration serialization will serialize the original Json representation for these text attributes now so that it can also be restored during deserialization.
* However, in order to still be able to deserialize previously serialized items, and in order to allow users to specify text in the more simple plain representation in configuration files, we also still accept plain text during deserialization. Our approach is to check if the serialized text contains legacy color codes, in which case we convert it to chat components using our own converter and then to Json. Otherwise we try to parse it via Minecraft's Json parser. If the parsing fails due to the text not being valid Json, we interpret the text as plain text and convert it via our own converter as well.
* Various duplicated code has been removed from CraftMetaBookSigned and instead the base CraftMetaBook class allows sub classes to override the relevant aspects of how pages are parsed, serialized and deserialized.
* The BlockStates for command blocks and signs preemptively retrieved the custom name and sign line components, converted them to plain text and later converted them back to text components when applying the BlockState. We now only perform this conversion if a plugin has explicitly modified these texts.

Other changes:
* Minor: We also retrieve, convert and update a few other BlockState attributes directly from the underlying snapshot and only when requested by plugins now.
* SPIGOT-5980: Written books did not properly persist their 'resolved' attribute, resulting in unresolved book pages not getting resolved.
* There are methods to get and set the resolved value for books. However, these are not yet exposed in Bukkit.
* Minor fix: CraftMetaBook#isBookEmpty did not check some of the book attributes. This is probably a minor issue, but for consistency reasons there are checks for the missing attribute(s) now.

----
Covered cases
---
* By remembering the raw original String data, we can persist the exact text representation (eg. the ordering of elements within the Json text object (SPIGOT-5656), used style of escaping quotes (single quotes, escaped double quotes, etc.), use of plain texts (SPIGOT-5304), used boolean style, modern text component features such as translatable texts (SPIGOT-4672), etc.). All of these differences would otherwise cause the ItemStack to no longer be considered equal to its original.
* An empty String in the serialized config data results in no display name rather than an empty display name, like before. An item with explicitly empty display name (`{display: {Name: '""'}}`) is saved as `'""'` and can also be loaded from that representation again.
* Any plain texts, with or without color codes, which don't parse as Json (eg. `display-name: 'Bla'`) are still getting run through Spigot's text to components converter, like before.
* We can now also persist empty but explicitly present lore (`{display:{Lore:[]}}`). Previously this would get removed when the ItemMeta gets reapplied to the item. And ItemMeta#equals would return true for items with and without this empty lore data, even though Minecraft considers them to be different. For plugins using the API there should be no change: #hasLore still checks whether the lore is both present and not empty, and #getLore returns an empty list instead of null in this case (however, it previously already returned an empty list in this case). And setting the lore to an empty list via #setLore will still result in an item with no lore.
* Similarly, we can also persist explicitly specified but empty lists of book pages now.

----
Cases that are not covered (i.e. which may lead to changes in items), but were already not covered previously:
----
* NBT data for text that is not actually of type String.
* Empty or unexpected entries within the display compound.
* Variations in the NBT data representation in item features other than the above mentioned ones.
* Texts containing color codes. During deserialization these texts get interpreted as plain text and converted to a text component representation. This will break the serialization of any ItemStacks which actually use a text component representation with embedded color codes for some reason. Usually the likelihood for encountering such items in practice would probably be small. However, in the past (pre MC 1.16) Spigot would actually produce such items during ItemStack deserialization or when plugins created ItemStack via the Bukkit API. However, Spigot has changed the text representation it produces in MC 1.16, so any previously created and still existing items with this text representation are already problematic anyways now. See SPIGOT-5964. A fix for this linked issue (eg. the automatic conversion of these items) would probably resolve this deficit here as well.
* Spigot's String to text components converter produces quite verbose components since 1.16. See SPIGOT-5964 as well. However, this applies regardless of the changes of this PR.
* Book ItemStacks with more pages than 100 pages or oversized pages are truncated (like before) and may therefore change.
hange.

By: blablubbabc <lukas@wirsindwir.de>
2021-01-01 08:53:14 +11:00
CraftBukkit/Spigot
9bda60d8b4 SPIGOT-6296: Server crashes when burning something at y-level 0
By: md_5 <git@md-5.net>
2020-12-29 08:45:45 +11:00
CraftBukkit/Spigot
3e80d2e4ec SPIGOT-6273: Expose ItemFrame ItemDropChance through API
By: md_5 <git@md-5.net>
2020-12-28 08:58:39 +11:00
CraftBukkit/Spigot
2eda6f0b01 SPIGOT-6292: LivingEntity.setNoDamageTicks no longer functions
By: md_5 <git@md-5.net>
2020-12-28 08:28:57 +11:00
CraftBukkit/Spigot
59490dfe12 SPIGOT-6289: Fix setting entity equipment
By: md_5 <git@md-5.net>
2020-12-23 07:53:45 +11:00
CraftBukkit/Spigot
9f19f0b9c4 #772: Add API to set equipment silently
By: Parker Hawke <hawkeboyz2@hotmail.com>
2020-12-21 18:30:48 +11:00
CraftBukkit/Spigot
df4db23320 SPIGOT-6256: Add method to check if the entity is in water
By: montlikadani <montlikada@gmail.com>
2020-12-21 18:20:54 +11:00
CraftBukkit/Spigot
04b08cc9de #773: Add method to get max world size
By: pop4959 <pop4959@gmail.com>
2020-12-13 11:30:54 +11:00
CraftBukkit/Spigot
6cfa45934b Increase outdated build delay
By: md_5 <git@md-5.net>
2020-12-03 19:29:47 +11:00
CraftBukkit/Spigot
7e0df16cfe #771: Add clear weather World API
By: Parker Hawke <hawkeboyz2@hotmail.com>
2020-11-26 10:08:19 +11:00
CraftBukkit/Spigot
d9f5dbb3e6 #752: Add the ability to retrieve hit, step, fall, and other sounds from blocks.
By: Martoph <sager1018@gmail.com>
2020-11-26 09:36:57 +11:00
CraftBukkit/Spigot
ec41049c8d #770: Send messages without sender with SYSTEM type again
This was the behaviour before the 1.16 update and made it so that any
 message sent by a plugin was treated as a system message allowing the
 player to disable chat messages while keeping access to commands.

After 1.16 disabling the chat also disabled any plugin output, this
 restores the original behaviour.

By: Phoenix616 <max@themoep.de>
2020-11-19 10:16:26 +11:00
CraftBukkit/Spigot
fa835a16a8 SPIGOT-6244: /spawnpoint ignores angle
By: md_5 <git@md-5.net>
2020-11-18 08:13:56 +11:00
CraftBukkit/Spigot
7dd38ec039 SPIGOT-6242: Fix some file line endings
By: md_5 <git@md-5.net>
2020-11-18 08:13:04 +11:00
CraftBukkit/Spigot
658c0a284a SPIGOT-6186: Canceling a CreatureSpawnEvent​ results in a "Unable to summon entity due to duplicate UUIDs" error
By: md_5 <git@md-5.net>
2020-11-17 13:41:47 +11:00
CraftBukkit/Spigot
889488ff73 SPIGOT-6236: Vehicle passenger portal cooldown does not change
By: md_5 <git@md-5.net>
2020-11-17 12:29:51 +11:00
CraftBukkit/Spigot
d7c19c9eb7 SPIGOT-6240: Use correct portal search radius
By: md_5 <git@md-5.net>
2020-11-13 18:06:34 +11:00
CraftBukkit/Spigot
2dfcf06f4a #769: Fix FishHook.maxWaitTime
By: Airtheon <Airtheonthesalion@gmail.com>
2020-11-09 18:21:10 +11:00
CraftBukkit/Spigot
9616dbb128 #767: Add wait time modification for FishHook
By: Airtheon <Airtheonthesalion@gmail.com>
2020-11-06 18:49:15 +11:00
CraftBukkit/Spigot
f602441c1d SPIGOT-6197: Prevent world loading from updating spawn settings of all worlds
By: Sander Knauff <sanderknauff@hotmail.com>
2020-11-06 18:46:21 +11:00
CraftBukkit/Spigot
7b5ac02c82 SPIGOT-6217: Missed PlayerEditBookEvent when editing books
By: md_5 <git@md-5.net>
2020-11-04 19:45:54 +11:00
CraftBukkit/Spigot
8a6781edb0 SPIGOT-6206: Use correct sender UUID for chat messages
By: Mariell Hoversholm <proximyst@proximyst.com>
2020-11-03 19:02:28 +11:00
CraftBukkit/Spigot
b180ac1eb9 Revert "Downgrade NMS revision"
This reverts commit 97af585bf8.

By: md_5 <git@md-5.net>
2020-11-03 19:02:28 +11:00
CraftBukkit/Spigot
11227b2076 SPIGOT-6205: Rewrite enum to/from NMS type methods
The methods would otherwise cache wrong enum types for specific enums.
This would result in a `ClassCastException` at the caller location,
which obviously is no fun. This broke API with `Switch#getFace` and
`FaceAttachable#getAttachedFace`.

The existing implementation was also stupid.

By: Mariell Hoversholm <proximyst@proximyst.com>
2020-11-03 18:15:08 +11:00
CraftBukkit/Spigot
97af585bf8 Downgrade NMS revision
This is not a precedent, please see https://www.spigotmc.org/wiki/nms/

By: md_5 <git@md-5.net>
2020-11-03 18:15:08 +11:00
CraftBukkit/Spigot
6450eb0ab7 Update to Minecraft 1.16.4
By: md_5 <git@md-5.net>
2020-11-03 07:00:00 +11:00
CraftBukkit/Spigot
964cc7554a Remove outdated build delay.
By: md_5 <git@md-5.net>
2020-10-25 18:10:28 +11:00
CraftBukkit/Spigot
d66dca2a11 #762: Add TNTPrimed#setSource method
By: Jakub Zacek <dawon.cz@gmail.com>
2020-10-25 18:10:08 +11:00
CraftBukkit/Spigot
834e89eca0 SPIGOT-6193: Allow small fireballs to ignite players when MobGriefing is disabled
By: Sander Knauff <sanderknauff@hotmail.com>
2020-10-23 18:29:08 +11:00
CraftBukkit/Spigot
d719a30af5 Rename Chunk "BukkitValues" key to "ChunkBukkitValues"
This will discard extra data increasing the size of the chunk from users affected by the bug in the previous commits.
The impact of this (affecting all users) is likely to be much higher than users with plugins relying on an API introduced within the last 12 hours.

By: md_5 <git@md-5.net>
2020-10-18 07:24:10 +11:00
CraftBukkit/Spigot
0632e375cf SPIGOT-6194: Read correct nbt compound into chunk pdc
Previously spigots chunk pdc loading logic would read the entire chunk
nbt compound into the persistent data container of the chunk instead of
just reading the "BukkitValues".

Furthermore this commit also now correctly checks if the nbt compounds
of entities, tile entities and chunks actually have a value for the
"BukkitValues" key, as the previous 'getCompound' call would always
return an instance, the null check was useless. This commit now uses
'get', which returns null if no key exists and then runs an instanceof
check to both validate a non-null instance and an NBTTagCompound
instance.

By: Bjarne Koll <lynxplay101@gmail.com>
2020-10-18 07:01:15 +11:00
CraftBukkit/Spigot
f93a843c80 Misc maven build updates
By: md_5 <git@md-5.net>
2020-10-17 17:51:10 +11:00
CraftBukkit/Spigot
b643889355 #759: Allow sending messages from specific UUIDs
By: Mariell Hoversholm <proximyst@proximyst.com>
2020-10-17 17:43:03 +11:00
CraftBukkit/Spigot
071360817a #672: Add PersistentDataHolder to Chunk
By: Nesaak <52047222+Nesaak@users.noreply.github.com>
2020-10-17 17:37:49 +11:00
CraftBukkit/Spigot
a3cf5aea1a #758: Item - add getters/setters for owner/thrower
By: Shane Bee <shanebolenback@me.com>
2020-10-14 19:56:14 +11:00
CraftBukkit/Spigot
f265542e4f #757: PoweredMinecart - add getter/setter for fuel
By: Shane Bee <shanebolenback@me.com>
2020-10-13 18:59:56 +11:00
CraftBukkit/Spigot
0410e56149 SPIGOT-6175: Fix generating loot tables for entities
By: md_5 <git@md-5.net>
2020-10-11 10:23:10 +11:00
CraftBukkit/Spigot
5eb09a7d93 SPIGOT-6168: Fix error with Player.getBedSpawnLocation when world is unloaded while server running
By: md_5 <git@md-5.net>
2020-10-06 18:36:43 +11:00
CraftBukkit/Spigot
753bccda7c SPIGOT-6130: Fix API loot table generation with certain contexts
By: md_5 <git@md-5.net>
2020-10-03 10:27:00 +10:00
CraftBukkit/Spigot
e54c8b2f3c SPIGOT-6147: InventoryCloseEvent does not fire after closing player inventory
By: md_5 <git@md-5.net>
2020-10-01 19:07:54 +10:00
CraftBukkit/Spigot
c94a28d0d5 SPIGOT-6152: End exit gates in custom ends do not send back to overworld
By: md_5 <git@md-5.net>
2020-09-30 08:58:36 +10:00
CraftBukkit/Spigot
8bd3d55e00 SPIGOT-6157: Crash when PortalCreateEvent cancelled
By: md_5 <git@md-5.net>
2020-09-29 18:10:57 +10:00
CraftBukkit/Spigot
0920dec75a #755: Fix NPE when calling getInventory() for virtual EnderChests
By: SydMontague <sydmontague@phoenix-staffel.de>
2020-09-27 11:47:50 +10:00
CraftBukkit/Spigot
08721acbaa Increase outdated build delay
By: md_5 <git@md-5.net>
2020-09-25 17:12:30 +10:00
CraftBukkit/Spigot
9bf5c9a30b #754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
The underlying issue is a change by Mojang how UUID are stored in NBT.
This patch will have CraftBukkit convert the format during
deserialization.

By: SydMontague <sydmontague@web.de>
2020-09-25 17:09:59 +10:00
CraftBukkit/Spigot
ec76385d2c #743: LivingEntity - add methods for getting/setting invisibility
By: Shane Bee <shanebolenback@me.com>
2020-09-19 17:44:48 +10:00
CraftBukkit/Spigot
405ea090eb #753: RecipeIterator#hasNext will now accurately represent if the current iterator has a next item.
By: Martoph <sager1018@gmail.com>
2020-09-18 18:43:48 +10:00
CraftBukkit/Spigot
0ba5779850 #746: Add Fluid types / tags
By: Martoph <sager1018@gmail.com>
2020-09-14 19:39:43 +10:00
CraftBukkit/Spigot
3c76d377fa SPIGOT-6063: ConsoleSender sending extra lines in Java 13+
By: md_5 <git@md-5.net>
2020-09-12 09:05:20 +10:00