Commit graph

3130 commits

Author SHA1 Message Date
miclebrick
d1ceb803d3 Add 5 second short dumps to watchdog (#1314) 2018-08-08 15:31:29 -04:00
Aikar
e5929a071e [CI-SKIP] add .editorconfig for base code style settings 2018-08-07 01:13:55 -04:00
Aikar
dad4f590f0 Undo a mistaken chunk registration change - Closes #1302
I misinterpreted some code as a risk of entity loss, but now
after deeper study, I see how that code was used more and why
it was adding entities to chunks that they shouldn't have been
in during a world transfer process.
2018-08-04 12:53:38 -04:00
Aikar
154a6bba21 Fix ItemStack.removeEnchantment returning wrong value 2018-08-04 01:13:10 -04:00
Aikar
7fe1caf23d make dupe uuid saferegen delete range configurable
also ensure we never process already valid entities. this shouldnt be possible as of recent
commits as we made the entity slice array safer, but doesn't hurt for this logic to be safe too
incase that patch got dropped in a future version by accident/necessarily
2018-08-04 00:23:00 -04:00
Aikar
d59b727a40 Entity add to world fixes - #1223
1) Chunk Registration might kill an entity, don't add it to the world if it did!

2) By default, entities are added to the world per slice iteration.
This opens risk of the slices being manipulated during chunk add if an
EntityAddToWorldEvent spawns an entity into this chunk.
Fix this by differing entity add to world for all entities at the same time

3) If a duplicate entity is attempted to add to the world of an entity, and
the original entity is dead, overwrite it as the logic does for unloaod queued entities.

Should hopefully finish up issues with #1223
2018-08-03 23:02:44 -04:00
Aikar
a75c747cd7 Fix logic bug in negative XP bug fix - Closes #1169 2018-08-03 20:59:35 -04:00
Mark Vainomaa
6116576bf3 Fix "MC-135506: Experience should save as Integers" still saving as short" (#1301) 2018-08-03 16:25:21 +03:00
Aikar
9dde9d710e fix missing | on dupe uuid patch 2018-08-03 08:51:04 -04:00
Aikar
a72b697cbb fix missed break statement and enum check on dupe uuid resolve 2018-08-03 01:32:00 -04:00
Aikar
3522a633d6 MC-135506: Experience should save as Integers
A large orb will lose its EXP value if it went over 32k due to short truncation.
2018-08-03 00:07:02 -04:00
Aikar
712ded51a2 Fix EXP orb merging causing values to go negative - Closes #1169 2018-08-03 00:06:20 -04:00
Aikar
4128c348c2 Add "Safe Regen" Duplicate UUID resolver and make default
After witnessing behavior of the regeneration logs, its clear that Vanilla
has had bugs with saving duplicate entities for a while....

Some entities are saved in multiple chunks, and now we are bringing those duplicates
out that use to never surface.

This mode will analyze if the entity appears to be a duplicate (near the other dupe uuid)
and delete the entity instead.

This should reduce regenerations to entities that are nowhere near each other, and
therefore more likely to be subject to real UUID collisions due to our
previous bug, and therefor should survive the chunk load.
2018-08-02 23:06:03 -04:00
Zach Brown
8930ecd00e [CI-SKIP] Add paper comment to last patch edit 2018-07-31 16:41:33 -05:00
Zach Brown
cc597bfd1d Ensure players are not marked to be removed after re-add 2018-07-31 16:39:15 -05:00
Shane Freeder
d72dce83ad Break up and make tab spam limits configurable
Due to the changes in 1.13, clients will send a tab completion request
for all bukkit commands in order to factor in the lack of support for
brigadier and provide backwards support in the API.

Craftbukkit, however; has moved the chat spam limiter to also interact
with the tab completion request, which while good for avoiding abuse,
causes 1.13 clients to easilly be kicked from a server in bukkit due
to this. Removing the spam limit could cause issues for servers, however,
there is no way for servers to manipulate this without blindly cancelling
kick events, which only causes additional complications. This also causes
issues in that the tab spam limit and chat share the same field but different
limits, meaning that a player having typed a long command may be kicked from
the server.

Splitting the field up and making it configurable allows for server owners
to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.

This patch has been applied to 1.12.2 in order to allow people using
plugins which allow clients of newer versions to connect, this is
not a common practice, however is being done as a level of nicety
given the current status of 1.13
2018-07-31 13:53:49 +01:00
Aikar
f036462d5b PlayerProfile.complete shouldn't throw NPE
We have a result boolean for this already, and this
method was meant to be "Try from cache, if that fails, look it up"

