Commit Graph

1101 Commits

Author SHA1 Message Date
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