Commit Graph

2104 Commits

Author SHA1 Message Date
Zach Brown
9f01a14531
Update upstream CB/S
--- work/CraftBukkit
Submodule work/CraftBukkit ba575a5a..b7fea427:
  > SPIGOT-5010: World.getEntities returns entities in border chunks
  > Show incorrect size passed into createInventory

--- work/Spigot
Submodule work/Spigot 093165d1..01d0f046:
  > SPIGOT-4986: EntityActivationRange - Raiders
  > SPIGOT-4988: Setting "mob-spawn-range" in spigot.yml also effects random block ticks
2019-05-30 18:54:25 -05:00
Zach Brown
550e5f8eaf
Fix null display when no version history
Should've been null checked since I made it nullable. String concat
saved us any real damage and so all we saw was "null" shown to users.
Quick check and now we don't.
2019-05-30 18:31:48 -05:00
Zach Brown
de002d43b3
Allow proto chunks to be saved again
Appear to be used more extensively in 1.14. Subject to further review.
2019-05-30 18:22:34 -05:00
Mark Vainomaa
3c6f46936e
Set connection thottle to -1 when Velocity IP forwarding is enabled 2019-05-30 18:46:50 +03:00
Shane Freeder
5405793b86
Don't replace entries in the tracked player map (Fixes #2102) 2019-05-29 05:54:11 +01:00
Shane Freeder
c605be20c7
ChunkMapDistance-CME 2019-05-29 04:25:08 +01:00
simpleauthority
87cc15d6e3 Add BlockSoundGroup to Block and implement 2019-05-28 20:08:59 -07:00
kashike
eb5951cd1c
Merge pull request #2089 from BillyGalbreath/GH2088
MC-114618 - Fix EntityAreaEffectCloud from going negative size
2019-05-28 17:44:32 -07:00
William Blake Galbreath
3c51fa0ac7 MC-114618 - Fix EntityAreaEffectCloud from going negative size 2019-05-28 19:35:06 -05:00
Spottedleaf
af021b9456 Update to 1.14.2 2019-05-28 00:30:44 +01:00
Spottedleaf
01670a5103 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:
e041de28 SPIGOT-4946: Add VillagerCareerChangeEvent

CraftBukkit Changes:
fcb9f90b SPIGOT-4946: Add VillagerCareerChangeEvent
a4a2f679 SPIGOT-4987: Shulkerbox does not save empty slots
2019-05-27 03:57:28 -07:00
Zach Brown
70ce6ce831
Move version command update checking to the implementation
This makes it easier for downstream projects (forks) to replace the
version fetching system with their own. It is as simple as implementing
an interface and overriding the default implementation of
org.bukkit.UnsafeValues#getVersionFetcher()

It also makes it easier for us to organize things like the version
history feature.

