Merge branch 'master' into pre/1.13

This commit is contained in:
Shane Freeder 2018-08-17 05:10:45 +01:00
commit 039d6f2f75
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C
18 changed files with 225 additions and 87 deletions

View file

@ -1,4 +1,4 @@
From 38e2e079115d4abb46751d6f46fa47a4b11a3e10 Mon Sep 17 00:00:00 2001
From d97433ee8959c0eb3fc72716910954cd5abb85bd Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 21:46:46 -0500
Subject: [PATCH] Basic PlayerProfile API
@ -7,10 +7,10 @@ Provides basic elements of a PlayerProfile to be used by future API/events
diff --git a/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
new file mode 100644
index 000000000..1a69e5f75
index 000000000..529c53760
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PlayerProfile.java
@@ -0,0 +1,141 @@
@@ -0,0 +1,142 @@
+package com.destroystokyo.paper.profile;
+
+import javax.annotation.Nonnull;
@ -140,6 +140,7 @@ index 000000000..1a69e5f75
+ * This is a blocking operation and should be done asynchronously.
+ *
+ * Optionally will also fill textures.
+ * @param textures controls if we should fill the profile with texture properties
+ * @return If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)
+ */
+ boolean complete(boolean textures);

View file

@ -1,4 +1,4 @@
From a2f75206786a9be627fbdb0c6e1597b6a38db782 Mon Sep 17 00:00:00 2001
From 0cd8ed512dd2fde1f4d765f39a8cf35c8f91184c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 3 Jul 2017 18:11:34 -0500
Subject: [PATCH] ProfileWhitelistVerifyEvent
@ -9,10 +9,10 @@ Allows you to do dynamic whitelisting and change of kick message
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
new file mode 100644
index 00000000..a11f811e
index 000000000..b57fff9fb
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
@@ -0,0 +1,110 @@
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2017 - Daniel Ennis (Aikar) - MIT License
+ *
@ -66,7 +66,7 @@ index 00000000..a11f811e
+ }
+
+ /**
+ * Gets the currently planned message to send to the user if they are not whitelisted
+ * @return the currently planned message to send to the user if they are not whitelisted
+ */
+ public String getKickMessage() {
+ return kickMessage;
@ -87,7 +87,7 @@ index 00000000..a11f811e
+ }
+
+ /**
+ * Whether the player is whitelisted to play on this server (whitelist may be off is why its true)
+ * @return Whether the player is whitelisted to play on this server (whitelist may be off is why its true)
+ */
+ public boolean isWhitelisted() {
+ return whitelisted;
@ -95,20 +95,21 @@ index 00000000..a11f811e
+
+ /**
+ * Changes the players whitelisted state. false will deny the login
+ * @param whitelisted The new whitelisted state
+ */
+ public void setWhitelisted(boolean whitelisted) {
+ this.whitelisted = whitelisted;
+ }
+
+ /**
+ * Returns if the player obtained whitelist status by having op
+ * @return if the player obtained whitelist status by having op
+ */
+ public boolean isOp() {
+ return isOp;
+ }
+
+ /**
+ * Returns if the server even has whitelist on
+ * @return if the server even has whitelist on
+ */
+ public boolean isWhitelistEnabled() {
+ return whitelistEnabled;

View file

@ -1,4 +1,4 @@
From 8bffb1aba48a936533d74a68f400ae6303304909 Mon Sep 17 00:00:00 2001
From 87499be0ee0fda808bf4d85547ccf0ad8f979ba3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:17:09 -0500
Subject: [PATCH] AsyncTabCompleteEvent
@ -13,7 +13,7 @@ completion, such as offline players.
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
new file mode 100644
index 00000000..3071320e
index 000000000..3c51aaf92
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
@@ -0,0 +1,168 @@
@ -154,7 +154,7 @@ index 00000000..3071320e
+ * If true, the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
+ * or current player names will not be called.
+ *
+ * @param handled
+ * @param handled if this completion should be marked as being handled
+ */
+ public void setHandled(boolean handled) {
+ this.handled = handled;
@ -170,7 +170,7 @@ index 00000000..3071320e
+
+ /**
+ * Will provide no completions, and will not fire the synchronous process
+ * @param cancelled
+ * @param cancelled true if you wish to cancel this event
+ */
+ @Override
+ public void setCancelled(boolean cancelled) {
@ -186,7 +186,7 @@ index 00000000..3071320e
+ }
+}
diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
index a6229839..f0bc3563 100644
index a6229839c..f0bc3563f 100644
--- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
+++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
@@ -1,5 +1,6 @@

View file

@ -1,4 +1,4 @@
From 246c2b730fc89acda50ad511ea306ca32c9818b7 Mon Sep 17 00:00:00 2001
From cff523453dbefafaa591ff7ba1567e5f27317670 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 17:38:07 -0500
Subject: [PATCH] Ability to apply mending to XP API
@ -10,7 +10,7 @@ of giving the player experience points.
Both an API To standalone mend, and apply mending logic to .giveExp has been added.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 22b8cb916..805faaf35 100644
index 17c74f0ce..15bcb2929 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -963,12 +963,33 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
@ -40,8 +40,8 @@ index 22b8cb916..805faaf35 100644
+ *
+ * Can also be called with {@link #giveExp(int, boolean)} by passing true to applyMending
+ *
+ * @param amount
+ * @return
+ * @param amount Exp to apply
+ * @return the remaining experience
+ */
+ public int applyMending(int amount);
+ // Paper end

View file

@ -1,4 +1,4 @@
From 7991f82af6e972ee2ff68cb2c3d777f5226999e8 Mon Sep 17 00:00:00 2001
From 4ddcdfd0c5c246dc6af8d57823b7acfeb3dadc92 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 17:55:28 -0400
Subject: [PATCH] Additional world.getNearbyEntities API's
@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's
Provides more methods to get nearby entities, and filter by types and predicates
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 4e07af2e..49d2cc45 100644
index 9f3d805c2..f9d8b14c6 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2,11 +2,14 @@ package org.bukkit;
@ -24,7 +24,7 @@ index 4e07af2e..49d2cc45 100644
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
@@ -435,6 +438,205 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -435,6 +438,238 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Collection<Entity> getEntitiesByClasses(Class<?>... classes);
@ -32,7 +32,8 @@ index 4e07af2e..49d2cc45 100644
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param loc Center location
+ * @param radius X Radius
+ * @param radius Radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius);
@ -43,6 +44,7 @@ index 4e07af2e..49d2cc45 100644
+ * @param loc Center location
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius);
@ -54,6 +56,7 @@ index 4e07af2e..49d2cc45 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius);
@ -63,6 +66,8 @@ index 4e07af2e..49d2cc45 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param loc Center location
+ * @param radius X Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double radius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius, predicate);
@ -73,6 +78,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param loc Center location
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xzRadius, double yRadius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate);
@ -84,6 +91,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public default Collection<LivingEntity> getNearbyLivingEntities(Location loc, double xRadius, double yRadius, double zRadius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate);
@ -93,6 +102,7 @@ index 4e07af2e..49d2cc45 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param loc Center location
+ * @param radius X/Y/Z Radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius);
@ -103,6 +113,7 @@ index 4e07af2e..49d2cc45 100644
+ * @param loc Center location
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius);
@ -114,6 +125,7 @@ index 4e07af2e..49d2cc45 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius);
@ -123,6 +135,8 @@ index 4e07af2e..49d2cc45 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param loc Center location
+ * @param radius X/Y/Z Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double radius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius, predicate);
@ -133,6 +147,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param loc Center location
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xzRadius, double yRadius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius, predicate);
@ -144,6 +160,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public default Collection<Player> getNearbyPlayers(Location loc, double xRadius, double yRadius, double zRadius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius, predicate);
@ -154,6 +172,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param clazz Type to filter by
+ * @param loc Center location
+ * @param radius X/Y/Z radius to search within
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double radius) {
+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null);
@ -165,6 +185,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param loc Center location
+ * @param xzRadius X/Z radius to search within
+ * @param yRadius Y radius to search within
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null);
@ -177,6 +199,8 @@ index 4e07af2e..49d2cc45 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null);
@ -187,6 +211,9 @@ index 4e07af2e..49d2cc45 100644
+ * @param clazz Type to filter by
+ * @param loc Center location
+ * @param radius X/Y/Z radius to search within
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double radius, Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate);
@ -198,19 +225,25 @@ index 4e07af2e..49d2cc45 100644
+ * @param loc Center location
+ * @param xzRadius X/Z radius to search within
+ * @param yRadius Y radius to search within
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, Location loc, double xzRadius, double yRadius, Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate);
+ }
+
+ /**
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param loc Center location
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ */
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param loc Center location
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends Entity> clazz, Location loc, double xRadius, double yRadius, double zRadius, Predicate<T> predicate) {
+ if (clazz == null) {
+ clazz = Entity.class;

View file

@ -1,4 +1,4 @@
From f07a9db92dd5b0017c2cbd316a15fe3ee338057b Mon Sep 17 00:00:00 2001
From e831b67f4b5d0f76e11013e2557b6caa23810b78 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 29 Aug 2017 23:58:48 -0400
Subject: [PATCH] Expand World.spawnParticle API and add Builder
@ -11,10 +11,10 @@ This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
new file mode 100644
index 000000000..f7aa162fb
index 000000000..feebfb653
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
@@ -0,0 +1,378 @@
@@ -0,0 +1,416 @@
+package com.destroystokyo.paper;
+
+import com.google.common.collect.Lists;
@ -52,6 +52,8 @@ index 000000000..f7aa162fb
+ /**
+ * Sends the particle to all receiving players (or all).
+ * This method is safe to use Asynchronously
+ *
+ * @return a reference to this object.
+ */
+ public ParticleBuilder spawn() {
+ if (this.location == null) {
@ -74,6 +76,7 @@ index 000000000..f7aa162fb
+ /**
+ * Changes what particle will be sent
+ * @param particle The particle
+ * @return a reference to this object.
+ */
+ public ParticleBuilder particle(Particle particle) {
+ this.particle = particle;
@ -105,6 +108,7 @@ index 000000000..f7aa162fb
+ * Sends this particle to all players in the world. This is rather silly and you should likely not be doing this.
+ *
+ * Just be a logical person and use receivers by radius or collection.
+ * @return a reference to this object.
+ */
+ public ParticleBuilder allPlayers() {
+ this.receivers = null;
@ -113,6 +117,7 @@ index 000000000..f7aa162fb
+
+ /**
+ * @param receivers List of players to receive this particle, or null for all players in the world
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(@Nullable List<Player> receivers) {
+ // Had to keep this as we first made API List<> and not Collection, but removing this may break plugins compiled on older jars
@ -123,6 +128,7 @@ index 000000000..f7aa162fb
+
+ /**
+ * @param receivers List of players to receive this particle, or null for all players in the world
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(@Nullable Collection<Player> receivers) {
+ this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
@ -131,6 +137,7 @@ index 000000000..f7aa162fb
+
+ /**
+ * @param receivers List of players to be receive this particle, or null for all players in the world
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(Player... receivers) {
+ this.receivers = receivers != null ? Lists.newArrayList(receivers) : null;
@ -142,6 +149,7 @@ index 000000000..f7aa162fb
+ * If you want a more spherical check, see {@link #receivers(int, boolean)}
+ *
+ * @param radius amount to add on all axis
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(int radius) {
+ return receivers(radius, radius);
@ -153,6 +161,7 @@ index 000000000..f7aa162fb
+ * If byDistance is true, radius is tested by distance in a spherical shape
+ * @param radius amount to add on each axis
+ * @param byDistance true to use a spherical radius, false to use a cuboid
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(int radius, boolean byDistance) {
+ if (!byDistance) {
@ -181,6 +190,7 @@ index 000000000..f7aa162fb
+ *
+ * @param xzRadius amount to add on the x/z axis
+ * @param yRadius amount to add on the y axis
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(int xzRadius, int yRadius) {
+ return receivers(xzRadius, yRadius, xzRadius);
@ -193,6 +203,7 @@ index 000000000..f7aa162fb
+ * @param xzRadius amount to add on the x/z axis
+ * @param yRadius amount to add on the y axis
+ * @param byDistance true to use a cylinder shape, false to use cuboid
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(int xzRadius, int yRadius, boolean byDistance) {
+ if (!byDistance) {
@ -223,6 +234,7 @@ index 000000000..f7aa162fb
+ * @param xRadius amount to add on the x axis
+ * @param yRadius amount to add on the y axis
+ * @param zRadius amount to add on the z axis
+ * @return a reference to this object.
+ */
+ public ParticleBuilder receivers(int xRadius, int yRadius, int zRadius) {
+ if (location == null) {
@ -241,6 +253,7 @@ index 000000000..f7aa162fb
+ /**
+ * Sets the source of this particle for visibility concerns (Vanish API)
+ * @param source The player who is considered the source
+ * @return a reference to this object.
+ */
+ public ParticleBuilder source(Player source) {
+ this.source = source;
@ -257,6 +270,7 @@ index 000000000..f7aa162fb
+ /**
+ * Sets the location of where to spawn the particle
+ * @param location The location of the particle
+ * @return a reference to this object.
+ */
+ public ParticleBuilder location(Location location) {
+ this.location = location.clone();
@ -269,6 +283,7 @@ index 000000000..f7aa162fb
+ * @param x X location
+ * @param y Y location
+ * @param z Z location
+ * @return a reference to this object.
+ */
+ public ParticleBuilder location(World world, double x, double y, double z) {
+ this.location = new Location(world, x, y, z);
@ -285,6 +300,7 @@ index 000000000..f7aa162fb
+ /**
+ * Sets the number of particles to spawn
+ * @param count Number of particles
+ * @return a reference to this object.
+ */
+ public ParticleBuilder count(int count) {
+ this.count = count;
@ -293,18 +309,21 @@ index 000000000..f7aa162fb
+
+ /**
+ * Particle offset X. Varies by particle on how this is used
+ * @return Particle offset X.
+ */
+ public double offsetX() {
+ return offsetX;
+ }
+ /**
+ * Particle offset Y. Varies by particle on how this is used
+ * @return Particle offset Y.
+ */
+ public double offsetY() {
+ return offsetY;
+ }
+ /**
+ * Particle offset Z. Varies by particle on how this is used
+ * @return Particle offset Z.
+ */
+ public double offsetZ() {
+ return offsetZ;
@ -312,6 +331,10 @@ index 000000000..f7aa162fb
+
+ /**
+ * Sets the particle offset. Varies by particle on how this is used
+ * @param offsetX Particle offset X
+ * @param offsetY Particle offset Y
+ * @param offsetZ Particle offset Z
+ * @return a reference to this object.
+ */
+ public ParticleBuilder offset(double offsetX, double offsetY, double offsetZ) {
+ this.offsetX = offsetX;
@ -322,6 +345,7 @@ index 000000000..f7aa162fb
+
+ /**
+ * Gets the Particle extra data. Varies by particle on how this is used
+ * @return the extra particle data
+ */
+ public double extra() {
+ return extra;
@ -329,6 +353,8 @@ index 000000000..f7aa162fb
+
+ /**
+ * Sets the particle extra data. Varies by particle on how this is used
+ * @param extra the extra particle data
+ * @return a reference to this object.
+ */
+ public ParticleBuilder extra(double extra) {
+ this.extra = extra;
@ -337,6 +363,8 @@ index 000000000..f7aa162fb
+
+ /**
+ * Gets the particle custom data. Varies by particle on how this is used
+ * @param <T> The Particle data type
+ * @return the ParticleData for this particle
+ */
+ public <T> T data() {
+ //noinspection unchecked
@ -345,6 +373,9 @@ index 000000000..f7aa162fb
+
+ /**
+ * Sets the particle custom data. Varies by particle on how this is used
+ * @param data The new particle data
+ * @param <T> The Particle data type
+ * @return a reference to this object.
+ */
+ public <T> ParticleBuilder data(T data) {
+ this.data = data;
@ -357,6 +388,7 @@ index 000000000..f7aa162fb
+ * If false, the particle will show according to the client's particle settings.
+ *
+ * @param force true to force, false for normal
+ * @return a reference to this object.
+ */
+ public ParticleBuilder force(boolean force) {
+ this.force = force;
@ -366,6 +398,8 @@ index 000000000..f7aa162fb
+ /**
+ * Sets the particle Color.
+ * Only valid for REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT.
+ * @param color the new particle color
+ * @return a reference to this object.
+ */
+ public ParticleBuilder color(Color color) {
+ return color(color.getRed(), color.getGreen(), color.getBlue());
@ -374,6 +408,10 @@ index 000000000..f7aa162fb
+ /**
+ * Sets the particle Color.
+ * Only valid for REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT.
+ * @param r red color component
+ * @param g green color component
+ * @param b blue color component
+ * @return a reference to this object.
+ */
+ public ParticleBuilder color(int r, int g, int b) {
+ if (particle != Particle.REDSTONE && particle != Particle.SPELL_MOB && particle != Particle.SPELL_MOB_AMBIENT) {
@ -394,7 +432,7 @@ index 000000000..f7aa162fb
+ }
+}
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
index 4d0acaf5b..0ae85d855 100644
index 4d0acaf5b..255efab76 100644
--- a/src/main/java/org/bukkit/Particle.java
+++ b/src/main/java/org/bukkit/Particle.java
@@ -21,8 +21,8 @@ public enum Particle {
@ -408,13 +446,15 @@ index 4d0acaf5b..0ae85d855 100644
SPELL_WITCH,
DRIP_WATER,
DRIP_LAVA,
@@ -82,6 +82,14 @@ public enum Particle {
@@ -82,6 +82,16 @@ public enum Particle {
return dataType;
}
+ // Paper start - Particle API expansion
+ /**
+ * Creates a {@link com.destroystokyo.paper.ParticleBuilder}
+ *
+ * @return a {@link com.destroystokyo.paper.ParticleBuilder} for the particle
+ */
+ public com.destroystokyo.paper.ParticleBuilder builder() {
+ return new com.destroystokyo.paper.ParticleBuilder(this);
@ -424,10 +464,10 @@ index 4d0acaf5b..0ae85d855 100644
* Options which can be applied to redstone dust particles - a particle
* color and size.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index cf5bd1540..ef1494dee 100644
index f9d8b14c6..5630c624a 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1709,7 +1709,57 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -1742,7 +1742,57 @@ public interface World extends PluginMessageRecipient, Metadatable {
* the type of this depends on {@link Particle#getDataType()}
* @param <T> Type
*/

View file

@ -1,4 +1,4 @@
From 859fbcc49fee34e570ef93b1cedeea6129c923d7 Mon Sep 17 00:00:00 2001
From 80c1d5d792249102bb1e09659b279183a743c174 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 1 May 2018 20:17:44 -0400
Subject: [PATCH] EndermanAttackPlayerEvent
@ -9,10 +9,10 @@ This allows you to override/extend the pumpkin/stare logic.
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
new file mode 100644
index 00000000..55912659
index 000000000..ab5a7a6b5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EndermanAttackPlayerEvent.java
@@ -0,0 +1,92 @@
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -62,6 +62,8 @@ index 00000000..55912659
+
+ /**
+ * The enderman considering attacking
+ *
+ * @return The enderman considering attacking
+ */
+ @Override
+ public Enderman getEntity() {
@ -70,6 +72,8 @@ index 00000000..55912659
+
+ /**
+ * The player the Enderman is considering attacking
+ *
+ * @return The player the Enderman is considering attacking
+ */
+ public Player getPlayer() {
+ return player;

View file

@ -1,4 +1,4 @@
From 4c4ed4d357e2ee60585351f515c1e2ef82754042 Mon Sep 17 00:00:00 2001
From d902c6cdb1dfed8c8eafff0a513e91a87186c94e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 16 May 2018 20:26:16 -0400
Subject: [PATCH] WitchConsumePotionEvent
@ -7,7 +7,7 @@ Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
new file mode 100644
index 00000000..e3035110
index 000000000..790218998
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchConsumePotionEvent.java
@@ -0,0 +1,64 @@
@ -36,7 +36,7 @@ index 00000000..e3035110
+ }
+
+ /**
+ * Gets the potion the witch will consume and have the effects applied.
+ * @return the potion the witch will consume and have the effects applied.
+ */
+ public ItemStack getPotion() {
+ return potion;
@ -77,7 +77,7 @@ index 00000000..e3035110
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
new file mode 100644
index 00000000..6ef6367b
index 000000000..6ef6367b6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchThrowPotionEvent.java
@@ -0,0 +1,33 @@

View file

@ -1,4 +1,4 @@
From 148d9f989050de122ceed7cbc9ee8f3a74affc28 Mon Sep 17 00:00:00 2001
From 21c4e3b980684039972f488f9c55ca46586258c4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 22:47:08 -0400
Subject: [PATCH] WitchReadyPotionEvent
@ -7,10 +7,10 @@ Control what potion the witch readies to use
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
new file mode 100644
index 00000000..5082662a
index 000000000..0e0c6da71
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/WitchReadyPotionEvent.java
@@ -0,0 +1,71 @@
@@ -0,0 +1,74 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.Material;
@ -31,6 +31,9 @@ index 00000000..5082662a
+
+ /**
+ * Fires thee event, returning the desired potion, or air of cancelled
+ * @param witch the witch whom is readying to use a potion
+ * @param potion the potion to be used
+ * @return The ItemStack to be used
+ */
+ public static ItemStack process(Witch witch, ItemStack potion) {
+ WitchReadyPotionEvent event = new WitchReadyPotionEvent(witch, potion);
@ -46,7 +49,7 @@ index 00000000..5082662a
+ }
+
+ /**
+ * Gets the potion the witch is readying to use
+ * @return the potion the witch is readying to use
+ */
+ public ItemStack getPotion() {
+ return potion;

View file

@ -1,11 +1,11 @@
From 557a8969ea196e6da7dea055516a9b66c30ec492 Mon Sep 17 00:00:00 2001
From 98993bdab959f99ca850a5ab7b767a5b56547688 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 18 Jun 2018 00:41:46 -0500
Subject: [PATCH] Add "getNearbyXXX" methods to Location
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 916238c4..c1689168 100644
index 916238c4d..162a76e8b 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -8,6 +8,15 @@ import org.bukkit.configuration.serialization.ConfigurationSerializable;
@ -24,7 +24,7 @@ index 916238c4..c1689168 100644
/**
* Represents a 3-dimensional position in a world.
* <br>
@@ -514,6 +523,194 @@ public class Location implements Cloneable, ConfigurationSerializable {
@@ -514,6 +523,228 @@ public class Location implements Cloneable, ConfigurationSerializable {
centerLoc.setZ(getBlockZ() + 0.5);
return centerLoc;
}
@ -49,6 +49,7 @@ index 916238c4..c1689168 100644
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X Radius
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius);
@ -58,6 +59,7 @@ index 916238c4..c1689168 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius);
@ -68,6 +70,7 @@ index 916238c4..c1689168 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z radius
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius);
@ -75,7 +78,9 @@ index 916238c4..c1689168 100644
+
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X Radius
+ * @param radius Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius, predicate);
@ -85,6 +90,8 @@ index 916238c4..c1689168 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius, predicate);
@ -95,6 +102,8 @@ index 916238c4..c1689168 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of living entities near location. This will always be a non-null collection.
+ */
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius, Predicate<LivingEntity> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius, predicate);
@ -103,7 +112,9 @@ index 916238c4..c1689168 100644
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X/Y/Z Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+
+ public Collection<Player> getNearbyPlayers(double radius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius);
+ }
@ -112,6 +123,7 @@ index 916238c4..c1689168 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius);
@ -122,6 +134,7 @@ index 916238c4..c1689168 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius);
@ -130,6 +143,8 @@ index 916238c4..c1689168 100644
+ /**
+ * Gets nearby players within the specified radius (bounding box)
+ * @param radius X/Y/Z Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double radius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius, predicate);
@ -139,6 +154,8 @@ index 916238c4..c1689168 100644
+ * Gets nearby players within the specified radius (bounding box)
+ * @param xzRadius X/Z Radius
+ * @param yRadius Y Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius, predicate);
@ -149,6 +166,8 @@ index 916238c4..c1689168 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param predicate a predicate used to filter results
+ * @return the collection of players near location. This will always be a non-null collection.
+ */
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius, Predicate<Player> predicate) {
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius, predicate);
@ -158,6 +177,8 @@ index 916238c4..c1689168 100644
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param radius X/Y/Z radius to search within
+ * @param <T> the entity type
+ * @return the collection of entities of type clazz near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double radius) {
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, null);
@ -168,6 +189,8 @@ index 916238c4..c1689168 100644
+ * @param clazz Type to filter by
+ * @param xzRadius X/Z radius to search within
+ * @param yRadius Y radius to search within
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double xzRadius, double yRadius) {
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null);
@ -179,6 +202,8 @@ index 916238c4..c1689168 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double xRadius, double yRadius, double zRadius) {
+ return getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null);
@ -188,6 +213,9 @@ index 916238c4..c1689168 100644
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
+ * @param clazz Type to filter by
+ * @param radius X/Y/Z radius to search within
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double radius, Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, predicate);
@ -198,6 +226,9 @@ index 916238c4..c1689168 100644
+ * @param clazz Type to filter by
+ * @param xzRadius X/Z radius to search within
+ * @param yRadius Y radius to search within
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends T> clazz, double xzRadius, double yRadius, Predicate<T> predicate) {
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate);
@ -209,6 +240,9 @@ index 916238c4..c1689168 100644
+ * @param xRadius X Radius
+ * @param yRadius Y Radius
+ * @param zRadius Z Radius
+ * @param predicate a predicate used to filter results
+ * @param <T> the entity type
+ * @return the collection of entities near location. This will always be a non-null collection.
+ */
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(Class<? extends Entity> clazz, double xRadius, double yRadius, double zRadius, Predicate<T> predicate) {
+ if (world == null) {

View file

@ -1,4 +1,4 @@
From 3c3e3c01d2d70fd004685f314dc5d222cdf6ae96 Mon Sep 17 00:00:00 2001
From c0279c1b26a29b6acc35b2c45bd53ed2f0253e1d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 18 Jun 2018 01:09:27 -0400
Subject: [PATCH] PlayerReadyArrowEvent
@ -8,7 +8,7 @@ Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java
new file mode 100644
index 00000000..c6add1b1
index 000000000..6fde1e97f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerReadyArrowEvent.java
@@ -0,0 +1,88 @@
@ -58,14 +58,14 @@ index 00000000..c6add1b1
+ }
+
+ /**
+ * What bow the player is using to fire the arrow
+ * @return the player is using to fire the arrow
+ */
+ public ItemStack getBow() {
+ return bow;
+ }
+
+ /**
+ * What arrow is being attempted to use
+ * @return the arrow that is attempting to be used
+ */
+ public ItemStack getArrow() {
+ return arrow;

View file

@ -1,4 +1,4 @@
From eaa1c2e41c62b988a2617ebc76bf905450f2222e Mon Sep 17 00:00:00 2001
From 04ec5bec611967cfad7bb9c1b811cb4bc7b0623f Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Mon, 18 Jun 2018 15:40:39 +0200
Subject: [PATCH] Add EntityKnockbackByEntityEvent
@ -6,10 +6,10 @@ Subject: [PATCH] Add EntityKnockbackByEntityEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
new file mode 100644
index 00000000..99f7ef70
index 000000000..f6ef11624
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
@@ -0,0 +1,67 @@
@@ -0,0 +1,76 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
@ -57,22 +57,31 @@ index 00000000..99f7ef70
+ cancelled = cancel;
+ }
+
+ /**
+ * @return the entity which was knocked back
+ */
+ @Override
+ public LivingEntity getEntity() {
+ return (LivingEntity) super.getEntity();
+ }
+
+ /**
+ * Returns the original knockback strength.
+ * @return the original knockback strength.
+ */
+ public float getKnockbackStrength() {
+ return knockbackStrength;
+ }
+
+ /**
+ * @return the Entity which hit
+ */
+ public Entity getHitBy() {
+ return hitBy;
+ }
+
+ /**
+ * @return the acceleration that will be applied
+ */
+ public Vector getAcceleration() {
+ return acceleration;
+ }

View file

@ -1,4 +1,4 @@
From c38195222988bd5699993de420938b81bda0b0c2 Mon Sep 17 00:00:00 2001
From eb5718c051248c4902e979e9ff35028a9356ed1b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:24:42 -0500
Subject: [PATCH] Expand Explosions API
@ -6,10 +6,10 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index c1689168..d0d86e1a 100644
index 162a76e8b..056a4d6bb 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -711,6 +711,84 @@ public class Location implements Cloneable, ConfigurationSerializable {
@@ -745,6 +745,87 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate);
}
@ -58,6 +58,7 @@ index c1689168..d0d86e1a 100644
+ *
+ * Will break blocks and ignite blocks on fire.
+ *
+ * @param source The source entity of the explosion
+ * @param power The power of explosion, where 4F is TNT
+ * @return false if explosion was canceled, otherwise true
+ */
@ -71,6 +72,7 @@ index c1689168..d0d86e1a 100644
+ *
+ * Will break blocks.
+ *
+ * @param source The source entity of the explosion
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
@ -83,6 +85,7 @@ index c1689168..d0d86e1a 100644
+ * Creates explosion at this location with given power and optionally
+ * setting blocks on fire, with the specified entity as the source.
+ *
+ * @param source The source entity of the explosion
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @param breakBlocks Whether or not to have blocks be destroyed
@ -95,10 +98,10 @@ index c1689168..d0d86e1a 100644
@Override
public boolean equals(Object obj) {
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index fd3a63fa..81d9e1df 100644
index 5630c624a..ef3a2f2d2 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -857,6 +857,99 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -890,6 +890,102 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public boolean createExplosion(Location loc, float power, boolean setFire);
@ -108,6 +111,7 @@ index fd3a63fa..81d9e1df 100644
+ * setting blocks on fire, with the specified entity as the source.
+ *
+ * @param source The source entity of the explosion
+ * @param loc Location to blow up
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @param breakBlocks Whether or not to have blocks be destroyed
@ -122,6 +126,7 @@ index fd3a63fa..81d9e1df 100644
+ * Will destroy other blocks
+ *
+ * @param source The source entity of the explosion
+ * @param loc Location to blow up
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
@ -134,6 +139,7 @@ index fd3a63fa..81d9e1df 100644
+ * Will set blocks on fire and destroy blocks.
+ *
+ * @param source The source entity of the explosion
+ * @param loc Location to blow up
+ * @param power The power of explosion, where 4F is TNT
+ * @return false if explosion was canceled, otherwise true
+ */

View file

@ -1,4 +1,4 @@
From 8757596345acf71f866fa9a83409b08686cbe0a1 Mon Sep 17 00:00:00 2001
From 60e287c651b9a42aea4798a5e3ece6265622222b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 29 Jun 2018 00:19:19 -0400
Subject: [PATCH] LivingEntity Hand Raised/Item Use API
@ -6,7 +6,7 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 932cc249a..4b7a19d31 100644
index 932cc249a..41619f09a 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -10,6 +10,7 @@ import org.bukkit.Material;
@ -17,7 +17,7 @@ index 932cc249a..4b7a19d31 100644
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
@@ -424,5 +425,27 @@ public interface LivingEntity extends Attributable, Entity, Damageable, Projecti
@@ -424,5 +425,31 @@ public interface LivingEntity extends Attributable, Entity, Damageable, Projecti
* @param delay Delay in ticks
*/
void setShieldBlockingDelay(int delay);
@ -36,11 +36,15 @@ index 932cc249a..4b7a19d31 100644
+
+ /**
+ * Get how long the players hands have been raised (Charging Bow attack, using a potion, etc)
+ *
+ * @return Get how long the players hands have been raised (Charging Bow attack, using a potion, etc)
+ */
+ int getHandRaisedTime();
+
+ /**
+ * Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
+ *
+ * @return Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
+ */
+ boolean isHandRaised();
// Paper end

View file

@ -1,4 +1,4 @@
From cf0088878648dbcf7c0a341569456b3b20ddba42 Mon Sep 17 00:00:00 2001
From 38a264062d9f7e239ee60eff8bd198197e8b77e8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 26 Jun 2018 21:34:40 -0400
Subject: [PATCH] RangedEntity API
@ -8,10 +8,10 @@ and to perform an attack.
diff --git a/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
new file mode 100644
index 00000000..7b07f10c
index 000000000..ded25f214
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
@@ -0,0 +1,28 @@
@@ -0,0 +1,29 @@
+package com.destroystokyo.paper.entity;
+
+import org.bukkit.entity.LivingEntity;
@ -20,6 +20,7 @@ index 00000000..7b07f10c
+ /**
+ * Attack the specified entity using a ranged attack.
+ *
+ * @param target the entity to target
+ * @param charge How "charged" the attack is (how far back the bow was pulled for Bow attacks).
+ * This should be a value between 0 and 1, represented as targetDistance/maxDistance.
+ */
@ -41,7 +42,7 @@ index 00000000..7b07f10c
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Illusioner.java b/src/main/java/org/bukkit/entity/Illusioner.java
index 7c92c431..14e6c5ee 100644
index 7c92c431b..14e6c5ee0 100644
--- a/src/main/java/org/bukkit/entity/Illusioner.java
+++ b/src/main/java/org/bukkit/entity/Illusioner.java
@@ -1,6 +1,10 @@
@ -57,7 +58,7 @@ index 7c92c431..14e6c5ee 100644
+
+}
diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java
index 9422d56c..92c30ed5 100644
index 9422d56cd..92c30ed5a 100644
--- a/src/main/java/org/bukkit/entity/Llama.java
+++ b/src/main/java/org/bukkit/entity/Llama.java
@@ -1,11 +1,12 @@
@ -75,7 +76,7 @@ index 9422d56c..92c30ed5 100644
/**
* Represents the base color that the llama has.
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
index e33d00b3..40157bef 100644
index e33d00b30..40157befd 100644
--- a/src/main/java/org/bukkit/entity/Skeleton.java
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
@@ -1,9 +1,11 @@
@ -92,7 +93,7 @@ index e33d00b3..40157bef 100644
/**
* Gets the current type of this skeleton.
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
index 818efe2a..10f8f6d4 100644
index 818efe2a4..10f8f6d45 100644
--- a/src/main/java/org/bukkit/entity/Snowman.java
+++ b/src/main/java/org/bukkit/entity/Snowman.java
@@ -1,9 +1,11 @@
@ -109,7 +110,7 @@ index 818efe2a..10f8f6d4 100644
/**
* Gets whether this snowman is in "derp mode", meaning it is not wearing a
diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java
index 9c5dc1f9..4b27f689 100644
index 9c5dc1f97..4b27f6890 100644
--- a/src/main/java/org/bukkit/entity/Witch.java
+++ b/src/main/java/org/bukkit/entity/Witch.java
@@ -1,7 +1,9 @@
@ -124,7 +125,7 @@ index 9c5dc1f9..4b27f689 100644
+public interface Witch extends Monster, RangedEntity { // Paper
}
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index 0922c5c6..c550ed06 100644
index 0922c5c6a..c550ed061 100644
--- a/src/main/java/org/bukkit/entity/Wither.java
+++ b/src/main/java/org/bukkit/entity/Wither.java
@@ -1,7 +1,9 @@

View file

@ -1,14 +1,14 @@
From 45d25ea6abacf44eee688b4e2bb8140be49fd359 Mon Sep 17 00:00:00 2001
From c0c64949e3296c8076656d6fab742b57a71299d3 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 3 Jul 2018 16:07:16 +0200
Subject: [PATCH] Add World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 81d9e1df..6e583b42 100644
index ef3a2f2d2..860e4374f 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -657,6 +657,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
@@ -690,6 +690,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
*/
public Collection<Entity> getNearbyEntities(Location location, double x, double y, double z);

View file

@ -1,4 +1,4 @@
From f9e5dde76a9d7df4e99e9677c7a09a8fbca3711b Mon Sep 17 00:00:00 2001
From c2bc9239b19e43b8ef8d3a4c82aee6d692732b20 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:52:52 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@ -7,16 +7,18 @@ 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.
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index dd95773e..3924d00c 100644
index dd95773e2..8fe01e47e 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -137,6 +137,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv
@@ -137,6 +137,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv
*/
public void closeInventory();
+ // Paper start
+ /**
+ * Force-closes the currently open inventory view for this player, if any.
+ *
+ * @param reason why the inventory is closing
+ */
+ public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason);
+ // Paper end
@ -25,7 +27,7 @@ index dd95773e..3924d00c 100644
* Returns the ItemStack currently in your hand, can be empty.
*
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
index 19889b27..e6e45b93 100644
index 19889b278..e6e45b936 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryCloseEvent.java
@@ -11,8 +11,58 @@ import org.bukkit.inventory.InventoryView;

View file

@ -1,4 +1,4 @@
From 3db6552e5028e2772b82d8eed338b5819f65f4ad Mon Sep 17 00:00:00 2001
From 616d772c83bd89a4bb763dcf202fc1bc094b639b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 4 Aug 2018 19:37:35 -0400
Subject: [PATCH] Provide Chunk Coordinates as a Long API
@ -27,7 +27,7 @@ index 079b9febe..c75bce07a 100644
* Gets the world containing this chunk
*
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index a9054d8f5..53517dab1 100644
index ba300c294..f84f151ad 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -137,6 +137,21 @@ public interface World extends PluginMessageRecipient, Metadatable {
@ -39,7 +39,7 @@ index a9054d8f5..53517dab1 100644
+ * Gets the chunk at the specified chunk key, which is the X and Z packed into a long.
+ *
+ * See {@link Chunk#getChunkKey()} for easy access to the key, or you may calculate it as:
+ * long chunkKey = (long) chunkX & 0xffffffffL | ((long) chunkZ & 0xffffffffL) << 32;
+ * long chunkKey = (long) chunkX &amp; 0xffffffffL | ((long) chunkZ &amp; 0xffffffffL) &gt;&gt; 32;
+ *
+ * @param chunkKey The Chunk Key to look up the chunk by
+ * @return The chunk at the specified key