Commit Graph

3594 Commits

Author SHA1 Message Date
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
Aikar
004b92b0e8
[CI-SKIP] Add copy of my checkout-pr script for other team members 2018-09-22 23:32:22 -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
Aikar
cce969a59d
Remove Precondition on name for AttributeModifier
Vanilla allows empty names
2018-09-22 18:42:03 -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
Zach Brown
44406d43b3
Fix up maven stuff hopefully 2018-09-22 12:58:09 -04:00
Aikar
62aa893cdb
Update maven url to new paper domain 2018-09-22 12:29:35 -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
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