Commit graph

1027 commits

Author SHA1 Message Date
Aikar
580ae44414 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
661d97b76d 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
31aa97180b Update Upstream 2018-01-01 16:29:33 -05:00
Zach Brown
fa8db475d6 Update upstream B/CB/S 2017-12-27 22:45:33 -06:00
Shane Freeder
67eb9725e2 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
9ba62bc998 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
c3791a5225 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
8665021cdb 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
ac0ae12415 PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
2017-12-19 22:05:16 -05:00
Aikar
1f44d0b82b 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
db3cc65511 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
497103c507 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
11635988ce Restore broken lighting logic from spigot 2017-12-18 07:35:42 +00:00
Aikar
3d71965eb8 Update upstream 2017-12-17 01:34:54 -05:00
Aikar
602a6e2bee 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
0ef74cf264 Update upstream 2017-12-09 12:37:09 -05:00
Shane Freeder
786d044753 Update B/CB/S 2017-12-05 01:34:10 +00:00
Aikar
f854342c1b Fix AsyncTabCompleteEvent not setting isCommand 2017-11-29 23:36:31 -05:00
Aikar
93477a5b68 Avoid NPE in PathfinderGoalTempt 2017-11-29 22:19:24 -05:00
Shane Freeder
149f6e1511 Fix ClassCastException in tabCompletor (fixes #942) 2017-11-27 16:52:32 +00:00
Aikar
f7f8c59f60 AsyncTabCompleteEvent
Let plugins be able to control tab completion of commands and chat async.

This will be useful for frameworks like ACF so we can define async safe completion handlers,
and avoid going to main for tab completions.

Especially useful if you need to query a database in order to obtain the results for tab
completion, such as offline players.

Also adds isCommand and getLocation to the sync TabCompleteEvent
2017-11-26 22:05:48 -05:00
Shane Freeder
ea4b94d62e Do not use a snapshot for hoppers
In 1.12, Spigot improved their blockstate implementation to take a full
copy of the TE, this allows for a much better snapshot in that it will
actually retain all of the TE's state, it is a much more expensive
implementation. This is also implicated with their backwards compat
for inventories meaning that accessing of a snapshots inventory of a
placed block will actually access the inventory of the live TE, making
creation of a snapshot redundant if the only intent is to interact with
the TEs inventory.

Hoppers are a horrible hit, every attempt to transfer an ItemStack will
result in two TileEntity snapshots, with two hoppers and a double chest
ontop, I managed to log 380 cases per second where a snapshot would have been
taken in cases where the snapshot is redundant.
2017-11-25 17:35:32 +00:00
Aikar
584a612fc0 API to get a BlockState without a snapshot
This allows you to get a BlockState without creating a snapshot, operating
on the real tile entity.

This is useful for where performance is needed
2017-11-24 07:28:57 +00:00
Shane Freeder
4bb7ee49bb Update B/CB 2017-11-24 07:14:38 +00:00
Shane Freeder
902eb624bd Update B/CB 2017-11-20 14:49:40 +00:00
Zach Brown
4966489929 Fix view distance API handling on negative values
Prior to this change, if a player was ever set to have a negative view
distance, an attempt to set them back to the default would fail, leading
to them appearing to be stuck in that state.

Now we just interpret that negative value as a "reset" to default.
2017-11-18 21:45:22 -05:00
Shane Freeder
a907e21341 Update B/CB/S 2017-11-18 03:04:21 +00:00
Shane Freeder
03960c3d95 Update B/CB/S 2017-11-17 09:40:49 +00:00
Shane Freeder
f77372c65e use CB BlockState implementations for captured blocks (Fixes #868) 2017-11-16 12:37:52 +00:00
Zach Brown
0c011b87c5 Merge pull request #935 from avatarmc/prevent-disconnected-logins
Prevent logins from being processed when the player has disconnected
2017-11-15 22:36:56 -05:00
Zach Brown
dfab59dfc7 Fix logic for unconditional xp orb merging
Fixes GH-936
2017-11-13 20:30:45 -05:00
Aikar
64fdf06f84 Use <= instead of < for structure patch
Thankfully I randomly think about code and randomly wondered if I used <= or < here, and caught this!

This would of missed some chunks for the structure at the highest X/Z
2017-11-12 18:51:10 -05:00
killme
d117fd54d1 Prevent logins from being processed when the player has disconnected 2017-11-12 20:04:08 +01:00
Aikar
41afad51da Improve Structures Checking
Improves performance by keying every chunk thats part of a structure to a hashmap
instead of only the first one.

This allows us to avoid iterating the entire structures value set to see
if a block position is inside of a structure.

This should have pretty decent performance improvement to any standard world
that has been around for a whilewith lots of structures due to ineffeciencies
in how MC stores structures (even unloaded chunks has structured data loaded)
2017-11-11 18:47:30 -05:00
Zach Brown
9650c9dddc Add Obfuscation helper for armor change impl
Also alphabetize the importmcdev script... heathens, all of you
2017-11-11 00:07:45 -05:00
pkt77
c849f4f132 Add PlayerArmorChangeEvent
Closes GH-928
2017-11-10 23:46:55 -05:00
BillyGalbreath
f4a7453b2a Add configurable max exp value when merging orbs 2017-11-10 23:04:06 -05:00
BillyGalbreath
222aac9769 PlayerAttemptPickupItemEvent additions 2017-11-10 22:49:53 -05:00
Shane Freeder
c1e786e5b0 Merge pull request '#925' from Brokkonaut/NoAttackSoundsFromVanishedPlayers
Send attack SoundEffects only to players who can see the attacker
2017-11-08 16:27:17 +00:00
Shane Freeder
6d76e5b46a Update B/CB/S 2017-11-08 16:13:57 +00:00
Shane Freeder
ef87e1e584 Revert maven-surefire to prevent a build regression
In some environments, the 2.20.1 version of the maven surefire plugin
can cause builds to fail due to changes in surefire in how it detects
that the forked JVM used for testing is still alive or not.
2017-11-06 23:58:32 +00:00
Shane Freeder
9fd1b06aa8 allow nerfed mobs to jump again
Entity AI tasks are initialized earlier in recent versions
of MC, this means that the fromMobSpawner has not been set
at the point where AI tasks are initilazed and so the goalFloat
will never be populated.

To rectify this, we can rely on the entity tick checking if
the mob is from a spawner each tick, and just initialize the
field should the paper option be enabled. This saves us from
having to modify the call chain in order to pass the fact that
it was created by a mobSpawner earlier.
2017-10-31 15:13:55 +00:00
Brokkonaut
2509fce30a Send attack SoundEffects only to players who can see the attacker 2017-10-31 03:29:53 +01:00
Shane Freeder
cfb274d3af rectify Configurable Cartographer Treasure Maps patch 2017-10-30 13:06:35 +00:00
Brokkonaut
56763aad0d Replace HashSet with fastutil's ObjectOpenHashSet in HashTreeSet
HashSet sometimes uses compareTo() instead of equals() and this breaks the comparison of net.minecraft.server.NextTickListEntry (the only place where HashTreeSet is used).

In this cases duplicate entries could be added to the HashSet of HashTreeSet, because NextTickListEntry.compareTo() does not return 0, even if NextTickListEntry.equals() returns true.

ObjectOpenHashSet never uses compareTo(), so the inconsistencies of NextTickListEntry cause no problems.

Fixes https://github.com/PaperMC/Paper/issues/588
2017-10-20 04:43:02 +02:00
Shane Freeder
c738f996e8 Update B/CB/S 2017-10-29 15:19:21 +00:00
Shane Freeder
16e823a55d Don't send keepalive logger message if we've already disconnected 2017-10-17 21:40:53 +01:00
Riley Park
2d0e7faeb1 Merge pull request #914 from Minecrell/expose-client-protocol-host
Expose client protocol version and virtual host
2017-10-17 11:03:58 -07:00
Shane Freeder
b1fa92a5e4 allow keepalive to wait longer for a client response
and also provide a bit more information in the server
logs so we can work out what is going on.
2017-10-15 14:00:42 +01:00
Zach Brown
689fdea2c7 Add command for listing entities in a world
Port of 303a775fc3

Will display a list of all entities in a world, as well as which chunks
they are in. Hopefully, this will make tracking down chunks with lots of
entities easier.

Only real change from the forge version is that instead of dimension
IDs, we accept world names in the form of a string.

/paper entity list - Lists all entities in the player's current world
/paper entity list minecraft:zombie - Lists all zombies in the player's
current world

/paper entity list * world_nether - Lists all entities in the nether
/paper entity list minecraft:ghast world_nether - Lists all ghasts in
the nether
2017-10-15 17:43:16 -04:00
Shane Freeder
0e26fc4fbb Update CB 2017-10-13 22:07:48 +01:00
Minecrell
90e48db51c Expose client protocol version and virtual host 2017-10-10 18:45:43 +02:00
Shane Freeder
e813ac8f9f Remove lighting patches from spigot that cause more harm than good.
This commit removes two patches from spigot:
please review the patch messages for more information, however;

"Allow Disabling of Random Lighting Updates" potentially leaves chunk light maps in an invalid state, with
how often the server looks at these anyways, this patch really serves a questionable nature, the work is
going to be done, only it's being delayed and allowing the light map to be left in a potentially outdated
state.

"Fix some chunks not being sent to the client" sends chunks before their lighting has been calculated, this
means that the client will recieve chunks before they lighting has been calculated which can cause rendering
artifacts. The original issue around this patch appears to have already been fixed years ago.
2017-10-04 07:02:04 +01:00
Shane Freeder
45c25c868e Update B/CB 2017-10-09 10:15:17 +01:00
Shane Freeder
f618803d57 Revert keepalive back to 15 seconds 2017-10-09 09:49:12 +01:00
Shane Freeder
d649f90be0 Update CB/S 2017-10-07 09:57:38 +01:00
stonar96
3a9f17bc4b Anti Xray v2 (#858) 2017-10-05 14:38:21 +01:00
Shane Freeder
4632195902 Fix patch message (off the main thread!)
Don't tired and push!
2017-10-06 04:27:26 +01:00
Shane Freeder
f23cfe77fe rectify comment derp somebody just to point out 2017-10-05 03:39:51 +01:00
Shane Freeder
58a24b5aaf handle PacketPlayInKeepAlive async
In 1.12.2, Mojang moved the processing of PacketPlayInKeepAlive off the main
thread, while entirely correct for the server, this causes issues with
plugins which are expecting the PlayerQuitEvent on the main thread.

In order to counteract some bad behavior, we will post handling of the
disconnection to the main thread, but leave the actual processing of the packet
on the main thread.
2017-10-05 02:25:41 +01:00
Shane Freeder
2727dfbafc Update craftbukkit 2017-10-01 01:57:01 +01:00
Zach Brown
91e639e718 Update documentation around PlayerJumpEvent 2017-09-29 14:58:24 -04:00
Zach Brown
563ee0f840 Fix build 2017-09-28 18:54:38 -04:00
Zach Brown
6e9bfd7ac6 Patch files need headers, weird isn't it 2017-09-28 18:43:36 -04:00
Zach Brown
12bf7a15ad Add PlayerJumpEvent 2017-09-28 17:38:17 -04:00
Shane Freeder
4a6a473a13 Update metrics to support java 9
http://openjdk.java.net/jeps/223
Java decided to change their versioning scheme and in doing so modified the
java.version system property to return $major[.$minor][.$secuity][-ea], as
opposed to 1.$major.0_$identifier we can handle pre-9 by checking if the "major"
is equal to "1", otherwise, 9+

of course, it really wouldn't be all that simple if they didn't add a quirk, now would it.
valid strings for the major may potentially include values such as -ea to deannotate a pre release
2017-09-26 05:58:52 +01:00
Minecrell
c4553b3936 Disable logger prefix for various plugins bypassing the plugin logger
Some plugins bypass the plugin logger and add the plugin prefix
manually to the log message. Since they use other logger names
(e.g. qualified class names) these would now also appear in the
log. Disable the logger prefix for these plugins so the messages
show up correctly.
2017-09-22 09:47:01 +02:00
Minecrell
a64c8c70da Allow plugins to use SLF4J for logging
SLF4J is a commonly used abstraction for various logging frameworks
such as java.util.logging (JUL) or Log4j. Currently, plugins are
required to do all their logging using the provided JUL logger.
This is annoying for plugins that target multiple platforms or when
using libraries that log messages using SLF4J.

Expose SLF4J as optional logging API for plugins, so they can use
it without having to shade it in the plugin and going through
several layers of logging abstraction.
2017-09-21 16:34:36 +02:00
Minecrell
57d987e936 Handle plugin prefixes in Log4j configuration 2017-09-21 16:18:30 +02:00
Minecrell
8556beee8c Use Log4j IOStreams to redirect System.out/err to logger
Log4j2 provides an optimized implementation of PrintStream that
redirects its output to a logger. Use it instead of a custom
implementation for minor performance improvements and some fixes.

With the old implementation, each call to System.print()
results in a separate line, even though it should not result in
a line break. Log4j's implementation handles it correctly.
2017-09-18 12:07:47 +02:00
Minecrell
03891a7fe5 Update TerminalConsoleAppender to 1.0.0 (updates JLine)
Fixes #879
2017-09-23 19:57:16 +02:00
Riley Park
041250dfb9 Avoid NPE in AdvancementDataWorld thanks to Spigot being dumb 2017-09-21 07:01:40 -07:00
Zach Brown
7be477c2cc Update upstream CB
Fixes GH-887
2017-09-18 22:01:43 -04:00
Aikar
68b6b07086 World can be null for sign conversion, fixes #886 2017-09-18 21:03:45 -04:00
Riley Park
d5dcfbc32d Avoid NPE during CraftBlockEntityState load 2017-09-18 13:39:40 -07:00
Shane Freeder
5ce5ef1c9f Update to 1.12.2, May the Tacos be with you 2017-09-18 12:04:01 +01:00
Shane Freeder
9f7b45a945 Update CB, refactor 0229-Fix-this-stupid-bullshit
Refactored 0229-Fix-this-stupid-bullshit in order to prevent merge conflicts
when spigot decides to update the timer and to provide some form of hint in the
console/log on startup.
2017-09-15 15:37:05 +01:00
Zach Brown
fe190b78a1 Fix race condition with chunks, dead tile entities
Fixes PaperMC/Paper#883 same issue as MinecraftForge/MinecraftForge#4386

A more detailed anaylsis of what is probably going on, courtesy of
@bs2609 and the MCForge Issue Tracker is:

When a chunk is unloaded, the entities and tile entities it contains are
marked for removal. The actual removal (from the world) occurs later,
when the world ticks its entities.
Conversely, when a chunk is loaded, it generally adds its entities to
the world promptly, without queuing.

Here's the normal sequence of events:

Chunk unloaded
Old entities removed
Chunk loaded
New entities added

However, what can happen:

Chunk unloaded
Chunk loaded
New entities added
Old entities removed

This occurs when an unloaded chunk is reloaded before its corresponding
entities have been removed.
2017-09-11 22:21:57 -04:00
Zach Brown
4424c3dec9 Rebuild patches 2017-09-06 22:59:08 -04:00
Shane Freeder
ada06c9e99 Rebuild patches 2017-09-03 01:09:35 +01:00
BillyGalbreath
8fc7933953 LivingEntity#setKiller 2017-08-24 15:18:41 -04:00
Riley Park
cc7b5ac739 Allow specifying a custom "authentication servers down" kick message
Thanks to @phenomax in #855
2017-08-17 16:13:22 -07:00
Shane Freeder
7fc4d26c3f Update CB 2017-08-16 16:47:06 +01:00
Shane Freeder
a6eb798352 Update S 2017-08-12 22:32:01 +01:00
Zach Brown
7a01df109a Merge pull request #853 from Brokkonaut/dragon-egg-falling
I forgot the // Paper comment
2017-08-11 21:39:54 -05:00
Brokkonaut
db39b99f26 I forgot the // Paper comment 2017-08-12 02:23:35 +02:00
Zach Brown
73f04c4828 Don't let Player#getLocale return null
Thanks for reporting @MatrixTunnel
2017-08-11 18:16:00 -05:00
Zach Brown
e70452db81 Remove null values in TileEntity tick list
Because who wouldn't want to tick a null tile entity right?
Fixes GH-851
2017-08-11 17:59:44 -05:00
Shane Freeder
4bf6691021 Update CB 2017-08-11 12:02:53 +01:00
Brokkonaut
3c154072d3 MC-94186 Fix dragon egg falling in lazy chunks
Fixes falling dragon eggs in lazy chunks fall to the block below the last empty block and replacing that block with them.

See also https://bugs.mojang.com/browse/MC-94186
2017-08-11 03:32:07 +02:00
Zach Brown
b8cda19a77 Fix MC-117075: TE Unload Lag Spike
PaperMC port of https://github.com/MinecraftForge/MinecraftForge/pull/4281
2017-08-09 18:11:57 -05:00
Shane Freeder
fbeadaefff Update CB (#846) 2017-08-09 19:44:28 +01:00
BillyGalbreath
19afa58c90 Ocelot despawns should honor nametags and leash (#821) 2017-08-07 22:26:44 -05:00
BillyGalbreath
568f82f3f8 Reset spawner timer when spawner event is cancelled (#819) 2017-08-07 22:25:59 -05:00
chickeneer
0e9f94b07a Fix Nether Portal Creation on cancelled event
Spigot is manipulating the Travel Agents canCreatePortal, but forgot to reset it on cancel

This causes nether portals to not be generated if the event is ever cancelled
2017-08-07 23:08:50 -04:00
Aikar
64b2b87256 Upstream update 2017-08-07 23:05:16 -04:00
DemonWav
2b47debe1e Fix this stupid bullshit 2017-08-06 17:18:20 -05:00
Shane Freeder
23d7d25afe fix construction order in CraftBanner 2017-08-06 16:36:48 +01:00
Shane Freeder
2c4293b0f6 Update B/CB/S 2017-08-05 23:36:47 +01:00
Zach Brown
04e2290f72 Update upstream CB 2017-08-04 22:10:30 -05:00