Commit Graph

3237 Commits

Author SHA1 Message Date
Nassim Jahnke
ec2e3991b9 Add item slot convenience methods
Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
2020-04-25 23:31:28 +02:00
nossr50
83b1a9e372 Add PlayerAttackEntityCooldownResetEvent 2020-03-26 19:30:58 -07:00
MiniDigger | Martin
6143a7a97b Add Player Client Options API 2020-01-20 21:38:34 +01:00
Mariell Hoversholm
21792a6e4b Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format.

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2020-04-30 16:56:31 +02:00
JRoy
a690b2a859 Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
2020-04-10 21:24:35 -04:00
William Blake Galbreath
c0e42aed8a Add tick times API 2020-04-05 22:22:58 -05:00
Trigary
0ee773e88b add hand to BlockMultiPlaceEvent 2020-03-01 22:43:34 +01:00
BillyGalbreath
fbcf4759fb Entity Jump API 2020-02-08 23:26:18 -06:00
William Blake Galbreath
599bf3512d Add ThrownEggHatchEvent
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement
(dispensers can throw eggs to hatch them, too).
2020-02-09 00:19:08 -06:00
Shane Freeder
d4ef0cde59 PlayerDeathEvent#shouldDropExperience 2019-12-24 00:35:31 +00:00
Jake Potrebic
1cf2aaef30 Improve Block#breakNaturally API
Adds bool param to trigger world particle effects

Adds bool param to trigger exp drops for blocks

Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
2020-01-02 12:25:16 -06:00
William Blake Galbreath
9a251fbd95 Expose the internal current tick 2019-04-20 19:47:29 -05:00
Shane Freeder
2cee31307e Set true custom payload channel size limit
This fixes compatibility with some mods that are sending very long channel names. Also gives developers the ability to send longer channel names.
2019-10-18 17:39:05 +01:00
simpleauthority
9fc26a2efb Amend PlayerInteractAtEntityEvent javadoc for ArmorStands 2019-07-11 10:35:56 -07:00
simpleauthority
d2e1163917 Add BlockSoundGroup interface
This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup
2019-05-28 03:41:28 -07:00
William Blake Galbreath
d1b40a9a13 Mob Spawner API Enhancements 2019-04-19 12:41:19 -05:00
Spottedleaf
315e1108a6 Add Heightmap API
Changed to use upstream's heightmap API - Machine_Maker
2018-12-01 19:00:36 -08:00
Aikar
f9af4df79e PlayerDeathEvent#getItemsToKeep
Exposes a mutable array on items a player should keep on death

Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
2013-03-11 20:04:34 -04:00
Aikar
06e00bdd20 Server Tick Events
Fires event at start and end of a server tick
2019-03-27 21:58:55 -04:00
Aikar
2825ece820 Fix Spigot annotation mistakes
while some of these may of been true, they are extreme cases and cause
a ton of noise to plugin developers.

Use ApiStatus.Internal instead of Deprecated for actual internal API
that continues to have use (internally).

These do not help plugin developers if they bring moise noise than value.
2019-03-24 18:39:01 -04:00
Aikar
ded424db46 Fixes and additions to the spawn reason API
Expose an entities spawn reason on the entity.
Pre existing entities will return NATURAL if it was a non
persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.

Additionally, add missing spawn reasons.

Co-authored-by: Aurora <aurora@relanet.eu>
Co-authored-by: Jakub Zacek <dawon@dawon.eu>
2019-03-24 00:21:23 -04:00
MisterVector
452f8cf88b Add PlayerPostRespawnEvent 2018-10-26 21:33:13 -07:00
Mark Vainomaa
86603709de Add GS4 Query event 2019-03-17 21:46:27 +02:00
Mark Vainomaa
13d4e540cf Add WhitelistToggleEvent 2019-03-13 20:04:43 +02:00
Aikar
719f0a0a7e BlockDestroyEvent
Adds an event for when the server is going to destroy a current block,
potentially causing it to drop. This event can be cancelled to avoid
the block destruction, such as preventing signs from popping when
floating in the air.

This can replace many uses of BlockPhysicsEvent
2019-02-06 00:19:33 -05:00
Aikar
fda116f002 Add ItemStack Recipe API helper methods
Allows using ExactChoice Recipes with easier methods

Redirects some of upstream's APIs to these new methods to avoid
usage of magic values and the deprecated RecipeChoice#getItemStack
2014-01-28 19:13:57 -05:00
Zach Brown
9b814929a7 Add APIs to replace OfflinePlayer#getLastPlayed
Currently OfflinePlayer#getLastPlayed could more accurately be described
as "OfflinePlayer#getLastTimeTheirDataWasSaved".

The API doc says it should return the last time the server "witnessed"
the player, whilst also saying it should return the last time they
logged in. The current implementation does neither.

Given this interesting contradiction in the API documentation and the
current defacto implementation, I've elected to deprecate (with no
intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
2019-01-02 00:31:12 -06:00
Spottedleaf
1302332a7e Add PlayerConnectionCloseEvent
This event is invoked when a player has disconnected. It is guaranteed that,
if the server is in online-mode, that the provided uuid and username have been
validated.

The event is invoked for players who have not yet logged into the world, whereas
PlayerQuitEvent is only invoked on players who have logged into the world.

The event is invoked for players who have already logged into the world,
although whether or not the player exists in the world at the time of
firing is undefined. (That is, whether the plugin can retrieve a Player object
using the event parameters is undefined). However, it is guaranteed that this
event is invoked AFTER PlayerQuitEvent, if the player has already logged into
the world.

This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has
been called beforehand, and this event may not be called in parallel with
AsyncPlayerPreLoginEvent for the same connection.

Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding
PlayerConnectionCloseEvent is never called.

The event may be invoked asynchronously or synchronously. As it stands,
it is never invoked asynchronously. However, plugins should check
Event#isAsynchronous to be future-proof.

On purpose, the deprecated PlayerPreLoginEvent event is left out of the
API spec for this event. Plugins should not be using that event, and
how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
is undefined.
2018-10-07 12:05:06 -07:00
DoNotSpamPls
ad83a72cf5 Change the reserved channel check to be sensible 2018-10-23 19:32:55 +03:00
BillyGalbreath
df6c6062ab Add more Zombie API 2018-10-07 04:29:51 -05:00
Shane Freeder
a9d195552e Support cancellation supression of EntityDismount/VehicleExit events"
Entities must be dismounted before teleportation in order to avoid
multiple issues in the server with regards to teleportation, shamefully,
too many plugins rely on the events firing, which means that not firing
these events caues more issues than it solves;

In order to counteract this, Entity dismount/exit vehicle events have
been modified to supress cancellation (and has a method to allow plugins
to check if this has been set), noting that cancellation will be silently
surpressed given that plugins are not expecting this event to not be cancellable.

This is a far from ideal scenario, however: given the current state of this
event and other alternatives causing issues elsewhere, I believe that
this is going to be the best soultion all around.

Improvements/suggestions welcome!
2018-11-18 15:53:43 +00:00
Shane Freeder
d9195b0be3 Make the default permission message configurable 2018-11-18 19:44:54 +00:00
BillyGalbreath
7b3013d59b Add more Witch API 2018-10-12 03:47:26 -05:00
Caleb Bassham
fb826f7221 Add spectator target events
- PlayerStartSpectatingEntityEvent
- PlayerStopSpectatingEntityEvent
2018-09-28 02:30:56 -05:00
BillyGalbreath
342e189485 Turtle API 2018-09-28 17:08:09 -05:00
BillyGalbreath
3ad277b100 Add sun related API 2018-10-07 00:54:15 -05:00
BillyGalbreath
51b4b8a059 Add LivingEntity#getTargetEntity 2018-09-22 00:32:53 -05:00
Phoenix616
63821bf96b PreSpawnerSpawnEvent
This adds a separate event before an entity is spawned by a spawner
which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.

Dropped as it does not apply due to the earlier PreCreatureSpawnEvent patch not being applied
2018-09-18 23:50:10 +01:00
Aikar
6512e0749b Add Material Tags
This adds a bunch of useful and missing Tags to be able to identify items that
are related to each other by a trait.

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Lena Kolb <lenakolb2204@gmail.com>
Co-authored-by: Layla Silbernberg <livsilbernberg@gmail.com>
Co-authored-by: Newwind <newwindserver@gmail.com>
2018-07-17 01:27:15 -04:00
Aikar
119dfa37f0 Material API additions 2018-10-06 21:14:29 -04:00
Tassu
6d98fbc47d Implement furnace cook speed multiplier API
Signed-off-by: Tassu <git@tassu.me>
2018-09-13 08:45:01 +03:00
Aikar
6a9c8c348b 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:51:50 -04:00
Aikar
2983b658fc Mob Pathfinding API
Adds an API to allow plugins to instruct a Mob to Pathfind to a Location or Entity

