Commit Graph

1181 Commits

Author SHA1 Message Date
Zach Brown
594b647cce
> not even using java8 time API
Gotta get this rocketship up to speed I guess...
2018-03-31 23:30:19 -04:00
Zach Brown
5bad6ba5b6
Easter and April Fools fall on the same day
¯\_(ツ)_/¯
2018-03-31 22:50:11 -04:00
Zach Brown
6f2009754d
Stop explicitly blocking Vanilla Method Profiler
At the time this was re-added, there was concern around how the JIT
would handle the system property that enabled it.

This shouldn't be a problem, and as such we no longer need to block
access to it.

The Vanilla Method Profiler will not provide much to most users however
there is no harm in providing it as an option. For most users, the
recommended and supported method for determining performance issues with
Paper will continue to be Timings.
2018-03-31 14:55:42 -04:00
Shane Freeder
d09826faf2
Flag to disable the channel limit
In some enviroments, the channel limit set by spigot can cause issues,
e.g. servers which allow and support the usage of mod packs.

provide an optional flag to disable this check, at your own risk.
2018-03-31 18:56:49 +01:00
Shane Freeder
ad2cf784b0
Delay initial ping sent to the client 2018-03-31 15:27:41 +01:00
Shane Freeder
fad15a6acc
Update CB/S 2018-03-31 14:30:29 +01:00
Minecrell
16869992a8 Call PaperServerListPingEvent for legacy pings (#1057)
* Make the legacy ping handler more reliable

The Minecraft server often fails to respond to old ("legacy") pings
from old Minecraft versions using the protocol used before the switch
to Netty in Minecraft 1.7.

Due to packet fragmentation[1], we might not have all needed bytes
available when the LegacyPingHandler is called. In this case, it will
run into an error, remove the handler and continue using the modern
protocol.

This is unlikely to happen for the first two revisions of the legacy
ping protocol (used in Minecraft 1.5.x and older) since the request
consists of only one or two bytes, but happens frequently for the
last/third revision introduced in Minecraft 1.6.

It has much larger, variable packet sizes due to the inclusion of
the virtual host (the hostname/port used to connect to the server).

The solution[2] is simple: If we find more than two matching bytes,
we buffer the remaining bytes until we have enough to fully read and
respond to the request.

[1]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h3-11
[2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13

* Add legacy ping support to PaperServerListPingEvent

Add a new method to StatusClient check if the client is a legacy
client that does not support all of the features provided in the
event.
2018-03-30 13:00:01 -04:00
Minecrell
604192da0c Avoid negative server ping player sample counts. Fixes #1067 (#1068) 2018-03-30 12:53:15 -04:00
Mark Vainomaa
aa6c4f29fd Make player data saving configurable (#1063) 2018-03-27 10:45:54 -04:00
Aikar
658eca0c22
Add Setters for ID/Name and add completeByCache for Profile API 2018-03-25 21:50:46 -04:00
Aikar
9b12f54b69
Update upstream 2018-03-25 20:06:44 -04:00
Aikar
c00a8a7a2b
Don't try to complete profile on creation from cache, only on complete()
For one, the wrong API was used that would trigger a network call.
2018-03-25 20:05:30 -04:00
Aikar
cff8ae9644
Use copies for PlayerProfile in PaperServerList and SkullMeta
Don't want to risk mutating players properties in server list (unlikely, but lets be proper)

and Skull also has a setter API, so that should be used too.
2018-03-22 23:32:55 -04:00
Minecrell
e15167251b Add extended PaperServerListPingEvent (#980)
* Drop original implementation for old player sample API

* Add extended PaperServerListPingEvent

Add a new event that extends the original ServerListPingEvent
and allows full control of the response sent to the client.

* Implement deprecated player sample API
2018-03-22 23:19:59 -04:00
Aikar
3f4fa0e839
More improvements to PlayerProfile code
.equals() was wrong
clean up createPlayerProfile code
don't set profile to null if the complete call fails
2018-03-22 21:57:11 -04:00
Aikar
b8a672dd94
Fix Profile Textures and expand PlayerProfile .complete() API
I mistakenly thought .complete() also checked for textures, which was not the case

So the logic was not working as desired.

Also some undesired logic paths lead to textures of the logging in player being dropped, forcing
us to always load the textures immediately again on login, leading to rate limits.

Everythings now good

the .complete() api now will default specify to also complete textures, but you may
pass false to it to skip loading textures.
2018-03-22 21:40:57 -04:00
Aikar
b29f5c05c1
getPlayerUniqueId API
Gets the unique ID of the player currently known as the specified player name
In Offline Mode, will return an Offline UUID

This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
2018-03-22 01:41:44 -04:00
Aikar
b63ac711e0
Check Profile Cache for PlayerProfile API
This ensures we look up the name for ID only Profiles

If the profile is in the UserCache, we can get those details quickly

This should avoid some unnecessary round trips.

Additionally, handle profiles for offline mode to use offline UUID's
2018-03-22 01:28:22 -04:00
Aikar
75640df894
Fix Dragon Server Crashes
If the dragon tries to find "ground" and hits a hole, or off edge,
it will infinitely keep looking for non air and eventually crash.
2018-03-21 20:55:46 -04:00
Aikar
fd54eb21e9
Configurable Unrestricted Signs - Resolves #1054
Bukkit restricts command execution of signs to test if the sender
has permission to run the specified command. This breaks vanilla
maps that use signs to intentionally run as elevated permission.

Bukkit provides an unrestricted advancements setting, so this setting
compliments that one and allows for unrestricted signs.

We still filter sign update packets to strip out commands at edit phase,
however there is no sanity in ever expecting creative mode to not be
able to create signs with any command.

Creative servers should absolutely never enable this.
Non creative servers, enable at own risk!!!
2018-03-21 19:59:54 -04:00
Aikar
723109fa84
Only complete incomplete profiles - Resolves #1053 2018-03-21 19:12:02 -04:00
MiniDigger
9aa5d9ec9b Call PortalCreateEvent for exit portals (#1047) 2018-03-20 14:56:44 -04:00
Brokkonaut
056e5d5953 Add missing registerPlayer in CraftPlayer.showPlayer0 (#1051) 2018-03-20 12:27:00 -04:00
Aikar
b4b649122a
Remove the immediate dispatch optimization and adjust thread executors
hopefully will resolve #1049
2018-03-18 20:09:12 -04:00
Aikar
c2933f8106
Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
2018-03-18 12:32:09 -04:00
Aikar
fb02c91835
Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
2018-03-18 11:46:14 -04:00
Aikar
e3e257562f
Add PlayerProfile.complete() API to trigger skin lookup 2018-03-18 11:31:32 -04:00
Aikar
242e82f25b
Fix more issues with async scheduler and cancelling pending task
was a race condition, so do need to use the head/parsePending logic still
2018-03-17 14:59:03 -04:00
Aikar
09d1277482
Fix isCurrentlyRunning for sync tasks
Not sure where this would of ever been used, but for correctness sake.
2018-03-17 13:14:44 -04:00
Aikar
26b1519733
check that a task is valid before executing incase it was cancelled elsewhere
also set runners in the short circuit path so we know of the pending task incase its long running
2018-03-17 12:58:27 -04:00
Aikar
7dfbe44247
Improved Async Task Scheduler
The Craft Scheduler still uses the primary thread for task scheduling.
This results in the main thread still having to do work as part of the
dispatching of async tasks.

If plugins make use of lots of async tasks, such as particle emitters
that want to keep the logic off the main thread, the main thread still
receives quite a bit of load from processing all of these queued tasks.

Additionally, resizing and managing the pending entries for all of
these asynchronous tasks takes up time on the main thread too.

This commit replaces the implementation of the scheduler when working
with asynchronous tasks, by forwarding calls to the new scheduler.

The Async Scheduler uses a single thread executor for "management" tasks.
The Management Thread is responsible for all adding and dispatching of
scheduled tasks.

The mainThreadHeartbeat will send a heartbeat task to the management thread
with the currentTick value, so that it can find which tasks to execute.

Scheduling of an async tasks also dispatches a management task, ensuring
that any Queue resizing operation occurs off of the main thread.

The async queue uses a complete separate PriorityQueue, ensuring that resize
operations are decoupled from the sync tasks queue.

Additionally, an optimization was made that if a plugin schedules
a single, non repeating, no delay task, that we immediately dispatch it
to the executor pool instead of scheduling it. This avoids an unnecessary
round trip through the queue, as well as will reduce the size growth of the
queue if a plugin schedules lots of asynchronous tasks.
2018-03-16 23:09:51 -04:00
Aikar
87c48cf19d
explicit, not implicit... oops 2018-03-11 14:21:03 -04:00
Aikar
c8027cd453
Disable Implicit Network Manager Flushing
This seems completely pointless, as packet dispatch uses .writeAndFlush.

Things seem to work fine without implicit flushing, but incase issues arise,
provide a System property to re-enable it using improved logic of doing the
flushing on the netty event loop, so it won't do the flush on the main thread.

Renable flushing by passing -Dpaper.implicit-flush=true
2018-03-11 14:15:38 -04:00
Aikar
6b04f82e90
Prevent Frosted Ice from loading/holding chunks 2018-03-10 16:33:49 -05:00
Shane Freeder
ddc8a0ae88
Return null instead of players location on EnderChests opened by plugins 2018-03-10 20:26:05 +00:00
Shane Freeder
77229ce7ab
Add OBFHELPER - InventoryEnderChest#getTileEntity 2018-03-10 17:11:51 +00:00
Shane Freeder
9daa9cec93
Fix NPE when getting location from players EnderChest (fixes #1041) 2018-03-10 13:26:49 +00:00
MiniDigger
09692269ca Toggleable player crits, helps mitigate hacked clients. (#1040)
This is a port of https://github.com/PaperMC/Paper/blob/ver/1.8.8/Spigot-Server-Patches/0040-Toggleable-player-crits-helps-mitigate-hacked-client.patch
Also adds me to the MIT list.
2018-03-09 23:14:47 -05:00
Shane Freeder
af94fec5af
Fix ItemStack.damage OBFHelper (fixes #1036) 2018-03-08 19:41:00 +00:00
Shane Freeder
cdc1dcf02e
Update CB/S 2018-03-08 19:36:35 +00:00
Minecrell
ce30be9781 [CI-SKIP] Add Minecrell to MIT list (#1035)
Change email address for some older patches to make it clear that
they are MIT licensed too.
2018-03-08 07:08:21 -08:00
Aikar
933c0ed1af
Fix ProfilePropertyIterator#remove() recursion bug 2018-03-07 21:03:01 -05:00
Gabscap
ce16fd74ca [CI-SKIP] Add me (Gabscap) to MIT list
And change my used mail address in patch
2018-03-07 13:58:17 +01:00
Aikar
709d95ae00
Add max-player-auto-save-per-tick setting to spread out saves more
This will force the saves to spread over multiple ticks even when many
players auto save interval is aligned, avoiding spikes on large servers.

Closes #1021
2018-03-04 20:20:27 -05:00
Aikar
34e91b6e40
Rename getOwnerUUID to Tameable#getOwnerUniqueId for consistency
for the @kashike, thanks for adding a server diff to use this name!
2018-02-24 01:17:05 -05:00
Shane Freeder
fab6cbe7e7
Update B/CB 2018-02-24 04:03:32 +00:00
Shane Freeder
17e57eb6ce
Extend Player Interact to cover CommandBlocks (@Phoenix616) 2018-02-18 14:39:02 +00:00
Aikar
a64aa09862
Ignore AsyncCatcher setting for Command Dispatch, always force sync
Plugins were abusing this to dispatch commands async anyways.

We will no longer check that flag, and force all commands to be ran sync.

Use a different boolean for allowing things go to through on shutdown/restart instead.

Resolves #1004
Resolves #1005
2018-02-15 00:34:58 -05:00
Aikar
84b0287c54
Fix bug with hopper optimizations when amount > 3 - Closes #1011 2018-02-14 21:30:12 -05:00
Aikar
094bb03a37
Optimize Hoppers
- Lots of itemstack cloning removed. Only clone if the item is actually moved
- Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items.
  However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on.
- Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory
- Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
2018-02-12 23:26:02 -05:00
Nikita Rudy
91bd6a049c Added options to disable additional ore generation in Mesa and Extreme Hills (#1006) 2018-02-12 19:44:50 -05:00
Shane Freeder
c66212c3ce
Update B/CB 2018-02-12 18:04:05 +00:00
Shane Freeder
19b309f63f
Close Structure Window when PlayerInteractEvent is cancelled
This is opened on the client, and so we send a CloseWindow packet
2018-02-12 17:47:26 +00:00
Shane Freeder
89a61a21ef
Update B/CB 2018-02-12 17:37:33 +00:00
Zach Brown
731eab80ed
Fix ArmorStand Item serialization
Broken in 09182f737d
2018-02-01 22:24:37 -05:00
Aikar
9b1ada78c9
Remove warning for custom entities in precreaturespawn, add note to event
We can't fix this. The event will simply not fire for hacky plugins replacing
entity registrations.
2018-01-28 22:50:35 -05:00
Aikar
a485501ce4
improve Profile Fill Events early return logic - #997 2018-01-28 19:40:19 -05:00
Zach Brown
09182f737d
Add ArmorStand Item Meta
This is adds basic item meta for armor stands. It does not add all
possible metadata however.

There are armor, hand, and equipment types, as well as position data
that can also be added here. This initial implementation should serve as
a starting point for future additions in this area.

Fixes GH-559
2018-01-27 20:40:42 -05:00
Zach Brown
f28f199099
Make push based hoppers imitate vanilla bounds
This is vanilla behavior https://i.imgur.com/zMIpRcQ.png
So we have to allow that sort of thing.

Fixes GH-993
2018-01-26 21:28:34 -05:00
Aikar
388f0e1001
MC-99321 - Dont check for blocked double chest for hoppers etc
This is a source of MAJOR lag for hoppers, as well as a gameplay bug.

This removes the necessity to disable the cat on chest behavior to improve performance.

now performance will be improved even if you have cat chest detection on.
2018-01-24 20:08:58 -05:00
Shane Freeder
212a6811db
Update B/CB 2018-01-24 17:31:43 +00:00
Aikar
845fcb7bd7
Fix build due to IDE inserting bad import 2018-01-21 14:12:54 -05:00
Aikar
8173d569d6
Make PlayerProfile.getProperties mutable
Most other collections returned like this is mutable, lets be consistent.
2018-01-21 14:09:41 -05:00
BillyGalbreath
4d7c516cb4 PlayerAdvancementCriterionGrantEvent (#978) 2018-01-21 13:23:34 -05:00
Aikar
5b72a03bcf
Fill Profile Property Events
Allows plugins to populate profile properties from local sources to avoid calls out to Mojang API
to fill in textures for example.

If Mojang API does need to be hit, event fire so you can get the results.

This is useful for implementing a ProfileCache for Player Skulls
2018-01-19 00:55:38 -05:00
Aikar
f193fdb1ab
Add SkullMeta.setPlayerProfile API
This allows you to create already filled textures on Skulls to avoid texture lookups
which commonly cause rate limit issues with Mojang API
2018-01-19 00:38:49 -05:00
Aikar
531981a1cc
Move ProfileWhitelistVerifyEvent to use new PlayerProfile API
Also update javadocs on lookup events to link the new methods to use
2018-01-19 00:12:03 -05:00
Aikar
18e3bf685c
Update Profile Lookup Events to use new PlayerProfile API 2018-01-19 00:03:09 -05:00
Aikar
71c18fd5c9
Add PlayerProfile API to replace GameProfile
This simply provides the base API to create the objects. Further commits will come that adds
adds usage of this API to existing GameProfile based API's, as well as new API's.
2018-01-18 23:19:30 -05:00
Aikar
2f0e48c89a
Check for missing EntityType for PreCreatureSpawnEvent - Resolves #973 2018-01-15 23:44:21 -05:00
Aikar
d5023110eb
Fix "unlimited" max chunk gens per tick setting
hopefully tried to set it to be unlimited in the first place....
2018-01-15 23:43:46 -05:00
Aikar
6068eb129f
PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.

Also a highly more effecient way to blanket block spawns in a world
2018-01-14 17:36:24 -05:00
Aikar
b98f8232e8
Move definition of fields up 2018-01-14 17:15:27 -05:00
Aikar
6a5948b316
PreCreatureSpawnEvent - Closes #917
Adds an event to fire before an Entity is created, so that plugins that need to cancel
CreatureSpawnEvent can do so from this event instead.

Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste
as it's done after the Entity object has been fully created.

Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event
instead and save a lot of server resources.

See: https://github.com/PaperMC/Paper/issues/917
2018-01-14 17:12:13 -05:00
Aikar
7c60dbe814
update upstream for spigot-3764 fix 2018-01-14 16:15:56 -05:00
Aikar
4886fbd3cc
Fix SPIGOT-3764 - Fixes deadlock with Skull Owner changes 2018-01-13 12:29:50 -05:00
Zach Brown
e6f92aecf3
Re-add config option for max squid spawn height
Apparently not only do people actually use it, but upstream missed it.
2018-01-11 16:50:27 -06:00
Zach Brown
d8c81d20d8
Update upstream B/CB/S 2018-01-10 23:31:19 -06:00
Zach Brown
7c27a2af9c
Update patches that slipped through last 2018-01-05 01:30:03 -06:00
Zach Brown
06818d2dd7
Update upstream CB/S 2018-01-05 00:46:00 -06:00
Zach Brown
fc911a20f5
Update upstream B/CB/S 2018-01-04 02:04:31 -06:00
Aikar
13b35536ce
Configurable Max Chunk Gens per Tick
Limit the number of generations that can occur in a single tick, forcing them
to be spread out more.

Defaulting to 10 as an average generation is going to be 3-6ms, which means 10 will
likely cause the server to lose TPS, but constrain how much.

This should result in no noticeable speed reduction in generation for servers not
lagging, and let larger servers reduce this value according to their own desires.
2018-01-01 16:38:34 -05:00
Aikar
baeb737366
Configurable Chunks Sends per Tick setting
Vanilla already had this limited, make it configurable.

Limit how much exploration lags the server
2018-01-01 16:36:23 -05:00
Aikar
c3432c8d29
Update Upstream 2018-01-01 16:29:33 -05:00
Zach Brown
eb0f5adfdc
Update upstream B/CB/S 2017-12-27 22:45:33 -06:00
Shane Freeder
c79d824fcd
Provide a system property to set the keepalive limit
add a system property to allow people to tweak how long the server
will wait for a reply. There is a compromise here between lower and higher
values, lower values will mean that dead connections can be closed sooner,
whereas higher values will make this less sensitive to issues such as spikes
from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer.
2017-12-24 13:44:41 +00:00
Zach Brown
34731dd04e
Restructure lighting queue runnable handling
Instead of overriding add within the queue, never add runnables to the
queue if the light queue is disabled.

This change is made to make timings reports and stacktraces less
confusing for administrators, who prior to this change, would have seen
the lighting queue referenced in both, regardless of whether or not it
was enabled.

This change should not affect performance, nor is it made with the
intent to.
2017-12-22 15:25:01 -06:00
Aikar
fc194dfaae
Ability to apply mending to XP API
This allows plugins that give players the ability to apply the experience
points to the Item Mending formula, which will repair an item instead
of giving the player experience points.

Both an API To standalone mend, and apply mending logic to .giveExp has been added.
2017-12-20 17:50:26 -05:00
Aikar
46394cb8b0
ExperienceOrbMergeEvent
Fired when the server is about to merge 2 experience orbs
Plugins can cancel this if they want to ensure experience orbs do not lose important
metadata such as spawn reason, or conditionally move data from source to target.
2017-12-19 22:57:46 -05:00
Aikar
9f204c2a91
PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
2017-12-19 22:05:16 -05:00
Aikar
2603e833f7
Auto sort enchants on items - Fixes #915
This ensures that enchants are never added in inconsistent order.
The client shows the enchants in a sorted order already

This will auto fix previously created items too on load.
2017-12-19 17:56:13 -05:00
Aikar
c208d652b4
ExperienceOrbs API for Reason/Source/Triggering player
Adds lots of information about why this orb exists.

Replaces isFromBottle() with logic that persists entity reloads too.
2017-12-19 16:46:27 -05:00
Shane Freeder
fa204e45f9
Don't blindly send unlit chunks when lighting updates are allowed
Spigot, by default, disables several mechanisms around how chunks are
lit, if ever, which has forced them to always send chunks before vanilla
would consider them ready to send, causing for lots of issues around
lighting glitches.

Shamefully, the amount of work to relight chunks can be detremental
to some servers, meaning that forcibily disabling light updates can
cause major performance issues.

as such, we make a compromise; if this "feature" is disabled, we will
only send chunks which are actually ready to be sent, otherwise, we
will always send chunks.
2017-12-18 07:37:50 +00:00
Shane Freeder
0f97922ebd
Restore broken lighting logic from spigot 2017-12-18 07:35:42 +00:00
Aikar
099911fbd1
Update upstream 2017-12-17 01:34:54 -05:00
Aikar
b8833f477c
SPIGOT-3699: Fix cloning banner itemstacks
the banner meta would end up with a shared reference to the patterns
2017-12-15 15:57:15 -05:00
Aikar
ad40e694a3
Update upstream 2017-12-09 12:37:09 -05:00
Shane Freeder
a693cb21ab
Update B/CB/S 2017-12-05 01:34:10 +00:00
Aikar
70caa048a8
Fix AsyncTabCompleteEvent not setting isCommand 2017-11-29 23:36:31 -05:00
Aikar
b02a8b65df
Avoid NPE in PathfinderGoalTempt 2017-11-29 22:19:24 -05:00