Use ? super in Consumer/Predicate API (#9939)

This commit is contained in:
Jake Potrebic 2023-11-25 15:03:02 -08:00 committed by GitHub
parent f9938d3949
commit b37bbcfd98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 240 additions and 277 deletions

View file

@ -6,7 +6,7 @@ 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 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db36d85a6c 100644
index 3161eae2fa5f03b7d3a5e9945ab659c15cf568c6..af737017ee397f80c44ee02c6cc60cefa07f59c1 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -7,6 +7,7 @@ import java.util.HashMap;
@ -17,14 +17,14 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
import org.bukkit.util.NumberConversions;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
@@ -568,6 +569,89 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
return centerLoc;
@@ -569,6 +570,89 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
}
// Paper end - expand Location API
+ // Paper start - Expand Explosions API
+ /**
+ * Creates explosion at this location with given power
+ *
+ * <p>
+ * Will break blocks and ignite blocks on fire.
+ *
+ * @param power The power of explosion, where 4F is TNT
@ -37,11 +37,11 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
+ /**
+ * Creates explosion at this location with given power and optionally
+ * setting blocks on fire.
+ *
+ * <p>
+ * Will break blocks.
+ *
+ * @param power The power of explosion, where 4F is TNT
+ * @param setFire Whether or not to set blocks on fire
+ * @param setFire Whether to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(float power, boolean setFire) {
@ -53,8 +53,8 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
+ * setting blocks on fire.
+ *
+ * @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
+ * @param setFire Whether to set blocks on fire
+ * @param breakBlocks Whether to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(float power, boolean setFire, boolean breakBlocks) {
@ -63,7 +63,7 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
+
+ /**
+ * Creates explosion at this location with given power, with the specified entity as the source.
+ *
+ * <p>
+ * Will break blocks and ignite blocks on fire.
+ *
+ * @param source The source entity of the explosion
@ -77,12 +77,12 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
+ /**
+ * Creates explosion at this location with given power and optionally
+ * setting blocks on fire, with the specified entity as the source.
+ *
+ * <p>
+ * 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
+ * @param setFire Whether to set blocks on fire
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
@ -95,8 +95,8 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
+ *
+ * @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
+ * @param setFire Whether to set blocks on fire
+ * @param breakBlocks Whether to have blocks be destroyed
+ * @return false if explosion was canceled, otherwise true
+ */
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire, boolean breakBlocks) {
@ -104,14 +104,14 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db
+ }
+ // Paper end - Expand Explosions API
+
// Paper start - additional getNearbyEntities API
/**
* Returns a list of entities within a bounding box centered around a Location.
*
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index d02b6743e4401004e75501e99b717b58e5acc5ae..de896af6006f791625bb388b105983fb64489071 100644
index 93c46d40efd73293d84c7eaadf4e360cc3706e2a..cd946f2de8a09fdb6ff9b256ca7eba64e6ed9aab 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1398,6 +1398,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -1380,6 +1380,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire);