More work
This commit is contained in:
parent
d42140148f
commit
19da14ee00
23 changed files with 276 additions and 307 deletions
|
@ -1,20 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 24 Mar 2019 18:44:26 -0400
|
||||
Subject: [PATCH] Ignore package-private methods for nullability annotations
|
||||
|
||||
This isn't API
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 2bb75e967d4250476a151599b68de80011d222b2..03229d5f4ec36a82197beb391356d791ff67fb2f 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -168,7 +168,7 @@ public class AnnotationTest {
|
||||
|
||||
private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map<String, ClassNode> allClasses) {
|
||||
// Exclude private, synthetic and deprecated methods
|
||||
- if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0) {
|
||||
+ if ((method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_DEPRECATED)) != 0 || (method.access & (Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) == 0) { // Paper - ignore package-private
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 24 Mar 2019 18:39:01 -0400
|
||||
Subject: [PATCH] Flip some Spigot API null annotations
|
||||
|
||||
while some of these may of been true, they are extreme cases and cause
|
||||
a ton of noise to plugin developers.
|
||||
|
||||
These do not help plugin developers if they bring moise noise than value.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index dcaefdaf5a0de8486f59115c8c4d4c211b7d64cd..e3304fcc8c4fd176abd3fb7d4b47e5ccb7bdd37f 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1389,7 +1389,7 @@ public final class Bukkit {
|
||||
*
|
||||
* @return the scoreboard manager or null if no worlds are loaded.
|
||||
*/
|
||||
- @Nullable
|
||||
+ @NotNull // Paper
|
||||
public static ScoreboardManager getScoreboardManager() {
|
||||
return server.getScoreboardManager();
|
||||
}
|
||||
@@ -1686,7 +1686,7 @@ public final class Bukkit {
|
||||
* @param clazz the class of the tag entries
|
||||
* @return the tag or null
|
||||
*/
|
||||
- @Nullable
|
||||
+ @UndefinedNullability // Paper
|
||||
public static <T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> clazz) {
|
||||
return server.getTag(registry, tag, clazz);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 9c91c49ed7302c12fcb1d8e9bc58712efc199954..d5d67b3d84cd88ed0f858497e68535ec0162c700 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -46,7 +46,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
* @param y The y-coordinate of this new location
|
||||
* @param z The z-coordinate of this new location
|
||||
*/
|
||||
- public Location(@Nullable final World world, final double x, final double y, final double z) {
|
||||
+ public Location(@UndefinedNullability final World world, final double x, final double y, final double z) { // Paper
|
||||
this(world, x, y, z, 0, 0);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
* @param yaw The absolute rotation on the x-plane, in degrees
|
||||
* @param pitch The absolute rotation on the y-plane, in degrees
|
||||
*/
|
||||
- public Location(@Nullable final World world, final double x, final double y, final double z, final float yaw, final float pitch) {
|
||||
+ public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) {
|
||||
if (world != null) {
|
||||
this.world = new WeakReference<>(world);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
* @throws IllegalArgumentException when world is unloaded
|
||||
* @see #isWorldLoaded()
|
||||
*/
|
||||
- @Nullable
|
||||
+ @UndefinedNullability
|
||||
public World getWorld() {
|
||||
if (this.world == null) {
|
||||
return null;
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 9b8e6b7bbbed44e2659379c8046acaa35aaa8910..989a732e5ef2053deede245d65fbf99cdf117c5e 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1171,7 +1171,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*
|
||||
* @return the scoreboard manager or null if no worlds are loaded.
|
||||
*/
|
||||
- @Nullable
|
||||
+ @NotNull // Paper
|
||||
ScoreboardManager getScoreboardManager();
|
||||
|
||||
/**
|
||||
@@ -1441,7 +1441,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @param clazz the class of the tag entries
|
||||
* @return the tag or null
|
||||
*/
|
||||
- @Nullable
|
||||
+ @UndefinedNullability
|
||||
<T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> clazz);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 591e095dabd4cb72881abf206b1d7f0c8818cef3..ecf509a970ed4f0052d5d2c756406bf96052a680 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
+import org.bukkit.UndefinedNullability;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
@@ -25,7 +26,7 @@ public interface ItemFactory {
|
||||
* @return a new ItemMeta that could be applied to an item stack of the
|
||||
* specified material
|
||||
*/
|
||||
- @Nullable
|
||||
+ @UndefinedNullability // Paper
|
||||
ItemMeta getItemMeta(@NotNull final Material material);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 686e2a0b9fe061816b41435ef2337870dbdca8e5..290c3f0fd6e8c3407d421b697e0ee01584f4cebd 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -8,6 +8,7 @@ import java.util.Set; // Paper
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
+import org.bukkit.UndefinedNullability;
|
||||
import org.bukkit.Utility;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@@ -546,7 +547,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
*
|
||||
* @return a copy of the current ItemStack's ItemData
|
||||
*/
|
||||
- @Nullable
|
||||
+ @UndefinedNullability // Paper
|
||||
public ItemMeta getItemMeta() {
|
||||
return this.meta == null ? Bukkit.getItemFactory().getItemMeta(this.type) : this.meta.clone();
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 27 Mar 2019 21:58:55 -0400
|
||||
Subject: [PATCH] Server Tick Events
|
||||
|
||||
Fires event at start and end of a server tick
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9fd28e03649f66f71fb7f0536a137557ec32cd25
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickEndEvent.java
|
||||
@@ -0,0 +1,59 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the server has finished ticking the main loop
|
||||
+ */
|
||||
+public class ServerTickEndEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final int tickNumber;
|
||||
+ private final double tickDuration;
|
||||
+ private final long timeEnd;
|
||||
+
|
||||
+ public ServerTickEndEvent(int tickNumber, double tickDuration, long timeRemaining) {
|
||||
+ this.tickNumber = tickNumber;
|
||||
+ this.tickDuration = tickDuration;
|
||||
+ this.timeEnd = System.nanoTime() + timeRemaining;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return What tick this was since start (first tick = 1)
|
||||
+ */
|
||||
+ public int getTickNumber() {
|
||||
+ return tickNumber;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return Time in milliseconds of how long this tick took
|
||||
+ */
|
||||
+ public double getTickDuration() {
|
||||
+ return tickDuration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Amount of nanoseconds remaining before the next tick should start.
|
||||
+ *
|
||||
+ * If this value is negative, then that means the server has exceeded the tick time limit and TPS has been lost.
|
||||
+ *
|
||||
+ * Method will continously return the updated time remaining value. (return value is not static)
|
||||
+ *
|
||||
+ * @return Amount of nanoseconds remaining before the next tick should start
|
||||
+ */
|
||||
+ public long getTimeRemaining() {
|
||||
+ return this.timeEnd - System.nanoTime();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..eac85f1f49088bb71afb01eff4d5f53887306461
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerTickStartEvent.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class ServerTickStartEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final int tickNumber;
|
||||
+
|
||||
+ public ServerTickStartEvent(int tickNumber) {
|
||||
+ this.tickNumber = tickNumber;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return What tick this is going be since start (first tick = 1)
|
||||
+ */
|
||||
+ public int getTickNumber() {
|
||||
+ return tickNumber;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -1,63 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 11 Mar 2013 20:04:34 -0400
|
||||
Subject: [PATCH] PlayerDeathEvent#getItemsToKeep
|
||||
|
||||
Exposes a mutable array on items a player should keep on death
|
||||
|
||||
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
index a01d4c21bedc7f1a54f5a330bb4c2909ce3a18e4..8c46eaebf004823c1c31eb2c7304181487cb1332 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
|
||||
@@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- @Deprecated // Paper
|
||||
public PlayerDeathEvent(@NotNull final Player player, @NotNull final List<ItemStack> drops, final int droppedExp, @Nullable final String deathMessage) {
|
||||
this(player, drops, droppedExp, 0, deathMessage);
|
||||
}
|
||||
@@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent {
|
||||
this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper
|
||||
}
|
||||
|
||||
+ @Deprecated // Paper
|
||||
+ // Paper start
|
||||
+ private List<ItemStack> itemsToKeep = new java.util.ArrayList<>();
|
||||
+
|
||||
+ /**
|
||||
+ * A mutable collection to add items that the player should retain in their inventory on death (Similar to KeepInventory game rule)
|
||||
+ *
|
||||
+ * You <b>MUST</b> remove the item from the .getDrops() collection too or it will duplicate!
|
||||
+ * <pre>{@code
|
||||
+ * {@literal @EventHandler(ignoreCancelled = true)}
|
||||
+ * public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
+ * for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
|
||||
+ * ItemStack drop = iterator.next();
|
||||
+ * List<String> lore = drop.getLore();
|
||||
+ * if (lore != null && !lore.isEmpty()) {
|
||||
+ * if (lore.get(0).contains("(SOULBOUND)")) {
|
||||
+ * iterator.remove();
|
||||
+ * event.getItemsToKeep().add(drop);
|
||||
+ * }
|
||||
+ * }
|
||||
+ * }
|
||||
+ * }
|
||||
+ * }</pre>
|
||||
+ *
|
||||
+ * Adding an item to this list that the player did not previously have will give them the item on death.
|
||||
+ * An example case could be a "Note" that "You died at X/Y/Z coordinates"
|
||||
+ *
|
||||
+ * @return The list to hold items to keep
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<ItemStack> getItemsToKeep() {
|
||||
+ return itemsToKeep;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public Player getEntity() {
|
|
@ -1,196 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Sat, 1 Dec 2018 19:00:36 -0800
|
||||
Subject: [PATCH] Add Heightmap API
|
||||
|
||||
Changed to use upstream's heightmap API - Machine_Maker
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/HeightmapType.java b/src/main/java/com/destroystokyo/paper/HeightmapType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..709e44ea1b14ab6917501c928e689cc6cbdf4bb4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/HeightmapType.java
|
||||
@@ -0,0 +1,39 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import org.bukkit.*;
|
||||
+
|
||||
+/**
|
||||
+ * Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster
|
||||
+ * than using an iterative search for a block in a given x, z coordinate.
|
||||
+ *
|
||||
+ * @deprecated Upstream has added their own API for using the game heightmaps. See {@link org.bukkit.HeightMap} and the
|
||||
+ * non-deprecated getHighestBlock methods on World such as {@link org.bukkit.World#getHighestBlockAt(Location, HeightMap)}.
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public enum HeightmapType {
|
||||
+
|
||||
+ /**
|
||||
+ * The highest block used for lighting in the world. Also the block returned by {@link World#getHighestBlockYAt(int, int)}}
|
||||
+ */
|
||||
+ LIGHT_BLOCKING,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest block in the world.
|
||||
+ */
|
||||
+ ANY,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest solid block in a world.
|
||||
+ */
|
||||
+ SOLID,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest solid or liquid block in a world.
|
||||
+ */
|
||||
+ SOLID_OR_LIQUID,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest solid or liquid block in a world, excluding leaves.
|
||||
+ */
|
||||
+ SOLID_OR_LIQUID_NO_LEAVES;
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index d5d67b3d84cd88ed0f858497e68535ec0162c700..432d5711b7ec34eafeb27df82d367612dfe1fe54 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -638,6 +638,47 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
return centerLoc;
|
||||
}
|
||||
|
||||
+ // Paper start - Add heightmap api
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
|
||||
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
|
||||
+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location toHighestLocation() {
|
||||
+ return this.toHighestLocation(HeightMap.WORLD_SURFACE);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap)
|
||||
+ * @param heightmap The heightmap to use for finding the highest y location.
|
||||
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap)
|
||||
+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null}
|
||||
+ * @throws UnsupportedOperationException if {@link World#getHighestBlockYAt(int, int, com.destroystokyo.paper.HeightmapType)} does not support the specified heightmap
|
||||
+ * @deprecated Use {@link org.bukkit.Location#toHighestLocation(HeightMap)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated
|
||||
+ public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) {
|
||||
+ final Location ret = this.clone();
|
||||
+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap));
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap)
|
||||
+ * @param heightMap The heightmap to use for finding the highest y location.
|
||||
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location toHighestLocation(@NotNull final HeightMap heightMap) {
|
||||
+ final Location ret = this.clone();
|
||||
+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightMap));
|
||||
+ return ret;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Creates explosion at this location with given power
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 19060c7d9c74b9b2808103f3d5627444aece6ccb..f8e104d5e61e52c5fe658d7cda373f62424c7bea 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -160,6 +160,87 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
@NotNull
|
||||
public Block getHighestBlockAt(@NotNull Location location);
|
||||
|
||||
+ // Paper start - Add heightmap API
|
||||
+ /**
|
||||
+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param x The block's x-coordinate.
|
||||
+ * @param z The block's z-coordinate.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(int, int, HeightMap)}
|
||||
+ *
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException;
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * Note that the y-coordinate of the specified location is ignored.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param location The specified block coordinates.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(Location, HeightMap)}
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||
+ return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ * @param x The block's x-coordinate.
|
||||
+ * @param z The block's z-coordinate.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(int, int, HeightMap)}
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @NotNull
|
||||
+ default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||
+ return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * Note that the y-coordinate of the specified location is ignored.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ * @param location The specified block coordinates.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(Location, HeightMap)}
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @NotNull
|
||||
+ default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||
+ return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the highest coordinate corresponding to the {@link HeightMap} at the
|
||||
* given coordinates.
|
|
@ -1,41 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 19 Apr 2019 12:41:19 -0500
|
||||
Subject: [PATCH] Mob Spawner API Enhancements
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/CreatureSpawner.java b/src/main/java/org/bukkit/block/CreatureSpawner.java
|
||||
index cb447a4ad5a9dce7c98999a5d7fcd6111fc9b10e..5bbae759ce39d42886994e500fd9454ec328f804 100644
|
||||
--- a/src/main/java/org/bukkit/block/CreatureSpawner.java
|
||||
+++ b/src/main/java/org/bukkit/block/CreatureSpawner.java
|
||||
@@ -199,4 +199,30 @@ public interface CreatureSpawner extends TileState {
|
||||
* @see #getSpawnRange()
|
||||
*/
|
||||
public void setSpawnRange(int spawnRange);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Check if spawner is activated (a player is close enough)
|
||||
+ *
|
||||
+ * @return True if a player is close enough to activate it
|
||||
+ */
|
||||
+ public boolean isActivated();
|
||||
+
|
||||
+ /**
|
||||
+ * Resets the spawn delay timer within the min/max range
|
||||
+ */
|
||||
+ public void resetTimer();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the {@link EntityType} to {@link EntityType#DROPPED_ITEM} and sets the data to the given
|
||||
+ * {@link org.bukkit.inventory.ItemStack ItemStack}.
|
||||
+ * <p>
|
||||
+ * {@link #setSpawnCount(int)} does not dictate the amount of items in the stack spawned, but rather how many
|
||||
+ * stacks should be spawned.
|
||||
+ *
|
||||
+ * @param itemStack The item to spawn. Must not {@link org.bukkit.Material#isAir be air}.
|
||||
+ * @see #setSpawnedType(EntityType)
|
||||
+ */
|
||||
+ void setSpawnedItem(@NotNull org.bukkit.inventory.ItemStack itemStack);
|
||||
+ // Paper end
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue