Commit Graph

1953 Commits

Author SHA1 Message Date
Aikar
2cb75d6cce
[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:
812f66aa SPIGOT-4684: Update persistence of converting zombie villagers
2019-04-08 06:31:50 -04:00
Aikar
c36f206209
Optimize Captured TileEntity Lookup
upstream was doing a containsKey/get pattern, and always doing it at that.
that scenario is only even valid if were in the middle of a block place.

Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
2019-04-06 10:25:21 -04:00
Aikar
0ff0c18238
Improve Cancelled Block Place Tile Entity discardment
We bandaided this logic on a case by case basis before with Loot Tables and Chests,
but that is not the correct fix.

Ultimately we just needed to clear out the captured tile entity list so that the
update calls did not process the tile entity that is no longer even valid.

This solution will ensure ALL placed tile entities data is ignored and not just
the few cases we previously had filters for.
2019-04-06 10:23:05 -04:00
Spottedleaf
6d7b032d2b Only flush to disk on chunk saves if paper.flush-on-save is true (#1942)
The cost of a call to sync() adds up quickly and especially for
HDDs. Playing around generating chunks for a while warranted a
3 min save time on a HDD. This is unacceptable default behaviour
and now the behaviour is hidden behind a flag for server owners
who are OK with taking a hit on saves (although SSDs will not have
this issue remotely as bad, since most of the time was spent seeking).
2019-04-06 05:59:42 -04:00
Zach Brown
bd5b758a92
Clear containers on cancelled place events
It is possible for a container to be brought into the world pre-filled
in place event (thanks NBT!). When the blockplacevent(s) are cancelled
their blockstate is updated in OBC. This triggers them to drop their
inventories.

Rather than screwing with the update method which is used elsewhere, we
can simply clear any inventories once we are told that a plugin intends
to cancel the interaction.

Fixes GH-1831
2019-04-06 00:31:19 -04:00
Spottedleaf
33a5a0f84e
Optimize GameRules to use LinkedHashMap
Previously TreeMap was used which has poor get(K) performance.
2019-04-05 23:25:12 -04:00
Aikar
9dc4d6448b
Numerous fixes to entity related changes
While it wasn't really "broken" before, if plugins use NMS
(which they really should't be) and mess with entity management
themselves, and get it wrong, they could ultimately corrupt our
state expectations.

I've been unable to reproduce any issues locally, but these changes
are the result of me analyzing the code pretty deeply and seeing
about how to make it more durable to abnormal usage.

Any servers seeing oddities, please run with -Ddebug.entities=true
and send me any logs triggered.
2019-04-05 23:08:45 -04:00
Shane Freeder
5c0133110b Revert entityList type in World
Why are plugins accessing this?! Whhhhy?!

For any plugin developers reading this, this are methods in World
specifically for adding entities to the world, aptly called spawnEntity
2019-04-05 13:45:21 +01:00
Zach Brown
86e6d961f0
Update upstream CB
--- work/CraftBukkit
Submodule work/CraftBukkit 0e1cea5a..f40143ef:
  > SPIGOT-4691: Fix custom world generator when placing tiles
2019-04-05 05:17:10 -04:00
Zach Brown
b963196ed5
Default nether void damage to off and allow that 2019-04-05 01:27:37 -04:00
Zach Brown
401cd58e70
Allow configurable nether void height damage
Fixes GH-1804
2019-04-05 01:09:32 -04:00
Zach Brown
58185a044c
Don't throw if a server unregisters the version cmd 2019-04-05 01:09:32 -04:00
Zach Brown
26bbc23a01
Prevent negative in lure times - Fixes GH-1583 2019-04-05 01:09:26 -04:00
Spottedleaf
c4ff33a9e5
Make region files more reliable to write to
Previously we would write to header before writing our chunk data,
which opens a window for corruption (or we would overwrite entirely).
Now the saving process has been changed to follow this chain of events:

1. We always allocate a new space to write so we do not potentially
overwrite and corrupt the current data
2. Write the chunk data first (the order of the fields in
the chunk data isn't relevant though)
3. Flush to disk
4. Write to the region header last
5. Flush to disk
6. Then we free the previous space allocated

With this chain of events it is impossible for a chunk write to corrupt
a region file, unless the operating system has lied and we have NOT flushed
to disk.

However server administrators are still recommended to continue performing
regular backups.

Note that when Mojang finally decides to change their region format
to deal with oversized chunks this patch must be changed to deal with
whatever system they decide to impose.

We also make use of two flushes to disk per chunk save (to ensure
ordering and ensure data has gone to disk), so this will negatively
affect save performance.
2019-04-03 22:24:55 -04:00
Aikar
87a726351b
[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:
7634491f Added Entity#setRotation.

CraftBukkit Changes:
0e1cea5a Added Entity#setRotation.
2019-04-03 04:51:39 -04:00
Spottedleaf
2e43721654
Allow login events to fire only after the server has loaded
Plugins that rely on the async login event to fire can miss the event
if a player tries to log in before the server has loaded.

The solution is to simply block the event threads from executing until
the server has loaded. This will not have an adverse affect on logins
since the event threads are cached and are only used for executing events
asynchronously.
2019-04-03 02:27:09 -04:00
Aikar
e9b353ff02
Updated Upstream (CraftBukkit/Spigot)
We pretty much reverted most of Spigots changes here as ours is better.

I guess least Spigot is trying to get closer to us? but missed..

CraftBukkit Changes:
0bf75bbd SPIGOT-4686: Enchantment ordering nondeterministic

Spigot Changes:
f09662d0 Rebuild patches
2019-04-02 23:27:31 -04:00
Aikar
eb3be0ea5c
Re-add isTypeNotPersistent check
seems CB did something different with that field more than I understood.

So now it permanently doesn't match vanilla? :(
2019-03-29 08:50:52 -04:00
Shane Freeder
761d6ae72e Fix PersistentStructureLegacy NPE on custom worlds
This is caused due to the DimensionManager in CB worlds not being
registered by NMS, we fix this by copying CBs behavior of using the
world providers DimensionManager, vs using the actual dimension manager
of the world
2019-03-29 11:37:20 +00:00
Aikar
f4f4396f0e
Restore vanilla behavior of mob counts for persistent mobs
Now decounts entities that got name tagged or persistent state changed.

Removes a bad CB check that ignored some persistent mobs persistence state.

Vanilla code explicitly only cares 'is this mob persistent?' and if
it is, it is not counted. CB should not of been checking its type state.

Fixes #1922
2019-03-29 03:38:23 -04:00
Aikar
27c32b9344
Fix map rendering issues - Fixes #1796 2019-03-29 03:38:23 -04:00
Aikar
52ebb355bc
Optimize Persistent Data Loading
removes Mineshaft loading legacy as we had pre 1.13.2 to avoid managing
that very large data file from legacy systems.

Previous to 1.13.2 these data files were never loaded to begin with, so they
effectively do not contain valid/relevant data.

These files take a long time to convert on large worlds and crashes the server.

Additionally, cache the result of a file being missing so we don't keep spam checking it.
2019-03-29 03:38:22 -04:00
Aikar
b66154b26e
Fix a concurrency issue with legacy structure data loading
This code could get hit by many threads at once, causing multiple
chunk loads to convert legacy data, leading to all sorts of fun.

Additionally, go ahead and preload it async on world load.
2019-03-29 03:38:22 -04:00
Aikar
a73444b0e1
Reuse buffers for chunk compression to optimize memory use
Instead of allocating a buffer for every chunk compression, reuse
the same 64k sized buffer.

Also stopped doing dynamic compression levels. It wasn't helping enough.

This will improve memory usage and zlib performance of chunk compression.
2019-03-28 23:46:45 -04:00
Aikar
def0033929
Forgot to convert duration to millis per the API expectation for tick event 2019-03-28 01:27:39 -04:00
Aikar
be067fea11
PlayerDeathEvent#getItemsToKeep
Exposes a mutable array on items a player should keep on death.

This allows a cleaner method to implement "Keep certain items on death"
than how plugins currently do it in that it never removes them in first
place, so its safe if the player logs out/server is shutdown before respawn.

Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
2019-03-28 01:12:38 -04:00
Aikar
8f25112b93
Server Tick Events
Fires event at start and end of a server tick
2019-03-27 22:49:29 -04:00
Aikar
af52f138da
Remove light optimization
getting lots of bug reports on light. just going to drop this even though
I really don't see how it could be the source due to my understanding of
the games light engine...

Fixes #1920
2019-03-27 20:46:46 -04:00
Shane Freeder
8383c2b97c 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:
4c8327f7 SPIGOT-4673: EntitySpawnEvent should not be called for players

Spigot Changes:
5629554b Rebuild patches
2019-03-27 18:41:12 +00:00
Aikar
25e5bfe669
Revert "Optimize Bukkit <-> NMS Mapping tables and legacy conversion"
This reverts commit f5e7717214.

Has issues, will fix later
2019-03-26 02:04:09 -04:00
Aikar
4d3f9e2033
Fix issue in last build with null task timings 2019-03-26 01:31:59 -04:00
Aikar
e055103d3d
Improve Timings stack protection more
Ensures in more places that exceptions will not corrupt the Timings stack.

Timings will now better report stack corruption and auto repair itself too.
2019-03-26 00:58:23 -04:00
Aikar
f5e7717214
Optimize Bukkit <-> NMS Mapping tables and legacy conversion
Use O(1) patterns for mapping conversions to improve plugin performance.
Optimize collections used by legacy plugin conversion

This should improve plugin performance across the board
on Paper for both Modern and Legacy Plugins.

Also log how long building those tables takes...
2019-03-26 00:07:20 -04:00
Aikar
e8bbfbfddf
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2019-03-24 23:51:44 -04:00
Shane Freeder
8e9ec4b058 Don't update entity trackers for worlds without players
PlayerList#moveToWorld already untracks the player from the player list,
meaning that we do not need to worry about this untracking players
who've left the world, The server also untracks a player during
disconnect, handing yet another case.

If we don't need to untrack players who've left the world, it should be
reasonably save to do this, as we're not going to be performing any
server->client updates here, which is what this code is intended to do,
and all players should be untracked.
2019-03-24 23:55:05 +00:00
Aikar
95941afd59
missed a spot for pickupDelay fix 2019-03-24 18:15:39 -04:00
Aikar
76fab035d3
don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0

Fixes #1911
2019-03-24 18:12:56 -04:00
Aikar
424b05051b
update metadata refresh approach
same fix, less work needed to do it
2019-03-24 17:48:22 -04:00
Aikar
5fc918bbf1
include chunk gen mobs in natural counting, fix some spawn reasons 2019-03-24 14:11:06 -04:00
Joel Paulien
830137acbe Add PlayerPostRespawnEvent (#1622) 2019-03-24 13:50:42 -04:00
Mark Vainomaa
556259dd97 Add GS4 query event (#1906) 2019-03-24 13:01:31 -04:00
Johnny Cao
0f82626d76 Fixes issues with player interaction preventing metadata from being updated for other players (#1896) 2019-03-24 13:00:42 -04:00
Aikar
76d2a4cb8f
Add a config for mob spawn change, really shouldn't use it
turning this to true allows 1 player to deny other players the ability
to have mobs spawn. It really is a bad idea and reverts back to iffy
mob spawn limits where mob farms in the world stops natural spawns
from occuring.

Really recommend resorting to different solutions than ever using this config.
2019-03-24 12:59:28 -04:00
Aikar
458aa79f63
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:
451bd74e Use gson for decoding version command

CraftBukkit Changes:
51100db8 SPIGOT-4678: Fix placing signs in certain circumstances
2019-03-24 12:33:39 -04:00
Aikar
5368451566
Only count Natural Spawned mobs towards natural spawn mob limit
This resolves the super common complaint about mobs not spawning.

This was ultimately a flaw in the vanilla count algorithim that allows
spawners and other misc mobs to count against the mob limit, which are
not bounded, and can prevent the entire world from spawning new.

I believe Bukkits changes around persistence may of actually made it
worse than vanilla.

This should fully solve all of the issues around it so that only natural
influences natural spawns.
2019-03-24 01:05:20 -04:00
Aikar
e58c65bb37
Entity#getEntitySpawnReason
Allows you to return the SpawnReason for why an Entity Spawned

Pre existing entities will return NATURAL if it was a non
persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
2019-03-24 01:05:20 -04:00
Aikar
81ff6e67f5
Fix a case where mob spawning could load/gen chunks 2019-03-24 01:05:20 -04:00
kashike
2e4520d902 Use proper max length when serialising BungeeCord text component 2019-03-20 21:20:56 -07:00
Shane Freeder
ea855e2b46 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

Developers!: You will need to clean up your work/Minecraft/1.13.2 folder
for this

Also, restore a patch that was dropped in the last upstream

Bukkit Changes:
279eeab3 Fix command description not being set
96e2bb18 Remove debug print from SyntheticEventTest

CraftBukkit Changes:
d3ed1516 Fix dangerously threaded beacons
217a293d Don't relocate joptsimple to allow --help to work.
1be05a21 Prepare for imminent Java 12 release
a49270b2 Mappings Update
5259d80c SPIGOT-4669: Fix PlayerTeleportEvent coordinates for relative teleports

Spigot Changes:
e6eb36f2 Rebuild patches
2019-03-20 01:55:16 +00:00
Shane Freeder
0976d52bbd 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

Please note that this build includes changes to meet upstreams
requirements for nullability annotations. While we aim for a level of
accuracy, these might not be 100% correct, if there are any issues,
please speak to us on discord, or open an issue on the tracker to
discuss.

Bukkit Changes:
9a6a1de3 Remove nullability annotations from enum constructors
3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API

CraftBukkit Changes:
8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep
8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals
39a287b7 Don't ignore newlines in PlayerListHeader/Footer

Spigot Changes:
cf694d87 Add nullability annotations
2019-03-20 00:31:18 +00:00
Zach Brown
c3c889523f
Stop loading entity bounding boxes from NBT
This may be creating more issues than it's solving
cc GH-1806
2019-03-15 23:25:32 -04:00
Mark Vainomaa
bf2be652f0 Add WhitelistToggleEvent (#1899) 2019-03-13 16:51:42 -04:00
Shane Freeder
2828dd1c67 Revert "Don't update snapshot blockstates" (Fixes #1882)
CraftBukkit already checks that we're not trying to copy data
back to the same snapshot, reverting this fixes the ability to
properly update non-snapshot blockstates
2019-03-07 17:21:02 +00:00
Zach Brown
825d17c326
Update upstream B/CB
--- work/Bukkit
Submodule work/Bukkit 96e09e50..0b95b68f:
  > SPIGOT-4650: Charging API for Vex

--- work/CraftBukkit
Submodule work/CraftBukkit f102d882..77ca7ca0:
  > Rebuild patches
  > Improve damage handling of dead entities
  > SPIGOT-4646: Test + fix InventoryWrapper.getContents
  > SPIGOT-4650: Charging API for Vex
2019-03-06 00:46:21 -05:00
Phoenix616
2c9924816f
Improve damage handling of dead entities
Manually applied because of upstream patch file issues.
Upstream 73597ed865
2019-03-06 00:00:34 -05:00
Aikar
9f8a17af2a
[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:
f102d882 SPIGOT-4647: Properly cancel VehicleDamageEvent
ec17d07d Use getBukkitEntity for ExplosionPrimeEvent instead of creating new one
2019-03-05 00:46:37 -05:00
Zach Brown
ffd51cbe2d
Set Zombie lastTick at start of drowned conversion
Fixes GH-1887

Prior to this change, the lastTick value for zombies would be set to
their initial spawn tick. This caused the drowned conversion process to
immediately occur rather than observing the vanilla delay.

Easy fix, just make sure its set again when the process actually starts.

And no, this change has absolutely nothing to do with the other thing.
That's been fixed and remains fixed.
2019-03-04 02:27:27 -05:00
Zach Brown
814356359a
Fire PlayerArmorChangeEvent for more cases 2019-03-03 15:22:30 -05:00
Aikar
f0d45d4eab
Fix crops not popping when no plugin listens to physics 2019-03-03 12:22:24 -05:00
Aikar
21ee8800f8
Remove left over debug from entity slices 2019-03-02 18:52:16 -05:00
Aikar
7e3169e3de
MC-145260: Fix Whitelist On/Off inconsistency - Fixes #1880
Mojang stored whitelist state in 2 places (Whitelist Object, PlayerList)

some things checked PlayerList, some checked object. This moves
everything to the Whitelist object.
2019-03-02 16:23:06 -05:00
Aikar
40e666b44a
Add config to disable light recalculation optimizations
I really don't know how this could break things with light, but wanted to
let it be an option so we can try turning it off to fix some light bug reports
2019-03-02 16:22:01 -05:00
Aikar
a684cde66b
Handle Excessive Signs in Chunks creating too large of packets
Also adds a limit to stop sending Sign data to client after 500
signs per chunk to limit client lag.

Use -DPaper.excessiveSignsLimit=500 to configure that limit, or -1
to disable the limit and let your players be abused.

fixes #1878
2019-03-02 15:30:00 -05:00
Aikar
420ce3aaed
don't check convert signs boolean every sign save
that lookup isn't "cheap", and synchronizes so cache it to a boolean instead
2019-03-02 15:29:09 -05:00
Aikar
58398da145
Remove outbound string length limits on signs, improve codepoint logic
now 80 chars counts multi sized code points the same so 80 chinese
characters would be allowed too.

Removed outbound limit as it doesn't solve the chunk oversize problem.

proper fix for chunk sending in another patch next.
2019-03-02 15:28:04 -05:00
Zach Brown
40f5a94b8f
Remove unnecessary set init I missed in last 2019-02-28 20:04:14 -05:00
Zach Brown
24fed5a3a5
Fix CanDestroy CanPlaceOn on untagged items 2019-02-28 19:52:12 -05:00
Shane Freeder
025a590fbd Apply sign limits to signs text content 2019-02-28 18:07:14 +00:00
Aikar
3ab6da0e4f
Fix incorrect check on vehicle for auto dismount
This fixes an issue where players are dismounted from their horse on logout.
2019-02-28 02:43:38 -05:00
Aikar
2f8bdbfde8
Fix BlockState hashCode optimization patch performance bug
we missed something in updating this patch and accidently left
hashCode as a 0 value. This caused a pretty nasty performance hit
for BlockStateEnum instances as they would be all a hash collision.

This update fixes that and also promotes the optimizations to cover
ALL cases of Block States, not just enums.

While mojang cached hashCode in 1.13, we can still just use a simple
large prime based hashCode that auto increments guaranteeing no overlap.

Additionally, replace all equals with an identity check.
2019-02-28 01:35:06 -05:00
Aikar
906684ff4f
Fix a sign memory leak 2019-02-28 00:47:57 -05:00
Aikar
b2d7ef4f3c
Strip extra Sign data to/from client - Fixes #1876
modified clients can send abnormally large data from the client
to the server and it would get stored on the sign as sent.

the client can barely render around 16 characters as-is, but formatting
codes can get it to be more than 16 actual length.

Set a limit of 80 which should give an average of 16 characters 2
sets of legacy formatting codes which should be plenty for all uses.

This does not strip any existing data from the NBT as plugins
may use this for storing data out of the rendered area.

it only impacts data sent to and from the client.

Set -DPaper.maxSignLength=XX to change limit or -1 to disable
2019-02-28 00:47:50 -05:00
Aikar
47c6e17d45
Improve reliability of Shapeless Recipe logic
per feedback from @liach about a bug with vanillas previous logic
that we essentially just reverted to. complex recipes could run into
cases where a recipe that does have enough items can be unsatisfied
if the items are in certain orders, making them not truely shapeless.

this scenario doesn't occur in vanilla, but users can load custom recipes.

this improves the logic to do some sorting on the lists to improve
chances of matching the recipes harder ingredients before the easier
to satisfy ingredients.

the likelyhood of someone adding a recipe that still fails this is too
extreme to care about. i doubt mojangs implementation is perfect either.

we can improve this logic more later if we actually get bug reports on it.
2019-02-28 00:45:45 -05:00
Aikar
ac5b19c55e
Fix Custom Shapeless Custom Crafting Recipes
Mojang implemented Shapeless different than Shaped

This made the Bukkit RecipeChoice API not work for Shapeless.

This reimplements vanilla logic using the same test logic as Shaped
2019-02-27 21:06:04 -05:00
Aikar
2ced55d05f
Revert "Fix Custom Shapeless Crafting Recipes"
This reverts commit e56f465acd.
2019-02-26 01:25:27 -05:00
Aikar
e56f465acd
Fix Custom Shapeless Crafting Recipes
Mojang implemented Shapeless different than Shaped

Make shaped also support the RecipeChoice API
2019-02-25 21:31:50 -05:00
Aikar
32b9e543d9
BlockDestroyEvent
Adds an event for when the server is going to destroy a current block,
potentially causing it to drop. This event can be cancelled to avoid
the block destruction, such as preventing signs from popping when
floating in the air.

This can replace many uses of BlockPhysicsEvent, as this will not fire
with the same velocity as BPE.
2019-02-25 21:26:12 -05:00
Aikar
0a76e7d1aa
Remove redstone checks for BlockPhysicsEvent as it wasnt working, general optimize
Just make it ignore the event fires when no plugin is listening to it.
2019-02-25 21:26:12 -05:00
Zach Brown
1e38743b1d
Update upstream B/CB/S
Also fixes build as a result of an upstream force push

--- work/Bukkit
Submodule work/Bukkit 217dc08d..d13fdf8c:
  > SPIGOT-4637: Add source block to BlockPhysicsEvent.

--- work/CraftBukkit
Submodule work/CraftBukkit acbba8ba..cb98c6ea:
  > Fix line endings in CraftDefaultPermissions
  > SPIGOT-4637: Add source block to BlockPhysicsEvent.

--- work/Spigot
Submodule work/Spigot 75ee78a0c...4165cd8f4 (commits not present)
  > (Manually Added) - Appears to be a result of an upstream force push
  > (Manually Added) - Changed: SPIGOT-4636: Add creative mode NBT permissions
2019-02-25 04:39:24 -05:00
Aikar
e6fc2d18c3
[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:
acbba8ba SPIGOT-4635: Restore shield damage sound
2019-02-25 02:56:39 -05:00
Aikar
b4e7e439e4
Missed diff on spigot chunk patch
not much concern over it, it would of just misidentified a corrupt chunk as not corrupt
2019-02-23 16:18:46 -05:00
Aikar
7ab257e4f1
Remove ChunkSection debug - #1302
While these logs indicate something is 'off', we've had no reports
of visible 'issues' with entities, and no one is going to take the
time to debug this farther, so just getting rid of the logs so it's
like its never happening!

Ignorance is bliss.
2019-02-23 12:24:23 -05:00
Aikar
17b58d00d8
Unwrap Event Exceptions
This was a useless exception wrapper that ends up making
stack traces harder to read as well as the JVM cutting off
the important parts

Nothing catches this exception, so its safe to just get rid
of it and let the REAL exception bubble down
2019-02-23 12:17:41 -05:00
Aikar
ddab622b9a
Load correct chunks for spawn chunk loading - Fixes #1866
logic was loading the wrong x/z in block coords instead of chunk coords
2019-02-22 00:02:37 -05:00
Aikar
13d1abf01e
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has only been PARTIALLY tested by PaperMC and as with ANY update, please do your own testing

I've tested basic region file saving as well as our oversized chunks approach.

Bukkit Changes:
e167e549 Clarify MerchantInventory#getSelectedRecipe.
3a1d5b8f Apply default permissions by registration order.
c64cc93f Make tags Keyed
ec037ed7 Added a method to get a list of tags
bfb6ef86 Introduce rotation methods to the Vector class
fc727372 Remove draft API from FluidLevelChangeEvent

CraftBukkit Changes:
6430d9c0 SPIGOT-4632: BlockState location is not fixed
14cd1688 Fix CraftInventoryMerchant#getSelectedRecipe if there is no active merchant recipe.
c24abab7 Load custom permissions after default permissions.
bc99dfe8 Make tags Keyed
6fce004f Added a method to get a list of tags

Spigot Changes:
e5e5c7c6 Allow Saving Large Chunks
e8d3881c Rebuild patches
2019-02-21 22:41:40 -05:00
Aikar
825191f069
Fix loot table restriction when replenish is disabled - Fixes #1860 2019-02-16 18:22:35 -05:00
Aikar
84480114eb
Allow Saving of Oversized Chunks - READ COMMIT DETAILS!!!
Please test this build on a local TEST SERVER before sending to your live server!

PaperMC is not responsible for any data loss to your chunks.

-------------------------------------------------------------------

The Minecraft World Region File format has a hard cap of 1MB per chunk.
This is due to the fact that the header of the file format only allocates
a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector.

This limit can be reached fairly easily with books, resulting in the chunk being unable
to save to the world. Worse off, is that nothing printed when this occured, and silently
performed a chunk rollback on next load.

This leads to security risk with duplication and is being actively exploited.

This patch catches the too large scenario, falls back and moves any large Entity
or Tile Entity into a new compound, and this compound is saved into a different file.

On Chunk Load, we check for oversized status, and if so, we load the extra file and
merge the Entities and Tile Entities from the oversized chunk back into the level to
then be loaded as normal.

Once a chunk is returned back to normal size, the oversized flag will clear, and no
extra data file will exist.

This fix maintains compatability with all existing Anvil Region Format tools as it
does not alter the save format. They will just not know about the extra entities.

This fix also maintains compatability if someone switches server jars to one without
this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored.
2019-02-15 20:13:38 -05:00
Aikar
ed62690821
Catch all exceptions thrown by chunk loading
If anything throwable is thrown, be sure its caught too.

Because I totally did new Error() out of javascript habit...

This ensures that chunk loading process cant get stuck due to uncaught errors
2019-02-15 18:33:45 -05:00
Zach Brown
0ecc1545dd
Update upstream CB
--- work/CraftBukkit
Submodule work/CraftBukkit a2dd0e303..51c118b1d:
  > SPIGOT-4619: Incorrect packet order for villager inventories
  > Fix EntityPickupItemEvent getRemaining / PlayerInventory#canHold
2019-02-13 09:07:12 -05:00
Shane Freeder
60d222d330
Fix newline inconsistencies from libraries 2019-02-10 21:53:53 +00:00
Shane Freeder
3ddcf052ae
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:
a8887389 Make AreaEffectCloudApplyEvent cancellable

CraftBukkit Changes:
a2dd0e30 SPIGOT-4615: Missing target event for withers
b26fb374 Update outdated spigot link
2b1940ae Make AreaEffectCloudApplyEvent cancellable
2019-02-10 21:17:18 +00:00
Zach Brown
a5172f8d68
Always run server tests 2019-02-07 00:48:17 -05:00
Aikar
7d5b217d83
Fix logic error in async chunk loading
if a chunk load was cancelled after generating stage started
it would short circuit return with a null.

however this skipped the creation of the loadTask, which some code
would then invoke in requestChunk and trigger an NPE.

This then likely left an incomplete corrupt request in the chunk map
which then crashes servers.

It should fix these isseues
Fixes #1775
Fixes #1743
2019-02-07 00:04:29 -05:00
Shane Freeder
182d4f528f
Fix NPE during server initialization from server list pings 2019-02-06 19:15:46 +00:00
Shane Freeder
e952f6ebe2
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:
43b46cbd SPIGOT-4608: Improve quality of MapMeta APIs

CraftBukkit Changes:
c7ba9790 Fix incorrect method descriptor in previous commit
3d19f011 SPIGOT-4608: Improve quality of MapMeta APIs
2019-02-06 02:19:49 +00:00
Zach Brown
8211569c9a
Only enforce CraftPlayer#remove exception on instances of EntityPlayer
Should be more friendly to plugins that dabble in inheriting NMS
entities.
2019-02-05 07:44:36 -05:00
Zach Brown
28cf2696d4
Block Entity#remove from being called on Players
This doesn't result in the same behavior as other entities and causes
several problems. Anyone ever complain about the "Cannot send chat
message" thing? That's one of the issues this causes, among others.

If a plugin developer can come up with a valid reason to call this on a
Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
2019-02-04 23:43:28 -05:00
Aikar
5ae3895105
Fix Async Tab Completion processing
previous logic was super broken and did not truncate your currently typed
part of the input from the suggestions.
2019-02-04 22:39:00 -05:00
Shane Freeder
abba3d113b
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:
bb813f6f SPIGOT-4605: Warn against hacking physics

CraftBukkit Changes:
2ced0233 Don't handle sync packets for kicked players
d5e96882 SPIGOT-4602: Cache reflection in decompile error workaround

Spigot Changes:
b0f4c22b SPIGOT-4605: Catch more physics problems
2019-02-03 15:34:04 +00:00
Zach Brown
f8058a8187
Fire BlockPistonRetractEvent for all empty pistons
There is an explicit check in the handling code for empty pistons that
prevents sticky pistons from firing the event. However when we look back
at the history we see that this check was originally added so that ONLY
sticky pistons would fire the retract event. I'm not sure why.
1092acbddf

Over the course of several updates, the meaning of that field appears to
have changed from "is NOT sticky" to "is sticky". So now its having the
opposite effect. Only normal pistons fire the retraction event. And like
all things in CB, it's just been carried around since.

If we are to believe the history, the correct fix for this issue is to
flip it so it only fires for sticky pistons, but that puts us in a
bind. It's already firing for non-sticky pistons, changing it now would
likely result in breakage. Furthermore, there is little documentation as
to WHY that was ever intended to be the case.

Instead we opt to remove the check entirely so that the event fires for
all piston types.

Fixes GH-1829
2019-01-31 16:45:43 -05:00