Patches
This commit is contained in:
parent
35d0ab1ca8
commit
5d0d11e4b6
20 changed files with 79 additions and 103 deletions
|
@ -1,169 +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] Fix Spigot annotation mistakes
|
||||
|
||||
while some of these may of been true, they are extreme cases and cause
|
||||
a ton of noise to plugin developers.
|
||||
|
||||
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 a10ad183431d2a67e8f49062fba37e7fc3b760dc..5c7681809a27796e398170fc72bf0a950e52a971 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1519,7 +1519,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();
|
||||
}
|
||||
@@ -1816,7 +1816,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 88b3e0323dbc4f0fce31b147c7aaa08d65745852..23ca89dde7f6ac9082d4b97fce2959425f3680cb 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) { // Paper
|
||||
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 // Paper
|
||||
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 27353a3eb4669ee457fe7d65dc5dd5e8c23c8283..5162e8b356e73ac41d6f4f5a0ea0efeda85382c7 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1286,7 +1286,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();
|
||||
|
||||
/**
|
||||
@@ -1556,7 +1556,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 // Paper
|
||||
<T extends Keyed> Tag<T> getTag(@NotNull String registry, @NotNull NamespacedKey tag, @NotNull Class<T> clazz);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/LingeringPotion.java b/src/main/java/org/bukkit/entity/LingeringPotion.java
|
||||
index f124b35ec76e6cb6a1a0dc464005087043c3efd0..94a2fef0dc9e13c754cd31d5eabc1bde2dbbe6a5 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LingeringPotion.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LingeringPotion.java
|
||||
@@ -5,4 +5,5 @@ package org.bukkit.entity;
|
||||
*
|
||||
* @deprecated lingering status depends on only on the potion item.
|
||||
*/
|
||||
+@Deprecated // Paper
|
||||
public interface LingeringPotion extends ThrownPotion { }
|
||||
diff --git a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
|
||||
index 2ff1b1308571d8f8056d3359e8a8ba4a589c3726..e669ad8ecd182c6899c7820414e6ee1f7312d699 100644
|
||||
--- a/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/enchantment/PrepareItemEnchantEvent.java
|
||||
@@ -68,6 +68,7 @@ public class PrepareItemEnchantEvent extends InventoryEvent implements Cancellab
|
||||
* @return experience level costs offered
|
||||
* @deprecated Use {@link #getOffers()} instead of this method
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
@NotNull
|
||||
public int[] getExpLevelCostsOffered() {
|
||||
int[] levelOffers = new int[offers.length];
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 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..aacf8ea85909299355d16cad0386072ec542a70e 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;
|
||||
@@ -68,6 +69,7 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
* @param damage durability / damage
|
||||
* @deprecated see {@link #setDurability(short)}
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
public ItemStack(@NotNull final Material type, final int amount, final short damage) {
|
||||
this(type, amount, damage, null);
|
||||
}
|
||||
@@ -546,7 +548,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();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/material/Step.java b/src/main/java/org/bukkit/material/Step.java
|
||||
index 9f502e7ee05d0512e190a1722cc112ece068c4e2..10c0465cf58d680bfa9a0f9233f94e8b6d5a9b93 100644
|
||||
--- a/src/main/java/org/bukkit/material/Step.java
|
||||
+++ b/src/main/java/org/bukkit/material/Step.java
|
||||
@@ -78,6 +78,7 @@ public class Step extends TexturedMaterial {
|
||||
*
|
||||
* @deprecated Magic value
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
@Override
|
||||
protected int getTextureIndex() {
|
||||
return getData() & 0x7;
|
|
@ -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 23ca89dde7f6ac9082d4b97fce2959425f3680cb..8321441b8f528a05e297f485672f928e76fe017d 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 e4d3618afa8a022ae556febd23be76b5fe6dfe0e..bcac107353149d0129571a3548965a407aa7640c 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 RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@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
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: simpleauthority <jacob@algorithmjunkie.com>
|
||||
Date: Tue, 28 May 2019 03:41:28 -0700
|
||||
Subject: [PATCH] Add BlockSoundGroup interface
|
||||
|
||||
This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8cf87d228a7006658d52ce0da16c2d74f4706545
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package com.destroystokyo.paper.block;
|
||||
+
|
||||
+import org.bukkit.Sound;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents the sounds that a {@link Block} makes in certain situations
|
||||
+ * <p>
|
||||
+ * The sound group includes break, step, place, hit, and fall sounds.
|
||||
+ */
|
||||
+public interface BlockSoundGroup {
|
||||
+ /**
|
||||
+ * Gets the sound that plays when breaking this block
|
||||
+ *
|
||||
+ * @return The break sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getBreakSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when stepping on this block
|
||||
+ *
|
||||
+ * @return The step sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getStepSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when placing this block
|
||||
+ *
|
||||
+ * @return The place sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getPlaceSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when hitting this block
|
||||
+ *
|
||||
+ * @return The hit sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getHitSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when this block falls
|
||||
+ *
|
||||
+ * @return The fall sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getFallSound();
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 18ab5cca036522df2d245f755d6c67904e6398e8..5ac36e0f90d0889853736390877aa92ec0ca181b 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -587,4 +587,16 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
@NotNull
|
||||
VoxelShape getCollisionShape();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block.
|
||||
+ * <p>
|
||||
+ * This object contains the block, step, place, hit, and fall sounds.
|
||||
+ *
|
||||
+ * @return the sound group for this block
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: simpleauthority <jacob@algorithmjunkie.com>
|
||||
Date: Thu, 11 Jul 2019 10:35:56 -0700
|
||||
Subject: [PATCH] Amend PlayerInteractAtEntityEvent javadoc for ArmorStands
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java
|
||||
index 1075dbb8135d2fd2fd69d1e821dd1ba7f90824d5..3f24d302e28170f7f6e5885b5b9abb22cbbb7d66 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java
|
||||
@@ -13,6 +13,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <br>
|
||||
* Note that the client may sometimes spuriously send this packet in addition to {@link PlayerInteractEntityEvent}.
|
||||
* Users are advised to listen to this (parent) class unless specifically required.
|
||||
+ * <br>
|
||||
+ * Note that interacting with Armor Stands fires this event only and not its parent and as such users are expressly required
|
||||
+ * to listen to this event for that scenario.
|
||||
*/
|
||||
public class PlayerInteractAtEntityEvent extends PlayerInteractEntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
Loading…
Add table
Add a link
Reference in a new issue