So NPE'ing there just wasn't correct.
2018-07-31 01:37:41 -04:00
Aikar
15735117d7 Properly forward exit 1 code from the paper root command
This is so the CI server can pick up when applying patches fails,
and mark the build as a failure.
2018-07-30 17:37:24 -04:00
Aikar
2b23006694 clear current chunk and entity slice on chunk unload
ideally this should of never mattered, as it will only
be hit if you teleport out of an unloaded chunk...

But apparently some people are triggering this.

See #1223
2018-07-30 00:51:58 -04:00
Aikar
4bd8975ab6 MC-111480: Start Entity ID's at 1 - Closes #1287
DataWatchers that store Entity ID's treat 0 as special,
and can break things such as Elytra Fireworks.
2018-07-29 23:00:00 -04:00
Aikar
cf817bd292 Always process chunk registration after moving
This will help guarantee that entities are always in the
chunk that they are currently located at.

Should hopefully also fix Citizens triggering the "Saved to wrong chunk" message
2018-07-29 12:10:20 -04:00
Aikar
24f2a7f9f6 Always move Entity to its new Chunk even if unloaded
Vanilla logic here would allow us to remvoe an entity from
its current chunk, and if it was going to move into an unloaded
chunk, that entity would not be added to the unloaded chunk.

This is bad because this will result in the entity being lost!

In almost all cases, the chunk will be loaded, but in the event
it wasn't, instead of losing the entity, load the chunk to add
the entity to it.
2018-07-29 12:06:35 -04:00
Aikar
372d9c2d4a If Entity is added to chunk, look up the chunk if current isnt set
Hopefully will (f)ix #1280...

I'm suspicious that Citizens isn't calling things in the same order and causes the current
chunk to not be set, which then bugs removals. Though this doesn't make any sense to me,
so this likely won't fix it...

But if the isAddedToChunk is true, we really should be returning a chunk anyways if its loaded.
2018-07-29 12:04:09 -04:00
Aikar
189b80e425 Ignore Dead Entities in entityList iteration
A spigot change delays removal of entities from the entity list.
This causes a change in behavior from Vanilla where getEntities type
methods will return dead entities that they shouldn't otherwise be doing.

This will ensure that dead entities are skipped from iteration since
they shouldn't of been in the list in the first place.
2018-07-28 12:26:36 -04:00
Aikar
f94330b3e4 Always process chunk removal in removeEntity
Spigot might skip chunk registration changes in removeEntity
which can keep them in the chunk when they shouldnt be if done
during entity ticking.

Should fix some cases where "Entity is still in another chunk section"
Related to #1223
2018-07-28 12:13:52 -04:00
Aikar
6cd0bd29ab Fix Dupe UUID logic triggering when the duplicate is pending unload
Vanilla logic checks unload queue and overwrites if its in it.
we're triggering this if a chunk unloads, and reloads immediately in same tick.

Added check for unload queue to not treat as duplicate

Also fixed the config setting not even loading
2018-07-28 01:20:06 -04:00
Aikar
3c8a4cb1bb Relookup Entity Save ID if was null during precache
Should fix #1280

Citizens hijacks entity map, and im guessing under the right conditions
the result might actually be null during entity creation

Pre the cache patch, the id is looked up on save, so it was fine.

Now, if its null and the save ID is requested, we will try to look
it up again and cache it if found.
2018-07-26 23:57:31 -04:00
Aikar
119ae29b37 Prevent Saving Bad entities to chunks
See https://github.com/PaperMC/Paper/issues/1223

Should fix Vanilla bugs

Minecraft is saving invalid entities to the chunk files.

Avoid saving bad data, and also make improvements to handle
loading these chunks. Any invalid entity will be instant killed,
so lets avoid adding it to the world...

This lets us be safer about the dupe UUID resolver too, as now
we can ignore instant killed entities and avoid risk of duplicating
an invalid entity.

This should reduce log occurrences of dupe uuid messages.

