Commit Graph

1694 Commits

Author SHA1 Message Date
Zach Brown
4b45701372
Always write dimension NBT, even if we ignore it
DataPacks can use the dimension field for various things, so we should
still write this field to NBT, even if we ignore reading it ourselves.
2018-10-24 14:41:04 -04:00
Aikar
9e795dfe7f
Fix unloaded chunks movement setting 2018-10-24 08:38:34 -04:00
Aikar
5f7c6d0d2a
Improve default thread counts for DataFix BootStrap
Spigot capped it to 2 threads. This bumps it back up to do
maxcores -2 with a max cap of 6.

A typical 4C8T system can use 6 threads and be done in 6 seconds.

Server owners can use system property to override, but this
improves the default.
2018-10-23 23:53:13 -04:00
Aikar
d07f7197f2
Use Last Access Cache for isLoaded calls
this should provide a pretty good across-the-board performance
improvement for the entire server, as it's very common for code
to check if (isLoaded(x, z)) { then do something on that chunk }

Previously, containsKey would not read or set the last access cache

By making it do get() != null, we gain the benefits of last access
and also improves thread safey for async isLoaded checks

This exact usage scenario is used in Entity movement, so that alone
saves us up to 5%~ of CPU time for Entity movement.
2018-10-23 23:50:51 -04:00
Aikar
e9305f96a3
Don't sleep after profile lookups if not needed
Mojang was sleeping even if we had no more requests to go after
the current one finished, resulting in 100ms lost per profile lookup
2018-10-23 21:14:11 -04:00
Aikar
eb38e51ee0
Fix "prevent players from moving into unloaded chunks"
it used public method instead of private, and moved to world config

also improved the implementation to not use obfuscated stuff

Also removed the Fix Double chest conversion patch since its
fixed in other ways in vanilla
2018-10-23 21:13:58 -04:00
Zach Brown
042ccbb9b2
Strip private area unicode characters from signs
It is not immediately clear how these characters ended up on signs in
previous versions. It is clear, however, that they now render as empty
unicode boxes in 1.13, whereas previously they rendered as invisible
characters.

When these signs are loaded in versions after this commit, these
characters from the private use area of the Unicode block will be
stripped. The sign will then be marked to ensure this conversion only
runs once.

There is a flag -DPaper.keepInvalidUnicode=true that can be used if you
do not want us to strip these characters from your signs, though I can
think of no reason to use it.

