Commit graph

226 commits

Author SHA1 Message Date
Aikar
3430a002d1 InventoryCloseEvent Reason API
Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
2018-07-03 21:56:23 -04:00
BillyGalbreath
b7f23ee86d Add config to disable ender dragon legacy check 2018-06-22 10:38:31 -05:00
Aikar
dddd41ac34 Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.

Co-authored-by: Esoteric Enderman <90862990+EsotericEnderman@users.noreply.github.com>
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2018-06-20 23:17:24 -04:00
Brokkonaut
991875920d Add entity knockback events
- EntityKnockbackEvent
- EntityPushedByEntityAttackEvent
- EntityKnockbackByEntityEvent

Co-authored-by: aerulion <aerulion@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2018-06-18 15:46:23 +02:00
Aikar
d68fcd321f PlayerReadyArrowEvent
Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
2018-06-18 01:12:53 -04:00
Aikar
26ade76848 Improve EntityShootBowEvent
Adds missing call to Illagers and also adds Arrow ItemStack to skeletons

== AT ==
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
2013-06-15 19:51:17 -04:00
BillyGalbreath
2d9d74f9a9 Make shield blocking delay configurable 2018-06-16 01:18:16 -05:00
Aikar
4ec0188c4d Print Error details when failing to save player data 2018-06-15 20:37:03 -04:00
Aikar
d50334d6e8 Configurable LootPool luck formula
Rewrites the Vanilla luck application formula so that luck can be
applied to items that do not have any quality defined.

See: https://luckformula.emc.gs for data and details
-----------

The rough summary is:
My goal was that in a pool, when luck was applied, the pool
rebalances so the percentages for bigger items is
lowered and smaller items is boosted.

Do this by boosting and then reducing the weight value,
so that larger numbers are penalized more than smaller numbers.
resulting in a larger reduction of entries for more common
items than the reduction on small weights,
giving smaller weights more of a chance

-----------

This work kind of obsoletes quality, but quality would be useful
for 2 items with same weight that you want luck to impact
in varying directions.

Fishing still falls into that as the weights are closer, so luck
will invalidate junk more.

This change will result in some major changes to fishing formulas.

-----------

I would love to see this change in Vanilla, so Mojang please pull :)
2018-06-15 00:30:32 -04:00
Aikar
809fa1fbea Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
2018-06-10 01:18:49 -04:00
Shane Freeder
d6d2d75fe6 Add EntityTeleportEndGatewayEvent 2018-06-09 14:08:39 +02:00
Aikar
b64e7f96d3 WitchReadyPotionEvent 2018-06-05 22:47:26 -04:00
Aikar
a3b5f969ed WitchThrowPotionEvent
Fired when a witch throws a potion at a player
2018-05-16 20:44:58 -04:00
Aikar
72743537f4 WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
2018-05-16 20:35:16 -04:00
Aikar
40e2712d61 EndermanAttackPlayerEvent
Allow control over whether or not an enderman aggros a player.

This allows you to override/extend the pumpkin/stare logic.
2018-05-01 20:18:54 -04:00
0x22
952a6d631c Fix exploit that allowed colored signs to be created 2018-04-26 04:41:11 -04:00
Aikar
634b639098 Expand World.spawnParticle API and add Builder
Adds ability to control who receives it and who is the source/sender (vanish API)
the standard API is to send the packet to everyone in the world, which is ineffecient.
Adds an option to control the force mode of the particle.

This adds a new Builder API which is much friendlier to use.
2017-08-15 22:29:12 -04:00
Aikar
b4ece1619f EndermanEscapeEvent
Fires an event anytime an enderman intends to teleport away from the player

You may cancel this, enabling ranged attacks to damage the enderman for example.
2018-04-30 13:15:55 -04:00
Brokkonaut
5a528af05e Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities.
2018-04-14 20:20:46 +02:00
Minecrell
0511551203 Call PaperServerListPingEvent for legacy pings 2017-10-11 19:30:51 +02:00
Minecrell
361fc3ab43 Make 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
2017-10-11 18:22:50 +02:00
Aikar
d0d0b1a21e Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.

== AT ==
public-f net.minecraft.world.entity.player.Player gameProfile
2018-03-18 12:29:48 -04:00
Aikar
5fb78725e4 Add more fields to AsyncPreLoginEvent
Co-authored-by: Connor Linfoot <connorlinfoot@me.com>
Co-authored-by: MCMDEV <john-m.1@gmx.de>
2018-03-18 11:45:57 -04:00
Minecrell
ac0c06a72f Implement extended PaperServerListPingEvent 2017-10-11 15:56:26 +02:00
Aikar
a7bc7ca33a Disable Explicit Network Manager Flushing
This seems completely pointless, as packet dispatch uses .writeAndFlush.

