patches
fix
This commit is contained in:
parent
0fa2a949ae
commit
79f1d1a078
27 changed files with 340 additions and 481 deletions
41
patches/api/0154-Material-API-additions.patch
Normal file
41
patches/api/0154-Material-API-additions.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 6 Oct 2018 21:14:29 -0400
|
||||
Subject: [PATCH] Material API additions
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index da9f91d0a1d20839cfbc4e564f4987cda440f2ac..52290c43d1c02785c4cae4a73494a75cdc369e02 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -99,6 +99,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* An enum of all material IDs accepted by the official server and client
|
||||
*/
|
||||
+@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
|
||||
public enum Material implements Keyed {
|
||||
//<editor-fold desc="Materials" defaultstate="collapsed">
|
||||
AIR(9648, 0),
|
||||
@@ -3977,6 +3978,22 @@ public enum Material implements Keyed {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * @return If the type is either AIR, CAVE_AIR or VOID_AIR
|
||||
+ */
|
||||
+ public boolean isEmpty() {
|
||||
+ switch (this) {
|
||||
+ case AIR:
|
||||
+ case CAVE_AIR:
|
||||
+ case VOID_AIR:
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Do not use for any reason.
|
||||
*
|
1044
patches/api/0155-Add-Material-Tags.patch
Normal file
1044
patches/api/0155-Add-Material-Tags.patch
Normal file
File diff suppressed because it is too large
Load diff
105
patches/api/0156-Add-LivingEntity-getTargetEntity.patch
Normal file
105
patches/api/0156-Add-LivingEntity-getTargetEntity.patch
Normal file
|
@ -0,0 +1,105 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 22 Sep 2018 00:32:53 -0500
|
||||
Subject: [PATCH] Add LivingEntity#getTargetEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f52644fab1522bdf83ff4f489e9805b274421094
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
|
||||
@@ -0,0 +1,38 @@
|
||||
+package com.destroystokyo.paper.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents information about a targeted entity
|
||||
+ */
|
||||
+public class TargetEntityInfo {
|
||||
+ private final Entity entity;
|
||||
+ private final Vector hitVec;
|
||||
+
|
||||
+ public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) {
|
||||
+ this.entity = entity;
|
||||
+ this.hitVec = hitVec;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity that is targeted
|
||||
+ *
|
||||
+ * @return Targeted entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the position the entity is targeted at
|
||||
+ *
|
||||
+ * @return Targeted position
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Vector getHitVector() {
|
||||
+ return hitVec;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 05992ade1bca42a6233373b44513b89986d89c5a..ac6921093457cee6d01fd27690c8bb6034b4af53 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -151,6 +151,50 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
@Nullable
|
||||
public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @return entity being targeted, or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default Entity getTargetEntity(int maxDistance) {
|
||||
+ return getTargetEntity(maxDistance, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @param ignoreBlocks true to scan through blocks
|
||||
+ * @return entity being targeted, or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @return TargetEntityInfo about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance) {
|
||||
+ return getTargetEntityInfo(maxDistance, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @param ignoreBlocks true to scan through blocks
|
||||
+ * @return TargetEntityInfo about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks);
|
||||
// Paper end
|
||||
|
||||
/**
|
45
patches/api/0157-Add-sun-related-API.patch
Normal file
45
patches/api/0157-Add-sun-related-API.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 7 Oct 2018 00:54:15 -0500
|
||||
Subject: [PATCH] Add sun related API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 1264c65235e622f648d71ef10d804ef5193da973..b80a2fe9eb6824d986126e451900a62244d3a8e7 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -1812,6 +1812,16 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
*/
|
||||
public void setFullTime(long time);
|
||||
|
||||
+ // Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * Check if it is currently daytime in this world
|
||||
+ *
|
||||
+ * @return True if it is daytime
|
||||
+ */
|
||||
+ public boolean isDayTime();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the full in-game time on this world since the world generation
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||
index b132287817d35579ca5128a1ed5c242bf229771a..d726453c041a980576312b6bee96a07837f37974 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -16,6 +16,13 @@ public interface Mob extends LivingEntity, Lootable {
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.entity.Pathfinder getPathfinder();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if this mob is exposed to daylight
|
||||
+ *
|
||||
+ * @return True if mob is exposed to daylight
|
||||
+ */
|
||||
+ boolean isInDaylight();
|
||||
// Paper end
|
||||
|
||||
/**
|
42
patches/api/0158-Here-s-Johnny.patch
Normal file
42
patches/api/0158-Here-s-Johnny.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 12 Oct 2018 01:37:16 -0500
|
||||
Subject: [PATCH] Here's Johnny!
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Vindicator.java b/src/main/java/org/bukkit/entity/Vindicator.java
|
||||
index b8ea68a8f420c1ba99c0621a15e654d3ee48c8d6..c5d9e76a6a4125eb0409967a57e3836b8f2d24a0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Vindicator.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Vindicator.java
|
||||
@@ -3,4 +3,30 @@ package org.bukkit.entity;
|
||||
/**
|
||||
* Represents a Vindicator.
|
||||
*/
|
||||
-public interface Vindicator extends Illager { }
|
||||
+public interface Vindicator extends Illager {
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Check if this Vindicator is set to Johnny mode.
|
||||
+ * <p>
|
||||
+ * When in Johnny mode the Vindicator will be hostile to any kind of mob, except
|
||||
+ * for evokers, ghasts, illusioners and other vindicators. It will even be hostile
|
||||
+ * to vexes. All mobs, except for endermites, phantoms, guardians, slimes and
|
||||
+ * magma cubes, will try to attack the vindicator in return.
|
||||
+ *
|
||||
+ * @return True if in Johnny mode
|
||||
+ */
|
||||
+ boolean isJohnny();
|
||||
+
|
||||
+ /**
|
||||
+ * Set this Vindicator's Johnny mode.
|
||||
+ * <p>
|
||||
+ * When in Johnny mode the Vindicator will be hostile to any kind of mob, except
|
||||
+ * for evokers, ghasts, illusioners and other vindicators. It will even be hostile
|
||||
+ * to vexes. All mobs, except for endermites, phantoms, guardians, slimes and
|
||||
+ * magma cubes, will try to attack the vindicator in return.
|
||||
+ *
|
||||
+ * @param johnny True to enable Johnny mode
|
||||
+ */
|
||||
+ void setJohnny(boolean johnny);
|
||||
+ // Paper end
|
||||
+}
|
283
patches/api/0159-Turtle-API.patch
Normal file
283
patches/api/0159-Turtle-API.patch
Normal file
|
@ -0,0 +1,283 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 28 Sep 2018 17:08:09 -0500
|
||||
Subject: [PATCH] Turtle API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..021356d151ed638068e3e89b8cc77b3795883233
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
||||
@@ -0,0 +1,49 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Turtle;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Turtle decides to go home
|
||||
+ */
|
||||
+public class TurtleGoHomeEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public TurtleGoHomeEvent(@NotNull Turtle turtle) {
|
||||
+ super(turtle);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The turtle going home
|
||||
+ *
|
||||
+ * @return The turtle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a315c5185cd465dcf63c0ababef195da76dfc786
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
@@ -0,0 +1,87 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Turtle;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Turtle lays eggs
|
||||
+ */
|
||||
+public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+ @NotNull
|
||||
+ private final Location location;
|
||||
+ private int eggCount;
|
||||
+
|
||||
+ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) {
|
||||
+ super(turtle);
|
||||
+ this.location = location;
|
||||
+ this.eggCount = eggCount;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The turtle laying the eggs
|
||||
+ *
|
||||
+ * @return The turtle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the location where the eggs are being laid
|
||||
+ *
|
||||
+ * @return Location of eggs
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the number of eggs being laid
|
||||
+ *
|
||||
+ * @return Number of eggs
|
||||
+ */
|
||||
+ public int getEggCount() {
|
||||
+ return eggCount;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the number of eggs being laid
|
||||
+ *
|
||||
+ * @param eggCount Number of eggs
|
||||
+ */
|
||||
+ public void setEggCount(int eggCount) {
|
||||
+ if (eggCount < 1) {
|
||||
+ cancelled = true;
|
||||
+ return;
|
||||
+ }
|
||||
+ eggCount = Math.min(eggCount, 4);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688bd97cf78
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
@@ -0,0 +1,62 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Turtle;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a Turtle starts digging to lay eggs
|
||||
+ */
|
||||
+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+ @NotNull private final Location location;
|
||||
+
|
||||
+ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) {
|
||||
+ super(turtle);
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The turtle digging
|
||||
+ *
|
||||
+ * @return The turtle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Turtle getEntity() {
|
||||
+ return (Turtle) entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the location where the turtle is digging
|
||||
+ *
|
||||
+ * @return Location where digging
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java
|
||||
index 0a4cd29930c2f1c28f5a3e6884c7dec45b5cac11..5375ea14097f4f10b2294488b92924a35a72d4d7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Turtle.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Turtle.java
|
||||
@@ -1,6 +1,55 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
+import org.bukkit.Location;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
/**
|
||||
* Represents a turtle.
|
||||
*/
|
||||
-public interface Turtle extends Animals { }
|
||||
+public interface Turtle extends Animals {
|
||||
+ // Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * Get the turtle's home location
|
||||
+ *
|
||||
+ * @return Home location
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Location getHome();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the turtle's home location
|
||||
+ *
|
||||
+ * @param location Home location
|
||||
+ */
|
||||
+ void setHome(@NotNull Location location);
|
||||
+
|
||||
+ /**
|
||||
+ * Check if turtle is currently pathfinding to it's home
|
||||
+ *
|
||||
+ * @return True if going home
|
||||
+ */
|
||||
+ boolean isGoingHome();
|
||||
+
|
||||
+ /**
|
||||
+ * Get if turtle is digging to lay eggs
|
||||
+ *
|
||||
+ * @return True if digging
|
||||
+ */
|
||||
+ boolean isDigging();
|
||||
+
|
||||
+ /**
|
||||
+ * Get if turtle is carrying egg
|
||||
+ *
|
||||
+ * @return True if carrying egg
|
||||
+ */
|
||||
+ boolean hasEgg();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if turtle is carrying egg
|
||||
+ *
|
||||
+ * @param hasEgg True if carrying egg
|
||||
+ */
|
||||
+ void setHasEgg(boolean hasEgg);
|
||||
+ // Paper end
|
||||
+}
|
141
patches/api/0160-Add-spectator-target-events.patch
Normal file
141
patches/api/0160-Add-spectator-target-events.patch
Normal file
|
@ -0,0 +1,141 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Caleb Bassham <caleb.bassham@gmail.com>
|
||||
Date: Fri, 28 Sep 2018 02:30:56 -0500
|
||||
Subject: [PATCH] Add spectator target events
|
||||
|
||||
- PlayerStartSpectatingEntityEvent
|
||||
- PlayerStopSpectatingEntityEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b8ec7ef2d4ef0683cc0d6ca86885dd9a01f47e16
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
|
||||
@@ -0,0 +1,67 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Triggered when a player starts spectating an entity in spectator mode.
|
||||
+ */
|
||||
+public class PlayerStartSpectatingEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ @NotNull private final Entity currentSpectatorTarget;
|
||||
+ @NotNull private final Entity newSpectatorTarget;
|
||||
+
|
||||
+ public PlayerStartSpectatingEntityEvent(@NotNull Player player, @NotNull Entity currentSpectatorTarget, @NotNull Entity newSpectatorTarget) {
|
||||
+ super(player);
|
||||
+ this.currentSpectatorTarget = currentSpectatorTarget;
|
||||
+ this.newSpectatorTarget = newSpectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that the player is currently spectating or themselves if they weren't spectating anything
|
||||
+ *
|
||||
+ * @return The entity the player is currently spectating (before they start spectating the new target).
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getCurrentSpectatorTarget() {
|
||||
+ return currentSpectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new entity that the player will now be spectating
|
||||
+ *
|
||||
+ * @return The entity the player is now going to be spectating.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getNewSpectatorTarget() {
|
||||
+ return newSpectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..693d119ab920a1bd0d1b5a0feb092631715ec0ad
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Triggered when a player stops spectating an entity in spectator mode.
|
||||
+ */
|
||||
+public class PlayerStopSpectatingEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ @NotNull private final Entity spectatorTarget;
|
||||
+
|
||||
+ public PlayerStopSpectatingEntityEvent(@NotNull Player player, @NotNull Entity spectatorTarget) {
|
||||
+ super(player);
|
||||
+ this.spectatorTarget = spectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that the player is spectating
|
||||
+ *
|
||||
+ * @return The entity the player is currently spectating (before they will stop).
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getSpectatorTarget() {
|
||||
+ return spectatorTarget;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
64
patches/api/0161-Add-more-Witch-API.patch
Normal file
64
patches/api/0161-Add-more-Witch-API.patch
Normal file
|
@ -0,0 +1,64 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 12 Oct 2018 03:47:26 -0500
|
||||
Subject: [PATCH] Add more Witch API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java
|
||||
index aa88aede6c4e66a608a63d07bc66d60357b0bee9..b7f9db08fb2e4633e1dfad5c752451f6ac23d437 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Witch.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Witch.java
|
||||
@@ -2,8 +2,53 @@ package org.bukkit.entity;
|
||||
|
||||
import com.destroystokyo.paper.entity.RangedEntity;
|
||||
|
||||
+// Paper start
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+// Paper end
|
||||
+
|
||||
/**
|
||||
* Represents a Witch
|
||||
*/
|
||||
public interface Witch extends Raider, RangedEntity { // Paper
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Check if Witch is drinking a potion
|
||||
+ *
|
||||
+ * @return True if drinking a potion
|
||||
+ */
|
||||
+ boolean isDrinkingPotion();
|
||||
+
|
||||
+ /**
|
||||
+ * Get time remaining (in ticks) the Witch is drinking a potion
|
||||
+ *
|
||||
+ * @return Time remaining (in ticks)
|
||||
+ */
|
||||
+ int getPotionUseTimeLeft();
|
||||
+
|
||||
+ /**
|
||||
+ * Set time remaining (in ticks) that the Witch is drinking a potion.
|
||||
+ * <p>
|
||||
+ * This only has an effect while the Witch is drinking a potion.
|
||||
+ *
|
||||
+ * @param ticks Time in ticks remaining
|
||||
+ * @see #isDrinkingPotion
|
||||
+ */
|
||||
+ void setPotionUseTimeLeft(int ticks);
|
||||
+
|
||||
+ /**
|
||||
+ * Get the potion the Witch is drinking
|
||||
+ *
|
||||
+ * @return The potion the witch is drinking
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ ItemStack getDrinkingPotion();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the potion the Witch should drink
|
||||
+ *
|
||||
+ * @param potion Potion to drink
|
||||
+ */
|
||||
+ void setDrinkingPotion(@Nullable ItemStack potion);
|
||||
+ // Paper end
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue