Commit Graph

1466 Commits

Author SHA1 Message Date
Aikar
fc99b0dc70 Merge branch 'master' into pre/1.13
* master:
  make dupe uuid saferegen delete range configurable
  Entity add to world fixes - #1223
2018-08-04 00:33:21 -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
f09645d934 Merge branch 'master' into pre/1.13
* master:
  Fix logic bug in negative XP bug fix - Closes #1169
2018-08-03 21:20:57 -04:00
Aikar
a75c747cd7 Fix logic bug in negative XP bug fix - Closes #1169 2018-08-03 20:59:35 -04:00
Aikar
5148f6bae0 Merge branch 'master' into pre/1.13
* master:
  Fix "MC-135506: Experience should save as Integers" still saving as short" (#1301)
2018-08-03 09:26:56 -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
19073d84a4 fix missing | on dupe uuid patch 2018-08-03 08:51:04 -04:00
Aikar
9dde9d710e fix missing | on dupe uuid patch 2018-08-03 08:51:04 -04:00
Zach Brown
d691bec84f Use correct update flag and blockdata for portals
Fixes GH-1286
2018-08-03 03:26:10 -05:00
Aikar
919b04c7b8 Merge branch 'master' into pre/1.13
* master:
  fix missed break statement and enum check on dupe uuid resolve
2018-08-03 01:33:34 -04:00
Aikar
a72b697cbb fix missed break statement and enum check on dupe uuid resolve 2018-08-03 01:32:00 -04:00
Aikar
c4fd14d690 Merge branch 'master' into pre/1.13
* master:
  MC-135506: Experience should save as Integers
  Fix EXP orb merging causing values to go negative - Closes #1169
  Add "Safe Regen" Duplicate UUID resolver and make default
2018-08-03 01:29:20 -04:00
Aikar
e966ee5aef Upstream update 2018-08-03 01:04:28 -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
631614f5bd Update upstream B/CB 2018-08-02 18:29:34 -05:00
Aikar
66db17bdd4 Update upstream 2018-08-01 22:49:47 -04:00
Zach Brown
5d5faf3cc6 Make portal teleportation adjustment math more accurate
Fixes GH-1295

Non-standard sized portals exacerbate a flaw in the vanilla
portal teleportation adjustment logic.
As a result, an entity can end up slightly inside of the surrounding
portal blocks. In vanilla, this issue is minor and you are adjusted out
as if it never happened. In CraftBukkit and derivatives, the
anti-suffocation behavior activates and players end up teleported on top
of their portals.

This improves the offset so as to keep the issue from ever occurring in
the first place.

Special thanks to CarpetMod who appears to have had this fixed for some
time, and has licensed their code such that we can use it as needed.
2018-07-31 20:13:40 -05:00
Zach Brown
fdb8141a2b Add decompile fix for ChunkSection 2018-07-31 16:55:57 -05:00
Zach Brown
f17ce0acb2 Merge branch 'master' into pre/1.13 2018-07-31 16:44:46 -05: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
Zach Brown
1e737abf13 Re-add GH-1286 fix for portals
Accidentally removed in 897d804c62