This does not do anything to stop other AI rules from changing the location, so
it is still up to the plugin to control that or override after another goal changed
the location.

You can use EntityPathfindEvent to cancel new pathfinds from overriding your current.
2018-09-09 12:39:06 -04:00
Phoenix616
9bcb238879 Improve death events
This adds the ability to cancel the death events and to modify the sound
an entity makes when dying. (In cases were no sound should it will be
called with shouldPlaySound set to false allowing unsilencing of silent
entities)

It makes handling of entity deaths a lot nicer as you no longer need
to listen on the damage event and calculate if the entity dies yourself
to cancel the death which has the benefit of also receiving the dropped
items and experience which is otherwise only properly possible by using
internal code.
2018-08-21 01:32:28 +01:00
BillyGalbreath
9ccfc565ff Expose attack cooldown methods for Player 2018-09-04 15:01:54 -05:00
BillyGalbreath
c708d136f7 Add ray tracing methods to LivingEntity 2018-09-03 18:13:53 -05:00
Aikar
8ce80096b6 Async Chunks API
Adds API's to load or generate chunks asynchronously.

Also adds utility methods to Entity to teleport asynchronously.
2016-02-29 17:43:33 -06:00
Sotr
318265a167 Add source block constructor and getChangedBlockData() to BlockPhysicsEvent 2018-08-23 16:14:25 +08:00
cswhite2000
a366055b99 isChunkGenerated API 2018-08-21 19:39:46 -07:00
Zach Brown
6cc3102429 Inventory#removeItemAnySlot 2018-08-28 23:04:06 -04:00
BillyGalbreath
2c612508cb Add More Creeper API 2018-08-24 11:50:16 -05:00
BillyGalbreath
72098bd870 Add PhantomPreSpawnEvent 2018-08-25 19:56:42 -05:00
BillyGalbreath
b589db2d90 Slime Pathfinder Events 2018-08-24 08:18:27 -05:00
Spottedleaf
8170ae9d64 Allow Blocks to be accessed via a long key
The key can be retrieved via methods Location#toBlockKey() and
Block#getBlockKey()

World provides lookup for blocks by long key via method World#getBlockAtKey(long)

The formatting for the key is as follows:

10 bit y|27 bit z|27 bit x

The y value is considered unsigned while z and x are considered two's complement