Fixes GH-1571
2018-10-23 20:59:08 -04:00
Shane Freeder
1387cff4e8
Update for Minecraft 1.13.2 2018-10-23 00:16:21 +01:00
GreenMeanie
9b98a252d6 Reset players remainingAir on respawn (#1598)
As mentioned in #1597, your air level did not reset if you drown.

Now you get a full breath during respawn.
2018-10-22 15:25:48 -04:00
Gabriele C
ce7e1c14a6 Add option to prevent players from moving into unloaded chunks (#1608)
Resolves #1551
2018-10-22 15:25:16 -04:00
Aikar
7c5b5ce946
[Auto] Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
a639ae44 Remove outdated build delay.
2018-10-22 15:02:10 -04:00
Aikar
d066d8b926 Remove debug text
resolves #1606
2018-10-21 19:16:54 -04:00
BillyGalbreath
0db94d4fca Fix #1604 (#1605) 2018-10-21 20:39:21 +01:00
Aikar
3fa9c0b5c3
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-21 15:31:50 -04:00
Caleb Bassham
64840b3018 Fix NPE when setting a player's spectator target (#1596)
Fix NPE when setting a player's spectator target
2018-10-21 20:27:53 +01:00
Brokkonaut
4dc24e6c0f Don't modify item tag if interaction is canceled (#1589)
The item tag is stored before executing the interaction and restored before handling the
resulting events. If the event was not canceled and the ItemStack is not modified in the
event, the new tag is set back to the new one afterwards. This is similar to the handling
of the item amount.

This fixes a bug where tools lose durability when the interaction is canceled and another bug
where tools become completely repaired when they should break but the interaction was canceled.
2018-10-20 10:03:35 -04:00
BillyGalbreath
8098020fd0 Fix MC-93764 2018-10-19 19:39:21 -05:00
BillyGalbreath
8c7f0e79ce Add more Witch API (#1564) 2018-10-18 23:24:09 -04:00
Aikar
0d1ca37436
Remove MOST Synchronization from Chunk Map
This will provide quite a major performance boost by avoiding
synchronizing on EVERY chunk lookup.

Synchronize, even without contention, incurs processor cache flushes.

Considering this is the 2nd hottest method in the code base, lets
avoid doing that...

Additionally, chunk conversion operations were occuring while
under synchronization which lead to deadlocks.

Now the conversion will occur outside of the lock, and fix
that issue, resolving #1586

Note, that the chunk map is still thread safe for get operations!

The chunk map was never intended to be modified async with our
changes, as we post to main to modify the map, however
we do still synchronize for write operations (put, remove)

We also synchronize for async get operations, ensuring that
async gets are safe.

We do not need to synchronize main thread gets as the processor
cache will be insync since the map is only updated on the main thread.

However, if someone does try to delete or put concurrently, we
will force their operation back to the main thread.
2018-10-18 22:41:23 -04:00
Andrew Steinborn
7141632abf Add Velocity IP forwarding support (#1557)
While Velocity supports BungeeCord-style IP forwarding, it is not secure. Users
have a lot of problems setting up firewalls or setting up plugins like IPWhitelist.
Further, the BungeeCord IP forwarding protocol still retains essentially its original
form, when there is brand new support for custom login plugin messages in 1.13.

Velocity's modern IP forwarding uses an HMAC-SHA256 code to ensure authenticity
of messages, is packed into a binary format that is smaller than BungeeCord's
forwarding, and is integrated into the Minecraft login process by using the 1.13
login plugin message packet.
2018-10-18 20:44:59 -04:00
Caleb Bassham
3b358452ba Add events for player changing spectator target (#1498)
* Add events for player changing spectator target

- Add PlayerStartSpectatingEntityEvent
- Add PlayerStopSpectatingEntityEvent
2018-10-18 16:53:10 -04:00
Aikar
42772e476a
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-17 23:06:33 -04:00
Brokkonaut
4168fa182e Fire EntityCombustEvent for phantoms (#1573) 2018-10-17 23:04:21 -04:00
Aikar
00f0a30680
Ensure chunk neighbor counts do not get desynced
Mojang was not checking that the chunk did not overwrite, or
was successfully removed.

We're seeing odd reports in #1561 that indicates issues around
this are having problems.
2018-10-17 22:47:27 -04:00
Aikar
e047098814
MC-50319: Check other worlds for shooter of projectiles
Say a player shoots an arrow through a nether portal, the game
would lose the shooter for determining things such as Player Kills,
because the entity is in another world.

If the projectile fails to find the shooter in the current world, check
other worlds.
2018-10-17 19:30:57 -04:00
BillyGalbreath
52ae2a1aec
Implement getters and setters for EntityItem owner and thrower
Closes #1526
2018-10-16 22:17:59 -04:00
Zach Brown
6ec7d9f674
Fix equals case in lightning sounds 2018-10-16 21:40:32 -04:00
Trigary
20515a30ae
Limit lightning strike effect distance
Resolves GH-1436
2018-10-16 21:23:44 -04:00
GreenMeanie
03ecc80de8 Actually set the header (#1576) 2018-10-15 01:05:02 -04:00
Aikar
6a60c4295d
[Auto] Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
e7ced970 Catch plugins setting null Material or BlockData to blocks
2018-10-12 18:46:42 -04:00
Shane Freeder
35fcc2e2d0
Share the main thread queue for AsyncChunkProvider
fixes an issue in which thread requests are only processed
for the current provider which can cause a deadlock should
multiple requests exist across providers
2018-10-12 15:50:58 +01:00
Aikar
69a4a30e47
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-12 03:11:50 -04:00
BillyGalbreath
3b580e8aa9 Here's Johnny! (#1563)
Adds Johnny API to Vindicator
2018-10-12 03:09:53 -04:00
Aikar
04b8268cf1
Improvements to DataFixers for performance
Mojang asked me to make some changes, so applied them here.
2018-10-12 01:29:28 -04:00
Aikar
77c6bafe46
Missed a +1 on village doors 2018-10-11 21:54:15 -04:00
Aikar
dc6dbeb6ad
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-11 21:46:35 -04:00
Aikar
ee7933e43e
Improve Village Door code to not break village mechanics 2018-10-11 21:42:52 -04:00
BillyGalbreath
a16ef75bfd Add sun related API (#1546)
These methods are used internally throughout the game for things like spawning mobs during day/night only or making them burn in daylight, etc. Now exposed for plugin usage.
2018-10-11 21:42:49 -04:00
BillyGalbreath
fe01fa5641 Turtle API (#1509) 2018-10-10 23:40:49 -04:00
Aikar
14de21393c
Use a method for EntityTrackerEntry for Gerrygames
Allow overriding the method for interception

https://github.com/PaperMC/Paper/issues/1537

Resolves #1537
2018-10-10 23:19:51 -04:00
Aikar
f21e10da65
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-10 23:06:38 -04:00
BillyGalbreath
950b62689f Check Drowned for Villager Aggression Config (#1560) 2018-10-10 23:01:14 -04:00
Aikar
62efc6ab31
Improvements to Async Chunks
If a chunk load comes in on a chunk load or gen thread,
execute it synchronously on that thread instead of enqueueing it.

It doesn't make sense to enqueue it as that thread is then
going to future.join() it and block until it's ready anyways.

This opens risk to a deadlock if every load or gen thread is
waiting on a recursive chunk but it will never finish because
all of the threads are waiting.
2018-10-10 22:48:35 -04:00
Aikar
0693716984
Identify corrupt region file data and self recover
If we identify an invalid offset (negative, or the header sectors),
then back up the region file and erase that specific chunks offset
data.

This will avoid crashing the server with AIOBB errors and also avoids
server owners having to consider the entire region file 'lost'.

I'm not sure what leads to this state, I can only assume write cut
off mid bits.

In this scenario, there is absolutely no way to know where the chunk
actually is in the data file without loading every
single chunk in the file. And even to do that, would be quite extreme
due to the fact the file isn't in some orderly fashion.

Since the file is backed up, the user can use a region fixer tool
externally to try to restore that single chunk. We could even
add a command to restore a chunk from a backup file in a different
commit later on. But this at least prevents the server from crashing.

The server will just generate a new chunk and move on,
after printing an error to the console about it.

Also fixed the case reported in this issue about the server
hanging when a corrupt chunk is encountered, so this issue
is now fully closed.

Resolves #1541
2018-10-10 21:28:12 -04:00
BillyGalbreath
b1b6a6c4e2 Add LivingEntity#getTargetEntity (#1467) 2018-10-08 21:14:55 -04:00
Aikar
a3cccc9359
Complete future when chunk fails to load 2018-10-08 21:14:13 -04:00
Aikar
df22839abf
Fix Light Bugs - Fixes #1542
Applied a "Only run this when the blocks are different" to
a place, that apparently must be called even with the same
block but different other data I guess.

This was causing oddness with light data.
2018-10-08 20:27:13 -04:00
Aikar
1f5866fcf8
Improve synchronization on chunk gen to not block main - Fixes #1550
Chunk Generation was occuring while inside of the progressCache lock
this caused the progressCache to stay blocked for a long period of time
which then blocked main when main needed to clean the expiring map.

We now maintain a separate map for pending scheduler entries, that
we can join on if a 2nd request comes in while one is starting.

This strategy keeps the lock only for a fraction of time but
maintains thread safety.

So now the chunk is generated without holding a lock and wont
block the main thread on the expiring map as we will insert it
once ready.
2018-10-08 00:45:04 -04:00
Aikar
2a2d9fb508
Improvements to Logging Warnings/Dupe Entities - Resolves #1544
1) Removed "Regen" mode of Dupe UUID resolver, forced safe.
Some servers who updated before we had safe mode added still had this value.

There's really no reason to keep this mode, as we've seen that vanilla
triggers this often and 99.9999999% of cases will be an actual duplicate
that needs to be deleted.

2) Made Vanilla Debug messages about dupe UUIDs and dupe uuid resolve messages
only show up if the debug.entities flag is on. This will stop server owners
from panicing from seeing these logs, and stop opening bug reports on this,
only for us to tell you "don't worry about it".

3) Avoid adding entities to world that are already added to world.

This can be triggered by anything that causes an entity to be added
to the world during the chunk load process, such as chunk conversions.

Issue #1544 was a case of this.

4) Removed debug warning about ExpiringMap.

Nothing more I know to do about this anyways. We recover from it,
stop warning to reduce noise of issues to us.
2018-10-07 15:10:23 -04:00
BillyGalbreath
438ee3f487 Fix weird issues with Creeper ignite state (#1534) 2018-10-07 12:58:09 -04:00