Commit graph

292 commits

Author SHA1 Message Date
Aikar
d39553c217 Rename getOwnerUUID to Tameable#getOwnerUniqueId for consistency
for the @kashike, thanks for adding a server diff to use this name!
2018-02-24 01:16:01 -05:00
Aikar
d285cd8073 Tameable#getOwnerUUID API
This is faster if all you need is the UUID, as .getOwner() will cause
an OfflinePlayer to be loaded from disk.

This method is already implemented on the server, just needed to expose it.
2018-02-24 00:57:03 -05:00
Aikar
3d9d0a7227 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-01-18 01:00:51 -05:00
Shane Freeder
26144e31b3 Update B/CB 2018-02-08 10:07:27 +00:00
Zach Brown
963ddeb6ed Properly flag profile events as async as needed 2018-02-01 23:24:27 -05:00
Aikar
79e1eb906f 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
Zach Brown
690c955207 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
Aikar
8d654f26d3 Make PlayerProfile.getProperties mutable
Most other collections returned like this is mutable, lets be consistent.
2018-01-21 14:09:09 -05:00
BillyGalbreath
b89d7add43 PlayerAdvancementCriterionGrantEvent (#978) 2018-01-21 12:23:34 -06:00
Aikar
0d9f8672b1 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
e06cc30ff7 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
d065e0b00e 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
17bec29ef0 Update Profile Lookup Events to use new PlayerProfile API 2018-01-19 00:03:09 -05:00
Aikar
a7da447b88 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-15 22:13:17 -05:00
Aikar
70f7748553 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
2e05bc73b3 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:02:38 -05:00
Zach Brown
ef505a9a32 Update upstream B/CB/S 2018-01-04 02:04:31 -06:00
Shane Freeder
77f24f0be5 Update B 2017-12-28 16:56:31 +00:00
Zach Brown
fa8db475d6 Update upstream B/CB/S 2017-12-27 22:45:33 -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
4f6b49e007 Always copy completions for #setCompletions in Tab Complete Events
Per feedback on 6364cb2
2017-12-20 01:09:54 -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
0968270200 Make PlayerPickupExperienceEvent extend PlayerEvent 2017-12-19 22:08:28 -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
6364cb2591 AsyncTabCompleteEvent shouldn't store Immutable Lists 2017-12-19 16:52:53 -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
Aikar
7cc544d715 Add World#createExplosion(Location, float, boolean, boolean) API
don't know why this API was missing
2017-12-19 16:25:38 -05:00
Aikar
fa254542bc Display warning on deprecated recipe API
Any plugin still using this API will result in the server saving an inconsistent UUID to player data files,
which then triggers warnings such as "Tried to load unrecognized recipe: bukkit:9e5b92f5-e549-4f47-b0a8-9f89390ed77b removed now."
on the players login.

Plugin authors need to define a key to keep it consistent between server restarts.
2017-12-09 12:42:11 -05:00
Shane Freeder
786d044753 Update B/CB/S 2017-12-05 01:34:10 +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
2a3e13cc52 Fix javadocs 2017-11-25 17:53:42 +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
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
pkt77
c849f4f132 Add PlayerArmorChangeEvent
Closes GH-928
2017-11-10 23:46:55 -05:00
BillyGalbreath
222aac9769 PlayerAttemptPickupItemEvent additions 2017-11-10 22:49:53 -05:00
Zach Brown
f141bae102 Update B/CB/S 2017-11-10 17:31:39 -05:00
Shane Freeder
6d76e5b46a Update B/CB/S 2017-11-08 16:13:57 +00:00
Minecrell
90e48db51c Expose client protocol version and virtual host 2017-10-10 18:45:43 +02:00
Minecrell
4b3dd7c7e8 Deprecate player sample list that includes only the player name 2017-10-12 15:50:17 +02:00
Riley Park
7cecdeca83 Some logging changes 2017-10-03 12:13:38 -04:00
Zach Brown
91e639e718 Update documentation around PlayerJumpEvent 2017-09-29 14:58:24 -04:00
Zach Brown
12bf7a15ad Add PlayerJumpEvent 2017-09-28 17:38:17 -04:00
Minecrell
241a264046 Add workaround for plugins modifying the parent of the plugin logger
Essentials uses a custom logger name ("Essentials") instead of the
plugin logger. Log messages are redirected to the plugin logger by
setting the parent of the "Essentials" logger to the plugin logger.

With our changes, the plugin logger is now also called "Essentials",
resulting in an infinite loop. Make sure plugins can't change the
parent of the plugin logger to avoid this.
2017-09-21 19:44:24 +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
DemonWav
81d69d5889 Move eclipse compiler patch to POM changes patch
Also update to Paperclip 1.1-SNAPSHOT
2017-09-23 13:17:20 -05:00
DemonWav
52c741517f Remove eclipse compiler for Paper-API
Fixes building with JDK9
2017-09-22 20:12:23 -05: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
0ccfc595a4 Cache generated EventExecutors (fixes #786)
the first 'major' change in this PR is to cache the generated event
executrs from the ASM class, by doing this we only generate a single
class for every method that we need an executor for, thus reducing the
number of classes that are needed, especially in cases where plugins
re/unregister events all the time.

The second change is to modify the generated classloader map, generated
classloaders are not held against the plugin itself but the classloader
that the event is declared in, the implication here is that we cannot
drop generated classloaders when a plugin disable, and so we use a guava
weak-key'd hashmap, downfall here is that classes won't be GC'd until
guava drops the generated classloader, however the first change should
deal with most of the grunt.
2017-09-06 21:18:36 +01:00