mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
patches
fix
This commit is contained in:
105
patches/api/Add-LivingEntity-getTargetEntity.patch
Normal file
105
patches/api/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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
|
||||
/**
|
1044
patches/api/Add-Material-Tags.patch
Normal file
1044
patches/api/Add-Material-Tags.patch
Normal file
File diff suppressed because it is too large
Load Diff
64
patches/api/Add-more-Witch-API.patch
Normal file
64
patches/api/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Witch.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Witch.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
141
patches/api/Add-spectator-target-events.patch
Normal file
141
patches/api/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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStartSpectatingEntityEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerStopSpectatingEntityEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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;
|
||||
+ }
|
||||
+}
|
45
patches/api/Add-sun-related-API.patch
Normal file
45
patches/api/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 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 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -0,0 +0,0 @@ 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/Here-s-Johnny.patch
Normal file
42
patches/api/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Vindicator.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Vindicator.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
+}
|
41
patches/api/Material-API-additions.patch
Normal file
41
patches/api/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -0,0 +0,0 @@ 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),
|
||||
@@ -0,0 +0,0 @@ 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.
|
||||
*
|
283
patches/api/Turtle-API.patch
Normal file
283
patches/api/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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Turtle.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Turtle.java
|
||||
@@ -0,0 +0,0 @@
|
||||
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
|
||||
+}
|
Reference in New Issue
Block a user