Commit Graph

1761 Commits

Author SHA1 Message Date
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
BillyGalbreath
4266bfa3e4 Fix timer in slime AI (#1548)
Seems my original pull for this created an unseen bug where the target timer would never run out (the slime would not "forget" it's target over time). Went ahead and fixed that, and made the code more legible by adding the imports.
2018-10-07 12:57:52 -04:00
BillyGalbreath
0ca403459b Allow setting the vex's summoner (#1545) 2018-10-06 23:31:21 -04:00
Aikar
468a1cbbd7
[Auto] Updated Upstream (Bukkit/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

Bukkit Changes:
ee12ca7b Add maximum repair cost API to AnvilInventory

CraftBukkit Changes:
1ceee633 Implement maximum repair cost API to AnvilInventory
2018-10-06 05:31:40 -04:00
Aikar
addebee995
Fix logic error in water activation range immunity check
was no longer giving immunity to items
2018-10-06 01:17:32 -04:00
Aikar
49052de5e5
Fix many light bugs by removing recheckGaps change
Fixes #1539
Fixes #1483
2018-10-06 00:56:20 -04:00
Aikar
f21627490e
Don't stop chunk executors, cancel pending chunks instead
Fixes #1532
2018-10-06 00:15:40 -04:00
Aikar
70b156939f
Cancel pending chunk loads when they are no longer needed
This will improve queue times by canceling chunks when a player
leaves the radius of an async loading/generating chunk.

This matches behavior we had pre 1.13 for loading too.
2018-10-06 00:02:09 -04:00
Zach Brown
2ae1ed6336
Hook into CB's plugin rewriting system
Primarily to update plugins for our fastutil relocation. Can also be
used to do things like debug plugins accessing versioned NMS packages in
an IDE pre-relocate step.
2018-10-05 19:44:46 -04:00
133Seven
d7cb3a9989 [CI-SKIP] Change URL in POM to https://papermc.io 2018-10-05 11:52:04 -04:00
Matthew Miller
8749e58b72 Don't update snapshot blockstates (#1535)
Following this comment on PaperLib, https://github.com/PaperMC/PaperLib/pull/2#discussion_r222761017

I've made non-snapshot TE's not update when they receive the update call. They still do the rest of the update, just not the applying of the TE data. This is to still allow forced physics updates etc. Also in the case of Jukeboxes, updating the properties
2018-10-05 11:24:01 -04:00
Brokkonaut
0a6d449907 Sometimes World.save() did not save the whole world. (#1538)
flag = true is a force save of the whole world (for example World.save()), this should ignore the current queue size.
2018-10-05 11:23:20 -04:00
Aikar
e2418a9945
[CI-SKIP] Undo an accidental merger of patches
Accidently merged 1 pathfinding patch into a light patch instead
of the other pathfinding page.

Fixed that. Hand editting patch master race
2018-10-04 23:31:01 -04:00
Aikar
459987d69f
More improvements to activation range, improve turtles
improved the water code so that immunity wont trigger if the entity
has the water pathfinder system active, so this improves support
for all entities that know how to behave in water.

Merged 2 EAR patches together, and removed an MCUtil method that
doesnt have a purpose anymore
2018-10-04 23:18:46 -04:00
Aikar
a4df5ddee7
Report errors correctly from FutureTasks
Anything that posts something to main thread was not
correctly reporting their errors to the logger, passing the
ExecutionExcetion instead of the cause. This resolves that,
as well as patches some simple cases of System.nanoTime where mojang
had used a LongSupplier to use a different method on client.
2018-10-04 01:45:11 -04:00
Aikar
d7dd3798ec
Fix lag caused by water mobs across the board - Fixes #1462
This update introduces Entity Activation Range for water mobs.

Activation Range has been one of my biggest performance improvements
I ever added to Minecraft, however "Entity is in Water" is an immunity
case that keeps an entity active.

This update ignores the water check for known water based mobs, allowing
them to actually go inactive.

In addition to that, a new config option was added to spigot.yml to go with
the rest of the entity-activation-range options to let you configure
aquatic mobs like fish, squid and dolphins separately.

This should overall fix all lag caused by water mobs.
2018-10-04 01:21:02 -04:00
Zach Brown
ebe072deb6
Revert "Dont strip explicit leading color codes in chat components (#1512)"
This reverts commit 31a99db328.

Fixes GH-1525
Reintroduces GH-1484
2018-10-03 18:15:22 -04:00
Shane Freeder
2dcae290df Updated Upstream (Bukkit/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

Bukkit Changes:
867794b2 Make setPersistent also control player saving

CraftBukkit Changes:
02518f92 Make setPersistent also control player saving
2018-10-03 20:19:35 +01:00
Shane Freeder
26153def87 Fix FileIOThread concurrency issues (fixes #1505)
FileIOThread was using two volatile counters in order to track if
any pending work was in the queue, this causes potential concurrency
issues when this counter is updated from multiple threads, potentially
causing these counters to desync due to the unsafe volatile update
2018-10-03 19:12:07 +01:00
Aikar
a64b0952cb
Add config options to paper.yml for Async Chunks and Shared Host Overrides
Shared Hosts have been concerned over the increased CPU usage that Async Chunks
has introduced. We understand that shared hosts can't allow 1 client
to abuse the systme resources depriving other servers of cpu time, so we've
added some configs to allow hosts to force some settings.

Hosts, you may set the following SYSTEM ENVIRONMENT VARIABLES (NOT JVM FLAGS)
to change some behavior:

PAPER_ASYNC_CHUNKS_SHARED_HOST_GEN=1   - Enable Single Threaded World Generation (capping CPU Usage
PAPER_ASYNC_CHUNKS_SHARED_HOST_GEN=2   - Disable Async Chunk Generation - Please do not do this!!!
  - Minecraft is moving towards asynchronousm per-world chunk generation itself. You need to prepare
  - for this, so please do not disable async chunk generation.

PAPER_ASYNC_CHUNKS_SHARED_HOST_LOAD=#  - Where # is Maximum number of threads to use on Chunk Loading
  - This is a max, so your end user can reduce it more too. I suggest no lower than 2. Minimum is 1.
  - These are usually much faster request, so outside of loading entire worlds, They usually do not
  - get as much load. Paperby default uses CPU Core count * 1.5, so this may default to a higher value
  - on shared host and you should override it with this value to say 2-4.

These settings will override your clients paper.yml options. Set as a system wide environment
variable to ensure all Paper clients respect your resource usage desires.

Resolves #1520
2018-10-02 23:51:03 -04:00
Zach Brown
10209bfbd8
Do not allow null in CanPlaceDestroy NBT API
Fixes GH-1523
2018-10-02 22:54:38 -04:00
Aikar
38f0f0b71a
Disable use of Locks on main thread for DataPaletteBlock
This should greatly improve performance by using a No Op lock
while on the main thread.

Vanilla always had a write lock on write operations, but we added
a Read Lock during Async Chunks to make concurrent writes non fatal
for Async Chunks.

This means we added on a bunch of over head to all chunk read operations.

This corrects that, as well as disabling the write lock while on main thread.

It is a general rule that you do not touch a chunk async once it is loaded
into the world, as we never had locks on the chunk before 1.13 even.

So once we are on main, we don't expect concurrent access to begin with,
so we don't need the write locks either.
2018-10-02 22:29:31 -04:00
Aikar
e45b853e60
Optimize some light chunk access
light calculations repeatedly looks up the same chunk while going
down on the Y access. Pass the chunk to it to skip many round trips
to the map lookup process.

while the gains arent as big since we have last access cache, it
should hopefully avoid many callstacks of depth and improve inlining,
as well as avoids entering a synchronized code block.

The avoiding of entering synchronized section is the main goal here.
2018-10-02 21:55:30 -04:00
Aikar
97b9ce8476
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-10-02 10:26:35 -04:00
BillyGalbreath
31a99db328 Dont strip explicit leading color codes in chat components (#1512) 2018-10-02 10:21:12 -04:00
Aikar
920bf4680b
[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:
68588dac SPIGOT-4405: Chunk generation problem
2018-10-02 09:06:52 -04:00
Shane Freeder
9038677c89
Updated Upstream (Bukkit/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

Bukkit Changes:
c71bb9ca Add PlayerRecipeDiscoverEvent and methods to (un/)discover recipes

CraftBukkit Changes:
7a2f4867 Implement PlayerRecipeDiscoverEvent and methods to (un/)discover recipes
2018-10-02 11:01:56 +01:00
Shane Freeder
eaa2c39183
Configurable connection throttle kick message (Closes #1515) 2018-10-02 10:39:49 +01:00
Shane Freeder
3fc712a78f
Fix custom flying kick message 2018-10-02 10:39:49 +01:00
Shane Freeder
f1a92f03db
Cleanup tab completion
During testing, I could not find any case of TabCompleteEvent firing,
however, upon reinspection of the code, and additional testing, this
appears to work fine without any changes on our part.
2018-10-02 10:37:37 +01:00
Aikar
6371b4581d
Fix Async Chunk Load Callback if chunk was already loaded
Fixes ACL API mainly, but might fix other smaller things too

Also improved the high priority check if the chunk was already marked done
2018-10-01 01:00:09 -04:00
Aikar
48b1b0aac5
Optimize Spare Chunk loads to be removed faster
this has technically been a longer standing problem, but if an async
chunk loads after a chunk has been removed from the chunk map, it would
be treated as any other spare chunk and kept loaded until Chunk GC kicks in.

This fixes that, but also obsoletes ChunkGC in that anytime we load a spare
chunk (a chunk outside of any players view distance), we will immediately
mark it for unload.

This should reduce the amount of spare chunks loaded on a server.
2018-09-30 20:34:05 -04:00
BillyGalbreath
c81736fd60 Fix cancelled lootables (#1510) 2018-09-29 21:57:59 -04:00
Zach Brown
d9363f2979
Fix slime pathfinding when loaded from NBT
GH-1507

The canWander property is initialized to true by default, however when
loaded from NBT, if the key doesn't exist the property will be set to
false. The correct solution is to ensure the key exists before setting
the property.
2018-09-29 16:06:26 -04:00
Aikar
9285b9cf1c
Fix village check
obf helper was in an unimported file, so just going to skip helper here
2018-09-29 12:20:29 -04:00
Aikar
c64503c66f
Fix Village Loading Doors fix, add config option, hopefully fix farms
The patch was previously applied wrong, and still caused chunk loads.

Now, we will prevent it again, but also added a config option to
disable this optimization.

However, I also updated it so that doors are not removed if the chunk
the door is in is unloaded, so this should avoid breaking farms.

Fixes #1506
2018-09-29 12:03:11 -04:00
Aikar
08bb5b49d2
Fix Sending Chunks to Client - Fixes #1504
Vanilla has some screwy logic that doesn't send a chunk until
it has been post processed. This is an issue as post processing
doesn't occur until all neighbor chunks have been loaded.

This can reduce view distance while generating terrain, but also
cause bugs where chunks are never sent to the client.

This fix always sends chunks to the client, and simply updates
the client anytime post processing is triggered with the new chunk data.
2018-09-29 01:22:21 -04:00
Aikar
590c2f96eb
Fix bug in async load order priority
accidently had priority inverted!

This will greatly improve visual chunk load speeds
2018-09-28 23:12:16 -04:00
Aikar
0c9bb9b7ae
Don't recheck type after setting a block
The server does a "Did my update succeed" check after setting
a blocks data to a chunk.

However, writes can not fail outside of a hard error or a
a race condition from multiple threads writing, which is
not something that should ever occur on the server.

So this check is pointless, as if it did occur, the server would
be having data corruption issues anyways.

This provides a small boost to all setType calls.
2018-09-28 22:40:04 -04:00
Aikar
f02b4d200e
Fix issues with entity loss due to unloaded chunks
Vanilla has risk of losing entities by causing them to be
removed from all chunks if they try to move into an unloaded chunk.

This pretty much means high chance this entity will be lost in this scenario.

There is another case that adding an entity to the world can fail if
the chunk isn't loaded.

Lots of the server is designed around addEntity never expecting to fail for these reasons,
nor is it really logical.

This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.

Hopefully will fix issues #1496 and #1434
2018-09-28 22:39:20 -04:00
Aikar
cd6a5f3b51
Remove Water optimization from the Light Optimizations
case was found where it could cause light to become incorrect

But we still get to optimize out any same block updates which reduces light operations
2018-09-28 22:37:43 -04:00
Aikar
c75015c1a4
Remove the "Entity already removed" warning unless debug entities is on 2018-09-28 22:37:33 -04:00
Aikar
de4487435d
Optimize Light Recalculations
The server triggers light recalculations even if the new block
is the same as the old block. At this time, BlockData Properties
do not impact light calculations.

So the only way light should change, is if the block itself
changes from 1 block to another.

Additionally, as of 1.13, water now only blocks 1 light level
instead of 3, meaning that light level decreasing is the same as air.

This means, transitions between water and air also do not need
to recalculate light, which saves a TON of updates caused by
fluids flowing.
2018-09-28 21:30:03 -04:00
BillyGalbreath
3482df728f Fix turtle lag (for real this time) (#1503)
Amends #1502, to further fix #1501
2018-09-28 21:27:40 -04:00
Aikar
b62dfa0bf9
Updated Upstream (Bukkit/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

Bukkit Changes:
39ce5d3a SPIGOT-4399: ItemMeta.equals broken with AttributeModifiers

CraftBukkit Changes:
1cf8b5dc SPIGOT-4400: Populators running on existing chunks
116cb9a1 SPIGOT-4399: Add attribute modifier equality test
5ee1c18a SPIGOT-4398: Set ASM7_EXPERIMENTAL flag
2018-09-28 19:31:59 -04:00
BillyGalbreath
afeb77bc88 Fix turtle lag (#1502)
Fix #1501

I just added a condition check to not start a new pathfinder goal if the turtle already has one set.

Needs more testing.

![Timings Comparison](https://i.imgur.com/p9eJQSo.png)
2018-09-28 13:58:06 -04:00
Aikar
515f2e7beb
Ignore Dimension NBT field in Entity data
Minecraft is trying to set Dimension Objects based on a Dimension ID

Dimension ID's for custom worlds are dynamically allocate dand not guaranteed
consistent.

This removes checking the NBT data, as the Entity will always have its
DimensionManager set to the world it is being placed into.

This fixes corrupt entities breaking chunk saving in custom worlds.
2018-09-27 00:11:50 -04:00
Aikar
2365b308c8
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.

This update has been tested to ensure that World Conversion still occurs correctly.

Bukkit Changes:
0812ce2c SPIGOT-4397: isChunkGenerated API

CraftBukkit Changes:
4824655c SPIGOT-4398: Upgrade to ASM 6.2.1 for better Java 11 support
eea43870 MC-134115: Fix issues converting tile entities
1a7f2d10 SPIGOT-4397: isChunkGenerated API
40aed54d SPIGOT-4396: Improve vehicle movement

Spigot Changes:
f6a273b1 Rebuild patches
2018-09-26 22:35:46 -04:00
Daniel Ennis
c5fbde9f17
Async Chunk Loading and Generation (#1397)
This restores Asynchronous Chunk Loading to 1.13, as well as adds Asynchronous Chunk Generation..

This provides a massive boost to server performance and should bring 1.13 back closer to 1.12 performance levels for pre generated worlds.

World Generation will now be faster overall than 1.12 since 1.12 did not have async generation.


**DONATE:**
Lots of effort has went into making this happen. Want to say thanks and donate? 

https://donate.emc.gs/AsyncChunks
2018-09-26 18:21:44 -04:00
Aikar
5cdfbda4e4
Re-enable light queue toggle, optimize neighbor checks, add max queue time
light queue is actually buggy, so re-enabling the config.

however, if anyone is ok with the buggy behavior, made the max time lost due to
light queue configurable.

We want to get to making the ligth queue default if we can make it work perfectly.

also applying neighbor optimizations to use the faster method for light checks.
2018-09-26 00:57:59 -04:00
BillyGalbreath
e1ba203df8 Honor EntityAgeable#ageLock (#1481)
* test

* Obfuscation helper

* Fix #1459
2018-09-25 10:54:06 -04:00
Brokkonaut
e8e994656b Avoid dimension id collisions (#1487)
getDimensionId() returns the dimension id - 1. So without this patch
we would reuse an existing dimension id, if some other dimension was
unloaded before.

In Spigot this is nearly invisible because DimensionManager has no equals(),
so dimension id collisions just create 2 worlds with the same dimension.

The PaperWorldMap (Added in
https://github.com/PaperMC/Paper/blob/master/Spigot-Server-Patches/0376-Optimize-Server-World-Map.patch ) changes this - Now the dimension is overwritten if there is some collision,
what causes players to teleport to incorrect worlds, World checks will no longer work
and many more evil things.
2018-09-25 10:53:52 -04:00
Aikar
917d582441
[Auto] Updated Upstream (Bukkit/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

Bukkit Changes:
b9620fd9 API to generate filled explorer maps

CraftBukkit Changes:
c1ecaa2f API to generate filled explorer maps
2018-09-24 05:41:32 -04:00
Aikar
6cd928f83e
[Auto] Updated Upstream (Bukkit/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

Bukkit Changes:
6f57bf95 SPIGOT-4391: Sign editable API

CraftBukkit Changes:
5cffeca2 SPIGOT-4391: Sign editable API
2018-09-24 01:06:42 -04:00
Aikar
61709368af
Updated Upstream (CraftBukkit/Spigot)
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:
dcb43ef8 MC-136886: locate command loads chunks without needing to.

Spigot Changes:
f823ac54 Rebuild patches
2018-09-23 21:29:00 -04:00
Zach Brown
7a57f23710
Make bad custom name resolution more specific
Avoids interfering with other places in vanilla where these issues
are tolerated and expected.
2018-09-23 20:10:24 -04:00
Kyle Wood
5d7bf5d57a Enable experimental ASM support for Java 11 plugins (#1480)
JEP 181 brings a new bytecode format for nest mates. ASM API 7 supports
this, but API 7 is still experimental. Attempting to load a Java 11
class that contains nest mates will cause an
UnsupportedOperationException, as API 6 can't handle them. This doesn't
really require any changes to the rest of the code, since this is just
related to ASM's visitor.

We want to use the stable API 6 for all other plugins, only using the
experimental API when required, so we check the class version first.

This should be removed as soon as ASM API 7 is stable.
2018-09-23 15:00:46 -04:00
Aikar
9787753c4f
[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:
fc10dec5 Don't throw error on invalid data in CraftMetaItem.
2018-09-23 05:06:41 -04:00
BillyGalbreath
003c0e0766
Fix NPE race condition in ServerListPingEvent
Fixes GH-1473

If a ping is responded to prior to the server sample being populated
(pre-tick as an example) it can result in an NPE.
2018-09-22 23:55:30 -04:00
Mark Vainomaa
3491f5542e Create API for CanPlaceOn and CanDestroy NBT tags (#1015) 2018-09-22 23:30:54 -04:00
BillyGalbreath
df72ca1321 Expose attack cooldown methods for Player (#1412) 2018-09-22 23:03:53 -04:00
BillyGalbreath
fedb0c07ae Add creative-arrow-despawn-rate (#1411)
* Add creative-arrow-despawn-rate
2018-09-22 22:48:30 -04:00
BillyGalbreath
844687a91c Add obfuscation helper (aikar's request) (#1468) 2018-09-22 22:28:16 -04:00
Zach Brown
e62f3ae259
Return null if we get a ParseException in IChatBaseComponent
Fixes GH-1471, GH-1474

As a result, data that no longer parses correctly will not crash the server
instead just logging the exception and continuing (and in most cases should
fix the data)

Player data is fixed pretty much immediately but some block data (like
Shulkers) may need to be modified in-game in order for it to re-save
properly

No more crashing though.
2018-09-22 15:58:13 -04:00
Senmori
042e018bb1
Apply Spigot PR 493 - Fixes #1469 2018-09-22 12:58:57 -04:00
Aikar
1556158be3
Fix bug in last commit 2018-09-22 12:28:38 -04:00
Aikar
e07e0cb3ca
Improve Light Queue and force enable it for all
There is no reason for the light queue to even be an option. This
enables the light queue for everyone.

This also improves the "can we still tick" time logic to always
check before running a light operation.

previously, we always executed at least 10 on the first world
(but not other worlds...), but we are seeing light take up some
heavy time, so improving that for now.

I've now also improved recheck gaps logic to happen at the end of all single block updates

This also prevents multiple gap checks, as previously if a tick skipped
the gaps check, the next tick would end up re-adding the entry again,
resulting in multiple gap checks.

This now just sets a marker "We need to recheck gaps" and will only occur
once.

This also should reduce chunk loads, as previously, we checked if
the neighbor chunks were loaded for the gap check, however those
neighbor chunks might of unloaded before the light queue operation
actually ran. Now, the neighbor chunk is done when the gap check
is being done, so it should avoid loading chunks.

Fixes #1466
Fixes #1431
2018-09-22 12:09:12 -04:00
Aikar
b6c3d89496
Revert "All generated chunks should be loadable" - Fixes #1470
This reverts commit 60b1ed9c76.
2018-09-22 11:33:30 -04:00
Aikar
0b3afe6c97
[Auto] Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Bukkit Changes:
4db9e3dc Add API to locate structures

CraftBukkit Changes:
65bb2d0f Increase expiration time to 10 days
88a5346f Add API to locate structures.

Spigot Changes:
68acb93f Rebuild patches
2018-09-22 03:16:43 -04:00
Aikar
1db10a30db
Improve synchronization on ExpiringMap 2018-09-21 21:43:50 -04:00
Aikar
60b1ed9c76
All generated chunks should be loadable
Some chunks that need conversion may fail the loadChunks pass, and
end up entering the world gen code to finish processing.

We solved this on the API level before, but this needs to apply to
all chunk loads when gen=false
2018-09-21 16:59:47 -04:00
Aikar
7438edc9a1
Rework Async Chunks API in prep for merge, add utility
This adds a new Future based, Consumer<Chunk> based, and ability
to control whether or not to generate to the Async Chunk API.

Until Async Chunks merges, these API's are still synchronous, but
this commit will allow plugins to start using the API's in use
with the Async Chunks beta.
2018-09-21 16:56:08 -04:00
Aikar
fd1bd5223a
Sync Player Position to Vehicles
Player Positions could become desynced with their vehicle resulting
in chunk conflicts about which chunk the entity should really be in.
2018-09-21 11:37:38 -04:00
Aikar
f02ab90a19
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Bukkit Changes:
cbb4fc16 SPIGOT-1916: Attribute modifiers for ItemStacks

CraftBukkit Changes:
8164f4b2 SPIGOT-1916: Attribute modifiers for ItemStacks

Spigot Changes:
38536abd Rebuild patches
2018-09-21 11:29:17 -04:00
Aikar
fba19f5f30
MC-134115: Fix Double Chest Chunk Conversion Error
A bug with double chest conversion would lead to data
loss from chunks if they crossed chunk boundries.

This fixes the issue.

It should now be safe to upgrade worlds to 1.13.1
2018-09-20 19:13:29 -04:00
Aikar
1b8f425949
Fix concurrency issues with ExpiringMap 2018-09-20 11:43:32 -04:00
Aikar
a7e90f01fe
[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:
26c89277 SPIGOT-4385: Clearer error for invalid generator-settings
2018-09-19 04:36:38 -04:00
Max Lee
1e66b061fa Add a separate PreSpawnerSpawnEvent (#1455)
This event extends the PreCreatureSpawnEvent and includes the position
of the spawner that spawned the entitiy. (similarly to how the
SpawnerSpawnEvent contains the spawner's BlockState).

This one doesn't include the state though as getting the block and
generating that snapshot is a bit wasteful.
2018-09-18 19:34:11 -04:00
Aikar
0d54dc2025
Make a copy for worldloadevent to avoid como's - fixes #1453
If you try to load a world inresponse to another world loading,
a concurrent modification exception will throw.

This avoids that by making a defensive copy of the list for the server init stage.

you might  want to do this if you want to guarantee your world loads
immediately after the vanilla worlds before another plugin has a chance
to load worlds during POST_WORLD plugin stage.
2018-09-18 19:33:43 -04:00
Aikar
5ef5f3b67b
Optimize Server World Map
Minecraft moved worlds to a hashmap in 1.13.1.
This creates inconsistent order for iteration of the map.

This patch restores World management to be back as an Array.

.values() will allow us to iterate as it was pre 1.13.1 by
ArrayList, giving consistent ordering and effecient iteration performance.

KeySet and EntrySet iteration is proxied to the List iterator,
and should retain manipulation behavior but nothing should be doing that.

Getting a World by dimension ID is now back a constant time operation.

Hopefully no other plugins try to mess with this map, as we are only handling
known NMS used methods, but we can add more if naughty plugins are found later.

Multiverse was tested with this and no breakage.
2018-09-18 01:34:44 -04:00
Aikar
db8ecff805
Support Overriding World Seeds - Closes #350
Allows you to add to paper.yml

seed-overrides:
  world_name: some seed value

This will ignore every where a seed is set/created/loaded and force
a world to use the specified seed.

This seed will end up being saved to the world data file, so it is
a permanent change in that it won't go back if you remove it from paper.yml
2018-09-17 23:38:17 -04:00
Aikar
3aaba8c301
Use BigDecimal to improve accracy of TPS results - long live 20 TPS!
It's always been commonly said to 'ignore' that TPS was '19.X', that
it was fine.

I suspect that the inaccuracy of floating point math resulted in us
losing precision over time, making it difficult to actually get back to 20,
as you know the fun 0.1 + 0.1 ... 9 more times != 1 problem.

BigDecimal supports working with doubles with higher precision.

This change makes it so our RollingAverage class maintains all of the data
using BigDecimal and using BigDecimal arithematic operations.

This ensures we have extremely high precision, enabling us to
actually be able print '20 TPS' when TPS is perfect.
2018-09-17 22:32:37 -04:00
Brokkonaut
2b349bb02b The disconnect on packet spam must be called sync (#1452)
And it was called twice, probably forgotten in the patch.
2018-09-17 22:04:47 -04:00
Aikar
fcc2e46edd
Ensure mobs don't spawn out of world border
this is originally what I thought #1333 was, but wasn't, but this is still valid fix
2018-09-17 21:50:02 -04:00
Tassu
03c8b8ec27 Implement furnace cook speed multiplier API. (#1437)
Adds methods `Furnace#getCookSpeedMultiplier()` and
`Furnace#setCookSpeedMultiplier(double)`.

This PR is basically 3516ae34ef for 1.13.

A test plugin may be found [here](https://gist.github.com/supertassu/fade0cce946261732c6299e1ec89290e).
2018-09-17 18:53:27 -04:00
Aikar
f95ffce1af
[Auto] Updated Upstream (Bukkit/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

Bukkit Changes:
4b9a93ec Add BatToggleSleepEvent

CraftBukkit Changes:
a222e4a2 Implement BatToggleSleepEvent
2018-09-17 03:06:34 -04:00
Aikar
32c9917149
[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:
79ada744 SPIGOT-4382: Fix damage_absorbed statistic
2018-09-17 02:46:39 -04:00
Aikar
e1056b7187 I dedicate this to Billy, the one and true dolphin rider
Fixes a data fixer bug
2018-09-17 00:41:20 -04:00
Aikar
9860c9c694
more improvements to expiring map stuff 2018-09-16 03:21:52 -04:00
Aikar
80ee619035
prevent crashes on expiring map desync, dont spam logs 2018-09-16 03:00:28 -04:00
Aikar
d5da5375a6
Override some more methods in ExpiringMap to ensure fix
Seen some warnings of leak still being detected.

I'm not sure what's missing, so I'm adding nearly everything.
2018-09-16 01:04:40 -04:00
Aikar
b6760850b8
fix bug in last bug fix, recursion! 2018-09-16 00:26:32 -04:00
Aikar
2c3e7e48fc
Fix major memory leaks in ExpiringMap
computeIfAbsent would leak as the entry
was never registered into the ttl map

This fixes that ,as well as redesigns cleaning to
not run on every manipulation, and instead to run clean
once per tick per expiring map.
2018-09-16 00:01:48 -04:00
Aikar
30785b9132
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:
94b8708a SPIGOT-4373: Item display colours are white by default
61668436 SPIGOT-4378: Fix mistakenly included code
2018-09-15 19:13:40 -04:00
Aikar
90fd694c4c
Fix loop risk in mob spawning around unloaded chunks
When a mob was about to load a chunk to try to spawn in, we did not
increment the attempt counter, resulting in it being stuck in the mob
spawn loop for a long time and hanging servers.
2018-09-15 13:46:01 -04:00
Aikar
10848b4104
Concurrency and Performance Improvements to DataFixers
Found some more unsafe operations in DataFixers.

Also replaced quite a few bad uses of Map.containsKey

containsKey is a common newbie mistake that "reads" cleaner, but
results in double the performance cost of all map operations as
containsKey in MOST cases where null values are not used is identical to get() == null

Considering how deep datafixers go in call stacks, with tons of map lookups,
this micro optimization could provide some gains.

Additionally, many of the containsKey/get/put style operations were
also a concurrency risk, resulting in multiple computation/insertions.
2018-09-15 13:22:14 -04:00
Aikar
f956f185c8
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Bukkit Changes:
47b9cf30 SPIGOT-4372: LightningStrikeEvent cause API
a9ceda75 Include the plugin channel name in the exception message

CraftBukkit Changes:
a4bdecff SPIGOT-4372: LightningStrikeEvent cause API
34caaf6d SPIGOT-4371: Trident damaged when event cancelled
97315374 SPIGOT-4369: Handle cancelled trident event
bf1c8273 SPIGOT-4370: Remove vehicle if its passenger spawn event was cancelled

Spigot Changes:
6b015b4b SPIGOT-4370: Remove vehicle if its passenger spawn event was cancelled
2018-09-15 12:10:26 -04:00
Aikar
b606122b85
MC-136886: Don't load chunks looking for features - Fixes #1438
I'm sure a few servers have crashed due to this.
2018-09-13 22:36:38 -04:00
Aikar
e0cf98b1ed
Missed a case where fish could load chunks 2018-09-12 21:58:38 -04:00
Aikar
94171733dd
Optimize Biome Mob Lookups for Mob Spawning
Uses an EnumMap as well as a Set paired List for O(1) contains calls
2018-09-12 21:50:34 -04:00
Aikar
c6409382b8
Prevent fish from loading/generating chunks 2018-09-12 21:25:02 -04:00
Aikar
6e203e64cc
Prevent mob spawning from loading chunks 2018-09-12 21:18:31 -04:00
Aikar
fd84aa5c42
Fix pathfinding NPE - Fixes #1435 2018-09-12 21:17:59 -04:00
Aikar
bd4280b9ec
ensure world is set for pathfinders 2018-09-11 19:10:14 -04:00
Zach Brown
9fe29f979c
Merge branch 'master' into pre/1.13 2018-09-11 17:48:17 -04:00
Zach Brown
b380338244
Ensure entity is always dying before Death Event
Prior to this it was possible for plugins to put the server into a never
ending recursive loop until it eventually killed itself.

Fixes GH-1432
2018-09-11 17:38:57 -04:00
Aikar
c563327fa2
Prevent pathfinding and zombie AI from loading chunks 2018-09-11 00:07:19 -04:00
Aikar
87d59fdab4
Prevent fluids from loading chunks - major performance boost 2018-09-10 23:38:16 -04:00
Aikar
2dd8623548
Updated Upstream (CraftBukkit/Spigot)
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:
7033f180 Hoist out synchronisation from ChunkRegionLoader

Spigot Changes:
500ff5d4 Rebuild patches

Additional Paper changes:
Fixed Versioned World Folders to not synchronize on ChunkRegionLoader
Optimized Save Queue even more to use a Long2ObjectOpenHashmap for save map
Add World#getXIfLoaded to IWorldReader to expose it to more places
2018-09-10 23:14:02 -04:00
Aikar
cf1fe85b04
Mob Pathfinding API
Adds an API to allow plugins to instruct a Mob to Pathfind to a Location or Entity

This does not do anything to stop other AI rules from changing the location, so
it is still up to the plugin to control that or override after another goal changed
the location.
2018-09-09 21:50:12 -04:00
Aikar
b3a9fc3bf9
Rename some methods per discussion in channel 2018-09-09 21:45:54 -04:00
Zach Brown
efc0babe91
Stop using transaction id in tab completions
Fixes GH-1417, GH-1424 (probably).

There are other issues in this area, including just how much a mess it
is but we will get to those when we get to those.
2018-09-09 17:52:48 -04:00
Aikar
7c11dbee6d
Forgot to rebuild patches after I fixed things in upstream update 2018-09-09 15:29:22 -04:00
Aikar
6d41af029c
Updated Upstream (Bukkit/CraftBukkit/Spigot)
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

Bukkit Changes:
3e2858f6 SPIGOT-4352: MoistureChangeEvent
5466e281 Add BlockDispenseArmorEvent

CraftBukkit Changes:
3123a069 SPIGOT-4352: MoistureChangeEvent
226db0ea Add BlockDispenseArmorEvent
cd367fa4 Fix bad thread safety in ChunkRegionLoader
3f5ca5f2 SPIGOT-4355: Improve cancelling VehicleEnterEvent

Spigot Changes:
145a37ae Rebuild patches
3f2423cc Rebuild patches
2018-09-09 15:26:56 -04:00
Rick
0305af2c14 Fix view distance API (#1419) 2018-09-09 14:38:27 -04:00
Aikar
05edb779e0
getextPointIndex was not needing to be boxed/nullable 2018-09-09 14:36:51 -04:00
Aikar
16efbae731
Mob Pathfinding API
Adds an API to allow plugins to instruct a Mob to Pathfind to a Location or Entity

This does not do anything to stop other AI rules from changing the location, so
it is still up to the plugin to control that or override after another goal changed
the location.
2018-09-09 14:31:08 -04:00
BillyGalbreath
c755f90933 Allow chests to be placed with NBT (#1425)
This restores vanilla behavior of allowing placed chests to retain any Block Entity Tag data.

Upstream added filtering to chests, breaking vanilla behavior, and preventing use of loot table chests as a reward mechanism.

Upon review, we can find no security risk in allowing players to place a chest with NBT data, as Spawn Eggs, Minecarts, command blocks etc all have their own checks.

Additionally, survival mode players, non op players can not create these items anyways. If a player has Creative or Op, they already have high levels of access.

Plus, Chests aren't the only inventory that could have free form items, so this filter was insufficient anyways.
2018-09-09 12:53:23 -04:00
Aikar
5228a4f24c
Remove deadlock risk in firing async events
The PluginManager incorrectly used synchronization on firing any event
that was marked as synchronous.

This synchronized did not even protect any concurrency risk as
handlers were already thread safe in terms of mutations during event
dispatch.

The way it was used, has commonly led to deadlocks on the server,
which results in a hard crash.

This change removes the synchronize and adds some protection around enable/disable
2018-09-09 01:04:59 -04:00
Zach Brown
1bce77696d
Merge branch 'master' into pre/1.13 2018-09-08 19:12:58 -04:00
Aikar
d617f95f05
[Auto] Updated Upstream (Bukkit/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

Bukkit Changes:
310dc809 Add ServerLoadEvent

CraftBukkit Changes:
19d654bd Add ServerLoadEvent
2018-09-07 23:49:37 -04:00
Max Lee
4e30b91d4e Improve death events (#1362)
* Improve death events

This adds the ability to cancel the events and to specify the sound.
2018-09-07 20:14:48 -04:00
Aikar
2571276390
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-09-07 20:06:35 -04:00
BillyGalbreath
0e749a05b2 Fix #1420 (#1421) 2018-09-07 20:03:38 -04:00
Aikar
62b2a5e05e
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:
632449b6 SPIGOT-4349: End portal has wrong TeleportCause
3eb8af23 SPIGOT-4348: Use online player for setting skull owner if possible
2018-09-06 22:08:35 -04:00
Zach Brown
fb9e60b238
MC-2025 - Save entity AABB to prevent fp wobble
This work is largely a result of the analysis done on the Mojang issue
tracker. See patch header for additional information.
2018-09-04 19:18:06 -04:00
Aikar
2e8340addd
Fix yet another issue with concurrency with datafixers 2018-09-04 01:50:14 -04:00
Aikar
39042c4a36
Fix another case of concurrency issue in data fixers 2018-09-04 00:02:38 -04:00
Aikar
d01d2d8cc5
Fix concurrency issues in DataFixers
We are seeing issues with DataFixers being not thread safe in async chunks
and even in some spigot packet sending code.

There are a few more global objects that are mutated that need to
be synchronized to be safe for use over multiple threads.

There may be more cases, but these are extremely obvious ones.
2018-09-03 22:36:41 -04:00
BillyGalbreath
997190c3e0 Add ray tracing methods to LivingEntity (#1410)
This method will return the Block a player is looking at while taking into consideration the AABB of each block in the path.

For example, you can look through the 1/4 space of air in a Stair block and get the block behind it instead of the Stair block you are looking past.
2018-09-03 19:59:54 -04:00
Aikar
6a3ee6dd09 Check that phantom spawned uuid is set for save/load
Fixes #1408

Spawn eggs wont have a player set
2018-09-03 15:22:41 -04:00
Aikar
d37d04a52f
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2018-09-03 12:31:32 -04:00
Aikar
28557509c5
Remove Pass World Tile Entities patch
Some things break from this, while this was trying to fix other things
since the thing this patch tried to fix still had problems and required
yet another fix, just going to remove this patch.
2018-09-03 12:23:25 -04:00
Aikar
bafdbdcac7 fix typo in patch file 2018-09-03 10:38:28 -04:00