Lastly I have updated the paper implementation to check against the site
API rather than against jenkins.
2019-05-27 04:13:41 -05:00
Spottedleaf
7fb12d787e Improve MT-Safety of UserCache (#2080)
We were missing a synchronize on a get if cached method, however
it appears that using a ConcurrentHashMap is a better solution
so readers can avoid locking if they just want a cached value.

Existing synchronization for writers remains untouched, the
ConcurrentHashMap is just so readers can safely read without
synchronization
2019-05-27 01:17:50 -05:00
Spottedleaf
5dc46cd3b2 Move getTypeIfLoaded and friends to IBlockAccess (#2077) 2019-05-27 01:14:14 -05:00
Spottedleaf
90141ff411 Handle gen flag for placeholder getChunkAtAsync (#2079)
Also fix a loadChunk call in heightmap api
2019-05-27 00:17:12 -05:00
Zach Brown
7fe6e643d1
Check property exists before playing chest close sound
There is an artificial delay added to chest close sounds (of 10 ticks)
to make them "feel" more true to vanilla. The problem is that because of
this delay it is possible for the block to be removed by the time the
sound plays.

With 1.14 in the state it is the timing necessary to encounter this
issue has increased.

The correct fix is to just return early if the property checked for in
the TileEntityChest sound method does not exist for the block at the
current location.

Fixes GH-2074
2019-05-26 23:42:39 -05:00
Shane Freeder
e9c7232267
Merge branch 'master' into ver/1.14 2019-05-27 01:16:47 +01:00
Spottedleaf
07762fc610 Revert Don-t-recheck-type-after-setting-a-block.patch 2019-05-26 10:40:12 -07:00
Shane Freeder
d627cfa110
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:
17da3420 Fix reading custom persistent entity data
83783357 SPIGOT-4980: Shields will not be put on cooldown when hit with an axe
8d0f3722 SPIGOT-4752: Fixed inconsistency between isChunkLoaded and chunk load/unload events
3f9f31c3 SPIGOT-4982: Armor disappearing while breaking the armor stand
2019-05-26 02:56:30 +01:00
Shane Freeder
ddab5b61a8
Fix some concurrency issues around world generation (Fixes #2052, #2037) 2019-05-24 11:16:03 +01:00
Shane Freeder
b3aa7dadcd
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:
c45c0a98 SPIGOT-4972: Cannot add contextual data to loot table API
2019-05-24 04:49:27 +01:00
Spottedleaf
c47f54dc88 Add configurable spawn loaded range back (#2051) 2019-05-24 04:12:57 +01:00
Spottedleaf
27731ddb32 Fix /tps (#2066) 2019-05-22 19:57:27 +01:00
Shane Freeder
d9ad4e8bd8
Fix compilation 2019-05-22 05:14:56 +01:00
Shane Freeder
08aaab0105
Remove TPS catchup improvements
These changes are incompatbile as-is with 1.14 due to the Thread.sleep
call, this should ideally be brought back in the future
2019-05-22 04:59:14 +01:00
Shane Freeder
4800d2da2a
improve CraftWorld#isChunkLoaded to use the chunk status
vs just checking that it exists as an updating chunk, as this appears to
be a "the chunk should be loaded, but might not be"
2019-05-21 21:32:47 +01:00
Shane Freeder
034fefceb7
stop CraftWorld#isChunkLoaded from loading chunks 2019-05-21 02:37:47 +01:00
Spottedleaf
d189ac1db3 Fix RegionFileCache#hasRegionFile (#2062)
also remove the pointless synchronization on
RegionFileCache#getRegionFileName
2019-05-20 03:26:17 +01:00
Shane Freeder
6b05c3f8d6
try-with-resources on populate timer (Fixes #2061)
Lets also ignore the fixup patch, that never existed, right? Right.
2019-05-20 02:32:41 +01:00
Shane Freeder
25621957f1
Don't run death logic on dupe entity removals 2019-05-19 20:48:54 +01:00
Shane Freeder
060bc7bbee
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:
4543fb40 SPIGOT-4943: Zombie villager conversion player API.

CraftBukkit Changes:
585b2ebd Tweak thresholds for can't keep up message
91ada5c2 SPIGOT-4956: EntityTameEvent not triggered when taming a Cat
9bda4134 SPIGOT-4943: Zombie villager conversion player API.
5a027071 SPIGOT-4947: Allow setting the content on a lectern
09d00e9f SPIGOT-4938: Call EntityPickupItemEvent for dolphins
a278e445 SPIGOT-4948: Lectern.getInventory should return a LecternInventory

Spigot Changes:
4f661b22 Rebuild patches
2019-05-19 04:16:22 +01:00
Shane Freeder
da3b503596
Restore some entity duplication fix patches 2019-05-18 06:01:44 +01:00
Spottedleaf
2e18e54a83 Fix MinecraftServer#isMainThread (#2046)
See patch notes
2019-05-16 17:27:36 -05:00
Zach Brown
24a5bfb9cb
Fix logic issue with no save proto chunks patch
Should be returning true as a no-op "yes it was saved" rather than false
as a "there was an issue saving"
2019-05-16 16:53:17 -05:00
Shane Freeder
17fe7a1b43
Remove leftover line from spigots tick limiters
Looking over the code, this appears to be one "high risk but hopefully
unlikely that plugins are causing this to break", this line is however
redundant leftovers from spigots tick limiter patch, which should be
doing nothing as-is.
2019-05-15 22:53:13 +01:00
Shane Freeder
2f4fe0962b
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:
f6909573 SPIGOT-4935: Lore deserializes incorrectly from previous versions
dd99c5bb SPIGOT-4929: Beacon inventory getType() returns CHEST
2019-05-15 19:12:22 +01:00
kashike
3a425b3a72
Merge pull request #2029 from Spottedleaf/optimize-datawatcher
Optimize DataWatcher
2019-05-15 01:13:05 -07:00
Spottedleaf
89a1469d3f Resolve memory leak involving TileEntities
Their chunk is set to null before removal, so we kept them around.
2019-05-14 17:19:58 -05:00
Spottedleaf
1672ac6fc1 Fix CraftServer#isPrimaryThread
md_5 changed it so he could shut down the server asynchronously
from watchdog, although we have patches that prevent that type
of behavior for this exact reason.
2019-05-13 23:19:48 -05:00
Zach Brown
6c2a2f2dd2
Re-add dropped keep alive disconnect
Should fix the terminal spam
2019-05-13 23:17:05 -05:00
Spottedleaf
05d074d557 Optimize DataWatcher
The lock in DataWatcher is used to prevent concurrent modifications
to the 'd' field (entries in MCP). However any modifications to
this map only occur on initialization of an Entity in its
constructor. This modification is write-locked.

Every other access is through a readlock, which allows
the threads to pass if there is no thread holding the
writelock.

Since the writelock is only obtained in the constructor
of the Entity, the further readlocks are actually
useless (which get obtained on set, get, etc calls).

The entries field ('d' currently) has also been declared as
Int2ObjectOpenHashMap to avoid autoboxing on put(), get(), etc
calls.
2019-05-13 20:37:18 -07:00
Zach Brown
d84080e6d1
MC 1.14.1 2019-05-13 21:20:58 -05:00
Zach Brown
5e7cfaf718
Add comment to MC-151674 fix
[11:00 PM] kashike: <snip> missed // Paper - MC-151674 comment here
2019-05-12 23:06:28 -05:00
Spottedleaf
4f47cbdb77 Fix MC-151674 Close RegionFiles when they get evicted from cache
https://bugs.mojang.com/browse/MC-151674
2019-05-12 23:57:49 -04:00
Spottedleaf
da850bab55 Review EntityPathfindEvent
Add missing target forward
2019-05-12 23:57:49 -04:00
Spottedleaf
a2db4c09a2 Remove TODO on Add more Zombie API
Testing in game verified the zombie's arms raise and fall correctly
when using the API.
Renamed the OBFHELPER since the method is placed on EntityInsentient
(since we want to conflict on changes).
2019-05-12 23:57:49 -04:00
Spottedleaf
a22dfd8c16 Remove TODO on Add ray tracing methods to LivingEntity
Note: The entity parameter stays 'this' since we want the block the
entity is targetting. This can change based on the block the player
has in their hand (see scaffholding). With a scaffhold in hand, the
scaffhold blocks in the world become solid 1x1x1 cubes, and without they
follow their model's shape.
2019-05-12 23:57:49 -04:00
Spottedleaf
dc97f7d401 Fix TODOs in Optional TNT doesn't move in water
Turns out the doWaterMovement method was never called.
Moved the tracker updates into tick() and delete doWaterMovement
2019-05-12 23:57:49 -04:00
Spottedleaf
5a44b38dc5 Resolve TODO on PlayerNaturallySpawnCreaturesEvent
- Add missing isCancelled check

We don't need to worry about going out of range of int
since the value is clamped to view distance, and view
distance is clamped to 33
2019-05-12 23:57:49 -04:00
Shane Freeder
92e77aa7cb
Merge branch 'master' into ver/1.14 2019-05-10 20:06:21 +01:00
Shane Freeder
150fb7cda8
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:
7d29eb5e SPIGOT-4899: Horse inventory title not set
2019-05-10 19:11:17 +01:00
Shane Freeder
026210202b
Fix MCUtils and other calls to postTaskOnMain
Method changed changed it's role to providing a TickTask object which
isn't automatically scheduled onto the server
2019-05-10 18:42:33 +01:00
Spottedleaf
994679a0c9 Fix patch "Faster redstone torch rapid clock removal" (#2014)
Tux pointed out the patch still has O(n^2) time complexity since
the sublist class in arraylist does not override clear() from
AbstractList, which uses a forward moving iterator to clear
the list.

Resolved by using a peek and poll from ArrayDeque.

This patch also removes the useless WeakHashMap which holds
the list (it mapped world->list) and replaces it with a
field on World.
2019-05-10 16:48:58 +01:00
Shane Freeder
a72509fbe1
Fix accidental reversion of patches, oops 2019-05-09 15:23:52 +01:00
Shane Freeder
7f9b65035a
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:
fe0cadf0 Add BlockShearEntityEvent for Dispensers shearing Sheep
90e5cca3 SPIGOT-4892: Allow to set the currently viewed page of a book on a lectern inventory
a30337f7 SPIGOT-4887: Villager level minimum is 1
d88d828c SPIGOT-4886: Villager type SNOWY should be named SNOW

CraftBukkit Changes:
6ceffb0d SPIGOT-4895: Bed doesn't explode in Nether and The End
ee881847 SPIGOT-4888: setSleepingIgnored resets the night even when there is no one in a bed
15e02b40 SPIGOT-4890: EntityDeathEvent fires twice when breaking an armor stand in survival mode
b38a3c33 Add BlockShearEntityEvent for Dispensers shearing Sheep
70ebefca SPIGOT-4891: LecternInventory.getType() should return InventoryType.LECTERN
0036d1b7 SPIGOT-4887: Villager level minimum is 1
2019-05-09 08:20:01 +01:00
Spottedleaf
8191255cfa Use WorldServer#entitesById for entity iteration
WorldServer#globalEntityList is not the actual list of entities in a world
2019-05-07 18:49:41 -07:00
Spottedleaf
4ebd1808aa Actually write to the tracker field on entity
perhaps we can also look into removing this modification altogether
2019-05-07 18:13:24 -07:00
Shane Freeder
427078900e
Fix a ClassCastException from shooting fireworks 2019-05-07 19:56:32 +01:00
Shane Freeder
39bcf78e87
Fix RegionFileCache write logic 2019-05-07 16:26:55 +01:00
Spottedleaf
9db83af2ab Fix foxes not dropping items 2019-05-07 08:20:32 -07:00
Spottedleaf
cf17353783 Fix tracking dead entities 2019-05-07 06:50:02 -07:00
Shane Freeder
725cf24308
Don't double set air in BlockFire 2019-05-07 13:16:22 +01:00
Spottedleaf
c3534f1340 Fix entities refusing to die and portal search not working 2019-05-07 05:00:51 -07:00
Spottedleaf
bc024aec6e Update upstream 2019-05-06 17:33:26 -07:00
Spottedleaf
b5b481da62 Fix more runtime stuff
Remove chunk neighbour system until we can figure out the chunk system
2019-05-06 17:05:41 -07:00
Spottedleaf
a189bdc0fc Fix some runtime issues 2019-05-06 13:45:02 -07:00
Spottedleaf
e9439e7655 It compiles 2019-05-06 12:30:27 -07:00
Zach Brown
27c7749f42
More compile fixes
- Re-removes Bukkit#getServerName - This was (hopefully?) only added back
  for Timings v2. It should be kept in that scope.

- Intend to let PlayerViewDistance API slip. Given the scope of the
  changes in this area it seems best to let this slip past initial
  release. It can be re-added when there is additional time to focus on it
  and the changed systems it relies on. If it is fixed prior to release
  this is implemented as a single shim patch that can be dropped.
2019-05-06 03:20:16 -04:00
Spottedleaf
8dfd5dc0c4 Fix some more compile errors 2019-05-05 20:53:47 -07:00
Spottedleaf
eeb2ecd789 Update Upstream 2019-05-05 19:58:04 -07:00
Spottedleaf
cb24079b77 More compile error fixes 2019-05-05 17:57:14 -07:00
Spottedleaf
87759ffbb4 Fix some compile errors 2019-05-05 16:24:37 -07:00
Spottedleaf
027575df7f Fix some issues on the list 2019-05-05 14:39:51 -07:00
Spottedleaf
096e29ccfe Shove decompile fixes into the proper patch 2019-05-05 11:09:29 -07:00
Spottedleaf
fede947c28 More 1.14 patches
now we can rebase
2019-05-05 10:19:34 -07:00
Spottedleaf
1fee2081f1 Correct patches 2019-05-05 04:33:40 -07:00
William Blake Galbreath
9673aebba1 more 1.14 stuffs yay! 2019-05-05 06:12:32 -05:00
William Blake Galbreath
997e1c2ad3 More patches for 1.14 2019-05-05 03:33:44 -05:00
Shane Freeder
eb25d664df Even more patches for 1.14 2019-05-05 03:23:25 +01:00
Spottedleaf
acd2bd3c2c More 1.14 patches 2019-04-30 15:51:03 -07:00
Shane Freeder
df6c35d757 Even more patches for 1.14 2019-04-30 02:20:24 +01:00
Spottedleaf
9d3524b908 More 1.14 patches 2019-04-28 20:14:31 -07:00
Spottedleaf
4296582054 More 1.14 patches 2019-04-28 10:59:47 -07:00
Zach Brown
799f6af357
More patches for 1.14
Chunk related stuff will need to be revisted later
2019-04-27 19:24:00 -04:00
Spottedleaf
b4b181a1fb
More 1.14 work 2019-04-27 17:35:50 -04:00
Phoenix616
1183f1aa1e Fix itemframe sound on change 2019-04-27 20:05:20 +01:00
Spottedleaf
36873bf2d6 More 1.14 updates (#1995) 2019-04-26 23:05:36 -04:00
Shane Freeder
818e88dbc5 More work for 1.14 2019-04-26 02:24:00 +01:00
Shane Freeder
7e6db27085 Aim towards real 1.14 2019-04-25 07:53:51 +01:00
Shane Freeder
ab34e2751e A bit more work for 1.14 2019-04-24 03:34:11 +01:00
Shane Freeder
a64c1a03c9 More work towards 1.14 pre5 2019-04-24 02:00:24 +01:00
Shane Freeder
6c3f04049d Initial work on 1.14 pre-5 2019-04-23 10:35:52 +01:00
Shane Freeder
fb25dc17c6 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:
da08d022 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
0cef14e4 Remove draft API from selectEntities

CraftBukkit Changes:
a46fdbc6 Remove outdated build delay.
3697519b SPIGOT-4708: Fix ExactChoice recipes neglecting material
9ead7009 SPIGOT-4677: Add minecraft.admin.command_feedback permission
c3749a23 Remove the Damage tag from items when it is 0.
f74c7b95 SPIGOT-4706: Can't interact with active item
494eef45 Mention requirement of JIRA ticket for bug fixes
51d62dec SPIGOT-4702: Exception when middle clicking certain slots
be557e69 SPIGOT-4700: Add PlayerFishEvent.State.REEL_IN
2019-04-22 22:36:14 +01:00
Shane Freeder
10d58504f7 don't NPE on dimensionmanager toString
CraftBukkit uses vanillas DimensionManager, but does not actually
register its own dimension types, etc, due to vanilla

This causes issues because anything, e.g. command feedback, trying
to print information about the world will often attempt to print out
the dimension name, which ends up throwing an NPE due to the lack of
a registered type, we work around this by just returning the world name,
this is not super elegant, but is the only route that promises not to
break stuff.
2019-04-22 20:20:22 +01:00
Shane Freeder
faf59c3242 Only store oversized values on spawners if needed, and ensure that vanilla values are read when applicable 2019-04-20 19:33:53 +01:00
William Blake Galbreath
f6a78c9715 Mob Spawner API Enhancements 2019-04-19 13:14:10 -05:00
Shane Freeder
90d8377b59 Fix NPE from sign placement (Closes #1963) (Fixes #1917)
This fixes issues with upstreams changes to solve a private issue on
their side, as signs are placed, they may replace existing blocks, e.g.
grass, which breaks upstreams assumption that the sign is always placed
adjacent to a surface
2019-04-17 00:53:55 +01:00
Shane Freeder
9c79f489ed Don't try to read the data outside of the try-catch 2019-04-15 05:09:57 +01:00
Shane Freeder
41c86a6548 Handle bad chunks more gracefully
Brought this patch back from the graveyard, 1.13.x changed how chunks
where loaded and the patch was dropped.

Prior to this change the server would crash when attempting to load a
chunk from a region with bad data.

After this change the server will defer back to vanilla behavior. At
this time, that means attempting to generate a chunk in its place
(and occasionally just not generating anything and leaving small
holes in the world (This might not be accurate as of 1.13.x)).

Should Mojang choose to alter this behavior in the future, this change
will simply defer to whatever that new behavior is.
2019-04-15 05:05:14 +01:00
Spottedleaf
237250c08d Add Heightmap API (#1724)
Resolves #1672 
This API is intended to expose useful heightmaps found in the server to API. This exposes all of the live world heightmaps currently in the server. 
If a heightmap becomes impossible to implement, api spec allows the implementation to throw UnsupportedOperationException (far better than returning some weird unexpected value).

Tested via:
https://gist.github.com/Spottedleaf/5d47f67c55a9fb870251ff344bfeb6b3
2019-04-10 23:36:31 -04:00
Aikar
84386e1631
[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:
7c395d42 SPIGOT-4681: Note about additional world creation on STARTUP
2019-04-08 06:51:36 -04:00
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