Also reduce the logging spam overall.
2018-07-26 00:51:20 -04:00
Max Lee
dccf0f6a08 Apply spawner delay for cancelled pre spawn events (#1276)
Setting the flag updates the spawner's delay which stops the spawner from trying to find a new spawn position each tick efter the event was cancelled/aborted which makes it usable for mob stackers/mergers and other plugins that don't actually want any mob to spawn in the spawner cycle but keep the overall behaviour close to vanilla.

This might slightly effect existing plugins that use this event but I doubt anyone really relied on this behaviour, the only possible use case that I can think of is cancelling the event until you find a suitable position in your plugin... and this should be handled by the plugin itself by cancelling and spawning at the position manually.
2018-07-25 23:19:51 +01:00
Aikar
3aa400a7ca Expand Location Manipulation API - Closes #1265
Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z);
2018-07-25 01:38:37 -04:00
Aikar
782c68dad7 Add some debug for entity slices
If we find any entity in an unexpected state, log it so we can discover
what potentially put it in that state to relate to issue #1223
2018-07-23 22:55:27 -04:00
Aikar
f41ff893dd Mark chunk dirty on entity changes
This is to hopefully help avoid any chunk saving entity issues.
Marks the chunk that it NEEDS to be saved, ensuring the latest state gets saved.
2018-07-23 22:54:52 -04:00
Aikar
3b12d748b4 Reduce and improve dupe uuid resolve message 2018-07-23 22:50:56 -04:00
Aikar
64077154ff Add more entity debug info 2018-07-23 22:50:47 -04:00
Aikar
be34f22bf9 Bring some 1.13 authors to master 2018-07-23 21:09:25 -04:00
Aikar
1eee376989 Merge pull request #1250
Cleaned up some implementation notes to use existing Vanilla method for some things.
merged into parent patch

9526c764 Fixed more stuff (NickAcPT)
8672424c Remove unsed method (NickAcPT)
a7f45fb1 Extend player profile API to support skin changes (NickAcPT)
4cccd48a Extend player profile API to support skin changes (NickAcPT)

* pull/1250/head:
  Fixed more stuff
  Remove unsed method
  Extend player profile API to support skin changes
  Extend player profile API to support skin changes
2018-07-23 20:31:33 -04:00
Aikar
51f03d3579 Duplicate UUID Resolve Option
Due to a bug in bd75ff8b5b
which was added all the way back in March of 2016, it was unknown (potentially not at the time)
that an entity might actually change the seed of the random object.

At some point, EntitySquid did start setting the seed. Due to this shared random, this caused
every entity to use a Random object with a predictable seed.

This has caused entities to potentially generate with the same UUID....

Over the years, servers have had entities disappear, but no sign of trouble
because CraftBukkit removed the log lines indicating that something was wrong.

We have fixed the root issue causing duplicate UUID's, however we now have chunk
files full of entities that have the same UUID as another entity!

When these chunks load, the 2nd entity will not be added to the world correctly.

If that chunk loads in a different order in the future, then it will reverse and the
missing one is now the one added to the world and not the other. This results in very
inconsistent entity behavior.

This change allows you to recover any duplicate entity by generating a new UUID for it.
This also lets you delete them instead if you don't want to risk having new entities added to
the world that you previously did not see.

But for those who are ok with leaving this inconsistent behavior, you may use WARN or NOTHING options.

It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
2018-07-21 14:47:05 -04:00
Aikar
1b8cee45a0 Add more information to Entity.toString 2018-07-21 14:46:56 -04:00
NickAcPT
9526c76438 Fixed more stuff 2018-07-21 18:17:54 +01:00
Aikar
d291411d94 change LAST_EDIT to PAPER_LAST_EDIT for edit commands
LAST_EDIT is way too generic considering it pollutes the users global environment....
2018-07-21 12:07:33 -04:00
NickAcPT
8672424ca1 Remove unsed method 2018-07-21 16:54:52 +01:00
NickAcPT
a7f45fb1b4 Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
2018-07-21 16:22:10 +01:00
Aikar
f8af5faa43 Add more information to Entity.toString() 2018-07-21 10:29:37 -04:00
Aikar
19cec88852 Add Debug Entities option to debug dupe uuid issues
Add -Ddebug.entities=true to your JVM flags to enable more logging
2018-07-21 10:29:14 -04:00
Aikar
33cf273156 Guard the Entity.SHARED_RANDOM from seed changes
I don't clearly see any, but as a protection for future changes.
2018-07-21 09:03:10 -04:00
Aikar
185b6b4c59 Create a symlink on not-windows to current minecraft decompile dir
This is useful for project developers switching back and forth between
1.12.2 and 1.13 so we can have our IDE automatically use the
current version we are working on for included mc-dev files.
2018-07-21 08:09:40 -04:00
NickAcPT
4cccd48a4c Extend player profile API to support skin changes
Added code that refreshes the player's skin by sending packets with a special order, telling the client to respawn the player and re-apply the game profile
2018-07-21 12:58:48 +01:00
Minecrell
4e5ac2a052 Rebuild patch numbers 2018-07-20 14:06:39 -05:00
Minecrell
593e81812a Update to TerminalConsoleAppender 1.1.1 (#1240)
See https://github.com/Minecrell/TerminalConsoleAppender/releases/tag/1.1.1
2018-07-20 21:04:11 +02:00
Hugo Manrique
b90705d2ad Avoid item merge if stack size above max stack size (#1217) 2018-07-19 17:51:55 +02:00