Things seem to work fine without explicit 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.explicit-flush=true
2018-03-11 14:13:33 -04:00
MiniDigger | Martin
b9319698ce Toggleable player crits 2018-03-10 00:50:24 +01:00
Shane Freeder
794fc9799b Extend Player Interact cancellation
GUIs are opened on the client, meaning that the server cannot block them from opening,
However, it is possible to close these GUIs from the server.

Flower pots are also not updated on the client when interaction is cancelled, this patch
also resolves this.
2018-02-11 10:43:46 +00:00
BillyGalbreath
ec3ae43c82 Add PlayerAdvancementCriterionGrantEvent 2018-01-19 08:15:29 -06:00
Aikar
4f248b1b5b 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-02 00:31:26 -05:00
Aikar
cad0c129c8 PreCreatureSpawnEvent
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:01:31 -05:00
Aikar
f249b1f39a 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:02 -05:00
Aikar
533b86c3fc PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
2017-12-19 22:02:53 -05:00
Jason Penilla
ed76af5637 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

Co-authored-by: Aikar <aikar@aikar.co>
2017-11-26 13:19:58 -05:00
Aikar
eb20b0b160 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

also Avoid NPE during CraftBlockEntityState load if could not get TE

If Tile Entity was null, correct Sign to return empty lines instead of null
2017-11-06 21:08:22 -05:00
Shane Freeder
1d1c5a4493 use CB BlockState implementations for captured blocks
When modifying the world, CB will store a copy of the affected
blocks in order to restore their state in the case that the event
is cancelled. This change only modifies the collection of blocks
in the world by normal means, e.g. not during tree population,
as the potentially marginal overheads would serve no advantage.

CB was using a CraftBlockState for all blocks, which causes issues
should any block that uses information beyond a data ID would suffer
from missing information, e.g. Skulls.

By using CBs CraftBlock#getState(), we will maintain a proper copy of
the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
2017-11-16 12:12:41 +00:00
mezz
f1fd83ac7a Fix MC-117075: Block entity unload lag spike 2017-08-09 17:51:22 -05:00
killme
3ce6b37e05 Prevent logins from being processed when the player has disconnected 2017-11-12 19:40:01 +01:00
pkt77
540274bcf2 Add PlayerArmorChangeEvent 2017-11-10 23:46:34 -05:00
Brokkonaut
e0661a5f13 Send attack SoundEffects only to players who can see the attacker 2017-10-31 03:26:18 +01:00
Shane Freeder
2c11c3e2bb revert serverside behavior of keepalives
This patch intends to bump up the time that a client has to reply to the
server back to 30 seconds as per pre 1.12.2, which allowed clients
more than enough time to reply potentially allowing them to be less
tempermental due to lag spikes on the network thread, e.g. that caused
by plugins that are interacting with netty.

We also 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-10-15 00:29:07 +01:00
Minecrell
8838089321 Expose client protocol version and virtual host 2017-10-10 18:45:20 +02:00
Shane Freeder
70e24c1b60 handle ServerboundKeepAlivePacket async
In 1.12.2, Mojang moved the processing of ServerboundKeepAlivePacket 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
off the main thread.

also adding some additional logging in order to help work out what is causing
random disconnections for clients.
2017-10-05 01:54:07 +01:00
Zach Brown
8c951e13df Add PlayerJumpEvent 2017-09-28 17:21:44 -04:00
Riley Park
ebbb3ee8b5 Allow specifying a custom "authentication servers down" kick message 2017-08-17 16:08:20 -07:00
BillyGalbreath
d00d3df166 Reset spawner timer when spawner event is cancelled 2017-07-31 01:45:19 -05:00
BillyGalbreath
08aaee1b77 Ocelot despawns should honor nametags and leash 2017-07-31 01:54:40 -05:00
Kyle Wood
0dcb203960 Fix this stupid bullshit
Disable the 15 second sleep when the server jar hasn't been rebuilt within a period of time.

modified in order to prevent merge conflicts when Spigot changes/disables the warning,
and to provide some level of hint without being disruptive.
2017-08-06 17:17:53 -05:00
Aikar
2f6c221649 ProfileWhitelistVerifyEvent 2017-07-03 18:11:10 -05:00
BillyGalbreath
760d9e300f Entity#fromMobSpawner() 2017-06-18 18:17:05 -05:00
Zach Brown
3edcdeaf22 Block player logins during server shutdown 2017-07-02 21:35:56 -05:00