Commit graph

3571 commits

Author SHA1 Message Date
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 d7686f129f
Add ItemStackRecipeChoice Draft API
This is based on Spigots Draft API. This is subject to change

Allows creating recipes that must match isSimilar to full item stack.
2018-09-13 21:41:19 -04:00
Aikar 998bf84e4c
Performance & Concurrency Improvements to Permissions
Modifying of permissions was only half protected, enabling concurrency
issues to occur if permissions were modified async.

While no plugin really should be doing that, modifying operations
are not heavily called, so they are safe to add synchronization to.

Now, all modification API's will be synchronized ensuring safety.

Additionally, hasPermission was victim to a common java newbie mistake
of calling if (containsKey(k)) return get(k), resulting in 2 map lookups.

Optimized it to simply be a single get call cutting permission map
lookups in half.
2018-09-13 20:55:31 -04:00
Zach Brown 298f2a4cdf
Update branch name for GitHub version checking 2018-09-13 12:20:02 -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 d59a313d6d
[CI-SKIP] Use papermc.io domain and add info for plugin devs 2018-09-11 19:50:07 -04:00
Aikar bd4280b9ec
ensure world is set for pathfinders 2018-09-11 19:10:14 -04:00
Zach Brown 320feb400b
[CI-SKIP] Add note on 1.12.2 status to CONTRIBUTING.md 2018-09-11 18:11:28 -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 945f22e082
[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:
381fba2c SPIGOT-4314: Ability to change item in frame without playing sound

CraftBukkit Changes:
1cead628 SPIGOT-4363: Bad colours in leather armor
953e1d60 SPIGOT-4314: Ability to change item in frame without playing sound
2018-09-11 07:11:35 -04:00
Aikar 74548b6fec
[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:
b6bf6aa3 Add option to suppress normal output of 'makePatches' so it only outputs when a patch is changed or created.
2018-09-11 06:41:40 -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
Aikar dbc9a99af9
[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:
022b8c35 SPIGOT-4361: BlockFadeEvent for regular coral
2018-09-09 18:46:43 -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 9ba2d1befb
[CI-SKIP] adjust test server memory flags 2018-09-09 16:59:33 -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
Aikar 55afdc44c9
You can use EntityPathfindEvent to cancel new pathfinds from overriding your current 2018-09-09 14:48:32 -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