Y range: [0, 1023]
X, Z range: [-67 108 864, 67 108 863]
2018-08-14 21:42:10 -07:00
Aikar
ffe27211fb Don't use snapshots for Timings Tile Entity reports 2018-08-15 01:19:37 -04:00
Aikar
99bdc0fc19 Ability to get Tile Entities from a chunk without snapshots 2018-08-15 01:04:58 -04:00
Aikar
1dd927ee10 Provide Chunk Coordinates as a Long API
Allows you to easily access the chunks X/z as a long, and a method
to look up by the long key too.
2018-08-04 19:37:35 -04:00
Mark Vainomaa
0961228e4c Add TNTPrimeEvent 2018-07-15 22:17:55 +03:00
BillyGalbreath
cc6614603e AnvilDamageEvent 2018-07-20 23:36:55 -05:00
willies952002
2a9bc8abb9 Expand ArmorStand API
Adds the following:
- Add proper methods for getting and setting items in both hands. Deprecates old methods
- Enable/Disable slot interactions
- Allow using degrees for ArmorStand rotations (via new Rotations class)

Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2018-07-26 02:22:44 -04:00
Aikar
134ca58ee1 Expand Location Manipulation API
Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z);
2018-07-25 01:36:07 -04:00
BillyGalbreath
431acee6c7 SkeletonHorse Additions 2018-07-27 22:36:17 -05:00
Riley Park
f55cc79973 Allow disabling armour stand ticking 2018-08-15 01:26:03 -07:00
BillyGalbreath
d50ba0d9d0 PlayerLaunchProjectileEvent 2018-07-21 03:10:50 -05:00
BillyGalbreath
c3ab659a8a PlayerElytraBoostEvent 2018-07-21 01:59:53 -05:00
BillyGalbreath
d8cc2cf7e6 EnderDragon Events 2018-07-21 01:51:05 -05:00
Aikar
aec70dca41 Entity#getChunk API
Get the chunk the entity is currently registered to
2018-07-04 02:25:48 -04:00
BillyGalbreath
aa4a072807 Allow setting the vex's summoner 2018-10-06 21:47:09 -05:00
Aikar
6d3de60244 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:52:52 -04:00
Brokkonaut
f8562d67ca Add World.getEntity(UUID) API 2018-07-03 16:07:16 +02:00
Aikar
c8a0abe8fd RangedEntity API
Allows you to determine if an entity is capable of ranged attacks,
and to perform an attack.
2018-06-26 21:34:40 -04:00
Aikar
77334adf24 LivingEntity Active Item API
API relating to items being actively used by a LivingEntity
such as a bow or eating food.

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2018-06-29 00:19:19 -04:00
Aikar
fe1b88829d ItemStack API additions for quantity/flags/lore 2018-06-22 22:59:18 -04:00
Aikar
9624ed131b 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>
2017-12-19 16:24:42 -05:00
Brokkonaut
e95376162f 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:40:39 +02:00
Aikar
2533372193 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:09:27 -04:00
BillyGalbreath
85e9ea4189 Add "getNearbyXXX" methods to Location 2018-06-18 00:41:46 -05:00
Aikar
2961c3844c EntityShootBowEvent consumeArrow and getArrowItem API
Adds ability to get what arrow was shot, and control if it should be consumed.
2013-06-15 19:52:04 -04:00
BillyGalbreath
e7267acf84 Make shield blocking delay configurable 2018-06-16 01:17:39 -05:00
Shane Freeder
5cc8f5a0e6 Add EntityTeleportEndGatewayEvent 2018-06-09 13:08:21 +01:00
Aikar
b513a8369d ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
2018-06-05 22:59:50 -04:00
Aikar
a4ea7eef0b WitchReadyPotionEvent
Control what potion the witch readies to use
2018-06-05 22:47:08 -04:00
Aikar
bf8735b85b PotionEffect clone methods 2018-06-03 04:10:13 -04:00
Aikar
0432bbd3a8 Location.toBlockLocation/toCenterLocation()
Convert location objects to their block coordinates, or the center of the block
2018-05-24 21:01:13 -04:00
Aikar
9970e9dfde WitchThrowPotionEvent
Fired when a witch throws a potion at a player
2018-05-16 20:39:09 -04:00
Aikar
045c3d85fe WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
2018-05-16 20:26:16 -04:00
Aikar
4be5a9c1a7 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:17:44 -04:00
Aikar
2a57740d34 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.

This adds a new Builder API which is much friendlier to use.
2017-08-29 23:58:48 -04:00
Aikar
623c56ab78 Location.isChunkLoaded() API 2018-04-30 19:27:31 -04:00
Aikar
f8d5489645 Additional world.getNearbyEntities API's
Provides more methods to get nearby entities, and filter by types and predicates
2018-04-30 17:55:28 -04:00
Aikar
228f9bab1c Enderman.teleportRandomly()
Ability to trigger the vanilla "teleport randomly" mechanic of an enderman.
2018-04-30 13:29:15 -04:00
Aikar
1281d5b384 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:14:30 -04:00
Aikar
92482f8e92 Add Ban Methods to Player Objects
Allows a more logical API for banning players.

player.banPlayer("Breaking the rules");
2018-04-28 10:28:50 -04:00
Mark Vainomaa
a97f03a018 Add openSign method to HumanEntity 2018-04-01 02:28:43 +03:00
Minecrell
16b17bdc68 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.
2017-10-11 19:30:20 +02:00
Aikar
635e3fa1fa 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:39:28 -04:00
Aikar
4447307899 Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
2018-03-18 12:28:55 -04:00
Minecrell
2eaa723e96 Add extended PaperServerListPingEvent
Add a new event that extends the original ServerListPingEvent
and allows full control of the response sent to the client.
2017-10-11 15:55:38 +02:00
Aikar
bb5e4dd0eb 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:43:30 -04:00
Aikar
4198da1e99 Tameable#getOwnerUniqueId API
This is faster if all you need is the UUID, as .getOwner() will cause
an OfflinePlayer to be loaded from disk.
2018-02-24 00:55:52 -05:00