Also added to End Portals
2018-07-31 15:16:12 -05:00
Shane Freeder
87cbe8e40c Fixup keepalive logic (closes #1274) 2018-07-31 16:39:08 +01:00
Shane Freeder
6de5639fe3 Fix misapplied line in keepalive changes 2018-07-31 15:19:18 +01:00
Shane Freeder
897d804c62 Cleanup PortalCreateEvent patch 2018-07-31 15:14:54 +01:00
Shane Freeder
a8c3640efd Merge branch 'fix-portal-create-event' of https://github.com/prplz/Paper into pre/1.13 2018-07-31 15:07:41 +01:00
Shane Freeder
09b6ad6501 Merge branch 'master' into pre/1.13 2018-07-31 14:50:40 +01:00
Michael Himing
9608bdb825 Fix nether portals (#1286) 2018-07-31 23:33:30 +10: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
429c317232 Merge pull request #1214
55d5aef0 Add TNTPrimeEvent (Mark Vainomaa)

* pull/1214/head:
  Add TNTPrimeEvent
2018-07-31 01:49:40 -04:00
Aikar
1e848fb0ed Merge branch 'master' into pre/1.13
* master:
  PlayerProfile.complete shouldn't throw NPE
2018-07-31 01:44:11 -04: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
willies952002
4d30046dbf World EntityHuman Lookup Optimizations (#1291)
Fixes #1290
2018-07-31 00:27:45 -04:00
Zach Brown
452f012665 Update upstream B/CB 2018-07-30 20:19:41 -05:00
Zach Brown
5368b241ab Fix i18n String API
In 1.13 the method previously used now returns translatable keys.
`block.minecraft.cobblestone` instead of `Cobblestone`

We just need to make sure we're translating those keys.
2018-07-30 16:07:36 -05:00
Aikar
720dabd2aa Update Upstream
Removed my ChunkLoadEvent patch as upstream fixed it
2018-07-30 01:08:59 -04:00
Aikar
5fe01c2659 Merge branch 'master' into pre/1.13
* master:
  clear current chunk and entity slice on chunk unload
2018-07-30 01:06:39 -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
ef22f9d531 Merge pull request #1244
07cf46c4 Rebuild Patches (BillyGalbreath)
9362271f AnvilDamageEvent (BillyGalbreath)

* pull/1244/head:
  Rebuild Patches
  AnvilDamageEvent
2018-07-30 00:12:03 -04:00
Anthony MacAllister
366c974474 EntityTransformedEvent (#1281) 2018-07-29 23:54:13 -04:00
willies952002
b6ba2877b7 Expand ArmorStand API (#1277)
Add the following:
- Add proper methods for getting and setting items in both hands. Deprecates old methods
- Enable/Disable slot interactions
2018-07-29 23:53:59 -04:00
Aikar
924a15f961 Fix last patch for 1.13, pulled the push button too quickly... 2018-07-29 23:05:35 -04:00
Aikar
ddd23165a6 Merge branch 'master' into pre/1.13
* master:
  MC-111480: Start Entity ID's at 1 - Closes #1287
2018-07-29 23:00:41 -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
20bf0ed9ea Update upstream 2018-07-29 22:16:15 -04:00
Aikar
430513974f Fix bug with entities not being added from loaded chunks
No entities were lost in this bug, just we were triggering the add entities
before they were loaded due to an inconsistent order of putting chunk into chunkmap.

Any entity that appeared to be gone on the last build will now be back.
2018-07-29 21:53:02 -04:00
Aikar
1c52c3a29c [EXPERIMENTAL] Provide option to use a versioned world folder for testing
This should not ever be used in production!!

This setting is intended for testing so you can try out converting your world
without actually modifying the world files.

This will add some additional overhead to your world, but you're
just testing anyways so that's not a big deal :)

Will store in a folder named after the current version.

PlayerData and Data folders are copied on server start, so there
may be some delay there, but region files are only copied on demand.

This is highly experiemental so backup your world before relying on this to not modify it
2018-07-29 17:05:50 -04:00
Aikar
18944d81ff Process Chunk.addEntities before chunkLoadEvent
1.13 undesirably changed behavior here that chunk load event fired
before the entities were added to the world.

This means any plugin that spawns entities in chunk load event
causes the entities to be registered to the chunk, and then
added to the world twice.

Moves Entity Add to World to be done anytime a chunk is
registered to the Chunk Map, and ignore other calls.

Fixes #1288
2018-07-29 17:05:24 -04:00
Aikar
82500a59f0 Merge branch 'master' into pre/1.13
* master:
  Always process chunk registration after moving
  Always move Entity to its new Chunk even if unloaded
  If Entity is added to chunk, look up the chunk if current isnt set
  Ignore Dead Entities in entityList iteration
  Always process chunk removal in removeEntity
2018-07-29 13:12:39 -04:00
Aikar
c33b679642 update upstream 2018-07-29 12:42:07 -04:00
Hugo Manrique
3cce0c9f1b Optimize hasItemMeta (remove getItemMeta call) (#1279)
Spigot 1.13 checks if any field (which are manually copied from the ItemStack's "tag" NBT tag) on the ItemMeta class of an ItemStack is set.

We could just check if the "tag" NBT tag is empty, albeit that would break some plugins. The only general tag added on 1.13 is "Damage", and we can just check if the "tag" NBT tag contains any other tag that's not "Damage" (https://minecraft.gamepedia.com/Player.dat_format#Item_structure) making the `hasItemStack` method behave as before.

Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. (I also added some extra tests).

`hasItemMeta()` will return true if `ItemStack.getDamage() != 0` or it has the `Damage` tag or any other tag is set.

Closes #1222
2018-07-29 18:30:01 +02: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
BillyGalbreath
07cf46c4e3 Rebuild Patches 2018-07-28 22:15:52 -05:00
BillyGalbreath
3eb423d212 Merge branch 'pre/1.13' of https://github.com/PaperMC/Paper into AnvilDamageEvent 2018-07-28 22:02:56 -05: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
BillyGalbreath
28d01d85cc 1.13: EnderDragon Events (#1247)
Replaces PR #1185 for 1.13

Add some new cancellable enderdragon events dealing with its fireball shooting and the areaeffectcloud it spawns. Based on [talking with someone with a specific use-case](https://www.spigotmc.org/threads/cancel-projectilehitevent.326466/) this was [confirmed to work](http://i.imgur.com/ezlfpKC.png) for them in PM.
2018-07-28 01:03:10 -05:00
Aikar
1ac925f0e0 Merge branch 'master' into pre/1.13
* master:
  Fix Dupe UUID logic triggering when the duplicate is pending unload
2018-07-28 01:59:20 -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
Shane Freeder
5abfd8100e Update CB/S 2018-07-28 03:38:13 +01:00
Aikar
817b9934c7 Merge branch 'master' into pre/1.13
* master:
  Relookup Entity Save ID if was null during precache
2018-07-27 00:44:53 -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
Shane Freeder
9629d65220 Fix EntityDismountEvent changes
While upstream has now made this event cancellable, their changes
result in the vechicle being removed before the event is called,
thus leading cancellation to not behave as expected.
2018-07-26 18:41:00 +01:00
Shane Freeder
ff4fc52552 Update B/CB/S 2018-07-26 16:20:37 +01:00
Aikar
42e1254bbe Merge branch 'master' into pre/1.13
* master:
  Prevent Saving Bad entities to chunks
2018-07-26 00:57:16 -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
Zach Brown
0b2b5ecc33 Remove deprecated AuthLib API from Paper-API
Use the PlayerProfile API as a replacement
2018-07-25 21:49:43 -05:00
Aikar
7a058415e5 Merge pull request #1256
adbb709f Fix decompile error (Hugo Manrique)
f2fe0329 Re-add Vanished players don't have rights patch (Hugo Manrique)

* pull/1256/head:
  Fix decompile error
  Re-add Vanished players don't have rights patch
2018-07-25 19:41:35 -04:00
Aikar
5d33e18bf8 Merge branch 'master' into pre/1.13
* master:
  Apply spawner delay for cancelled pre spawn events (#1276)
2018-07-25 19:07:56 -04:00
Aikar
8536a71daa Update upstream 2018-07-25 19:05:07 -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
Shane Freeder
10ed7dc6b4 Explictly reset chat format in vanilla scoreboard display (fixes #1263)
Vanilla now uses chat components for scoreboards, thus no longer
returns a string which also resets the chat the chat format, add
this back ourselves.
2018-07-25 09:58:03 +01:00
Aikar
34a60bdae9 Fix RCON Ip Defaulting to wrong value - Closes #1267 2018-07-25 01:24:28 -04:00
Aikar
5992b9f2ad Update upstream and remove hopper patch for #1270 2018-07-25 01:11:08 -04:00
Brokkonaut
875c84df6f Fix broken block iteration (#1269)
Fixes https://github.com/PaperMC/Paper/issues/1259 and generation of the end pillars
2018-07-25 03:39:30 +02:00
Aikar
af10851ed2 restore uuid to Entity.toString 2018-07-24 00:48:07 -04:00
Aikar
a78fe918bf Optimize Region File Cache
CraftBukkit added synchronization to read and write methods. This adds
much more contention on this object for accessing region files, as
the entire read and write of NBT data is now a blocking operation.

This causes issues when something then simply needs to check if a chunk exists
on the main thread, causing a block...

However, this synchronization was unnecessary, because there is already
enough synchronization done to keep things safe

1) Obtaining a Region File: Those methods are still static synchronized.
   Meaning we can safely obtain a Region File concurrently.

2) RegionFile data access: Methods reading and manipulating data from
   a region file are also marked synchronized, ensuring that no 2 processes
   are reading or writing data at the same time.

3) Checking a region file for chunkExists: getOffset is also synchronized
   ensuring that even if a chunk is currently being written, it will be safe.

By removing these synchronizations, we reduce the locking to only
when data is being write or read.

GZIP compression and NBT Buffer creation will no longer be part of the
synchronized context, reducing lock times.

Ultimately: This brings us back to Vanilla, which has had no indication of region file loss.

Closes #1260
2018-07-23 23:50:09 -04:00
Aikar
533770f772 Merge branch 'master' into pre/1.13
* master:
  Add some debug for entity slices
  Mark chunk dirty on entity changes
  Reduce and improve dupe uuid resolve message
  Add more entity debug info
  Bring some 1.13 authors to master
  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 23:20:41 -04:00
Aikar
6ee16a913b Update upstream 2018-07-23 23:00:57 -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
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
af3bd62f9e Merge pull request #1248
1cff9820 PlayerElytraBoostEvent (BillyGalbreath)

* pull/1248/head:
  PlayerElytraBoostEvent

Also merged paper config into parent
2018-07-23 20:24:44 -04:00
Aikar
1ec5f04a0e Merge pull request #1254
d6bfa1a0 Re-add Option to prevent armor stands from doing entity lookups (Hugo Manrique)

* pull/1254/head:
  Re-add Option to prevent armor stands from doing entity lookups
2018-07-23 20:21:28 -04:00
Aikar
8e2ae7eb37 Merge pull request #1257
5e14f241 Put the decompile fixes into MC Dev Fixes patch (Andrew Steinborn)
9399a74c Optimize RegistryID.c() (Andrew Steinborn)

* pull/1257/head:
  Put the decompile fixes into MC Dev Fixes patch
  Optimize RegistryID.c()
2018-07-23 20:15:56 -04:00
Aikar
f3a76d261a Fix a concurrency issue with chunk scheduler
It's possible we won't hit this on the servers current state since nothing is async,
but we are working towards that.

I experienced a crash due to this code during my work.
2018-07-23 19:41:41 -04:00
Aikar
7349a434ad Fix memory leak in proto chunk change 2018-07-23 19:41:29 -04:00
Aikar
77c51f1785 Update upstream 2018-07-23 18:57:54 -04:00
Shane Freeder
ceedd8c4f1 Update S
Also drop a few patches which are no longer needed/already merged in.
2018-07-23 18:21:07 +01:00
Andrew Steinborn
5e14f2410c Put the decompile fixes into MC Dev Fixes patch 2018-07-23 13:10:06 -04:00
Andrew Steinborn
9399a74c2a Optimize RegistryID.c()
Fixes #1253
2018-07-23 12:58:01 -04:00
Hugo Manrique
adbb709ff5 Fix decompile error 2018-07-23 16:57:21 +02:00
Hugo Manrique
f2fe0329c1 Re-add Vanished players don't have rights patch 2018-07-23 14:31:18 +02:00
Hugo Manrique
d6bfa1a05c Re-add Option to prevent armor stands from doing entity lookups
Remove old patch
2018-07-23 13:08:02 +02:00
Shane Freeder
fea7cd7e3c Avoid ArithmeticException should server be stopped before worlds are loaded
Our changes for the spawn radius have the potential to throw an ArithmeticException
should the server be stopped before we've loaded worlds, we check if the server is
running earlier to check if we should even consider attempting to load chunks, which
would cause us to, 1) not load chunks anyways, as we're disabled; 2) throw an
ArithmeticException due to us expecting that we're going to be loading more than 0 chunks.
2018-07-23 10:24:51 +01:00
Shane Freeder
0c14fc6ee6 Update B/CB/S 2018-07-23 09:39:55 +01:00
Aikar
68c928477c Remove debug that got left in proto chunk change last build 2018-07-22 22:33:43 -04:00
Aikar
fa09f31f10 Don't save Proto Chunks
These chunks are unfinished, and waste cpu time saving these unfinished chunks.
the loadChunk method refuses to acknoledge they exists, and will restart
a new chunk generation process to begin with, so saving them serves no benefit.
2018-07-22 21:25:48 -04:00
Aikar
7c1ad2bc8d Fix spawn loading percentages 2018-07-22 19:53:01 -04:00
Aikar
84b819bcb8 Fix Chest open/close animations 2018-07-22 19:39:56 -04:00
Aikar
9108f443a8 Re-add Optimize Hoppers patch 2018-07-22 19:03:54 -04:00
Aikar
1fbc4f4d9b Re-add block inlining - Closes #1229
Also reordered MC Utils to be higher up
2018-07-22 18:46:13 -04:00
Aikar
d5a4135e98 Update upstream 2018-07-22 13:10:15 -04:00
Aikar
70c967fb6b Update Paper to 1.13 proper - THIS IS STILL HIGHLY UNSTABLE
DO NOT RUN ON PRODUCTION SERVERS!!! Use Backups!!
2018-07-22 01:27:46 -04:00
Aikar
6b5f080374 Add mc util methods 2018-07-22 00:45:49 -04:00
Aikar
1db0b7ed58 Readd configurable max chunk gens per tick 2018-07-21 17:24:18 -04:00
Aikar
d6293c533d Restore Configurable Allowance of Perm Chunk Loaders 2018-07-21 17:03:26 -04:00
Aikar
58a8ca3eae Restore World.loadChunkAsync API - but load chunks sync
We are still missing Async Chunk Loading, but plugins may be
depending on this API, so it missing blocks upgrading.
2018-07-21 16:55:43 -04:00
Aikar
1b778924c3 Rebuild patches for upstream merge 2018-07-21 16:43:00 -04:00
Aikar
7c13469d6c Merge branch 'master' into pre/1.13
* master:
  Duplicate UUID Resolve Option
  Add more information to Entity.toString
  change LAST_EDIT to PAPER_LAST_EDIT for edit commands
  Add more information to Entity.toString()
  Add Debug Entities option to debug dupe uuid issues
  Guard the Entity.SHARED_RANDOM from seed changes
  Create a symlink on not-windows to current minecraft decompile dir
2018-07-21 16:13:27 -04:00
Aikar
97d99711ff Update Upstream 2018-07-21 16:03:10 -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
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
Brokkonaut
df8c42d4ad 1.13: Resend bed on cancelled interaction (#1245)
Minecraft 1.13 requires resending the block for both parts of the bed
2018-07-21 14:47:22 +02: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
BillyGalbreath
1cff982021 PlayerElytraBoostEvent 2018-07-21 02:00:31 -05:00
BillyGalbreath
9362271fc3 AnvilDamageEvent 2018-07-20 23:37:40 -05:00
Shane Freeder
7dd591d1a6 update B/CB/S 2018-07-20 20:57:43 +01:00
Zach Brown
f899206b89 Merge branch 'master' into pre/1.13 2018-07-20 14:15:12 -05: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
Zach Brown
77f54129b4 Move decomp fix from last up to fixes patch 2018-07-19 16:55:27 -05:00
Zach Brown
c17484979e Fix crash in RegionLimitedWorldAccess 2018-07-19 16:51:32 -05:00
Shane Freeder
62511066e1 Merge branch 'master' into pre/1.13 2018-07-19 20:23:18 +01:00
Minecrell
391324437a Avoid adding NetworkManager twice
The removal of `ServerConnection.this.h.add(networkmanager);` got
lost in the 1.13 update, causing network managers to be registered
twice.

Fixes "handleDisconnection() called twice" warning spam in console.
2018-07-19 20:14:27 +02:00
Minecrell
9a1643dab4 Fix decompile/deobfuscation error in BlockPosition iterator
Some of the fields in the anonymous class are named the same as the
surrounding method's parameters, which caused the fields to be
initialized incorrectly.

That way it keeps returning the same block position, resulting
in an infinite loop during chunk generation.
2018-07-19 19:50:34 +02:00
Hugo Manrique
b90705d2ad Avoid item merge if stack size above max stack size (#1217) 2018-07-19 17:51:55 +02:00
Aikar
c3a05c5ba0 Update master patches just merged to 1.13 2018-07-19 01:51:01 -04:00
Aikar
be3fe3da6d Merge branch 'master' into pre/1.13
* master:
  Don't process despawn if entity is in a chunk scheduled for unload
  Fix Squids corrupting the entire servers entity randomness....
  Fix placement of chunk tracking - Fixes #1199
2018-07-19 01:46:11 -04:00
Aikar
bc063a06e8 Don't process despawn if entity is in a chunk scheduled for unload
This won't happen anyways if the user has
"skip ticking for entities in chunks scheduled for unload" turned on,
but if they don't, protect from this instant killing the entity to
keep it vanilla in behavior

a player may teleport away, and trigger instant despawn
2018-07-19 01:25:18 -04:00
Aikar
5353f8878e Fix Squids corrupting the entire servers entity randomness....
Really hope this solves #1223

Also re-add vanilla debug messages back and add uuid to toString
2018-07-19 01:13:53 -04:00
Shane Freeder
bd34c3623b NOT FINISHED! She compiles, and she... suffers the wrath of chunkgen... 2018-07-19 05:42:43 +01:00
Shane Freeder
aea45cba34 NF! 1.13 - more fixes 2018-07-19 00:31:45 +01:00
Shane Freeder
20e3b69061 NOT FINISHED! 1.13 pre-7
I need more creative commit messages.
2018-07-19 00:16:19 +01:00
Shane Freeder
37f7038e10 NOT FINISHED! 1.13 pre-7 - Holy moley, more patches!
Really, don't touch! may harm your cat!
2018-07-18 19:55:52 +01:00
Aikar
96f62ca759 fix a patch catboy asked me to 2018-07-18 01:08:17 -04:00
Aikar
9ce19f0321 NOT FINISHED: Current progress, updated upstream 2018-07-18 00:52:33 -04:00
Shane Freeder
68f8952459 NOT FINISHED! restore dropped patches, fix one more! 2018-07-18 01:37:30 +01:00
Shane Freeder
3cb169aa7c NOT FINISHED! 1.13-pre7 - even more patches!
Patches, patches everywhere!
2018-07-18 01:08:13 +01:00
Shane Freeder
c8d8659ad3 NOT WORKING! Even even more patches! 2018-07-17 21:32:05 +01:00
Shane Freeder
828dea48de NOT FINISHED! Fixed a few decomp issues 2018-07-17 16:14:23 +01:00
Minecrell
2db50592b9 Use asynchronous Log4j 2 loggers 2018-07-17 16:44:32 +02:00
Minecrell
9cfd6ff449 Update TerminalConsoleAppender to 1.1.0
Fixes a race condition when using TerminalConsoleAppender that may
result in IllegalStateExceptions or duplicate input prompts.
2018-07-17 14:48:52 +02:00
Shane Freeder
e7cf7c9168 NOT FINISHED! even more 1.13-pre patches! 2018-07-16 21:08:09 +01:00
Shane Freeder
93a7205ba8 NOT FINISHED!!! More progress on 1.13-pre7
This work is unfinished, keep your paws off this branch!
2018-07-16 16:34:55 +01:00
Aikar
bac47163e8 Delete some dupe patches (should be fixed going forward) 2018-07-16 00:32:35 -04:00
Mark Vainomaa
55d5aef00c Add TNTPrimeEvent 2018-07-16 00:06:26 +03:00
Aikar
9a22d2fdec Fix placement of chunk tracking - Fixes #1199
Spigot had code that returned early in chunk add/remove methods.

This was causing our code added to set current chunks and counts to
be skipped over if the entity was default not persistent but made persistent.

This was the source of many issues

Fixes #1208
2018-07-15 02:44:37 -04:00
Aikar
6d1a918378 NOT FINISHED!!! Current Progress on 1.13-pre7 update
This work is 100% unfinished. I am pushing it up so that we as a team
can work on this update.

Do not try to use this branch. You will fail.
2018-07-14 21:53:17 -04:00
Aikar
fe9d5b5570 Fix issue with entity activation range check - #1199 2018-07-14 00:12:42 -04:00
Minecrell
695beffc27 Refresh player inventory when cancelling PlayerInteractEntityEvent (#1205)
When interacting with entities with an item, the client will assume
the interaction is successful, and update the held item on the
client. However, if the interaction is cancelled on the server side,
the client will still mistakenly remove/replace the item in hand.

Examples for this are milking cows with a bucket or dyeing sheep.
The bucket is replaced with milk and the dye removed from inventory.

Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
2018-07-13 22:52:34 +02:00
Minecrell
021305dc62 Avoid visual issues for adjacent blocks when cancelling PIE (#1198)
The adjacent blocks of doors, double plants, pistons and beds need
to be updated manually from the server when cancelling a block break
from a player, as it otherwise causes the other parts to disappear
on the client.

This is already done for doors but only for the BlockBreakEvent,
not for PlayerInteractEvent. Move the code to a common method
and also handle the other blocks in similar ways.
2018-07-13 09:48:51 +02:00
Minecrell
d4ccc60986 Avoid Netty buffer leak in LegacyPingHandler. Fixes #1200 (#1201)
The extra buffer used to decode the strings sent by the client
in the legacy ping protocol was never released. However, creating
an extra copy of the buffer just to decode it to a string isn't
actually necessary: We can just call toString() directly on the
original buffer.

Additionally, free the buffer in handlerRemoved() to handle cases
where the client never sends enough bytes to form a valid legacy
ping request.
2018-07-13 09:43:56 +02:00
Zach Brown
c89e4105d2 Update upstream B/CB 2018-07-13 02:39:44 -05:00
Aikar
eb1140acce Multitude of changes to attempt to fix #1199 2018-07-12 16:42:56 -04:00
Shane Freeder
7754b35d8f Don't send digged block updates for unloaded chunks 2018-07-12 15:19:33 +01:00
Aikar
8981806621 don't use a stream for entity counts (performance) 2018-07-10 01:06:09 -04:00
Shane Freeder
5ef91b3293 hopefully fix entity issues - #1199
@Aikar
2018-07-09 19:48:49 +01:00
Aikar
1ba951ee5d Only use stored chunk ref if it matches current chunk registration
Closes #1197

While this really undoes a lot of the desired performance gains avoiding chunk lookups,
we sadly have to accept this because we are seeing lots of bugs with entities.
2018-07-08 22:39:46 -04:00
Aikar
20aba250df Improve bed search pattern to go inwards out for bed search radius 2018-07-08 03:30:40 -04:00
Aikar
93dc25ecec Fix weird bugs with entities - Fixes #1195 2018-07-05 18:39:43 -04:00
Aikar
8ddd9ddefc Missed a case where to remove a chunk lookup on TE removal (performance, not bug fix) 2018-07-04 17:29:10 -04:00
Aikar
233a81a4ba [CI-SKIP] Remove paper tags - Fixes #1192 2018-07-04 17:26:54 -04:00
Aikar
25f583aaa4 Fix Tile Entities - #1192 Fixed 2018-07-04 17:22:38 -04:00
Aikar
cc84e0fab8 Vex#getOwner API
Get's the NPC that summoned this Vex
2018-07-04 15:32:30 -04:00
Aikar
3ed90751c5 Configurable Bed Search Radius
Allows you to increase how far to check for a safe place to respawn
a player near their bed, allowing a better chance to respawn the
player at their bed should it of became obstructed.

Defaults to vanilla 1.
2018-07-04 15:23:15 -04:00
Aikar
2cde0e40c3 support plugins calling OBC directly for inventory close event 2018-07-04 12:33:38 -04:00
Aikar
2df786eb1f Avoid Chunk Lookups for Entity/TileEntity Current Chunk
In many places where we simply want the current chunk the entity
is in, instead of doing a hashmap lookup for it, we now have access
to the object directly on the Entity/TileEntity object we can directly grab.

Use that local value instead to reduce lookups in many hot places.
2018-07-04 03:56:57 -04:00
Aikar
8778a2ef97 Current Chunk for Entity and Block Entities, counts by entity type
This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.

We also store counts by type to further enable other performance optimizations in later patches.
2018-07-04 03:55:24 -04:00
Aikar
58a2e2dc04 InventoryCloseEvent Reason API
Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
2018-07-03 21:57:33 -04:00
Brokkonaut
651753d370 Add World.getEntity(UUID) API
This is the best way to get an entity when the world and its UUID are known.
It is faster than Server.getEntity(UUID) because it does not have to iterate all worlds
2018-07-03 16:16:01 +02:00
BillyGalbreath
dcfc5893e7 Add config to disable ender dragon legacy check (#1167) 2018-06-22 10:49:10 -05:00
Brokkonaut
d47caaad6a Improve ProjectileHitEvent to include the BlockFace where the projectile has hit (#1182) 2018-06-30 05:50:17 +02:00
Shane Freeder
702bbe6f8a Cleanup allocated favicon ByteBuf (fixes #1191)
Cleanups a bytebuffer which was allocated during the encoding of the
favicon to be sent to the client.
2018-07-03 19:19:47 +01:00
Shane Freeder
9d16e77b90 Extend Player Interact cancellation to handle FlowerPots 2018-07-03 04:33:21 +01:00
Aikar
14ccb8ebeb Add Critical missing Bukkit API - setTarget/getTarget moved down to SentientNPC
This fixes a CRITICAL missing part of the Bukkit API due to mistakes on upstream
refusing to implement the Sentient NPC baseclass of all NPC's.

Until now, the Bukkit API has not provided a way for accessing and setting
a non creature entities target.

Although Flying, Slime, Ambient, and Water mobs all supported targets internally,
you were unable to get/set it.

Now with the SentientNPC API and these API's moved down, every sentient NPC has
access to target data.
2018-07-01 22:07:35 -04:00
Aikar
0a953a924a Fix issues with getBlockState(false) not loading Tile Entity data
This only impacted people who used our useSnapshots new API in a plugin,
which obviously was no one as the data result was completely broken.

Merged the NPE check patch into mine since it has to handle it too.
2018-06-30 01:40:52 -04:00
Aikar
d9c9b9a3d2 LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item

Also aliased isHandsRaised for isChargingAttack in RangedEntity
2018-06-29 00:55:29 -04:00
Aikar
278780623d RangedEntity API
Allows you to determine if an entity is capable of ranged attacks,
and to perform an attack.
2018-06-26 22:08:01 -04:00
Minecrell
2485e50970 Disable JLine event expansion. Fixes #1171 2018-06-25 17:40:35 +02:00
Aikar
6b198b5cfe Fix another case where villages load chunks 2018-06-21 22:58:09 -04:00
Aikar
34c2733939 Update Upstream 2018-06-20 23:29:33 -04:00
Aikar
899149d68d Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
2018-06-20 23:19:46 -04:00
Brokkonaut
fbe69b61a9 Add EntityKnockbackByEntityEvent (#1162)
This event is called when an entity receives knockback by another entity. The knockback can be modified in the event. If the event is cancelled the entity is not knocked back.
2018-06-21 03:59:11 +02:00
Aikar
5bf1029d82 Fire EntityShootBowEvent for Illusioner 2018-06-18 22:19:59 -04:00
Zach Brown
8e0411a1d3 Tie PlayerList#moveToWorld safety to existing config
Also renames patch file to better express what it's doing.

It is presumed that those using this config option intend for
suffocation checks to be disabled in all instances. In doing so, they
inherently assume the advantages and issues associated with removing
said safety check.

If the community expresses a desire for more specific options regarding
the handling of this safety feature, we can investigate providing them.

Fixes GH-1149
2018-06-18 16:27:33 -05:00
Aikar
be0d8a5f74 PlayerReadyArrowEvent
Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
2018-06-18 01:13:16 -04:00