mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-29 03:02:02 -07:00
more patches (#5811)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 15 Aug 2018 01:04:58 -0400
|
||||
Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Chunk.java
|
||||
+++ b/src/main/java/org/bukkit/Chunk.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit;
|
||||
|
||||
import java.util.Collection;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder {
|
||||
@NotNull
|
||||
Entity[] getEntities();
|
||||
|
||||
+ // Paper start
|
||||
/**
|
||||
* Get a list of all tile entities in the chunk.
|
||||
*
|
||||
* @return The tile entities.
|
||||
*/
|
||||
@NotNull
|
||||
- BlockState[] getTileEntities();
|
||||
+ default BlockState[] getTileEntities() {
|
||||
+ return getTileEntities(true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a list of all tile entities in the chunk.
|
||||
+ *
|
||||
+ * @param useSnapshot Take snapshots or direct references
|
||||
+ * @return The tile entities.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ BlockState[] getTileEntities(boolean useSnapshot);
|
||||
+
|
||||
+ /**
|
||||
+ * Get a list of all tile entities that match a given predicate in the chunk.
|
||||
+ *
|
||||
+ * @param blockPredicate The predicate of blocks to return tile entities for
|
||||
+ * @param useSnapshot Take snapshots or direct references
|
||||
+ * @return The tile entities.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Collection<BlockState> getTileEntities(@NotNull Predicate<Block> blockPredicate, boolean useSnapshot);
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Checks if the chunk is loaded.
|
91
patches/api/Add-More-Creeper-API.patch
Normal file
91
patches/api/Add-More-Creeper-API.patch
Normal file
@@ -0,0 +1,91 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 24 Aug 2018 11:50:16 -0500
|
||||
Subject: [PATCH] Add More Creeper API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Creeper;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Creeper is ignite flag is changed (armed/disarmed to explode).
|
||||
+ */
|
||||
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+ private boolean ignited;
|
||||
+
|
||||
+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
|
||||
+ super(creeper);
|
||||
+ this.ignited = ignited;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Creeper getEntity() {
|
||||
+ return (Creeper) entity;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isIgnited() {
|
||||
+ return ignited;
|
||||
+ }
|
||||
+
|
||||
+ public void setIgnited(boolean ignited) {
|
||||
+ this.ignited = ignited;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
||||
@@ -0,0 +0,0 @@ public interface Creeper extends Monster {
|
||||
* griefing gamerule.
|
||||
*/
|
||||
public void ignite();
|
||||
+ // Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether creeper is ignited or not (armed to explode)
|
||||
+ *
|
||||
+ * @param ignited New ignited state
|
||||
+ */
|
||||
+ public void setIgnited(boolean ignited);
|
||||
+
|
||||
+ /**
|
||||
+ * Check if creeper is ignited or not (armed to explode)
|
||||
+ *
|
||||
+ * @return Ignited state
|
||||
+ */
|
||||
+ public boolean isIgnited();
|
||||
+ // Paper end
|
||||
}
|
71
patches/api/Add-PhantomPreSpawnEvent.patch
Normal file
71
patches/api/Add-PhantomPreSpawnEvent.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 25 Aug 2018 19:56:42 -0500
|
||||
Subject: [PATCH] Add PhantomPreSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * Called when a phantom is spawned for an exhausted player
|
||||
+ */
|
||||
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
||||
+ @NotNull private final Entity entity;
|
||||
+
|
||||
+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ super(location, EntityType.PHANTOM, reason);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity this phantom is spawning for
|
||||
+ *
|
||||
+ * @return Entity
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getSpawningEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
/**
|
||||
* Represents a phantom.
|
||||
*/
|
||||
@@ -0,0 +0,0 @@ public interface Phantom extends Flying {
|
||||
* @param sz The new size of the phantom.
|
||||
*/
|
||||
public void setSize(int sz);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the UUID of the entity that caused this phantom to spawn
|
||||
+ *
|
||||
+ * @return UUID
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public java.util.UUID getSpawningEntity();
|
||||
+ // Paper end
|
||||
}
|
126
patches/api/Add-TNTPrimeEvent.patch
Normal file
126
patches/api/Add-TNTPrimeEvent.patch
Normal file
@@ -0,0 +1,126 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 15 Jul 2018 22:17:55 +0300
|
||||
Subject: [PATCH] Add TNTPrimeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when TNT block is about to turn into {@link org.bukkit.entity.TNTPrimed}
|
||||
+ * <p>
|
||||
+ * Cancelling it won't turn TNT into {@link org.bukkit.entity.TNTPrimed} and leaves
|
||||
+ * the TNT block as-is
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+public class TNTPrimeEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ @NotNull private PrimeReason reason;
|
||||
+ @Nullable private Entity primerEntity;
|
||||
+
|
||||
+ public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) {
|
||||
+ super(theBlock);
|
||||
+ this.reason = reason;
|
||||
+ this.primerEntity = primerEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TNT prime reason
|
||||
+ *
|
||||
+ * @return Prime reason
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PrimeReason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TNT primer {@link Entity}.
|
||||
+ *
|
||||
+ * It's null if {@link #getReason()} is {@link PrimeReason#REDSTONE} or {@link PrimeReason#FIRE}.
|
||||
+ * It's not null if {@link #getReason()} is {@link PrimeReason#ITEM} or {@link PrimeReason#PROJECTILE}
|
||||
+ * It might be null if {@link #getReason()} is {@link PrimeReason#EXPLOSION}
|
||||
+ *
|
||||
+ * @return The {@link Entity} who primed the TNT
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getPrimerEntity() {
|
||||
+ return this.primerEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ *
|
||||
+ * @return Whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether to cancel spawning {@link org.bukkit.entity.TNTPrimed} or not
|
||||
+ *
|
||||
+ * @param cancel whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum PrimeReason {
|
||||
+ /**
|
||||
+ * When TNT prime was caused by other explosion (chain reaction)
|
||||
+ */
|
||||
+ EXPLOSION,
|
||||
+
|
||||
+ /**
|
||||
+ * When TNT prime was caused by fire
|
||||
+ */
|
||||
+ FIRE,
|
||||
+
|
||||
+ /**
|
||||
+ * When {@link org.bukkit.entity.Player} used {@link org.bukkit.Material#FLINT_AND_STEEL} or
|
||||
+ * {@link org.bukkit.Material#FIRE_CHARGE} on given TNT block
|
||||
+ */
|
||||
+ ITEM,
|
||||
+
|
||||
+ /**
|
||||
+ * When TNT prime was caused by an {@link Entity} shooting TNT
|
||||
+ * using a bow with {@link org.bukkit.enchantments.Enchantment#ARROW_FIRE} enchantment
|
||||
+ */
|
||||
+ PROJECTILE,
|
||||
+
|
||||
+ /**
|
||||
+ * When redstone power triggered the TNT prime
|
||||
+ */
|
||||
+ REDSTONE
|
||||
+ }
|
||||
+}
|
130
patches/api/Add-hand-to-bucket-events.patch
Normal file
130
patches/api/Add-hand-to-bucket-events.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 2 Aug 2018 08:44:20 -0500
|
||||
Subject: [PATCH] Add hand to bucket events
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
||||
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who, block, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ @Deprecated
|
||||
+ public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, block, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||
private final Block blockClicked;
|
||||
private final BlockFace blockFace;
|
||||
private final Material bucket;
|
||||
+ private final EquipmentSlot hand; // Paper - add EquipmentSlot
|
||||
|
||||
@Deprecated
|
||||
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||
}
|
||||
|
||||
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ this(who, block, blockClicked, blockFace, bucket, itemInHand, null);
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public PlayerBucketEvent(@NotNull final Player who,@NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @Nullable final EquipmentSlot hand) {
|
||||
+ this(who, null, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @Nullable final EquipmentSlot hand) {
|
||||
+ // Paper end
|
||||
super(who);
|
||||
this.block = block;
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
this.bucket = bucket;
|
||||
+ this.hand = hand == null ? player.getInventory().getItemInMainHand().equals(itemInHand) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND : hand; // Paper - add EquipmentSlot
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * The hand used to perform this action.
|
||||
+ *
|
||||
+ * @return the hand used
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return hand;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
||||
super(who, block, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ @Deprecated
|
||||
+ public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ public PlayerBucketFillEvent(@NotNull final Player who, @NotNull Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, block, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
24
patches/api/Add-source-block-to-BlockPhysicsEvent.patch
Normal file
24
patches/api/Add-source-block-to-BlockPhysicsEvent.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Thu, 23 Aug 2018 16:14:25 +0800
|
||||
Subject: [PATCH] Add source block to BlockPhysicsEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockPhysicsEvent.java
|
||||
@@ -0,0 +0,0 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
|
||||
private final Block sourceBlock;
|
||||
private boolean cancel = false;
|
||||
|
||||
+ // Paper start - Legacy constructor, use #BlockPhysicsEvent(Block, BlockData, Block)
|
||||
+ @Deprecated
|
||||
+ public BlockPhysicsEvent(final Block block, final BlockData changed, final int sourceX, final int sourceY, final int sourceZ) {
|
||||
+ this(block, changed, block.getWorld().getBlockAt(sourceX, sourceY, sourceZ));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public BlockPhysicsEvent(@NotNull final Block block, @NotNull final BlockData changed) {
|
||||
this(block, changed, block);
|
||||
}
|
169
patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch
Normal file
169
patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch
Normal file
@@ -0,0 +1,169 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Tue, 14 Aug 2018 21:42:10 -0700
|
||||
Subject: [PATCH] Allow Blocks to be accessed via a long key
|
||||
|
||||
The key can be retrieved via methods Location#toBlockKey() and
|
||||
Block#getBlockKey()
|
||||
|
||||
World provides lookup for blocks by long key via method World#getBlockAtKey(long)
|
||||
|
||||
The formatting for the key is as follows:
|
||||
|
||||
10 bit y|27 bit z|27 bit x
|
||||
|
||||
The y value is considered unsigned while z and x are considered two's complement
|
||||
|
||||
Y range: [0, 1023]
|
||||
X, Z range: [-67 108 864, 67 108 863]
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
// Paper start
|
||||
import java.util.Collection;
|
||||
-import java.util.Collections;
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
blockLoc.setZ(getBlockZ());
|
||||
return blockLoc;
|
||||
}
|
||||
+
|
||||
+ // Paper Start
|
||||
+ /**
|
||||
+ * @return The block key for this location's block location.
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ */
|
||||
+ public long toBlockKey() {
|
||||
+ return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ());
|
||||
+ }
|
||||
+ // Paper End
|
||||
+
|
||||
/**
|
||||
* @return A new location where X/Y/Z are the center of the block
|
||||
*/
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
@NotNull
|
||||
public Block getBlockAt(@NotNull Location location);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link Block} at the given block key
|
||||
+ *
|
||||
+ * @param key The block key. See {@link Block#getBlockKey()}
|
||||
+ * @return Block at the key
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public default Block getBlockAtKey(long key) {
|
||||
+ int x = Block.getBlockKeyX(key);
|
||||
+ int y = Block.getBlockKeyY(key);
|
||||
+ int z = Block.getBlockKeyZ(key);
|
||||
+ return getBlockAt(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link Location} at the given block key
|
||||
+ *
|
||||
+ * @param key The block key. See {@link Location#toBlockKey()}
|
||||
+ * @return Location at the key
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public default Location getLocationAtKey(long key) {
|
||||
+ int x = Block.getBlockKeyX(key);
|
||||
+ int y = Block.getBlockKeyY(key);
|
||||
+ int z = Block.getBlockKeyZ(key);
|
||||
+ return new Location(this, x, y, z);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the highest non-empty (impassable) coordinate at the given
|
||||
* coordinates.
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -0,0 +0,0 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
int getZ();
|
||||
|
||||
+ // Paper Start
|
||||
+ /**
|
||||
+ * Returns this block's coordinates packed into a long value.
|
||||
+ * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())}
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ * @return This block's x, y, and z coordinates packed into a long value
|
||||
+ */
|
||||
+ public default long getBlockKey() {
|
||||
+ return Block.getBlockKey(this.getX(), this.getY(), this.getZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the specified block coordinates packed into a long value
|
||||
+ * <p>
|
||||
+ * The return value can be computed as follows:
|
||||
+ * <br>
|
||||
+ * {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);}
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * And may be unpacked as follows:
|
||||
+ * <br>
|
||||
+ * {@code int x = (int) ((packed << 37) >> 37);}
|
||||
+ * <br>
|
||||
+ * {@code int y = (int) (packed >>> 54);}
|
||||
+ * <br>
|
||||
+ * {@code int z = (int) ((packed << 10) >> 37);}
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @return This block's x, y, and z coordinates packed into a long value
|
||||
+ */
|
||||
+ public static long getBlockKey(int x, int y, int z) {
|
||||
+ return ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the x component from the packed value.
|
||||
+ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)}
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ * @return The x component from the packed value.
|
||||
+ */
|
||||
+ public static int getBlockKeyX(long packed) {
|
||||
+ return (int) ((packed << 37) >> 37);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the y component from the packed value.
|
||||
+ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)}
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ * @return The y component from the packed value.
|
||||
+ */
|
||||
+ public static int getBlockKeyY(long packed) {
|
||||
+ return (int) (packed >>> 54);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the z component from the packed value.
|
||||
+ * @param packed The packed value, as computed by {@link Block#getBlockKey(int, int, int)}
|
||||
+ * @see Block#getBlockKey(int, int, int)
|
||||
+ * @return The z component from the packed value.
|
||||
+ */
|
||||
+ public static int getBlockKeyZ(long packed) {
|
||||
+ return (int) ((packed << 10) >> 37);
|
||||
+ }
|
||||
+ // Paper End
|
||||
+
|
||||
/**
|
||||
* Gets the Location of the block
|
||||
*
|
32
patches/api/Allow-disabling-armour-stand-ticking.patch
Normal file
32
patches/api/Allow-disabling-armour-stand-ticking.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Wed, 15 Aug 2018 01:26:03 -0700
|
||||
Subject: [PATCH] Allow disabling armour stand ticking
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
|
||||
* @param move {@code true} if this armour stand can move, {@code false} otherwise
|
||||
*/
|
||||
void setCanMove(boolean move);
|
||||
+
|
||||
+ /**
|
||||
+ * Tests if this armor stand can tick.
|
||||
+ *
|
||||
+ * <p>The default value is defined in {@code paper.yml}.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if this armour stand can tick, {@code false} otherwise
|
||||
+ */
|
||||
+ boolean canTick();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this armor stand can tick.
|
||||
+ *
|
||||
+ * @param tick {@code true} if this armour stand can tick, {@code false} otherwise
|
||||
+ */
|
||||
+ void setCanTick(final boolean tick);
|
||||
// Paper end
|
||||
}
|
160
patches/api/AnvilDamageEvent.patch
Normal file
160
patches/api/AnvilDamageEvent.patch
Normal file
@@ -0,0 +1,160 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 20 Jul 2018 23:36:55 -0500
|
||||
Subject: [PATCH] AnvilDamageEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/AnvilDamagedEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.block.data.BlockData;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.inventory.InventoryEvent;
|
||||
+import org.bukkit.inventory.AnvilInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an anvil is damaged from being used
|
||||
+ */
|
||||
+public class AnvilDamagedEvent extends InventoryEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancel;
|
||||
+ private DamageState damageState;
|
||||
+
|
||||
+ public AnvilDamagedEvent(@NotNull InventoryView inventory, @NotNull BlockData blockData) {
|
||||
+ super(inventory);
|
||||
+ this.damageState = DamageState.getState(blockData);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public AnvilInventory getInventory() {
|
||||
+ return (AnvilInventory) super.getInventory();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new state of damage on the anvil
|
||||
+ *
|
||||
+ * @return Damage state
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DamageState getDamageState() {
|
||||
+ return damageState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the new state of damage on the anvil
|
||||
+ *
|
||||
+ * @param damageState Damage state
|
||||
+ */
|
||||
+ public void setDamageState(@NotNull DamageState damageState) {
|
||||
+ this.damageState = damageState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if anvil is breaking on this use
|
||||
+ *
|
||||
+ * @return True if breaking
|
||||
+ */
|
||||
+ public boolean isBreaking() {
|
||||
+ return damageState == DamageState.BROKEN;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if anvil is breaking on this use
|
||||
+ *
|
||||
+ * @param breaking True if breaking
|
||||
+ */
|
||||
+ public void setBreaking(boolean breaking) {
|
||||
+ if (breaking) {
|
||||
+ damageState = DamageState.BROKEN;
|
||||
+ } else if (damageState == DamageState.BROKEN) {
|
||||
+ damageState = DamageState.DAMAGED;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Represents the amount of damage on an anvil block
|
||||
+ */
|
||||
+ public enum DamageState {
|
||||
+ FULL(Material.ANVIL),
|
||||
+ CHIPPED(Material.CHIPPED_ANVIL),
|
||||
+ DAMAGED(Material.DAMAGED_ANVIL),
|
||||
+ BROKEN(Material.AIR);
|
||||
+
|
||||
+ private Material material;
|
||||
+
|
||||
+ DamageState(@NotNull Material material) {
|
||||
+ this.material = material;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get block material of this state
|
||||
+ *
|
||||
+ * @return Material
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getMaterial() {
|
||||
+ return material;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get damaged state by block data
|
||||
+ *
|
||||
+ * @param blockData Block data
|
||||
+ * @return DamageState
|
||||
+ * @throws IllegalArgumentException If non anvil block data is given
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static DamageState getState(@Nullable BlockData blockData) {
|
||||
+ return blockData == null ? BROKEN : getState(blockData.getMaterial());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get damaged state by block material
|
||||
+ *
|
||||
+ * @param material Block material
|
||||
+ * @return DamageState
|
||||
+ * @throws IllegalArgumentException If non anvil material is given
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static DamageState getState(@Nullable Material material) {
|
||||
+ if (material == null) {
|
||||
+ return BROKEN;
|
||||
+ }
|
||||
+ for (DamageState state : values()) {
|
||||
+ if (state.material == material) {
|
||||
+ return state;
|
||||
+ }
|
||||
+ }
|
||||
+ throw new IllegalArgumentException("Material not an anvil");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 15 Aug 2018 01:19:37 -0400
|
||||
Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
@@ -0,0 +0,0 @@ public class TimingHistory {
|
||||
data.entityCounts.get(entity.getType()).increment();
|
||||
}
|
||||
|
||||
- for (BlockState tileEntity : chunk.getTileEntities()) {
|
||||
+ for (BlockState tileEntity : chunk.getTileEntities(false)) {
|
||||
if (tileEntity == null) {
|
||||
Bukkit.getLogger().warning("Null tileentity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ());
|
||||
continue;
|
104
patches/api/EntityTransformedEvent.patch
Normal file
104
patches/api/EntityTransformedEvent.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Anthony MacAllister <anthonymmacallister@gmail.com>
|
||||
Date: Thu, 26 Jul 2018 15:28:53 -0400
|
||||
Subject: [PATCH] EntityTransformedEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an entity transforms into another entity
|
||||
+ * <p>
|
||||
+ * If the event is cancelled, the entity will not transform
|
||||
+ * @deprecated Bukkit has added {@link EntityTransformEvent}, you should start using that
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class EntityTransformedEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final Entity transformed;
|
||||
+ private final TransformedReason reason;
|
||||
+
|
||||
+ public EntityTransformedEvent(Entity entity, Entity transformed, TransformedReason reason) {
|
||||
+ super(entity);
|
||||
+ this.transformed = transformed;
|
||||
+ this.reason = reason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The entity after it has transformed
|
||||
+ *
|
||||
+ * @return Transformed entity
|
||||
+ * @deprecated see {@link EntityTransformEvent#getTransformedEntity()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public Entity getTransformed() {
|
||||
+ return transformed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The reason for the transformation
|
||||
+ * @deprecated see {@link EntityTransformEvent#getTransformReason()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public TransformedReason getReason() {
|
||||
+ return reason;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers(){
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList(){
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled(){
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel){
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ public enum TransformedReason {
|
||||
+ /**
|
||||
+ * When a zombie drowns
|
||||
+ */
|
||||
+ DROWNED,
|
||||
+ /**
|
||||
+ * When a zombie villager is cured
|
||||
+ */
|
||||
+ CURED,
|
||||
+ /**
|
||||
+ * When a villager turns to a zombie villager
|
||||
+ */
|
||||
+ INFECTED,
|
||||
+ /**
|
||||
+ * When a mooshroom turns to a cow
|
||||
+ */
|
||||
+ SHEARED,
|
||||
+ /**
|
||||
+ * When a pig turns to a zombiepigman
|
||||
+ */
|
||||
+ LIGHTNING
|
||||
+
|
||||
+ }
|
||||
+}
|
103
patches/api/Expand-ArmorStand-API.patch
Normal file
103
patches/api/Expand-ArmorStand-API.patch
Normal file
@@ -0,0 +1,103 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: willies952002 <admin@domnian.com>
|
||||
Date: Thu, 26 Jul 2018 02:22:44 -0400
|
||||
Subject: [PATCH] Expand ArmorStand API
|
||||
|
||||
Add the following:
|
||||
- Add proper methods for getting and setting items in both hands. Deprecates old methods
|
||||
- Enable/Disable slot interactions
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
|
||||
* Returns the item the armor stand is currently holding.
|
||||
*
|
||||
* @return the held item
|
||||
- * @deprecated prefer {@link EntityEquipment#getItemInHand()}
|
||||
+ * @deprecated prefer {@link ArmorStand#getItem(EquipmentSlot)} // Paper
|
||||
* @see #getEquipment()
|
||||
*/
|
||||
@NotNull
|
||||
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
|
||||
*
|
||||
* @param item the item to hold
|
||||
* @deprecated prefer
|
||||
- * {@link EntityEquipment#setItemInHand(org.bukkit.inventory.ItemStack)}
|
||||
+ * {@link ArmorStand#setItem(EquipmentSlot, ItemStack)} // Paper
|
||||
* @see #getEquipment()
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
|
||||
* @param tick {@code true} if this armour stand can tick, {@code false} otherwise
|
||||
*/
|
||||
void setCanTick(final boolean tick);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the item the armor stand has
|
||||
+ * equip in the given equipment slot
|
||||
+ *
|
||||
+ * @param slot the equipment slot to get
|
||||
+ * @return the ItemStack in the equipment slot
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ ItemStack getItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the item the armor stand has
|
||||
+ * equip in the given equipment slot
|
||||
+ *
|
||||
+ * @param slot the equipment slot to set
|
||||
+ * @param item the item to hold
|
||||
+ */
|
||||
+ void setItem(@NotNull final org.bukkit.inventory.EquipmentSlot slot, @Nullable final ItemStack item);
|
||||
+
|
||||
+ /**
|
||||
+ * Get the list of disabled slots
|
||||
+ *
|
||||
+ * @return list of disabled slots
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ java.util.Set<org.bukkit.inventory.EquipmentSlot> getDisabledSlots();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the disabled slots
|
||||
+ *
|
||||
+ * This makes it so a player is unable to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
|
||||
+ * Note: Once a slot is disabled, the only way to get an item back it to break the armor stand.
|
||||
+ *
|
||||
+ * @param slots var-arg array of slots to lock
|
||||
+ */
|
||||
+ void setDisabledSlots(@NotNull org.bukkit.inventory.EquipmentSlot... slots);
|
||||
+
|
||||
+ /**
|
||||
+ * Disable specific slots, adding them
|
||||
+ * to the currently disabled slots
|
||||
+ *
|
||||
+ * This makes it so a player is unable to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
|
||||
+ * Note: Once a slot is disabled, the only way to get an item back it to break the armor stand.
|
||||
+ *
|
||||
+ * @param slots var-arg array of slots to lock
|
||||
+ */
|
||||
+ void addDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
|
||||
+
|
||||
+ /**
|
||||
+ * Remove the given slots from the disabled
|
||||
+ * slots list, enabling them.
|
||||
+ *
|
||||
+ * This makes it so a player is able to interact with the Armor Stand to place, remove, or replace an item in the given slot(s)
|
||||
+ *
|
||||
+ * @param slots var-arg array of slots to unlock
|
||||
+ */
|
||||
+ void removeDisabledSlots(@NotNull final org.bukkit.inventory.EquipmentSlot... slots);
|
||||
+
|
||||
+ /**
|
||||
+ * Check if a specific slot is disabled
|
||||
+ *
|
||||
+ * @param slot The slot to check
|
||||
+ * @return {@code true} if the slot is disabled, else {@code false}.
|
||||
+ */
|
||||
+ boolean isSlotDisabled(@NotNull org.bukkit.inventory.EquipmentSlot slot);
|
||||
// Paper end
|
||||
}
|
66
patches/api/Expand-Location-Manipulation-API.patch
Normal file
66
patches/api/Expand-Location-Manipulation-API.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 25 Jul 2018 01:36:07 -0400
|
||||
Subject: [PATCH] Expand Location Manipulation API
|
||||
|
||||
Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
||||
|
||||
// Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the position of this Location and returns itself
|
||||
+ *
|
||||
+ * This mutates this object, clone first.
|
||||
+ * @param x X coordinate
|
||||
+ * @param y Y coordinate
|
||||
+ * @param z Z coordinate
|
||||
+ * @return self (not cloned)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location set(double x, double y, double z) {
|
||||
+ this.x = x;
|
||||
+ this.y = y;
|
||||
+ this.z = z;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Takes the x/y/z from base and adds the specified x/y/z to it and returns self
|
||||
+ *
|
||||
+ * This mutates this object, clone first.
|
||||
+ * @param base The base coordinate to modify
|
||||
+ * @param x X coordinate to add to base
|
||||
+ * @param y Y coordinate to add to base
|
||||
+ * @param z Z coordinate to add to base
|
||||
+ * @return self (not cloned)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location add(@NotNull Location base, double x, double y, double z) {
|
||||
+ return this.set(base.x + x, base.y + y, base.z + z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Takes the x/y/z from base and subtracts the specified x/y/z to it and returns self
|
||||
+ *
|
||||
+ * This mutates this object, clone first.
|
||||
+ * @param base The base coordinate to modify
|
||||
+ * @param x X coordinate to subtract from base
|
||||
+ * @param y Y coordinate to subtract from base
|
||||
+ * @param z Z coordinate to subtract from base
|
||||
+ * @return self (not cloned)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location subtract(@NotNull Location base, double x, double y, double z) {
|
||||
+ return this.set(base.x - x, base.y - y, base.z - z);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
|
||||
*/
|
45
patches/api/Inventory-removeItemAnySlot.patch
Normal file
45
patches/api/Inventory-removeItemAnySlot.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Tue, 28 Aug 2018 23:04:06 -0400
|
||||
Subject: [PATCH] Inventory#removeItemAnySlot
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
@@ -0,0 +0,0 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
@NotNull
|
||||
public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Searches all possible inventory slots in order to remove the given ItemStacks.
|
||||
+ * <p>
|
||||
+ * Similar to {@link Inventory#removeItem(ItemStack...)} in behavior, except this
|
||||
+ * method will check all possible slots in the inventory, rather than just the main
|
||||
+ * storage contents.
|
||||
+ * <p>
|
||||
+ * It will try to remove 'as much as possible' from the types and amounts
|
||||
+ * you give as arguments.
|
||||
+ * <p>
|
||||
+ * The returned HashMap contains what it couldn't remove, where the key is
|
||||
+ * the index of the parameter, and the value is the ItemStack at that
|
||||
+ * index of the varargs parameter. If all the given ItemStacks are
|
||||
+ * removed, it will return an empty HashMap.
|
||||
+ * <p>
|
||||
+ * It is known that in some implementations this method will also set the
|
||||
+ * inputted argument amount to the number of that item not removed from
|
||||
+ * slots.
|
||||
+ *
|
||||
+ * @param items The ItemStacks to remove
|
||||
+ * @return A HashMap containing items that couldn't be removed.
|
||||
+ * @throws IllegalArgumentException if items is null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public HashMap<Integer, ItemStack> removeItemAnySlot(@NotNull ItemStack... items) throws IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Returns all ItemStacks from the inventory
|
||||
*
|
19
patches/api/Make-EnderDragon-extend-Mob.patch
Normal file
19
patches/api/Make-EnderDragon-extend-Mob.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 10 Aug 2018 22:08:34 -0400
|
||||
Subject: [PATCH] Make EnderDragon extend Mob
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/EnderDragon.java b/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents an Ender Dragon
|
||||
*/
|
||||
-public interface EnderDragon extends ComplexLivingEntity, Boss {
|
||||
+public interface EnderDragon extends ComplexLivingEntity, Boss, org.bukkit.entity.Mob { // Paper - add Mob
|
||||
|
||||
/**
|
||||
* Represents a phase or action that an Ender Dragon can perform.
|
72
patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch
Normal file
72
patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
|
||||
Allows you to easily access the chunks X/z as a long, and a method
|
||||
to look up by the long key too.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Chunk.java
|
||||
+++ b/src/main/java/org/bukkit/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder {
|
||||
*/
|
||||
int getZ();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return The Chunks X and Z coordinates packed into a long
|
||||
+ */
|
||||
+ default long getChunkKey() {
|
||||
+ return getChunkKey(getX(), getZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param loc Location to get chunk key
|
||||
+ * @return Location's chunk coordinates packed into a long
|
||||
+ */
|
||||
+ static long getChunkKey(@NotNull Location loc) {
|
||||
+ return getChunkKey((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param x X Coordinate
|
||||
+ * @param z Z Coordinate
|
||||
+ * @return Chunk coordinates packed into a long
|
||||
+ */
|
||||
+ static long getChunkKey(int x, int z) {
|
||||
+ return (long) x & 0xffffffffL | ((long) z & 0xffffffffL) << 32;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
@NotNull
|
||||
public Chunk getChunkAt(@NotNull Block block);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * 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;
|
||||
+ *
|
||||
+ * @param chunkKey The Chunk Key to look up the chunk by
|
||||
+ * @return The chunk at the specified key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public default Chunk getChunkAt(long chunkKey) {
|
||||
+ return getChunkAt((int) chunkKey, (int) (chunkKey >> 32));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Checks if the specified {@link Chunk} is loaded
|
||||
*
|
124
patches/api/Remove-deadlock-risk-in-firing-async-events.patch
Normal file
124
patches/api/Remove-deadlock-risk-in-firing-async-events.patch
Normal file
@@ -0,0 +1,124 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 9 Sep 2018 00:32:05 -0400
|
||||
Subject: [PATCH] Remove deadlock risk in firing async events
|
||||
|
||||
The PluginManager incorrectly used synchronization on firing any event
|
||||
that was marked as synchronous.
|
||||
|
||||
This synchronized did not even protect any concurrency risk as
|
||||
handlers were already thread safe in terms of mutations during event
|
||||
dispatch.
|
||||
|
||||
The way it was used, has commonly led to deadlocks on the server,
|
||||
which results in a hard crash.
|
||||
|
||||
This change removes the synchronize and adds some protection around enable/disable
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
* @return true if the plugin is enabled, otherwise false
|
||||
*/
|
||||
@Override
|
||||
- public boolean isPluginEnabled(@Nullable Plugin plugin) {
|
||||
+ public synchronized boolean isPluginEnabled(@Nullable Plugin plugin) { // Paper - synchronize
|
||||
if ((plugin != null) && (plugins.contains(plugin))) {
|
||||
return plugin.isEnabled();
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void enablePlugin(@NotNull final Plugin plugin) {
|
||||
+ public synchronized void enablePlugin(@NotNull final Plugin plugin) { // Paper - synchronize
|
||||
if (!plugin.isEnabled()) {
|
||||
List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin);
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void disablePlugin(@NotNull final Plugin plugin, boolean closeClassloader) {
|
||||
+ public synchronized void disablePlugin(@NotNull final Plugin plugin, boolean closeClassloader) { // Paper - synchronize
|
||||
// Paper end - close Classloader on disable
|
||||
if (plugin.isEnabled()) {
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
defaultPerms.get(false).clear();
|
||||
}
|
||||
}
|
||||
+ private void fireEvent(Event event) { callEvent(event); } // Paper - support old method incase plugin uses reflection
|
||||
|
||||
/**
|
||||
* Calls an event with the given details.
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
*/
|
||||
@Override
|
||||
public void callEvent(@NotNull Event event) {
|
||||
- if (event.isAsynchronous()) {
|
||||
- if (Thread.holdsLock(this)) {
|
||||
- throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.");
|
||||
- }
|
||||
- if (server.isPrimaryThread()) {
|
||||
- throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from primary server thread.");
|
||||
- }
|
||||
- } else {
|
||||
- if (!server.isPrimaryThread()) {
|
||||
- throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from another thread.");
|
||||
- }
|
||||
+ // Paper - replace callEvent by merging to below method
|
||||
+ if (event.isAsynchronous() && server.isPrimaryThread()) {
|
||||
+ throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||
+ } else if (!event.isAsynchronous() && !server.isPrimaryThread()) {
|
||||
+ throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||
}
|
||||
|
||||
- fireEvent(event);
|
||||
- }
|
||||
-
|
||||
- private void fireEvent(@NotNull Event event) {
|
||||
HandlerList handlers = event.getHandlers();
|
||||
RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java
|
||||
+++ b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
|
||||
@@ -0,0 +0,0 @@ public class PluginManagerTest {
|
||||
private static final PluginManager pm = TestServer.getInstance().getPluginManager();
|
||||
|
||||
private final MutableObject store = new MutableObject();
|
||||
-
|
||||
+/* // Paper start - remove unneeded test
|
||||
@Test
|
||||
public void testAsyncSameThread() {
|
||||
final Event event = new TestEvent(true);
|
||||
@@ -0,0 +0,0 @@ public class PluginManagerTest {
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("No exception thrown");
|
||||
- }
|
||||
+ }*/ // Paper end
|
||||
|
||||
@Test
|
||||
public void testSyncSameThread() {
|
||||
final Event event = new TestEvent(false);
|
||||
pm.callEvent(event);
|
||||
}
|
||||
-
|
||||
+/* // Paper start - remove unneeded test
|
||||
@Test
|
||||
public void testAsyncLocked() throws InterruptedException {
|
||||
final Event event = new TestEvent(true);
|
||||
@@ -0,0 +0,0 @@ public class PluginManagerTest {
|
||||
if (store.value == null) {
|
||||
throw new IllegalStateException("No exception thrown");
|
||||
}
|
||||
- }
|
||||
+ } */ // Paper
|
||||
|
||||
@Test
|
||||
public void testRemovePermissionByNameLower() {
|
92
patches/api/SkeletonHorse-Additions.patch
Normal file
92
patches/api/SkeletonHorse-Additions.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 27 Jul 2018 22:36:17 -0500
|
||||
Subject: [PATCH] SkeletonHorse Additions
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+import org.bukkit.entity.SkeletonHorse;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
|
||||
+ */
|
||||
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final List<HumanEntity> eligibleHumans;
|
||||
+
|
||||
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse) {
|
||||
+ this(horse, ImmutableList.of());
|
||||
+ }
|
||||
+
|
||||
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse, @NotNull List<HumanEntity> eligibleHumans) {
|
||||
+ super(horse);
|
||||
+ this.eligibleHumans = eligibleHumans;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public SkeletonHorse getEntity() {
|
||||
+ return (SkeletonHorse) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public List<HumanEntity> getEligibleHumans() {
|
||||
+ return eligibleHumans;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
diff --git a/src/main/java/org/bukkit/entity/SkeletonHorse.java b/src/main/java/org/bukkit/entity/SkeletonHorse.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/SkeletonHorse.java
|
||||
+++ b/src/main/java/org/bukkit/entity/SkeletonHorse.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
/**
|
||||
* Represents a SkeletonHorse - variant of {@link AbstractHorse}.
|
||||
*/
|
||||
-public interface SkeletonHorse extends AbstractHorse { }
|
||||
+public interface SkeletonHorse extends AbstractHorse {
|
||||
+ // Paper start
|
||||
+ int getTrapTime();
|
||||
+
|
||||
+ boolean isTrap();
|
||||
+
|
||||
+ void setTrap(boolean trap);
|
||||
+ // Paper end
|
||||
+}
|
217
patches/api/Slime-Pathfinder-Events.patch
Normal file
217
patches/api/Slime-Pathfinder-Events.patch
Normal file
@@ -0,0 +1,217 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 24 Aug 2018 08:18:27 -0500
|
||||
Subject: [PATCH] Slime Pathfinder Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeChangeDirectionEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to change it's facing direction.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to change direction.
|
||||
+ */
|
||||
+public class SlimeChangeDirectionEvent extends SlimePathfindEvent implements Cancellable {
|
||||
+ private float yaw;
|
||||
+
|
||||
+ public SlimeChangeDirectionEvent(@NotNull Slime slime, float yaw) {
|
||||
+ super(slime);
|
||||
+ this.yaw = yaw;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the new chosen yaw
|
||||
+ *
|
||||
+ * @return Chosen yaw
|
||||
+ */
|
||||
+ public float getNewYaw() {
|
||||
+ return yaw;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the new chosen yaw
|
||||
+ *
|
||||
+ * @param yaw Chosen yaw
|
||||
+ */
|
||||
+ public void setNewYaw(float yaw) {
|
||||
+ this.yaw = yaw;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimePathfindEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to start pathfinding.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+public class SlimePathfindEvent extends EntityEvent implements Cancellable {
|
||||
+ public SlimePathfindEvent(@NotNull Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The Slime that is pathfinding.
|
||||
+ *
|
||||
+ * @return The Slime that is pathfinding.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Slime getEntity() {
|
||||
+ return (Slime) entity;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeSwimEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to start jumping while swimming in water/lava.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start jumping.
|
||||
+ */
|
||||
+public class SlimeSwimEvent extends SlimeWanderEvent implements Cancellable {
|
||||
+ public SlimeSwimEvent(@NotNull Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeTargetLivingEntityEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to change direction to target a LivingEntity.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+public class SlimeTargetLivingEntityEvent extends SlimePathfindEvent implements Cancellable {
|
||||
+ @NotNull private final LivingEntity target;
|
||||
+
|
||||
+ public SlimeTargetLivingEntityEvent(@NotNull Slime slime, @NotNull LivingEntity target) {
|
||||
+ super(slime);
|
||||
+ this.target = target;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the targeted entity
|
||||
+ *
|
||||
+ * @return Targeted entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getTarget() {
|
||||
+ return target;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SlimeWanderEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Slime;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Slime decides to start wandering.
|
||||
+ * <p>
|
||||
+ * This event does not fire for the entity's actual movement. Only when it
|
||||
+ * is choosing to start moving.
|
||||
+ */
|
||||
+public class SlimeWanderEvent extends SlimePathfindEvent implements Cancellable {
|
||||
+ public SlimeWanderEvent(@NotNull Slime slime) {
|
||||
+ super(slime);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Slime.java b/src/main/java/org/bukkit/entity/Slime.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Slime.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Slime.java
|
||||
@@ -0,0 +0,0 @@ public interface Slime extends Mob {
|
||||
* @param sz The new size of the slime.
|
||||
*/
|
||||
public void setSize(int sz);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get whether this slime can randomly wander/jump around on its own
|
||||
+ *
|
||||
+ * @return true if can wander
|
||||
+ */
|
||||
+ public boolean canWander();
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether this slime can randomly wander/jump around on its own
|
||||
+ *
|
||||
+ * @param canWander true if can wander
|
||||
+ */
|
||||
+ public void setWander(boolean canWander);
|
||||
+ // Paper end
|
||||
}
|
57
patches/api/isChunkGenerated-API.patch
Normal file
57
patches/api/isChunkGenerated-API.patch
Normal file
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: cswhite2000 <18whitechristop@gmail.com>
|
||||
Date: Tue, 21 Aug 2018 19:39:46 -0700
|
||||
Subject: [PATCH] isChunkGenerated API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
+import com.google.common.base.Preconditions; // Paper
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
||||
|
||||
// Paper start
|
||||
+ /**
|
||||
+ * Checks if a {@link Chunk} has been generated at this location.
|
||||
+ *
|
||||
+ * @return true if a chunk has been generated at this location
|
||||
+ */
|
||||
+ public boolean isGenerated() {
|
||||
+ World world = this.getWorld();
|
||||
+ Preconditions.checkNotNull(world, "Location has no world!");
|
||||
+ return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4);
|
||||
+ }
|
||||
|
||||
/**
|
||||
* Sets the position of this Location and returns itself
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
public default Chunk getChunkAt(long chunkKey) {
|
||||
return getChunkAt((int) chunkKey, (int) (chunkKey >> 32));
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if a {@link Chunk} has been generated at the specified chunk key,
|
||||
+ * which is the X and Z packed into a long.
|
||||
+ *
|
||||
+ * @param chunkKey The Chunk Key to look up the chunk by
|
||||
+ * @return true if the chunk has been generated, otherwise false
|
||||
+ */
|
||||
+ public default boolean isChunkGenerated(long chunkKey) {
|
||||
+ return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32));
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
Reference in New Issue
Block a user