mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
all the patches are done
This commit is contained in:
@@ -1,191 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 18 Oct 2019 22:50:05 -0500
|
||||
Subject: [PATCH] Llama API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java
|
||||
index d23226ccb0f6c25028f000ce31346cd0a8898e6a..1ef9479c962b3f4f6fed46671a1209c34040d16d 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Llama.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Llama.java
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.entity;
|
||||
import com.destroystokyo.paper.entity.RangedEntity;
|
||||
import org.bukkit.inventory.LlamaInventory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable; // Purpur
|
||||
|
||||
/**
|
||||
* Represents a Llama.
|
||||
@@ -67,4 +68,65 @@ public interface Llama extends ChestedHorse, RangedEntity { // Paper
|
||||
@NotNull
|
||||
@Override
|
||||
LlamaInventory getInventory();
|
||||
+
|
||||
+ // Purpur start
|
||||
+
|
||||
+ /**
|
||||
+ * Check if this Llama should attempt to join a caravan
|
||||
+ *
|
||||
+ * @return True if Llama is allowed to join a caravan
|
||||
+ */
|
||||
+ boolean shouldJoinCaravan();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if this Llama should attempt to join a caravan
|
||||
+ *
|
||||
+ * @param shouldJoinCaravan True to allow joining a caravan
|
||||
+ */
|
||||
+ void setShouldJoinCaravan(boolean shouldJoinCaravan);
|
||||
+
|
||||
+ /**
|
||||
+ * Check if Llama is in a caravan
|
||||
+ *
|
||||
+ * @return True if in caravan
|
||||
+ */
|
||||
+ boolean inCaravan();
|
||||
+
|
||||
+ /**
|
||||
+ * Join a caravan
|
||||
+ *
|
||||
+ * @param llama Head of caravan to join
|
||||
+ */
|
||||
+ void joinCaravan(@NotNull Llama llama);
|
||||
+
|
||||
+ /**
|
||||
+ * Leave current caravan if in one
|
||||
+ */
|
||||
+ void leaveCaravan();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if another Llama is following this Llama
|
||||
+ *
|
||||
+ * @return True if being followed in the caravan
|
||||
+ */
|
||||
+ boolean hasCaravanTail();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the Llama that this Llama is following
|
||||
+ * <p>
|
||||
+ * Does not necessarily mean the leader of the entire caravan
|
||||
+ *
|
||||
+ * @return The Llama being followed
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Llama getCaravanHead();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the Llama following this Llama, if any
|
||||
+ *
|
||||
+ * @return The Llama following this one
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Llama getCaravanTail();
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/LlamaJoinCaravanEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/LlamaJoinCaravanEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8849bb0becb16db907fa648cca2e98ab9d957c75
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/event/entity/LlamaJoinCaravanEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
+package org.purpurmc.purpur.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Llama;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Llama tries to join a caravan.
|
||||
+ * <p>
|
||||
+ * Cancelling the event will not let the Llama join. To prevent future attempts
|
||||
+ * at joining a caravan use {@link Llama#setShouldJoinCaravan(boolean)}.
|
||||
+ */
|
||||
+public class LlamaJoinCaravanEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+ private final Llama head;
|
||||
+
|
||||
+ public LlamaJoinCaravanEvent(@NotNull Llama llama, @NotNull Llama head) {
|
||||
+ super(llama);
|
||||
+ this.head = head;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public Llama getEntity() {
|
||||
+ return (Llama) entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the Llama that this Llama is about to follow
|
||||
+ *
|
||||
+ * @return Llama about to be followed
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Llama getHead() {
|
||||
+ return head;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/LlamaLeaveCaravanEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/LlamaLeaveCaravanEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c268c35b541a222d50875c29770c846a8ffcc4f8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/event/entity/LlamaLeaveCaravanEvent.java
|
||||
@@ -0,0 +1,34 @@
|
||||
+package org.purpurmc.purpur.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Llama;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Llama leaves a caravan
|
||||
+ */
|
||||
+public class LlamaLeaveCaravanEvent extends EntityEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ public LlamaLeaveCaravanEvent(@NotNull Llama llama) {
|
||||
+ super(llama);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public Llama getEntity() {
|
||||
+ return (Llama) entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user