ALL OF THE API

This commit is contained in:
Ben Kerllenevich
2021-11-24 20:52:07 -05:00
parent b613cfcd30
commit 4b23b498b8
45 changed files with 96 additions and 96 deletions

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <ben@omega24.dev>
Date: Sat, 12 Jun 2021 12:35:38 -0400
Subject: [PATCH] Build System Changes
todo: merge with rebrand patch
diff --git a/build.gradle.kts b/build.gradle.kts
index 0446e0131198ecd6d6d1e381eec5bbab18031b62..7d6cde4e703ad23f47471e8610ace396d7c22e31 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -39,6 +39,7 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-plain")
api("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
api("org.slf4j:slf4j-api:1.7.30") // Paper
+ api("net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT") // Purpur
implementation("org.ow2.asm:asm:9.1")
implementation("org.ow2.asm:asm-commons:9.1")

View File

@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 18 Feb 2020 20:30:03 -0600
Subject: [PATCH] Purpur config files
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 395b0706bfbf03741df6ca1ff084618b91140acc..5bd999c3a05d936b19689930c7f64e12c23c3679 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1727,6 +1727,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Paper end
+ // Purpur start
+ @NotNull
+ public org.bukkit.configuration.file.YamlConfiguration getPurpurConfig() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @NotNull
+ public java.util.Properties getServerProperties() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Purpur end
+
/**
* Sends the component to the player
*

View File

@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fredthedoggy <45927799+fredthedoggy@users.noreply.github.com>
Date: Thu, 19 Aug 2021 20:04:18 -0400
Subject: [PATCH] Purpur client support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7de08c12aec311a8de631a8ec37147579c5e9963..90a1635379f3db8f6158099198d142e6c2cc1c8c 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2290,4 +2290,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Override
Spigot spigot();
// Spigot end
+
+ // Purpur start
+ /**
+ * Allows you to get if player uses Purpur Client
+ *
+ * @return True if Player uses Purpur Client
+ */
+ public boolean usesPurpurClient();
+ // Purpur end
}

View File

@@ -0,0 +1,116 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 5 Jun 2020 23:32:38 -0500
Subject: [PATCH] Default permissions
diff --git a/src/main/java/org/bukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
index 7763d6101ac61900db1e2310966b99584539fd0e..d5a42707d365ffd72532bbb1a59a1ca7145f9918 100644
--- a/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
+++ b/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
@@ -18,6 +18,7 @@ public final class CommandPermissions {
DefaultPermissions.registerPermission(PREFIX + "plugins", "Allows the user to view the list of plugins running on this server", PermissionDefault.TRUE, commands);
DefaultPermissions.registerPermission(PREFIX + "reload", "Allows the user to reload the server settings", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(PREFIX + "version", "Allows the user to view the version of the server", PermissionDefault.TRUE, commands);
+ DefaultPermissions.registerPermission(PREFIX + "purpur", "Allows the user to use the purpur command", PermissionDefault.OP, commands); // Purpur
commands.recalculatePermissibles();
return commands;
diff --git a/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java b/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java
index e1a4ddf2c07cdd242fa8054a0152522fe4039e85..8e481e3815f5645ee92f0d229e5ff25c8fc9a6c2 100644
--- a/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java
+++ b/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java
@@ -89,6 +89,8 @@ public final class DefaultPermissions {
CommandPermissions.registerPermissions(parent);
BroadcastPermissions.registerPermissions(parent);
+ PurpurPermissions.registerPermissions(); // Purpur
+
parent.recalculatePermissibles();
}
}
diff --git a/src/main/java/org/bukkit/util/permissions/PurpurPermissions.java b/src/main/java/org/bukkit/util/permissions/PurpurPermissions.java
new file mode 100644
index 0000000000000000000000000000000000000000..316f3f7f865d5ccc7bdab9d3de5b0d558f96d11f
--- /dev/null
+++ b/src/main/java/org/bukkit/util/permissions/PurpurPermissions.java
@@ -0,0 +1,79 @@
+package org.bukkit.util.permissions;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Mob;
+import org.bukkit.permissions.Permission;
+import org.bukkit.permissions.PermissionDefault;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public final class PurpurPermissions {
+ private static final String ROOT = "purpur";
+ private static final String PREFIX = ROOT + ".";
+ private static final Set<String> mobs = new HashSet<>();
+
+ static {
+ for (EntityType mob : EntityType.values()) {
+ Class<? extends Entity> clazz = mob.getEntityClass();
+ if (clazz != null && Mob.class.isAssignableFrom(clazz)) {
+ mobs.add(mob.getName());
+ }
+ }
+ }
+
+ @NotNull
+ public static Permission registerPermissions() {
+ Permission purpur = DefaultPermissions.registerPermission(ROOT, "Gives the user the ability to use all Purpur utilities and commands", PermissionDefault.FALSE);
+
+ DefaultPermissions.registerPermission(PREFIX + "enderchest.rows.six", "Gives the user six rows of enderchest space", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "enderchest.rows.five", "Gives the user five rows of enderchest space", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "enderchest.rows.four", "Gives the user four rows of enderchest space", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "enderchest.rows.three", "Gives the user three rows of enderchest space", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "enderchest.rows.two", "Gives the user two rows of enderchest space", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "enderchest.rows.one", "Gives the user one row of enderchest space", PermissionDefault.FALSE, purpur);
+
+ DefaultPermissions.registerPermission(PREFIX + "debug.f3n", "Allows the user to use F3+N keybind to swap gamemodes", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "joinfullserver", "Allows the user to join a full server", PermissionDefault.OP, purpur);
+
+ DefaultPermissions.registerPermission(PREFIX + "drop.spawner", "Allows the user to drop spawner cage when broken with diamond pickaxe with silk touch", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "place.spawner", "Allows the user to place spawner cage in the world", PermissionDefault.FALSE, purpur);
+
+ DefaultPermissions.registerPermission(PREFIX + "anvil.color", "Allows the user to use color codes on anvils", PermissionDefault.FALSE, purpur);
+
+ Permission book = DefaultPermissions.registerPermission(PREFIX + "book", "Allows the user to use color codes on books", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "book.color.edit", "Allows the user to use color codes on books when editing", PermissionDefault.FALSE, book);
+ DefaultPermissions.registerPermission(PREFIX + "book.color.sign", "Allows the user to use color codes on books when signing", PermissionDefault.FALSE, book);
+ book.recalculatePermissibles();
+
+ Permission sign = DefaultPermissions.registerPermission(PREFIX + "sign", "Allows the user to use all sign abilities", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission(PREFIX + "sign.edit", "Allows the user to click signs to open sign editor", PermissionDefault.FALSE, sign);
+ DefaultPermissions.registerPermission(PREFIX + "sign.color", "Allows the user to use color codes on signs", PermissionDefault.FALSE, sign);
+ DefaultPermissions.registerPermission(PREFIX + "sign.style", "Allows the user to use style codes on signs", PermissionDefault.FALSE, sign);
+ DefaultPermissions.registerPermission(PREFIX + "sign.magic", "Allows the user to use magic/obfuscate code on signs", PermissionDefault.FALSE, sign);
+ sign.recalculatePermissibles();
+
+ Permission ride = DefaultPermissions.registerPermission("allow.ride", "Allows the user to ride all mobs", PermissionDefault.FALSE, purpur);
+ for (String mob : mobs) {
+ DefaultPermissions.registerPermission("allow.ride." + mob, "Allows the user to ride " + mob, PermissionDefault.FALSE, ride);
+ }
+ ride.recalculatePermissibles();
+
+ Permission special = DefaultPermissions.registerPermission("allow.special", "Allows the user to use all mobs special abilities", PermissionDefault.FALSE, purpur);
+ for (String mob : mobs) {
+ DefaultPermissions.registerPermission("allow.special." + mob, "Allows the user to use " + mob + " special ability", PermissionDefault.FALSE, special);
+ }
+ special.recalculatePermissibles();
+
+ Permission powered = DefaultPermissions.registerPermission("allow.powered", "Allows the user to toggle all mobs powered state", PermissionDefault.FALSE, purpur);
+ DefaultPermissions.registerPermission("allow.powered.creeper", "Allows the user to toggle creeper powered state", PermissionDefault.FALSE, powered);
+ powered.recalculatePermissibles();
+
+ DefaultPermissions.registerPermission(PREFIX + "portal.instant", "Allows the user to bypass portal wait time", PermissionDefault.FALSE, purpur);
+
+ purpur.recalculatePermissibles();
+ return purpur;
+ }
+}

View File

@@ -0,0 +1,214 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 4 May 2019 00:57:16 -0500
Subject: [PATCH] Ridables
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 2405254739a83b2fb517da7fa4ea0721c68f9f6d..825c02793e3aaff45a8a0a9da01d72daf9421bee 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -197,6 +197,11 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Raider> RAIDER_MOVE_THROUGH_VILLAGE = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_move_through_village"));
GoalKey<Creature> PARROT_WANDER = GoalKey.of(Creature.class, NamespacedKey.minecraft("parrot_wander"));
+ // Purpur start
+ GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
+ GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
+ // Purpur end
+
/**
* @deprecated removed in 1.16
*/
diff --git a/src/main/java/net/pl3x/purpur/event/entity/RidableMoveEvent.java b/src/main/java/net/pl3x/purpur/event/entity/RidableMoveEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..48e7ac392fe5efac8a4ce549e31a05ed817417e4
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/entity/RidableMoveEvent.java
@@ -0,0 +1,103 @@
+package net.pl3x.purpur.event.entity;
+
+import com.google.common.base.Preconditions;
+import org.bukkit.Location;
+import org.bukkit.entity.Mob;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Triggered when a ridable mob moves with a rider
+ */
+public class RidableMoveEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+ private final Player rider;
+ private Location from;
+ private Location to;
+
+ public RidableMoveEvent(@NotNull Mob entity, @NotNull Player rider, @NotNull Location from, @NotNull Location to) {
+ super(entity);
+ this.rider = rider;
+ this.from = from;
+ this.to = to;
+ }
+
+ @Override
+ @NotNull
+ public Mob getEntity() {
+ return (Mob) entity;
+ }
+
+ @NotNull
+ public Player getRider() {
+ return rider;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ /**
+ * Gets the location this entity moved from
+ *
+ * @return Location the entity moved from
+ */
+ @NotNull
+ public Location getFrom() {
+ return from;
+ }
+
+ /**
+ * Sets the location to mark as where the entity moved from
+ *
+ * @param from New location to mark as the entity's previous location
+ */
+ public void setFrom(@NotNull Location from) {
+ validateLocation(from);
+ this.from = from;
+ }
+
+ /**
+ * Gets the location this entity moved to
+ *
+ * @return Location the entity moved to
+ */
+ @NotNull
+ public Location getTo() {
+ return to;
+ }
+
+ /**
+ * Sets the location that this entity will move to
+ *
+ * @param to New Location this entity will move to
+ */
+ public void setTo(@NotNull Location to) {
+ validateLocation(to);
+ this.to = to;
+ }
+
+ private void validateLocation(@NotNull Location loc) {
+ Preconditions.checkArgument(loc != null, "Cannot use null location!");
+ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!");
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/net/pl3x/purpur/event/entity/RidableSpacebarEvent.java b/src/main/java/net/pl3x/purpur/event/entity/RidableSpacebarEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c0ec5a130985e8da4cc9e596a6b70503d2550f77
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/entity/RidableSpacebarEvent.java
@@ -0,0 +1,37 @@
+package net.pl3x.purpur.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.jetbrains.annotations.NotNull;
+
+public class RidableSpacebarEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+
+ public RidableSpacebarEvent(@NotNull Entity entity) {
+ super(entity);
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 18795003815d5bb6e04a15256430f69a31b2ace5..0de88cfff94a17ff41d28b569b8d283ad8bf0b49 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -768,4 +768,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull Set<Player> getTrackedPlayers();
// Paper end
+
+ // Purpur start
+ /**
+ * Get the riding player
+ *
+ * @return Riding player
+ */
+ @Nullable
+ Player getRider();
+
+ /**
+ * Check if entity is being ridden
+ *
+ * @return True if being ridden
+ */
+ boolean hasRider();
+
+ /**
+ * Check if entity is ridable
+ *
+ * @return True if ridable
+ */
+ boolean isRidable();
+
+ /**
+ * Check if entity is ridable in water
+ *
+ * @return True if ridable in water
+ */
+ boolean isRidableInWater();
+ // Purpur end
}

View File

@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 23 Jul 2019 06:50:55 -0500
Subject: [PATCH] Allow inventory resizing
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
index e1e7f45fd0f65d0874dd0698da436c7ac2e7951b..a31841b93964338c9325631dbfa59b3cad77b4f1 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -136,7 +136,7 @@ public enum InventoryType {
COMPOSTER(1, "Composter")
;
- private final int size;
+ private int size; // Purpur - remove final
private final String title;
private final boolean isCreatable;
@@ -163,6 +163,12 @@ public enum InventoryType {
this.defaultTitleComponent = net.kyori.adventure.text.Component.text(defaultTitle); // Paper - Adventure
}
+ // Purpur start
+ public void setDefaultSize(int size) {
+ this.size = size;
+ }
+ // Purpur end
+
public int getDefaultSize() {
return size;
}

View File

@@ -0,0 +1,191 @@
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/net/pl3x/purpur/event/entity/LlamaJoinCaravanEvent.java b/src/main/java/net/pl3x/purpur/event/entity/LlamaJoinCaravanEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..6e68c1399bf30eeef6ce0385867f0cf258698eae
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/entity/LlamaJoinCaravanEvent.java
@@ -0,0 +1,61 @@
+package net.pl3x.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/net/pl3x/purpur/event/entity/LlamaLeaveCaravanEvent.java b/src/main/java/net/pl3x/purpur/event/entity/LlamaLeaveCaravanEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ec8d978c22835e2789ebaaeddf0d13588ed1122a
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/entity/LlamaLeaveCaravanEvent.java
@@ -0,0 +1,34 @@
+package net.pl3x.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;
+ }
+}
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
}

View File

@@ -0,0 +1,111 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 10 Aug 2019 22:19:56 -0500
Subject: [PATCH] AFK API
diff --git a/src/main/java/net/pl3x/purpur/event/PlayerAFKEvent.java b/src/main/java/net/pl3x/purpur/event/PlayerAFKEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0c8b3e5e4ba412624357ea5662a78862bd9fc4be
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/PlayerAFKEvent.java
@@ -0,0 +1,70 @@
+package net.pl3x.purpur.event;
+
+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;
+import org.jetbrains.annotations.Nullable;
+
+public class PlayerAFKEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final boolean setAfk;
+ private boolean shouldKick;
+ private String broadcast;
+ private boolean cancel;
+
+ public PlayerAFKEvent(@NotNull Player player, boolean setAfk, boolean shouldKick, @Nullable String broadcast, boolean async) {
+ super(player, async);
+ this.setAfk = setAfk;
+ this.shouldKick = shouldKick;
+ this.broadcast = broadcast;
+ }
+
+ /**
+ * Whether player is going afk or coming back
+ *
+ * @return True if going afk. False is coming back
+ */
+ public boolean isGoingAfk() {
+ return setAfk;
+ }
+
+ public boolean shouldKick() {
+ return shouldKick;
+ }
+
+ public void setShouldKick(boolean shouldKick) {
+ this.shouldKick = shouldKick;
+ }
+
+ @Nullable
+ public String getBroadcastMsg() {
+ return broadcast;
+ }
+
+ public void setBroadcastMsg(@Nullable String broadcast) {
+ this.broadcast = broadcast;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 90a1635379f3db8f6158099198d142e6c2cc1c8c..dfc092c5f1f4e00d3eabb72b9f15d203cca602f7 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2298,5 +2298,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @return True if Player uses Purpur Client
*/
public boolean usesPurpurClient();
+
+ /**
+ * Check if player is AFK
+ *
+ * @return True if AFK
+ */
+ boolean isAfk();
+
+ /**
+ * Set player as AFK
+ *
+ * @param setAfk Whether to set AFK or not
+ */
+ void setAfk(boolean setAfk);
+
+ /**
+ * Reset the idle timer back to 0
+ */
+ void resetIdleTimer();
// Purpur end
}

View File

@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 26 May 2019 15:18:40 -0500
Subject: [PATCH] Bring back server name
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 7868a54eec71f7b31d7fabf3288eb2dc62649e92..ae8d698a58de2b4c0b42a6f43c63a9e5a4aaa039 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2120,4 +2120,15 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
+
+ // Purpur start
+ /**
+ * Get the name of this server
+ * @return the name of the server
+ */
+ @NotNull
+ public static String getServerName() {
+ return server.getServerName();
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5bd999c3a05d936b19689930c7f64e12c23c3679..06552f28aacf93ac68db90dccfcd1aa48eaba382 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1849,4 +1849,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
io.papermc.paper.datapack.DatapackManager getDatapackManager();
// Paper end
+
+ // Purpur start
+ /**
+ * Get the name of this server
+ * @return the name of the server
+ */
+ @NotNull
+ String getServerName();
+ // Purpur end
}

View File

@@ -0,0 +1,175 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 31 May 2019 00:08:28 -0500
Subject: [PATCH] ExecuteCommandEvent
diff --git a/src/main/java/net/pl3x/purpur/event/ExecuteCommandEvent.java b/src/main/java/net/pl3x/purpur/event/ExecuteCommandEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..3250bd4dc29a0cf79b08833d95a3321d1a6733f6
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/ExecuteCommandEvent.java
@@ -0,0 +1,130 @@
+package net.pl3x.purpur.event;
+
+import org.apache.commons.lang.Validate;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * This event is called whenever someone runs a command
+ */
+public class ExecuteCommandEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancel = false;
+ private CommandSender sender;
+ private Command command;
+ private String label;
+ private String[] args;
+
+ public ExecuteCommandEvent(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @Nullable String[] args) {
+ this.sender = sender;
+ this.command = command;
+ this.label = label;
+ this.args = args;
+ }
+
+ /**
+ * Gets the command that the player is attempting to execute.
+ *
+ * @return Command the player is attempting to execute
+ */
+ @NotNull
+ public Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Sets the command that the player will execute.
+ *
+ * @param command New command that the player will execute
+ * @throws IllegalArgumentException if command is null or empty
+ */
+ public void setCommand(@NotNull Command command) throws IllegalArgumentException {
+ Validate.notNull(command, "Command cannot be null");
+ this.command = command;
+ }
+
+ /**
+ * Gets the sender that this command will be executed as.
+ *
+ * @return Sender this command will be executed as
+ */
+ @NotNull
+ public CommandSender getSender() {
+ return sender;
+ }
+
+ /**
+ * Sets the sender that this command will be executed as.
+ *
+ * @param sender New sender which this event will execute as
+ * @throws IllegalArgumentException if the sender provided is null
+ */
+ public void setSender(@NotNull final CommandSender sender) throws IllegalArgumentException {
+ Validate.notNull(sender, "Sender cannot be null");
+ this.sender = sender;
+ }
+
+ /**
+ * Get the label used to execute this command
+ *
+ * @return Label used to execute this command
+ */
+ @NotNull
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * Set the label used to execute this command
+ *
+ * @param label Label used
+ */
+ public void setLabel(@NotNull String label) {
+ this.label = label;
+ }
+
+ /**
+ * Get the args passed to the command
+ *
+ * @return Args passed to the command
+ */
+ @NotNull
+ public String[] getArgs() {
+ return args;
+ }
+
+ /**
+ * Set the args passed to the command
+ *
+ * @param args Args passed to the command
+ */
+ public void setArgs(@NotNull String[] args) {
+ this.args = args;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 74252236b138969560e6513f24e7ecc6dc4a4127..c12de7917ab074083c9758645a403b501455a49d 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -147,6 +147,19 @@ public class SimpleCommandMap implements CommandMap {
return false;
}
+ // Purpur start
+ String[] parsedArgs = Arrays.copyOfRange(args, 1, args.length);
+ net.pl3x.purpur.event.ExecuteCommandEvent event = new net.pl3x.purpur.event.ExecuteCommandEvent(sender, target, sentCommandLabel, parsedArgs);
+ if (!event.callEvent()) {
+ return true; // cancelled
+ }
+
+ sender = event.getSender();
+ target = event.getCommand();
+ sentCommandLabel = event.getLabel();
+ parsedArgs = event.getArgs();
+ // Purpur end
+
// Paper start - Plugins do weird things to workaround normal registration
if (target.timings == null) {
target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
@@ -156,7 +169,7 @@ public class SimpleCommandMap implements CommandMap {
try {
try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
- target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
+ target.execute(sender, sentCommandLabel, parsedArgs); // Purpur
} // target.timings.stopTiming(); // Spigot // Paper
} catch (CommandException ex) {
server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 5 May 2019 12:58:19 -0500
Subject: [PATCH] LivingEntity safeFallDistance
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 31353bd20404a8c2acf6bf0df524dc3cae324272..e532430b7444cef4e383b3afb637cc6060d8686a 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -910,4 +910,20 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
void setHurtDirection(float hurtDirection);
// Paper end
+
+ // Purpur start
+ /**
+ * Gets the distance (in blocks) this entity can safely fall without taking damage
+ *
+ * @return Safe fall distance
+ */
+ float getSafeFallDistance();
+
+ /**
+ * Set the distance (in blocks) this entity can safely fall without taking damage
+ *
+ * @param safeFallDistance Safe fall distance
+ */
+ void setSafeFallDistance(float safeFallDistance);
+ // Purpur end
}

View File

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 23 Jul 2019 10:07:24 -0500
Subject: [PATCH] Lagging threshold
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ae8d698a58de2b4c0b42a6f43c63a9e5a4aaa039..a8fc16f2fa6713a4cbe75c17a8e6743f69c383d5 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2130,5 +2130,14 @@ public final class Bukkit {
public static String getServerName() {
return server.getServerName();
}
+
+ /**
+ * Check if server is lagging according to laggy threshold setting
+ *
+ * @return True if lagging
+ */
+ public static boolean isLagging() {
+ return server.isLagging();
+ }
// Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 06552f28aacf93ac68db90dccfcd1aa48eaba382..1910f88c155c6d19d02494e4fea2b86509235e5a 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1857,5 +1857,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
String getServerName();
+
+ /**
+ * Check if server is lagging according to laggy threshold setting
+ *
+ * @return True if lagging
+ */
+ boolean isLagging();
// Purpur end
}

View File

@@ -0,0 +1,97 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 5 Jul 2019 18:21:15 -0500
Subject: [PATCH] PlayerSetSpawnerTypeWithEggEvent
diff --git a/src/main/java/net/pl3x/purpur/event/PlayerSetSpawnerTypeWithEggEvent.java b/src/main/java/net/pl3x/purpur/event/PlayerSetSpawnerTypeWithEggEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c050b75e9a11ac728868fe95e3f89e6b99de6ad2
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/PlayerSetSpawnerTypeWithEggEvent.java
@@ -0,0 +1,85 @@
+package net.pl3x.purpur.event;
+
+import org.bukkit.block.Block;
+import org.bukkit.block.CreatureSpawner;
+import org.bukkit.entity.EntityType;
+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;
+
+public class PlayerSetSpawnerTypeWithEggEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Block block;
+ private final CreatureSpawner spawner;
+ private EntityType type;
+ private boolean cancel;
+
+ public PlayerSetSpawnerTypeWithEggEvent(@NotNull Player player, @NotNull Block block, @NotNull CreatureSpawner spawner, @NotNull EntityType type) {
+ super(player);
+ this.block = block;
+ this.spawner = spawner;
+ this.type = type;
+ }
+
+ /**
+ * Get the spawner Block in the world
+ *
+ * @return Spawner Block
+ */
+ @NotNull
+ public Block getBlock() {
+ return block;
+ }
+
+ /**
+ * Get the spawner state
+ *
+ * @return Spawner state
+ */
+ @NotNull
+ public CreatureSpawner getSpawner() {
+ return spawner;
+ }
+
+ /**
+ * Gets the EntityType being set on the spawner
+ *
+ * @return EntityType being set
+ */
+ @NotNull
+ public EntityType getEntityType() {
+ return type;
+ }
+
+ /**
+ * Sets the EntityType being set on the spawner
+ *
+ * @param type EntityType to set
+ */
+ public void setEntityType(@NotNull EntityType type) {
+ this.type = type;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -0,0 +1,79 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 21 Nov 2016 17:02:11 -0500
Subject: [PATCH] EMC - MonsterEggSpawnEvent
diff --git a/src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java b/src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f1c9c421aeeb0ddf331f076a9b646c510ea4337
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/entity/MonsterEggSpawnEvent.java
@@ -0,0 +1,67 @@
+package net.pl3x.purpur.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class MonsterEggSpawnEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+
+ private final Player player;
+ private Entity entity;
+ private final ItemStack item;
+
+ public MonsterEggSpawnEvent(@Nullable HumanEntity player, @NotNull Entity entity, @NotNull ItemStack item) {
+ this.player = (Player) player;
+ this.entity = entity;
+ this.item = item;
+ }
+
+ @Nullable
+ public Player getPlayer() {
+ return player;
+ }
+
+ @NotNull
+ public Entity getEntity() {
+ return entity;
+ }
+
+ public void setEntity(@Nullable Entity entity) {
+ if (entity == null) {
+ canceled = true;
+ return;
+ }
+ this.entity = entity;
+ }
+
+ @NotNull
+ public ItemStack getItem() {
+ return item;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 2 May 2020 20:55:31 -0500
Subject: [PATCH] Player invulnerabilities
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index dfc092c5f1f4e00d3eabb72b9f15d203cca602f7..081713363eaee99b9332f05e8d7afc218a044754 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2317,5 +2317,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Reset the idle timer back to 0
*/
void resetIdleTimer();
+
+ /**
+ * Check if player is invulnerable from recently spawning or accepting a resource pack
+ *
+ * @return True if invulnerable
+ */
+ boolean isSpawnInvulnerable();
+
+ /**
+ * Get invulnerable ticks remaining
+ *
+ * @return Invulnerable ticks
+ */
+ int getSpawnInvulnerableTicks();
+
+ /**
+ * Set invulnerable ticks remaining
+ *
+ * @param invulnerableTicks Invulnerable ticks remaining
+ */
+ void setSpawnInvulnerableTicks(int invulnerableTicks);
// Purpur end
}

View File

@@ -0,0 +1,124 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 19 Apr 2020 00:25:09 -0500
Subject: [PATCH] Anvil API
diff --git a/src/main/java/net/pl3x/purpur/event/inventory/AnvilTakeResultEvent.java b/src/main/java/net/pl3x/purpur/event/inventory/AnvilTakeResultEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..85663c0a44695f7b7f01a68693cac3d99f4b56ca
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/inventory/AnvilTakeResultEvent.java
@@ -0,0 +1,52 @@
+package net.pl3x.purpur.event.inventory;
+
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.inventory.InventoryEvent;
+import org.bukkit.inventory.AnvilInventory;
+import org.bukkit.inventory.InventoryView;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player takes the result item out of an anvil
+ */
+public class AnvilTakeResultEvent extends InventoryEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Player player;
+ private final ItemStack result;
+
+ public AnvilTakeResultEvent(@NotNull HumanEntity player, @NotNull InventoryView view, @NotNull ItemStack result) {
+ super(view);
+ this.player = (Player) player;
+ this.result = result;
+ }
+
+ @NotNull
+ public Player getPlayer() {
+ return player;
+ }
+
+ @NotNull
+ public ItemStack getResult() {
+ return result;
+ }
+
+ @NotNull
+ @Override
+ public AnvilInventory getInventory() {
+ return (AnvilInventory) super.getInventory();
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/net/pl3x/purpur/event/inventory/AnvilUpdateResultEvent.java b/src/main/java/net/pl3x/purpur/event/inventory/AnvilUpdateResultEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..2717ad82ccc0d39c5a69b8890303c245e9a17f83
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/inventory/AnvilUpdateResultEvent.java
@@ -0,0 +1,35 @@
+package net.pl3x.purpur.event.inventory;
+
+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;
+
+/**
+ * Called when anvil slots change, triggering the result slot to be updated
+ */
+public class AnvilUpdateResultEvent extends InventoryEvent {
+ private static final HandlerList handlers = new HandlerList();
+
+ public AnvilUpdateResultEvent(@NotNull InventoryView view) {
+ super(view);
+ }
+
+ @NotNull
+ @Override
+ public AnvilInventory getInventory() {
+ return (AnvilInventory) super.getInventory();
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
index b95e563b5454306a9188ae3295309ee86a756477..435026e533ea9edb8c1800d35c63543ca023a904 100644
--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java
+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java
@@ -109,4 +109,14 @@ public interface AnvilInventory extends Inventory {
setItem(2, result);
}
// Paper end
+
+ // Purpur start
+ boolean canBypassCost();
+
+ void setBypassCost(boolean bypassCost);
+
+ boolean canDoUnsafeEnchants();
+
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
+ // Purpur end
}

View File

@@ -0,0 +1,701 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 15 Mar 2020 20:52:12 -0500
Subject: [PATCH] ItemStack convenience methods
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index f24820f14d689d49dfea25605199d5299ec28e7c..4e4fcce337047da575a9318c7094614d5270040e 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -9832,4 +9832,40 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata
// </editor-fold>
}
}
+
+ // Purpur start
+ public boolean isArmor() {
+ switch (this) {
+ // <editor-fold defaultstate="collapsed" desc="isarmor">
+ case LEATHER_BOOTS:
+ case LEATHER_CHESTPLATE:
+ case LEATHER_HELMET:
+ case LEATHER_LEGGINGS:
+ case CHAINMAIL_BOOTS:
+ case CHAINMAIL_CHESTPLATE:
+ case CHAINMAIL_HELMET:
+ case CHAINMAIL_LEGGINGS:
+ case IRON_BOOTS:
+ case IRON_CHESTPLATE:
+ case IRON_HELMET:
+ case IRON_LEGGINGS:
+ case GOLDEN_BOOTS:
+ case GOLDEN_CHESTPLATE:
+ case GOLDEN_HELMET:
+ case GOLDEN_LEGGINGS:
+ case DIAMOND_BOOTS:
+ case DIAMOND_CHESTPLATE:
+ case DIAMOND_HELMET:
+ case DIAMOND_LEGGINGS:
+ case NETHERITE_BOOTS:
+ case NETHERITE_CHESTPLATE:
+ case NETHERITE_HELMET:
+ case NETHERITE_LEGGINGS:
+ case TURTLE_HELMET:
+ return true;
+ default:
+ return false;
+ }
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 56072cb4d32ca8a09023be08a5a832c2c108379a..401080c53a0f69dcdfb920dbf0c5a07e249f6338 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -17,6 +17,18 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+// Purpur start
+import com.google.common.collect.Multimap;
+import java.util.Collection;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.attribute.AttributeModifier;
+import org.bukkit.block.data.BlockData;
+import org.bukkit.inventory.meta.BlockDataMeta;
+import org.bukkit.inventory.meta.Repairable;
+import org.bukkit.persistence.PersistentDataContainer;
+import org.bukkit.persistence.PersistentDataHolder;
+import com.destroystokyo.paper.Namespaced;
+// Purpur end
/**
* Represents a stack of items.
@@ -954,4 +966,626 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this);
}
// Paper end
+
+ // Purpur start
+ /**
+ * Gets the display name that is set.
+ * <p>
+ * Plugins should check that hasDisplayName() returns <code>true</code>
+ * before calling this method.
+ *
+ * @return the display name that is set
+ */
+ @NotNull
+ public String getDisplayName() {
+ return getItemMeta().getDisplayName();
+ }
+
+ /**
+ * Sets the display name.
+ *
+ * @param name the name to set
+ */
+ public void setDisplayName(@Nullable String name) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setDisplayName(name);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Checks for existence of a display name.
+ *
+ * @return true if this has a display name
+ */
+ public boolean hasDisplayName() {
+ return hasItemMeta() && getItemMeta().hasDisplayName();
+ }
+
+ /**
+ * Gets the localized display name that is set.
+ * <p>
+ * Plugins should check that hasLocalizedName() returns <code>true</code>
+ * before calling this method.
+ *
+ * @return the localized name that is set
+ */
+ @NotNull
+ public String getLocalizedName() {
+ return getItemMeta().getLocalizedName();
+ }
+
+ /**
+ * Sets the localized name.
+ *
+ * @param name the name to set
+ */
+ public void setLocalizedName(@Nullable String name) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setLocalizedName(name);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Checks for existence of a localized name.
+ *
+ * @return true if this has a localized name
+ */
+ public boolean hasLocalizedName() {
+ return hasItemMeta() && getItemMeta().hasLocalizedName();
+ }
+
+ /**
+ * Checks for existence of lore.
+ *
+ * @return true if this has lore
+ */
+ public boolean hasLore() {
+ return hasItemMeta() && getItemMeta().hasLore();
+ }
+
+ /**
+ * Checks for existence of the specified enchantment.
+ *
+ * @param ench enchantment to check
+ * @return true if this enchantment exists for this meta
+ */
+ public boolean hasEnchant(@NotNull Enchantment ench) {
+ return hasItemMeta() && getItemMeta().hasEnchant(ench);
+ }
+
+ /**
+ * Checks for the level of the specified enchantment.
+ *
+ * @param ench enchantment to check
+ * @return The level that the specified enchantment has, or 0 if none
+ */
+ public int getEnchantLevel(@NotNull Enchantment ench) {
+ return getItemMeta().getEnchantLevel(ench);
+ }
+
+ /**
+ * Returns a copy the enchantments in this ItemMeta. <br>
+ * Returns an empty map if none.
+ *
+ * @return An immutable copy of the enchantments
+ */
+ @NotNull
+ public Map<Enchantment, Integer> getEnchants() {
+ return getItemMeta().getEnchants();
+ }
+
+ /**
+ * Adds the specified enchantment to this item meta.
+ *
+ * @param ench Enchantment to add
+ * @param level Level for the enchantment
+ * @param ignoreLevelRestriction this indicates the enchantment should be
+ * applied, ignoring the level limit
+ * @return true if the item meta changed as a result of this call, false
+ * otherwise
+ */
+ public boolean addEnchant(@NotNull Enchantment ench, int level, boolean ignoreLevelRestriction) {
+ ItemMeta itemMeta = getItemMeta();
+ boolean result = itemMeta.addEnchant(ench, level, ignoreLevelRestriction);
+ setItemMeta(itemMeta);
+ return result;
+ }
+
+ /**
+ * Removes the specified enchantment from this item meta.
+ *
+ * @param ench Enchantment to remove
+ * @return true if the item meta changed as a result of this call, false
+ * otherwise
+ */
+ public boolean removeEnchant(@NotNull Enchantment ench) {
+ ItemMeta itemMeta = getItemMeta();
+ boolean result = itemMeta.removeEnchant(ench);
+ setItemMeta(itemMeta);
+ return result;
+ }
+
+ /**
+ * Checks for the existence of any enchantments.
+ *
+ * @return true if an enchantment exists on this meta
+ */
+ public boolean hasEnchants() {
+ return hasItemMeta() && getItemMeta().hasEnchants();
+ }
+
+ /**
+ * Checks if the specified enchantment conflicts with any enchantments in
+ * this ItemMeta.
+ *
+ * @param ench enchantment to test
+ * @return true if the enchantment conflicts, false otherwise
+ */
+ public boolean hasConflictingEnchant(@NotNull Enchantment ench) {
+ return hasItemMeta() && getItemMeta().hasConflictingEnchant(ench);
+ }
+
+ /**
+ * Sets the custom model data.
+ * <p>
+ * CustomModelData is an integer that may be associated client side with a
+ * custom item model.
+ *
+ * @param data the data to set, or null to clear
+ */
+ public void setCustomModelData(@Nullable Integer data) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setCustomModelData(data);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Gets the custom model data that is set.
+ * <p>
+ * CustomModelData is an integer that may be associated client side with a
+ * custom item model.
+ * <p>
+ * Plugins should check that hasCustomModelData() returns <code>true</code>
+ * before calling this method.
+ *
+ * @return the localized name that is set
+ */
+ public int getCustomModelData() {
+ return getItemMeta().getCustomModelData();
+ }
+
+ /**
+ * Checks for existence of custom model data.
+ * <p>
+ * CustomModelData is an integer that may be associated client side with a
+ * custom item model.
+ *
+ * @return true if this has custom model data
+ */
+ public boolean hasCustomModelData() {
+ return hasItemMeta() && getItemMeta().hasCustomModelData();
+ }
+
+ /**
+ * Returns whether the item has block data currently attached to it.
+ *
+ * @return whether block data is already attached
+ */
+ public boolean hasBlockData() {
+ return hasItemMeta() && ((BlockDataMeta) getItemMeta()).hasBlockData();
+ }
+
+ /**
+ * Returns the currently attached block data for this item or creates a new
+ * one if one doesn't exist.
+ *
+ * The state is a copy, it must be set back (or to another item) with
+ * {@link #setBlockData(BlockData)}
+ *
+ * @param material the material we wish to get this data in the context of
+ * @return the attached data or new data
+ */
+ @NotNull
+ public BlockData getBlockData(@NotNull Material material) {
+ return ((BlockDataMeta) getItemMeta()).getBlockData(material);
+ }
+
+ /**
+ * Attaches a copy of the passed block data to the item.
+ *
+ * @param blockData the block data to attach to the block.
+ * @throws IllegalArgumentException if the blockData is null or invalid for
+ * this item.
+ */
+ public void setBlockData(@NotNull BlockData blockData) {
+ ItemMeta itemMeta = getItemMeta();
+ ((BlockDataMeta) itemMeta).setBlockData(blockData);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Gets the repair penalty
+ *
+ * @return the repair penalty
+ */
+ public int getRepairCost() {
+ return ((Repairable) getItemMeta()).getRepairCost();
+ }
+
+ /**
+ * Sets the repair penalty
+ *
+ * @param cost repair penalty
+ */
+ public void setRepairCost(int cost) {
+ ItemMeta itemMeta = getItemMeta();
+ ((Repairable) itemMeta).setRepairCost(cost);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Checks to see if this has a repair penalty
+ *
+ * @return true if this has a repair penalty
+ */
+ public boolean hasRepairCost() {
+ return hasItemMeta() && ((Repairable) getItemMeta()).hasRepairCost();
+ }
+
+ /**
+ * Return if the unbreakable tag is true. An unbreakable item will not lose
+ * durability.
+ *
+ * @return true if the unbreakable tag is true
+ */
+ public boolean isUnbreakable() {
+ return hasItemMeta() && getItemMeta().isUnbreakable();
+ }
+
+ /**
+ * Sets the unbreakable tag. An unbreakable item will not lose durability.
+ *
+ * @param unbreakable true if set unbreakable
+ */
+ public void setUnbreakable(boolean unbreakable) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setUnbreakable(unbreakable);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Checks for the existence of any AttributeModifiers.
+ *
+ * @return true if any AttributeModifiers exist
+ */
+ public boolean hasAttributeModifiers() {
+ return hasItemMeta() && getItemMeta().hasAttributeModifiers();
+ }
+
+ /**
+ * Return an immutable copy of all Attributes and
+ * their modifiers in this ItemMeta.<br>
+ * Returns null if none exist.
+ *
+ * @return an immutable {@link Multimap} of Attributes
+ * and their AttributeModifiers, or null if none exist
+ */
+ @Nullable
+ public Multimap<Attribute, AttributeModifier> getAttributeModifiers() {
+ return getItemMeta().getAttributeModifiers();
+ }
+
+ /**
+ * Return an immutable copy of all {@link Attribute}s and their
+ * {@link AttributeModifier}s for a given {@link EquipmentSlot}.<br>
+ * Any {@link AttributeModifier} that does have have a given
+ * {@link EquipmentSlot} will be returned. This is because
+ * AttributeModifiers without a slot are active in any slot.<br>
+ * If there are no attributes set for the given slot, an empty map
+ * will be returned.
+ *
+ * @param slot the {@link EquipmentSlot} to check
+ * @return the immutable {@link Multimap} with the
+ * respective Attributes and modifiers, or an empty map
+ * if no attributes are set.
+ */
+ @NotNull
+ public Multimap<Attribute, AttributeModifier> getAttributeModifiers(@Nullable EquipmentSlot slot) {
+ return getItemMeta().getAttributeModifiers(slot);
+ }
+
+ /**
+ * Return an immutable copy of all {@link AttributeModifier}s
+ * for a given {@link Attribute}
+ *
+ * @param attribute the {@link Attribute}
+ * @return an immutable collection of {@link AttributeModifier}s
+ * or null if no AttributeModifiers exist for the Attribute.
+ * @throws NullPointerException if Attribute is null
+ */
+ @Nullable
+ public Collection<AttributeModifier> getAttributeModifiers(@NotNull Attribute attribute) {
+ return getItemMeta().getAttributeModifiers(attribute);
+ }
+
+ /**
+ * Add an Attribute and it's Modifier.
+ * AttributeModifiers can now support {@link EquipmentSlot}s.
+ * If not set, the {@link AttributeModifier} will be active in ALL slots.
+ * <br>
+ * Two {@link AttributeModifier}s that have the same {@link java.util.UUID}
+ * cannot exist on the same Attribute.
+ *
+ * @param attribute the {@link Attribute} to modify
+ * @param modifier the {@link AttributeModifier} specifying the modification
+ * @return true if the Attribute and AttributeModifier were
+ * successfully added
+ * @throws NullPointerException if Attribute is null
+ * @throws NullPointerException if AttributeModifier is null
+ * @throws IllegalArgumentException if AttributeModifier already exists
+ */
+ public boolean addAttributeModifier(@NotNull Attribute attribute, @NotNull AttributeModifier modifier) {
+ ItemMeta itemMeta = getItemMeta();
+ boolean result = itemMeta.addAttributeModifier(attribute, modifier);
+ setItemMeta(itemMeta);
+ return result;
+ }
+
+ /**
+ * Set all {@link Attribute}s and their {@link AttributeModifier}s.
+ * To clear all currently set Attributes and AttributeModifiers use
+ * null or an empty Multimap.
+ * If not null nor empty, this will filter all entries that are not-null
+ * and add them to the ItemStack.
+ *
+ * @param attributeModifiers the new Multimap containing the Attributes
+ * and their AttributeModifiers
+ */
+ public void setAttributeModifiers(@Nullable Multimap<Attribute, AttributeModifier> attributeModifiers) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setAttributeModifiers(attributeModifiers);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Remove all {@link AttributeModifier}s associated with the given
+ * {@link Attribute}.
+ * This will return false if nothing was removed.
+ *
+ * @param attribute attribute to remove
+ * @return true if all modifiers were removed from a given
+ * Attribute. Returns false if no attributes were
+ * removed.
+ * @throws NullPointerException if Attribute is null
+ */
+ public boolean removeAttributeModifier(@NotNull Attribute attribute) {
+ ItemMeta itemMeta = getItemMeta();
+ boolean result = itemMeta.removeAttributeModifier(attribute);
+ setItemMeta(itemMeta);
+ return result;
+ }
+
+ /**
+ * Remove all {@link Attribute}s and {@link AttributeModifier}s for a
+ * given {@link EquipmentSlot}.<br>
+ * If the given {@link EquipmentSlot} is null, this will remove all
+ * {@link AttributeModifier}s that do not have an EquipmentSlot set.
+ *
+ * @param slot the {@link EquipmentSlot} to clear all Attributes and
+ * their modifiers for
+ * @return true if all modifiers were removed that match the given
+ * EquipmentSlot.
+ */
+ public boolean removeAttributeModifier(@Nullable EquipmentSlot slot) {
+ ItemMeta itemMeta = getItemMeta();
+ boolean result = itemMeta.removeAttributeModifier(slot);
+ setItemMeta(itemMeta);
+ return result;
+ }
+
+ /**
+ * Remove a specific {@link Attribute} and {@link AttributeModifier}.
+ * AttributeModifiers are matched according to their {@link java.util.UUID}.
+ *
+ * @param attribute the {@link Attribute} to remove
+ * @param modifier the {@link AttributeModifier} to remove
+ * @return if any attribute modifiers were remove
+ *
+ * @throws NullPointerException if the Attribute is null
+ * @throws NullPointerException if the AttributeModifier is null
+ *
+ * @see AttributeModifier#getUniqueId()
+ */
+ public boolean removeAttributeModifier(@NotNull Attribute attribute, @NotNull AttributeModifier modifier) {
+ ItemMeta itemMeta = getItemMeta();
+ boolean result = itemMeta.removeAttributeModifier(attribute, modifier);
+ setItemMeta(itemMeta);
+ return result;
+ }
+
+ /**
+ * Returns a custom tag container capable of storing tags on the object.
+ *
+ * Note that the tags stored on this container are all stored under their
+ * own custom namespace therefore modifying default tags using this
+ * {@link PersistentDataHolder} is impossible.
+ *
+ * @return the persistent metadata container
+ */
+ @NotNull
+ public PersistentDataContainer getPersistentDataContainer() {
+ return getItemMeta().getPersistentDataContainer();
+ }
+
+ /**
+ * Checks to see if this item has damage
+ *
+ * @return true if this has damage
+ */
+ public boolean hasDamage() {
+ return hasItemMeta() && ((Damageable) getItemMeta()).hasDamage();
+ }
+
+ /**
+ * Gets the damage
+ *
+ * @return the damage
+ */
+ public int getDamage() {
+ return ((Damageable) getItemMeta()).getDamage();
+ }
+
+ /**
+ * Sets the damage
+ *
+ * @param damage item damage
+ */
+ public void setDamage(int damage) {
+ ItemMeta itemMeta = getItemMeta();
+ ((Damageable) itemMeta).setDamage(damage);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Gets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ public Set<Namespaced> getDestroyableKeys() {
+ return getItemMeta().getDestroyableKeys();
+ }
+
+ /**
+ * Sets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canDestroy Collection of {@link com.destroystokyo.paper.Namespaced}
+ */
+ public void setDestroyableKeys(@NotNull Collection<Namespaced> canDestroy) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setDestroyableKeys(canDestroy);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Gets the collection of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ public Set<Namespaced> getPlaceableKeys() {
+ return getItemMeta().getPlaceableKeys();
+ }
+
+ /**
+ * Sets the set of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canPlaceOn Collection of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ public void setPlaceableKeys(@NotNull Collection<Namespaced> canPlaceOn) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setPlaceableKeys(canPlaceOn);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Checks for the existence of any keys that the item can be placed on
+ *
+ * @return true if this item has placeable keys
+ */
+ public boolean hasPlaceableKeys() {
+ return hasItemMeta() && getItemMeta().hasPlaceableKeys();
+ }
+
+ /**
+ * Checks for the existence of any keys that the item can destroy
+ *
+ * @return true if this item has destroyable keys
+ */
+ public boolean hasDestroyableKeys() {
+ return hasItemMeta() && getItemMeta().hasDestroyableKeys();
+ }
+
+ /**
+ * Repairs this item by 1 durability
+ */
+ public void repair() {
+ repair(1);
+ }
+
+ /**
+ * Damages this item by 1 durability
+ *
+ * @return True if damage broke the item
+ */
+ public boolean damage() {
+ return damage(1);
+ }
+
+ /**
+ * Repairs this item's durability by amount
+ *
+ * @param amount Amount of durability to repair
+ */
+ public void repair(int amount) {
+ damage(-amount);
+ }
+
+ /**
+ * Damages this item's durability by amount
+ *
+ * @param amount Amount of durability to damage
+ * @return True if damage broke the item
+ */
+ public boolean damage(int amount) {
+ return damage(amount, false);
+ }
+
+ /**
+ * Damages this item's durability by amount
+ *
+ * @param amount Amount of durability to damage
+ * @param ignoreUnbreaking Ignores unbreaking enchantment
+ * @return True if damage broke the item
+ */
+ public boolean damage(int amount, boolean ignoreUnbreaking) {
+ Damageable damageable = (Damageable) getItemMeta();
+ if (amount > 0) {
+ int unbreaking = getEnchantLevel(Enchantment.DURABILITY);
+ int reduce = 0;
+ for (int i = 0; unbreaking > 0 && i < amount; ++i) {
+ if (reduceDamage(java.util.concurrent.ThreadLocalRandom.current(), unbreaking)) {
+ ++reduce;
+ }
+ }
+ amount -= reduce;
+ if (amount <= 0) {
+ return isBroke(damageable.getDamage());
+ }
+ }
+ int damage = damageable.getDamage() + amount;
+ damageable.setDamage(damage);
+ setItemMeta((ItemMeta) damageable);
+ return isBroke(damage);
+ }
+
+ public boolean isBroke(int damage) {
+ if (damage > getType().getMaxDurability()) {
+ if (getAmount() > 0) {
+ // ensure it "breaks"
+ setAmount(0);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private boolean reduceDamage(java.util.Random random, int unbreaking) {
+ if (getType().isArmor()) {
+ return random.nextFloat() < 0.6F;
+ }
+ return random.nextInt(unbreaking + 1) > 0;
+ }
+ // Purpur end
}

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 28 Jun 2020 21:50:55 -0500
Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 825c02793e3aaff45a8a0a9da01d72daf9421bee..fff199d014f93c6655b3d756bcc6fe986c97a81c 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -200,6 +200,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
// Purpur start
GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
+ GoalKey<Phantom> FIND_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("find_crystal"));
+ GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
// Purpur end
/**

View File

@@ -0,0 +1,91 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 10 Jul 2020 12:43:25 -0500
Subject: [PATCH] ChatColor conveniences
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index 4594701d77c5d0f744bece871b98d9f6f73eb5a7..0aa79a9fbd5861d217a877a36e985e18fba6256f 100644
--- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java
@@ -2,6 +2,7 @@ package org.bukkit;
import com.google.common.collect.Maps;
import java.util.Map;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang.Validate;
import org.jetbrains.annotations.Contract;
@@ -413,4 +414,72 @@ public enum ChatColor {
BY_CHAR.put(color.code, color);
}
}
+
+ // Purpur start
+ /**
+ * Convert legacy string into a string ready to be parsed by MiniMessage
+ *
+ * @param str Legacy string
+ * @return MiniMessage ready string
+ */
+ @NotNull
+ public static String toMM(@NotNull String str) {
+ StringBuilder sb = new StringBuilder(str);
+ Matcher m = STRIP_COLOR_PATTERN.matcher(sb);
+ while (m.find()) {
+ sb.replace(m.start(), m.end(), sb.substring(m.start(), m.end()).toLowerCase());
+ }
+ return sb.toString()
+ .replace("&0", "<black>")
+ .replace("&1", "<dark_blue>")
+ .replace("&2", "<dark_green>")
+ .replace("&3", "<dark_aqua>")
+ .replace("&4", "<dark_red>")
+ .replace("&5", "<dark_purple>")
+ .replace("&6", "<gold>")
+ .replace("&7", "<grey>")
+ .replace("&8", "<dark_grey>")
+ .replace("&9", "<blue>")
+ .replace("&a", "<green>")
+ .replace("&b", "<aqua>")
+ .replace("&c", "<red>")
+ .replace("&d", "<light_purple>")
+ .replace("&e", "<yellow>")
+ .replace("&f", "<white>")
+ .replace("&k", "<obf>")
+ .replace("&l", "<b>")
+ .replace("&m", "<st>")
+ .replace("&n", "<u>")
+ .replace("&o", "<i>")
+ .replace("&r", "<r>");
+ }
+
+ @Deprecated
+ public static final Pattern HEX_PATTERN = Pattern.compile("(#[A-Fa-f0-9]{6})");
+
+ @Deprecated
+ @Nullable
+ public static String replaceHex(@Nullable String str) {
+ if (str != null) {
+ java.util.regex.Matcher matcher = HEX_PATTERN.matcher(str);
+ while (matcher.find()) {
+ String group = matcher.group(1);
+ str = str.replace(group, net.md_5.bungee.api.ChatColor.of(group).toString());
+ }
+ }
+ return str;
+ }
+
+ @Deprecated
+ @Nullable
+ public static String color(@Nullable String str) {
+ return color(str, true);
+ }
+
+ @Deprecated
+ @Nullable
+ public static String color(@Nullable String str, boolean parseHex) {
+ return str != null ? net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', parseHex ? replaceHex(str) : str) : str;
+ }
+ // Purpur end
}

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Mon, 17 Aug 2020 21:50:32 -0500
Subject: [PATCH] LivingEntity#broadcastItemBreak
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index e532430b7444cef4e383b3afb637cc6060d8686a..0f9dbacb6851b27b2e5b1aa1cf994ccb313f0f45 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -925,5 +925,12 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @param safeFallDistance Safe fall distance
*/
void setSafeFallDistance(float safeFallDistance);
+
+ /**
+ * Play item break animation for the item in specified equipment slot
+ *
+ * @param slot Equipment slot to play break animation for
+ */
+ void broadcastItemBreak(@NotNull org.bukkit.inventory.EquipmentSlot slot);
// Purpur end
}

View File

@@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 22 Aug 2020 17:42:08 -0500
Subject: [PATCH] Item entity immunities
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
index 0ee072645ecf1bf5feb74de6960947ef76db366e..5b9a20e0695218f1239d2bf1d0368291e2a10c06 100644
--- a/src/main/java/org/bukkit/entity/Item.java
+++ b/src/main/java/org/bukkit/entity/Item.java
@@ -120,4 +120,62 @@ public interface Item extends Entity {
*/
public void setWillAge(boolean willAge);
// Paper end
+
+ // Purpur start
+ /**
+ * Set whether or not this item is immune to cactus
+ *
+ * @param immuneToCactus True to make immune to cactus
+ */
+ void setImmuneToCactus(boolean immuneToCactus);
+
+ /**
+ * Check if item is immune to cactus
+ *
+ * @return True if immune to cactus
+ */
+ boolean isImmuneToCactus();
+
+ /**
+ * Set whether or not this item is immune to explosions
+ *
+ * @param immuneToExplosion True to make immune to explosions
+ */
+ void setImmuneToExplosion(boolean immuneToExplosion);
+
+ /**
+ * Check if item is immune to explosions
+ *
+ * @return True if immune to explosions
+ */
+ boolean isImmuneToExplosion();
+
+ /**
+ * Set whether or not this item is immune to fire
+ *
+ * @param immuneToFire True to make immune to fire
+ */
+ void setImmuneToFire(boolean immuneToFire);
+
+ /**
+ * Check if item is immune to fire
+ *
+ * @return True if immune to fire
+ */
+ boolean isImmuneToFire();
+
+ /**
+ * Set whether or not this item is immune to lightning
+ *
+ * @param immuneToLightning True to make immune to lightning
+ */
+ void setImmuneToLightning(boolean immuneToLightning);
+
+ /**
+ * Check if item is immune to lightning
+ *
+ * @return True if immune to lightning
+ */
+ boolean isImmuneToLightning();
+ // Purpur end
}

View File

@@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Parker Hawke <hawkeboyz2@hotmail.com>
Date: Sat, 27 Jun 2020 18:43:37 -0400
Subject: [PATCH] Spigot - Improve output of plugins command
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
index 1aa58c59e1e8738bbdc77752885ff3b18b29de42..4974fc518c3645e6e060ff52e71a47a86d52ec5c 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -11,6 +11,15 @@ import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
+// Spigot start
+import net.md_5.bungee.api.chat.BaseComponent;
+import net.md_5.bungee.api.chat.ClickEvent;
+import net.md_5.bungee.api.chat.ComponentBuilder;
+import net.md_5.bungee.api.chat.HoverEvent;
+import net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.PluginDescriptionFile;
+// Spigot end
public class PluginsCommand extends BukkitCommand {
public PluginsCommand(@NotNull String name) {
@@ -25,7 +34,13 @@ public class PluginsCommand extends BukkitCommand {
public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
if (!testPermission(sender)) return true;
- sender.sendMessage("Plugins " + getPluginList());
+ // Spigot start
+ if (sender instanceof Player && sender.hasPermission("bukkit.command.version")) {
+ sender.spigot().sendMessage(getPluginListSpigot());
+ } else {
+ sender.sendMessage("Plugins " + getPluginList());
+ }
+ // Spigot end
return true;
}
@@ -71,4 +86,72 @@ public class PluginsCommand extends BukkitCommand {
// Paper end
}
+ // Spigot start
+ @NotNull
+ private BaseComponent[] getPluginListSpigot() {
+ Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
+ ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.length + "): ");
+
+ int index = 0;
+ for (Plugin plugin : plugins) {
+ if (index++ > 0) {
+ pluginList.append(", ", FormatRetention.NONE).color(net.md_5.bungee.api.ChatColor.WHITE);
+ }
+
+ // Event components
+ PluginDescriptionFile description = plugin.getDescription();
+ ComponentBuilder hoverEventComponents = new ComponentBuilder();
+ hoverEventComponents.append("Version: ").color(net.md_5.bungee.api.ChatColor.WHITE).append(description.getVersion()).color(net.md_5.bungee.api.ChatColor.GREEN);
+
+ if (description.getDescription() != null) {
+ hoverEventComponents.append("\nDescription: ").color(net.md_5.bungee.api.ChatColor.WHITE).append(description.getDescription()).color(net.md_5.bungee.api.ChatColor.GREEN);
+ }
+
+ if (description.getWebsite() != null) {
+ hoverEventComponents.append("\nWebsite: ").color(net.md_5.bungee.api.ChatColor.WHITE).append(description.getWebsite()).color(net.md_5.bungee.api.ChatColor.GREEN);
+ }
+
+ if (!description.getAuthors().isEmpty()) {
+ if (description.getAuthors().size() == 1) {
+ hoverEventComponents.append("\nAuthor: ");
+ } else {
+ hoverEventComponents.append("\nAuthors: ");
+ }
+
+ hoverEventComponents.color(net.md_5.bungee.api.ChatColor.WHITE).append(getAuthors(description));
+ }
+
+ HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverEventComponents.create());
+ ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/version " + description.getName());
+
+ // Plugin list entry
+ pluginList.append(plugin.getDescription().getName());
+ pluginList.color(plugin.isEnabled() ? net.md_5.bungee.api.ChatColor.GREEN : net.md_5.bungee.api.ChatColor.RED);
+ pluginList.event(hoverEvent).event(clickEvent);
+
+ if (plugin.getDescription().getProvides().size() > 0) {
+ pluginList.append("( ", FormatRetention.NONE).color(net.md_5.bungee.api.ChatColor.WHITE).append(String.join(", ", plugin.getDescription().getProvides())).append(")");
+ }
+ }
+
+ return pluginList.create();
+ }
+
+ @NotNull
+ private BaseComponent[] getAuthors(@NotNull final PluginDescriptionFile description) {
+ ComponentBuilder result = new ComponentBuilder();
+ List<String> authors = description.getAuthors();
+
+ for (int i = 0; i < authors.size(); i++) {
+ if (i > 0) {
+ result.append(i < authors.size() - 1 ? ", " : " and ", FormatRetention.NONE);
+ result.color(net.md_5.bungee.api.ChatColor.WHITE);
+ }
+
+ result.append(authors.get(i)).color(net.md_5.bungee.api.ChatColor.GREEN);
+ }
+
+ return result.create();
+ }
+ // Spigot end
}

View File

@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nitricspace <nitricspace@users.noreply.github.com>
Date: Wed, 23 Sep 2020 22:14:38 +0100
Subject: [PATCH] Add option to disable zombie aggressiveness towards villagers
when lagging
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index fff199d014f93c6655b3d756bcc6fe986c97a81c..48605ace47735eb425bff0cd044455b6893d7ecb 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -202,6 +202,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
GoalKey<Phantom> FIND_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("find_crystal"));
GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
+ GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
+ GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
// Purpur end
/**

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 2 Oct 2020 17:43:24 -0500
Subject: [PATCH] Add predicate to recipe's ExactChoice ingredient
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java
index 90208bc96085f05a3b657b9467b1670d00b03104..c59d5e4ef9641fd73463b177239226866272745b 100644
--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java
+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java
@@ -10,6 +10,7 @@ import java.util.function.Predicate;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable; // Purpur
/**
* Represents a potential item match within a recipe. All choices within a
@@ -152,6 +153,7 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
public static class ExactChoice implements RecipeChoice {
private List<ItemStack> choices;
+ private Predicate<ItemStack> predicate; // Purpur
public ExactChoice(@NotNull ItemStack stack) {
this(Arrays.asList(stack));
@@ -196,6 +198,7 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
@Override
public boolean test(@NotNull ItemStack t) {
+ if (predicate != null) return predicate.test(t); // Purpur
for (ItemStack match : choices) {
if (t.isSimilar(match)) {
return true;
@@ -205,6 +208,17 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
return false;
}
+ // Purpur start
+ @Nullable
+ public Predicate<ItemStack> getPredicate() {
+ return predicate;
+ }
+
+ public void setPredicate(@Nullable Predicate<ItemStack> predicate) {
+ this.predicate = predicate;
+ }
+ // Purpur end
+
@Override
public int hashCode() {
int hash = 7;

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 8 Dec 2020 09:48:18 -0600
Subject: [PATCH] Alphabetize in-game /plugins list
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
index 4974fc518c3645e6e060ff52e71a47a86d52ec5c..37cc5d7e9db89e4ef7ab16da1b159bd19134a4ff 100644
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
@@ -2,6 +2,7 @@ package org.bukkit.command.defaults;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -89,7 +90,7 @@ public class PluginsCommand extends BukkitCommand {
// Spigot start
@NotNull
private BaseComponent[] getPluginListSpigot() {
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
+ Plugin[] plugins = Arrays.stream(Bukkit.getPluginManager().getPlugins()).sorted(Comparator.comparing(plugin -> plugin.getName().toLowerCase())).toArray(Plugin[]::new); // Purpur
ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.length + "): ");
int index = 0;

View File

@@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 8 Dec 2020 17:15:15 -0500
Subject: [PATCH] Rabid Wolf API
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 48605ace47735eb425bff0cd044455b6893d7ecb..6c0ac9c262a3f4469d2eba7f7af6a6fafb2ada1a 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -204,6 +204,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
+ GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));
// Purpur end
/**
diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java
index 0e5decadf31140d6cb121c298f935ccc12c7a7e7..c1fd30fe4cd4eec11eb8298f059d14584b7dd7ec 100644
--- a/src/main/java/org/bukkit/entity/Wolf.java
+++ b/src/main/java/org/bukkit/entity/Wolf.java
@@ -39,4 +39,20 @@ public interface Wolf extends Tameable, Sittable {
* @param color the color to apply
*/
public void setCollarColor(@NotNull DyeColor color);
+
+ // Purpur start
+ /**
+ * Checks if this wolf is rabid
+ *
+ * @return whether the wolf is rabid
+ */
+ public boolean isRabid();
+
+ /**
+ * Sets this wolf to be rabid or not
+ *
+ * @param rabid whether the wolf should be rabid
+ */
+ public void setRabid(boolean rabid);
+ // Purpur end
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Wed, 23 Dec 2020 00:43:27 -0600
Subject: [PATCH] PlayerBookTooLargeEvent
diff --git a/src/main/java/net/pl3x/purpur/event/player/PlayerBookTooLargeEvent.java b/src/main/java/net/pl3x/purpur/event/player/PlayerBookTooLargeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..39378ee2bfadf42ff358cc7b42dd75ac61615e15
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/player/PlayerBookTooLargeEvent.java
@@ -0,0 +1,65 @@
+package net.pl3x.purpur.event.player;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player tries to bypass book limitations
+ */
+public class PlayerBookTooLargeEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final ItemStack book;
+ private boolean kickPlayer = true;
+
+ /**
+ * @param player The player
+ * @param book The book
+ */
+ public PlayerBookTooLargeEvent(@NotNull Player player, @NotNull ItemStack book) {
+ super(player, !Bukkit.isPrimaryThread());
+ this.book = book;
+ }
+
+ /**
+ * Get the book containing the wanted edits
+ *
+ * @return The book
+ */
+ @NotNull
+ public ItemStack getBook() {
+ return book;
+ }
+
+ /**
+ * Whether server should kick the player or not
+ *
+ * @return True to kick player
+ */
+ public boolean shouldKickPlayer() {
+ return kickPlayer;
+ }
+
+ /**
+ * Whether server should kick the player or not
+ *
+ * @param kickPlayer True to kick player
+ */
+ public void setShouldKickPlayer(boolean kickPlayer) {
+ this.kickPlayer = kickPlayer;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 24 Dec 2020 11:00:04 -0600
Subject: [PATCH] Full netherite armor grants fire resistance
diff --git a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
index b915c3cab168a2bbdca740e662baaa708d425e41..476b33dd26af55f787f64c37d9a8cd2d0dc2a7f7 100644
--- a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
@@ -217,6 +217,12 @@ public class EntityPotionEffectEvent extends EntityEvent implements Cancellable
* When all effects are removed due to a bucket of milk.
*/
MILK,
+ // Purpur start
+ /**
+ * When a player wears full netherite armor
+ */
+ NETHERITE_ARMOR,
+ // Purpur end
/**
* When a player gets bad omen after killing a patrol captain.
*/

View File

@@ -0,0 +1,141 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Sat, 9 Jan 2021 15:26:04 +0100
Subject: [PATCH] Add EntityTeleportHinderedEvent
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/pl3x/purpur/event/entity/EntityTeleportHinderedEvent.java b/src/main/java/net/pl3x/purpur/event/entity/EntityTeleportHinderedEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..e6fcc4027cb70061b804460b39e00cca273d35ad
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/entity/EntityTeleportHinderedEvent.java
@@ -0,0 +1,117 @@
+package net.pl3x.purpur.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Fired when an entity is hindered from teleporting.
+ */
+public class EntityTeleportHinderedEvent extends EntityEvent {
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ private final Reason reason;
+
+ @Nullable
+ private final TeleportCause teleportCause;
+
+ private boolean retry = false;
+
+ public EntityTeleportHinderedEvent(@NotNull Entity what, @NotNull Reason reason,
+ @Nullable TeleportCause teleportCause) {
+ super(what);
+ this.reason = reason;
+ this.teleportCause = teleportCause;
+ }
+
+ /**
+ * @return why the teleport was hindered.
+ */
+ @NotNull
+ public Reason getReason() {
+ return reason;
+ }
+
+ /**
+ * @return why the teleport occurred if cause was given, otherwise {@code null}.
+ */
+ @Nullable
+ public TeleportCause getTeleportCause() {
+ return teleportCause;
+ }
+
+ /**
+ * Whether the teleport should be retried.
+ * <p>
+ * Note that this can put the server in a never-ending loop of trying to teleport someone resulting in a stack
+ * overflow. Do not retry more than necessary.
+ * </p>
+ *
+ * @return whether the teleport should be retried.
+ */
+ public boolean shouldRetry() {
+ return retry;
+ }
+
+ /**
+ * Sets whether the teleport should be retried.
+ * <p>
+ * Note that this can put the server in a never-ending loop of trying to teleport someone resulting in a stack
+ * overflow. Do not retry more than necessary.
+ * </p>
+ *
+ * @param retry whether the teleport should be retried.
+ */
+ public void setShouldRetry(boolean retry) {
+ this.retry = retry;
+ }
+
+ /**
+ * Calls the event and tests if should retry.
+ *
+ * @return whether the teleport should be retried.
+ */
+ @Override
+ public boolean callEvent() {
+ super.callEvent();
+ return shouldRetry();
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * Reason for hindrance in teleports.
+ */
+ public enum Reason {
+ /**
+ * The teleported entity is a passenger of another entity.
+ */
+ IS_PASSENGER,
+
+ /**
+ * The teleported entity has passengers.
+ */
+ IS_VEHICLE,
+
+ /**
+ * The teleport event was cancelled.
+ * <p>
+ * This is only caused by players teleporting.
+ * </p>
+ */
+ EVENT_CANCELLED,
+ }
+}

View File

@@ -0,0 +1,112 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nahuel <nahueldolores@hotmail.com>
Date: Sat, 9 Jan 2021 15:33:52 +0100
Subject: [PATCH] Add StructureGenerateEvent
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/net/pl3x/purpur/event/world/StructureGenerateEvent.java b/src/main/java/net/pl3x/purpur/event/world/StructureGenerateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..e77f45f761368da9b230c425d975a717cf4d10fd
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/event/world/StructureGenerateEvent.java
@@ -0,0 +1,68 @@
+package net.pl3x.purpur.event.world;
+
+import org.bukkit.Bukkit;
+import org.bukkit.StructureType;
+import org.bukkit.World;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.world.WorldEvent;
+import org.jetbrains.annotations.NotNull;
+
+public class StructureGenerateEvent extends WorldEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ private final StructureType structureType;
+ private final int chunkX;
+ private final int chunkZ;
+
+ private boolean cancel = false;
+
+ public StructureGenerateEvent(@NotNull World world,
+ @NotNull StructureType structureType, int chunkX, int chunkZ) {
+ super(!Bukkit.isPrimaryThread(), world); // Structure generation is not necessarily on the main thread as of 1.16.
+ this.structureType = structureType;
+ this.chunkX = chunkX;
+ this.chunkZ = chunkZ;
+ }
+
+ @NotNull
+ @Override
+ public World getWorld() {
+ return super.getWorld();
+ }
+
+ @NotNull
+ public StructureType getStructureType() {
+ return structureType;
+ }
+
+ public int getChunkX() {
+ return chunkX;
+ }
+
+ public int getChunkZ() {
+ return chunkZ;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/bukkit/event/world/WorldEvent.java b/src/main/java/org/bukkit/event/world/WorldEvent.java
index cffeff33f007d3b03b7c862b25be453f705da739..1fa083d53dce161ef9e9f19407f230c94b2d7d15 100644
--- a/src/main/java/org/bukkit/event/world/WorldEvent.java
+++ b/src/main/java/org/bukkit/event/world/WorldEvent.java
@@ -10,6 +10,13 @@ import org.jetbrains.annotations.NotNull;
public abstract class WorldEvent extends Event {
private final World world;
+ // Purpur start
+ public WorldEvent(boolean isAsync, @NotNull final World world) {
+ super(isAsync);
+ this.world = world;
+ }
+ // Purpur end
+
public WorldEvent(@NotNull final World world) {
this.world = world;
}

View File

@@ -0,0 +1,867 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Wed, 17 Mar 2021 15:56:47 -0500
Subject: [PATCH] Conflict on change for adventure deprecations
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a8fc16f2fa6713a4cbe75c17a8e6743f69c383d5..167d8fa9f8cb5ee67149da3b9b63c613668f20b0 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -370,7 +370,7 @@ public final class Bukkit {
* @return the number of players
* @deprecated in favour of {@link Server#broadcast(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public static int broadcastMessage(@NotNull String message) {
return server.broadcastMessage(message);
}
@@ -1099,7 +1099,7 @@ public final class Bukkit {
* @return number of message recipients
* @deprecated in favour of {@link #broadcast(net.kyori.adventure.text.Component, String)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public static int broadcast(@NotNull String message, @NotNull String permission) {
return server.broadcast(message, permission);
}
@@ -1378,7 +1378,7 @@ public final class Bukkit {
*
* @see InventoryType#isCreatable()
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) {
return server.createInventory(owner, type, title);
@@ -1428,7 +1428,7 @@ public final class Bukkit {
* @throws IllegalArgumentException if the size is not a multiple of 9
* @deprecated in favour of {@link #createInventory(InventoryHolder, InventoryType, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
public static Inventory createInventory(@Nullable InventoryHolder owner, int size, @NotNull String title) throws IllegalArgumentException {
return server.createInventory(owner, size, title);
@@ -1455,7 +1455,7 @@ public final class Bukkit {
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public static Merchant createMerchant(@Nullable String title) {
return server.createMerchant(title);
}
@@ -1553,7 +1553,7 @@ public final class Bukkit {
* @deprecated in favour of {@link #motd()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public static String getMotd() {
return server.getMotd();
}
@@ -1575,7 +1575,7 @@ public final class Bukkit {
* @deprecated in favour of {@link #shutdownMessage()}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public static String getShutdownMessage() {
return server.getShutdownMessage();
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 7e138e0b7d9c0ced83911035c1d8a956e432b304..c641822847c8f5c3753fa5a4ea97d86fa44b1fa0 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -290,7 +290,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the number of players
* @deprecated use {@link #broadcast(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public int broadcastMessage(@NotNull String message);
// Paper start
@@ -891,7 +891,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return number of message recipients
* @deprecated in favour of {@link #broadcast(net.kyori.adventure.text.Component, String)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public int broadcast(@NotNull String message, @NotNull String permission);
// Paper start
/**
@@ -1155,7 +1155,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @see InventoryType#isCreatable()
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title);
@@ -1199,7 +1199,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @throws IllegalArgumentException if the size is not a multiple of 9
* @deprecated in favour of {@link #createInventory(InventoryHolder, int, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, int size, @NotNull String title) throws IllegalArgumentException;
@@ -1222,7 +1222,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
Merchant createMerchant(@Nullable String title);
/**
@@ -1302,7 +1302,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @deprecated in favour of {@link #motd()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getMotd();
// Paper start
@@ -1320,7 +1320,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @deprecated in favour of {@link #shutdownMessage()}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getShutdownMessage();
/**
diff --git a/src/main/java/org/bukkit/block/Sign.java b/src/main/java/org/bukkit/block/Sign.java
index c8d37184d8e882a4084a1bfef85faa330588600b..46bae5c13ce2b973b114682f6a338981eb8d95bf 100644
--- a/src/main/java/org/bukkit/block/Sign.java
+++ b/src/main/java/org/bukkit/block/Sign.java
@@ -48,7 +48,7 @@ public interface Sign extends TileState, Colorable {
* @deprecated in favour of {@link #lines()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String[] getLines();
/**
@@ -62,7 +62,7 @@ public interface Sign extends TileState, Colorable {
* @deprecated in favour of {@link #line(int)}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getLine(int index) throws IndexOutOfBoundsException;
/**
@@ -76,7 +76,7 @@ public interface Sign extends TileState, Colorable {
* @throws IndexOutOfBoundsException If the index is out of the range 0..3
* @deprecated in favour of {@link #line(int, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setLine(int index, @NotNull String line) throws IndexOutOfBoundsException;
/**
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index fb4d5be0a972a5a8d441a628d796d6ada86cfe79..2b2c36e950f1518c795208157f52211a2e93f467 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -75,7 +75,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @return the friendly name
* @deprecated in favour of {@link #displayName()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
public String getDisplayName();
@@ -89,7 +89,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param name The new display name.
* @deprecated in favour of {@link #displayName(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setDisplayName(@Nullable String name);
// Paper start
@@ -130,7 +130,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @deprecated in favour of {@link #playerListName()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getPlayerListName();
/**
@@ -141,7 +141,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param name new player list name
* @deprecated in favour of {@link #playerListName(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setPlayerListName(@Nullable String name);
/**
@@ -150,7 +150,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @return player list header or null
* @deprecated in favour of {@link #playerListHeader()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@Nullable
public String getPlayerListHeader();
@@ -160,7 +160,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @return player list header or null
* @deprecated in favour of {@link #playerListFooter()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@Nullable
public String getPlayerListFooter();
@@ -170,7 +170,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param header player list header, null for empty
* @deprecated in favour of {@link #sendPlayerListHeader(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setPlayerListHeader(@Nullable String header);
/**
@@ -179,7 +179,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param footer player list footer, null for empty
* @deprecated in favour of {@link #sendPlayerListFooter(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setPlayerListFooter(@Nullable String footer);
/**
@@ -190,7 +190,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param footer player list footer, null for empty
* @deprecated in favour of {@link #sendPlayerListHeaderAndFooter(net.kyori.adventure.text.Component, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setPlayerListHeaderFooter(@Nullable String header, @Nullable String footer);
/**
@@ -230,7 +230,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param message kick message
* @deprecated in favour of {@link #kick(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void kickPlayer(@Nullable String message);
// Paper start
@@ -669,7 +669,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
* @deprecated in favour of {@link #sendSignChange(org.bukkit.Location, java.util.List)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException;
/**
@@ -690,7 +690,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
* @deprecated in favour of {@link #sendSignChange(org.bukkit.Location, java.util.List, org.bukkit.DyeColor)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException;
/**
@@ -1863,7 +1863,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @deprecated in favour of {@link #locale()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getLocale();
// Paper start
diff --git a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
index 5dbbb8767fa78c1ae4323e5e1e92f153571e3f3b..53ec0f32767bd808482ee05fc5d6e1f9480eac9d 100644
--- a/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
+++ b/src/main/java/org/bukkit/entity/minecart/CommandMinecart.java
@@ -37,7 +37,7 @@ public interface CommandMinecart extends Minecart, io.papermc.paper.command.Comm
* @param name New name for this CommandMinecart.
* @deprecated in favour of {@link #customName(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setName(@Nullable String name);
}
diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
index 1f79f704abf339150df08900b8ea7da4cefef258..004106913655446774f875015cb79863d21263c8 100644
--- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java
+++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
@@ -90,7 +90,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
* @deprecated in favour of {@link #lines()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String[] getLines() {
return adventure$lines.stream().map(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer()::serialize).toArray(String[]::new); // Paper
}
@@ -106,7 +106,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
* @deprecated in favour of {@link #line(int)}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getLine(int index) throws IndexOutOfBoundsException {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.adventure$lines.get(index)); // Paper
}
@@ -120,7 +120,7 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
* or < 0}
* @deprecated in favour of {@link #line(int, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setLine(int index, @Nullable String line) throws IndexOutOfBoundsException {
adventure$lines.set(index, line != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(line) : null); // Paper
}
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 8175e5329f7fb6da4c7faf695162b51492114dc3..839fea07e3b3fe486cd8f7f8fa5d2593ed54594e 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -162,7 +162,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
* @param deathMessage Message to appear to other players on the server.
* @deprecated in favour of {@link #deathMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setDeathMessage(@Nullable String deathMessage) {
this.deathMessage = deathMessage;
this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper
@@ -175,7 +175,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
* @deprecated in favour of {@link #deathMessage()}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getDeathMessage() {
return this.deathMessage != null ? this.deathMessage : (this.adventure$deathMessage != null ? getDeathMessageString(this.adventure$deathMessage) : null); // Paper
}
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
index 09f0fa8f2aac16b2c2d848089e228af2d09f9090..e10ff4ab0c649289af9eafe83ef9268ee6408e82 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -174,7 +174,7 @@ public enum InventoryType {
}
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getDefaultTitle() {
return title;
}
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index 694a81769076ea58aae9f14f076ab80c9952c957..2d5066a0e24b671a6b287c34603b371ed51d7be7 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -179,7 +179,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
* @deprecated in favour of {@link #kickMessage()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getKickMessage() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
}
@@ -190,7 +190,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
* @param message New kick message
* @deprecated in favour of {@link #kickMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setKickMessage(@NotNull final String message) {
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
}
@@ -210,7 +210,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
* @param message Kick message to display to the user
* @deprecated in favour of {@link #disallow(org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void disallow(@NotNull final Result result, @NotNull final String message) {
this.result = result;
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
diff --git a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java
index 851a189d42e271679abc78f95049d8badf7a2b64..7057c2e95267ad32190c5666f20a0566f7fe32fa 100644
--- a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java
@@ -17,7 +17,7 @@ public class PlayerJoinEvent extends PlayerEvent {
this.joinMessage = joinMessage;
}
- @Deprecated // Paper end
+ @Deprecated // Paper end // Purpur - conflict on change
public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final String joinMessage) {
super(playerJoined);
this.joinMessage = joinMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(joinMessage) : null; // Paper end
@@ -50,7 +50,7 @@ public class PlayerJoinEvent extends PlayerEvent {
* @deprecated in favour of {@link #joinMessage()}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getJoinMessage() {
return this.joinMessage == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.joinMessage); // Paper
}
@@ -61,7 +61,7 @@ public class PlayerJoinEvent extends PlayerEvent {
* @param joinMessage join message. If null, no message will be sent
* @deprecated in favour of {@link #joinMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setJoinMessage(@Nullable String joinMessage) {
this.joinMessage = joinMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(joinMessage) : null; // Paper
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
index 05ecfd8c133e72d198faeeded8c757c231c871cc..e57020767879b51f212d7a3e563a386adb390c5b 100644
--- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
@@ -85,7 +85,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
* @deprecated in favour of {@link #reason()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getReason() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.kickReason); // Paper
}
@@ -97,7 +97,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
* @deprecated in favour of {@link #leaveMessage()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getLeaveMessage() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.leaveMessage); // Paper
}
@@ -118,7 +118,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
* @param kickReason kick reason
* @deprecated in favour of {@link #reason(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setReason(@NotNull String kickReason) {
this.kickReason = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper
}
@@ -129,7 +129,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
* @param leaveMessage leave message
* @deprecated in favour of {@link #leaveMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setLeaveMessage(@NotNull String leaveMessage) {
this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(leaveMessage); // Paper
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
index ebd499c1a2d11ea068e8c374edbc3967e4cece3d..61895d8d9f01f7ad0409a1cbd902e8a21472d6d4 100644
--- a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
@@ -36,7 +36,7 @@ public class PlayerLocaleChangeEvent extends PlayerEvent {
* @deprecated in favour of {@link #locale()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getLocale() {
return locale;
}
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
index 75cc54739ef841cd90568d74927d6002d4cfa7e0..712900c9afc3b79806d2b564c0734facf969a6fe 100644
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
@@ -139,7 +139,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @deprecated in favour of {@link #kickMessage()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getKickMessage() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
}
@@ -150,7 +150,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param message New kick message
* @deprecated in favour of {@link #kickMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setKickMessage(@NotNull final String message) {
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
}
@@ -181,7 +181,7 @@ public class PlayerLoginEvent extends PlayerEvent {
* @param message Kick message to display to the user
* @deprecated in favour of {@link #disallow(Result, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper start
+ @Deprecated // Paper start // Purpur - conflict on change
public void disallow(@NotNull final Result result, @NotNull final String message) {
this.result = result;
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message);
diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
index 123979ed64939d615b061f91c19c630e1e1db8c7..5b85579964dc6a6150f0c0be650a4bf731414838 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
@@ -95,7 +95,7 @@ public class PlayerPreLoginEvent extends Event {
* @return Current kick message
* @deprecated in favour of {@link #kickMessage()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
public String getKickMessage() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
@@ -107,7 +107,7 @@ public class PlayerPreLoginEvent extends Event {
* @param message New kick message
* @deprecated in favour of {@link #kickMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setKickMessage(@NotNull final String message) {
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
}
@@ -127,7 +127,7 @@ public class PlayerPreLoginEvent extends Event {
* @param message Kick message to display to the user
* @deprecated in favour of {@link #disallow(org.bukkit.event.player.PlayerPreLoginEvent.Result, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void disallow(@NotNull final Result result, @NotNull final String message) {
this.result = result;
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
index e43acfb570036adb73d195136573620378cc6a61..1826d11d8b18702ee12c669b50df7f538c324582 100644
--- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
@@ -61,7 +61,7 @@ public class PlayerQuitEvent extends PlayerEvent {
* @deprecated in favour of {@link #quitMessage()}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getQuitMessage() {
return this.quitMessage == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.quitMessage); // Paper
}
@@ -72,7 +72,7 @@ public class PlayerQuitEvent extends PlayerEvent {
* @param quitMessage quit message
* @deprecated in favour of {@link #quitMessage(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setQuitMessage(@Nullable String quitMessage) {
this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper
}
diff --git a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java
index 4f8c85222c7bd33217c7db0ff5f47bf397f8f3e5..c18d6d979bd22814ebdc52b995d2cc7ed46dd87f 100644
--- a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java
+++ b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java
@@ -73,7 +73,7 @@ public class BroadcastMessageEvent extends ServerEvent implements Cancellable {
* @deprecated in favour of {@link #message()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getMessage() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
}
@@ -84,7 +84,7 @@ public class BroadcastMessageEvent extends ServerEvent implements Cancellable {
* @param message New message to broadcast
* @deprecated in favour of {@link #message(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setMessage(@NotNull String message) {
this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
}
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index fd4db14bef92b893ddaf5424e14ee71da22dcf84..dd7d8d8f2f848bdc1c224805afe0b03fb80fe5cd 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -113,7 +113,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @deprecated in favour of {@link #motd()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getMotd() {
return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.motd); // Paper
}
@@ -124,7 +124,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param motd the message of the day
* @deprecated in favour of {@link #motd(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setMotd(@NotNull String motd) {
this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper
}
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index b06995aa57aa9cba0bb59f1d26d81015619a08e6..5e33fe46ab9bb034acc6a38a3c00c33c8f029ca6 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -464,7 +464,7 @@ public abstract class InventoryView {
* @return The title.
* @deprecated in favour of {@link #title()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
public abstract String getTitle();
}
diff --git a/src/main/java/org/bukkit/inventory/meta/BookMeta.java b/src/main/java/org/bukkit/inventory/meta/BookMeta.java
index 248cd6faa72a91ceaf6f74d06c05d05bd26f5fbc..6ec728854333cd473528162b6381e7a5a83532d8 100644
--- a/src/main/java/org/bukkit/inventory/meta/BookMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/BookMeta.java
@@ -244,7 +244,7 @@ public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book {
* @deprecated in favour of {@link #page(int)}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getPage(int page);
/**
@@ -260,7 +260,7 @@ public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book {
* @param data the data to set for that page
* @deprecated in favour of {@link #page(int, net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setPage(int page, @NotNull String data);
/**
@@ -270,7 +270,7 @@ public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book {
* @deprecated in favour of {@link #pages()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
List<String> getPages();
/**
@@ -280,7 +280,7 @@ public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book {
* @param pages A list of pages to set the book to use
* @deprecated in favour of {@link #pages(List)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setPages(@NotNull List<String> pages);
/**
@@ -290,7 +290,7 @@ public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book {
* @param pages A list of strings, each being a page
* @deprecated in favour of {@link #pages(net.kyori.adventure.text.Component...)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setPages(@NotNull String... pages);
/**
@@ -300,7 +300,7 @@ public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book {
* @param pages A list of strings, each being a page
* @deprecated in favour of {@link #addPages(net.kyori.adventure.text.Component...)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void addPage(@NotNull String... pages);
/**
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index f093f991f1fedd20fcef041b093398250b7fb286..49d8b1bdad79f452c863f83557ffde7e8f4749c6 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -59,7 +59,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* @return the display name that is set
* @deprecated in favour of {@link #displayName()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@NotNull
String getDisplayName();
@@ -83,7 +83,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* @param name the name to set
* @deprecated in favour of {@link #displayName(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setDisplayName(@Nullable String name);
// Paper start
@@ -155,7 +155,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* @return a list of lore that is set
* @deprecated in favour of {@link #lore()}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
@Nullable
List<String> getLore();
@@ -179,7 +179,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
* @param lore the lore that will be set
* @deprecated in favour of {@link #lore(List)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setLore(@Nullable List<String> lore);
/**
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index ed0bc2024a0bb85837e25f75ae89d1fe257b2e60..f6e831f844e1fe99a2617bd64c2290d1f2e96d81 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -259,7 +259,7 @@ public final class MapCursor {
* @deprecated in favour of {@link #caption()}
*/
@Nullable
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public String getCaption() {
return this.caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.caption); // Paper
}
@@ -270,7 +270,7 @@ public final class MapCursor {
* @param caption new caption
* @deprecated in favour of {@link #caption(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
public void setCaption(@Nullable String caption) {
this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper
}
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
index 75acd6f8f3d774bb79e8e513125e801c5569a244..1eccadd957867e0c5d59a157e16bd4e5557caf68 100644
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
+++ b/src/main/java/org/bukkit/scoreboard/Objective.java
@@ -47,7 +47,7 @@ public interface Objective {
* @deprecated in favour of {@link #displayName()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getDisplayName() throws IllegalStateException;
/**
@@ -60,7 +60,7 @@ public interface Objective {
* characters.
* @deprecated in favour of {@link #displayName(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setDisplayName(@NotNull String displayName) throws IllegalStateException, IllegalArgumentException;
/**
diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
index f7754ab421c7b452a53c28d1e2fafdccfbba24bf..05026b8bc3d41f0391f7c7a59b56aab899537a3e 100644
--- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java
+++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
@@ -89,7 +89,7 @@ public interface Scoreboard {
* @deprecated in favour of {@link #registerNewObjective(String, String, net.kyori.adventure.text.Component)}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @NotNull String displayName) throws IllegalArgumentException;
/**
@@ -113,7 +113,7 @@ public interface Scoreboard {
* @deprecated in favour of {@link #registerNewObjective(String, String, net.kyori.adventure.text.Component, RenderType)}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @NotNull String displayName, @NotNull RenderType renderType) throws IllegalArgumentException;
/**
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
index d5b39fb4fc16a342b5661e08df1506858168d20d..723eb266fe1f965d2f08c6f3e8c652d0a0e52d58 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -108,7 +108,7 @@ public interface Team {
* @deprecated in favour of {@link #displayName()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getDisplayName() throws IllegalStateException;
/**
@@ -120,7 +120,7 @@ public interface Team {
* @throws IllegalStateException if this team has been unregistered
* @deprecated in favour of {@link #displayName(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setDisplayName(@NotNull String displayName) throws IllegalStateException, IllegalArgumentException;
/**
@@ -131,7 +131,7 @@ public interface Team {
* @deprecated in favour of {@link #prefix()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getPrefix() throws IllegalStateException;
/**
@@ -144,7 +144,7 @@ public interface Team {
* @throws IllegalStateException if this team has been unregistered
* @deprecated in favour of {@link #prefix(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setPrefix(@NotNull String prefix) throws IllegalStateException, IllegalArgumentException;
/**
@@ -155,7 +155,7 @@ public interface Team {
* @deprecated in favour of {@link #suffix()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
String getSuffix() throws IllegalStateException;
/**
@@ -168,7 +168,7 @@ public interface Team {
* @throws IllegalStateException if this team has been unregistered
* @deprecated in favour of {@link #suffix(net.kyori.adventure.text.Component)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setSuffix(@NotNull String suffix) throws IllegalStateException, IllegalArgumentException;
/**
@@ -182,7 +182,7 @@ public interface Team {
* @deprecated in favour of {@link #color()}
*/
@NotNull
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
ChatColor getColor() throws IllegalStateException;
/**
@@ -195,7 +195,7 @@ public interface Team {
* no color
* @deprecated in favour of {@link #color(net.kyori.adventure.text.format.NamedTextColor)}
*/
- @Deprecated // Paper
+ @Deprecated // Paper // Purpur - conflict on change
void setColor(@NotNull ChatColor color);
/**

View File

@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 23 Mar 2021 15:01:03 -0500
Subject: [PATCH] Add enchantment target for bows and crossbows
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
index 635e07a6b0e255c4fdad58ba9d281c807af4e229..93d5fad641c5afa679b59dc712f0d0faaddcfe2e 100644
--- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
@@ -226,6 +226,18 @@ public enum EnchantmentTarget {
public boolean includes(@NotNull Material item) {
return BREAKABLE.includes(item) || (WEARABLE.includes(item) && !item.equals(Material.ELYTRA)) || item.equals(Material.COMPASS);
}
+ // Purpur start
+ },
+
+ /**
+ * Allow the Enchantment to be placed on bows and crossbows.
+ */
+ BOW_AND_CROSSBOW {
+ @Override
+ public boolean includes(@NotNull Material item) {
+ return item.equals(Material.BOW) || item.equals(Material.CROSSBOW);
+ }
+ // Purpur end
};
/**

View File

@@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 13 May 2021 21:38:01 -0500
Subject: [PATCH] Iron golem poppy calms anger
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 6c0ac9c262a3f4469d2eba7f7af6a6fafb2ada1a..2b2fd0da10b84a2a93629a8fbd60f1258d45b3ee 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -205,6 +205,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
// Purpur end
/**

View File

@@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ben Kerllenevich <ben@omega24.dev>
Date: Tue, 25 May 2021 16:30:30 -0400
Subject: [PATCH] API for any mob to burn daylight
Co-authored by: Encode42 <me@encode42.dev>
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 55a40189d92b2bdf60023c1cc6096cc37dbb1630..037b6923f6e548619e5d196b6fa93bfb0dcab8a1 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -815,5 +815,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* @return True if ridable in water
*/
boolean isRidableInWater();
+
+ /**
+ * Checks if the entity is in daylight
+ *
+ * @return True if in daylight
+ */
+ boolean isInDaylight();
// Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 0f9dbacb6851b27b2e5b1aa1cf994ccb313f0f45..bbae010cedf30d0e3336a8f03ee00a0a824cb08d 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -932,5 +932,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @param slot Equipment slot to play break animation for
*/
void broadcastItemBreak(@NotNull org.bukkit.inventory.EquipmentSlot slot);
+
+ /**
+ * If this mob will burn in the sunlight
+ *
+ * @return True if mob will burn in sunlight
+ */
+ boolean shouldBurnInDay();
+
+ /**
+ * Set if this mob should burn in the sunlight
+ *
+ * @param shouldBurnInDay True to burn in sunlight
+ */
+ void setShouldBurnInDay(boolean shouldBurnInDay);
// Purpur end
}

View File

@@ -0,0 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TreyRuffy <TreyRuffy@users.noreply.github.com>
Date: Wed, 9 Jun 2021 16:31:15 -0600
Subject: [PATCH] Flying Fall Damage API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2b2c36e950f1518c795208157f52211a2e93f467..d4f66b338ecfe8c1bdcd8f5763e61539923c7efc 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2343,5 +2343,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param invulnerableTicks Invulnerable ticks remaining
*/
void setSpawnInvulnerableTicks(int invulnerableTicks);
+
+ /**
+ * Allows you to enable fall damage while {@link #getAllowFlight()} is {@code true}
+ *
+ * @param flyingFallDamage Enables fall damage when {@link #getAllowFlight()} is true
+ */
+ public void setFlyingFallDamage(boolean flyingFallDamage);
+
+ /**
+ * Allows you get if fall damage is enabled while {@link #getAllowFlight()} is {@code true}
+ *
+ * @return True if fall damage is enabled when {@link #getAllowFlight()} is true
+ */
+ public boolean hasFlyingFallDamage();
// Purpur end
}

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 26 Jun 2021 22:08:57 -0500
Subject: [PATCH] Add back player spawned endermite API
diff --git a/src/main/java/org/bukkit/entity/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java
index f76ddd80f9fc926f73b1cc50f0a2767abbc549bb..d71afdfa9f7eb66dffd9943d6e51314b0e91b4d0 100644
--- a/src/main/java/org/bukkit/entity/Endermite.java
+++ b/src/main/java/org/bukkit/entity/Endermite.java
@@ -6,24 +6,20 @@ package org.bukkit.entity;
public interface Endermite extends Monster {
/**
- * Gets whether this Endermite was spawned by a player.
+ * Gets whether this Endermite was spawned by a player from throwing an ender pearl
*
- * An Endermite spawned by a player will be attacked by nearby Enderman.
+ * An Endermite spawned by a player might be attacked by nearby Enderman depending on purpur.yml settings
*
* @return player spawned status
- * @deprecated this functionality no longer exists
*/
- @Deprecated
boolean isPlayerSpawned();
/**
- * Sets whether this Endermite was spawned by a player.
+ * Sets whether this Endermite was spawned by a player from throwing an ender pearl
*
- * An Endermite spawned by a player will be attacked by nearby Enderman.
+ * An Endermite spawned by a player might be attacked by nearby Enderman depending on purpur.yml settings
*
* @param playerSpawned player spawned status
- * @deprecated this functionality no longer exists
*/
- @Deprecated
void setPlayerSpawned(boolean playerSpawned);
}

View File

@@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Wed, 30 Jun 2021 17:44:27 -0500
Subject: [PATCH] Fix default permission system
diff --git a/src/main/java/org/bukkit/permissions/PermissibleBase.java b/src/main/java/org/bukkit/permissions/PermissibleBase.java
index cd3296fea01648592d2af89b3d80135acb6d0958..45797a6fbae1d8edc4211cb30def24ad4f59bd49 100644
--- a/src/main/java/org/bukkit/permissions/PermissibleBase.java
+++ b/src/main/java/org/bukkit/permissions/PermissibleBase.java
@@ -168,7 +168,7 @@ public class PermissibleBase implements Permissible {
for (Permission perm : defaults) {
String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH);
- permissions.put(name, new PermissionAttachmentInfo(parent, name, null, true));
+ permissions.put(name, new PermissionAttachmentInfo(parent, name, null, perm.getDefault().getValue(isOp()))); // Purpur
Bukkit.getServer().getPluginManager().subscribeToPermission(name, parent);
calculateChildPermissions(perm.getChildren(), false, null);
}
@@ -196,7 +196,7 @@ public class PermissibleBase implements Permissible {
String name = entry.getKey();
Permission perm = Bukkit.getServer().getPluginManager().getPermission(name);
- boolean value = entry.getValue() ^ invert;
+ boolean value = (entry.getValue() == null && perm != null ? perm.getDefault().getValue(isOp()) : entry.getValue()) ^ invert; // Purpur
String lname = name.toLowerCase(java.util.Locale.ENGLISH);
permissions.put(lname, new PermissionAttachmentInfo(parent, lname, attachment, value));
diff --git a/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java b/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java
index 8e481e3815f5645ee92f0d229e5ff25c8fc9a6c2..10627d2a11251a8cb01bbc3f6242d66f3505a16e 100644
--- a/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java
+++ b/src/main/java/org/bukkit/util/permissions/DefaultPermissions.java
@@ -31,7 +31,7 @@ public final class DefaultPermissions {
if (withLegacy) {
Permission legacy = new Permission(LEGACY_PREFIX + result.getName(), result.getDescription(), PermissionDefault.FALSE);
- legacy.getChildren().put(result.getName(), true);
+ legacy.getChildren().put(result.getName(), null); // Purpur
registerPermission(perm, false);
}
@@ -40,7 +40,7 @@ public final class DefaultPermissions {
@NotNull
public static Permission registerPermission(@NotNull Permission perm, @NotNull Permission parent) {
- parent.getChildren().put(perm.getName(), true);
+ parent.getChildren().put(perm.getName(), null); // Purpur
return registerPermission(perm);
}
@@ -53,7 +53,7 @@ public final class DefaultPermissions {
@NotNull
public static Permission registerPermission(@NotNull String name, @Nullable String desc, @NotNull Permission parent) {
Permission perm = registerPermission(name, desc);
- parent.getChildren().put(perm.getName(), true);
+ parent.getChildren().put(perm.getName(), null); // Purpur
return perm;
}
@@ -66,7 +66,7 @@ public final class DefaultPermissions {
@NotNull
public static Permission registerPermission(@NotNull String name, @Nullable String desc, @Nullable PermissionDefault def, @NotNull Permission parent) {
Permission perm = registerPermission(name, desc, def);
- parent.getChildren().put(perm.getName(), true);
+ parent.getChildren().put(perm.getName(), null); // Purpur
return perm;
}
@@ -79,7 +79,7 @@ public final class DefaultPermissions {
@NotNull
public static Permission registerPermission(@NotNull String name, @Nullable String desc, @Nullable PermissionDefault def, @Nullable Map<String, Boolean> children, @NotNull Permission parent) {
Permission perm = registerPermission(name, desc, def, children);
- parent.getChildren().put(perm.getName(), true);
+ parent.getChildren().put(perm.getName(), null); // Purpur
return perm;
}

View File

@@ -0,0 +1,81 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 3 Jul 2021 18:45:01 -0500
Subject: [PATCH] Summoner API
diff --git a/src/main/java/org/bukkit/entity/IronGolem.java b/src/main/java/org/bukkit/entity/IronGolem.java
index 655e37cb3a09610a3f3df805d6dcad17d722da62..09fd716c8fc9ea34a1cbf87bcbe22df035422a51 100644
--- a/src/main/java/org/bukkit/entity/IronGolem.java
+++ b/src/main/java/org/bukkit/entity/IronGolem.java
@@ -19,4 +19,20 @@ public interface IronGolem extends Golem {
* player created, false if you want it to be a natural village golem.
*/
public void setPlayerCreated(boolean playerCreated);
+
+ // Purpur start
+ /**
+ * Get the player that summoned this iron golem
+ *
+ * @return UUID of summoner
+ */
+ @org.jetbrains.annotations.Nullable java.util.UUID getSummoner();
+
+ /**
+ * Set the player that summoned this iron golem
+ *
+ * @param summoner UUID of summoner
+ */
+ void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner);
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
index 10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29..34f9d1b5d66ca96c71a94ebc981752e40019e575 100644
--- a/src/main/java/org/bukkit/entity/Snowman.java
+++ b/src/main/java/org/bukkit/entity/Snowman.java
@@ -23,4 +23,20 @@ public interface Snowman extends Golem, RangedEntity { // Paper
* @param derpMode True to remove the pumpkin, false to add a pumpkin
*/
void setDerp(boolean derpMode);
+
+ // Purpur start
+ /**
+ * Get the player that summoned this snowman
+ *
+ * @return UUID of summoner
+ */
+ @org.jetbrains.annotations.Nullable java.util.UUID getSummoner();
+
+ /**
+ * Set the player that summoned this snowman
+ *
+ * @param summoner UUID of summoner
+ */
+ void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner);
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index 8c95cd6933f11076de936854f379e6fc8600b525..86907637ed0a53d4967606dbba3ea20320b528f8 100644
--- a/src/main/java/org/bukkit/entity/Wither.java
+++ b/src/main/java/org/bukkit/entity/Wither.java
@@ -36,4 +36,20 @@ public interface Wither extends Monster, Boss, RangedEntity { // Paper
*/
void setCanTravelThroughPortals(boolean value);
// Paper end
+
+ // Purpur start
+ /**
+ * Get the player that summoned this wither
+ *
+ * @return UUID of summoner
+ */
+ @org.jetbrains.annotations.Nullable java.util.UUID getSummoner();
+
+ /**
+ * Set the player that summoned this wither
+ *
+ * @param summoner UUID of summoner
+ */
+ void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner);
+ // Purpur end
}

View File

@@ -0,0 +1,64 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 15 Jul 2021 23:43:04 -0500
Subject: [PATCH] Clean up version command output for console
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 57a21495843f3a144cd73473cdc8781d6129b7ca..7d9ffef457da0571bb2254c35b908d9c22a3dd46 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -168,14 +168,14 @@ public class VersionCommand extends BukkitCommand {
lastCheck = System.currentTimeMillis();
hasVersion = false;
} else {
- sender.sendMessage(versionMessage);
+ sendVersionMessage(sender); // Purpur
return;
}
}
versionLock.lock();
try {
if (hasVersion) {
- sender.sendMessage(versionMessage);
+ sendVersionMessage(sender); // Purpur
return;
}
versionWaiters.add(sender);
@@ -256,7 +256,7 @@ public class VersionCommand extends BukkitCommand {
hasVersion = true;
versionTaskStarted = false;
for (CommandSender sender : versionWaiters) {
- sender.sendMessage(versionMessage);
+ sendVersionMessage(sender); // Purpur
}
versionWaiters.clear();
} finally {
@@ -284,4 +284,27 @@ public class VersionCommand extends BukkitCommand {
return -1;
}
}
+
+ // Purpur start
+ private void sendVersionMessage(CommandSender sender) {
+ if (!(sender instanceof org.bukkit.command.ConsoleCommandSender)) {
+ sender.sendMessage(versionMessage);
+ return;
+ }
+ List<Component> list = new ArrayList<>();
+ if (versionMessage.children().size() == 1) {
+ versionMessage.children().get(0).children().forEach(child -> {
+ if (child.children().size() > 1) {
+ list.addAll(child.children());
+ } else {
+ list.add(child);
+ }
+ });
+ } else {
+ list.addAll(versionMessage.children());
+ }
+ list.removeIf(component -> net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer.plainText().serialize(component).equals("\n"));
+ list.forEach(sender::sendMessage);
+ }
+ // Purpur end
}

View File

@@ -0,0 +1,99 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 17 Aug 2021 17:39:14 -0500
Subject: [PATCH] Add force and prompt parameters to resource pack api
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d4f66b338ecfe8c1bdcd8f5763e61539923c7efc..40f56815ecee852582b5ed5a86393bee69d90b91 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1486,6 +1486,88 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void setResourcePack(@NotNull String url, @NotNull byte[] hash);
+ // Purpur start
+ /**
+ * Request that the player's client download and switch resource packs.
+ * <p>
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. When this request is sent for the very
+ * first time from a given server, the client will first display a
+ * confirmation GUI to the player before proceeding with the download.
+ * <p>
+ * Notes:
+ * <ul>
+ * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack!
+ * <li>There is no concept of resetting resource packs back to default
+ * within Minecraft, so players will have to relog to do so or you
+ * have to send an empty pack.
+ * </ul>
+ *
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param force If true, players will get kicked from the server if the
+ * resource pack is denied.
+ * @param prompt The server message added to the resource pack prompt.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is null.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ void setResourcePack(@NotNull String url, @NotNull byte[] hash, boolean force, @Nullable String prompt);
+
+ /**
+ * Request that the player's client download and switch resource packs.
+ * <p>
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. When this request is sent for the very
+ * first time from a given server, the client will first display a
+ * confirmation GUI to the player before proceeding with the download.
+ * <p>
+ * Notes:
+ * <ul>
+ * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack!
+ * <li>There is no concept of resetting resource packs back to default
+ * within Minecraft, so players will have to relog to do so or you
+ * have to send an empty pack.
+ * </ul>
+ *
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param force If true, players will get kicked from the server if the
+ * resource pack is denied.
+ * @param prompt The server message added to the resource pack prompt.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is null.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ void setResourcePack(@NotNull String url, @NotNull byte[] hash, boolean force, @Nullable net.kyori.adventure.text.Component prompt);
+ // Purpur end
+
/**
* Gets the Scoreboard displayed to this player
*

View File

@@ -0,0 +1,125 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YouHaveTrouble <youhavetrouble@youhavetrouble.me>
Date: Sun, 22 Aug 2021 05:11:09 +0200
Subject: [PATCH] Extended OfflinePlayer API
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 7838731e0e16bdccfb79e74ceb64148f7c52db79..8ea59406ddb2293af66719a893e6f13d8377b81e 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -437,4 +437,114 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* for the statistic
*/
public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue);
+
+ // Purpur start - OfflinePlayer API
+ /**
+ * Determines if the OfflinePlayer is allowed to fly via jump key double-tap like
+ * in creative mode.
+ *
+ * @return True if the player is allowed to fly.
+ */
+ public boolean getAllowFlight();
+
+ /**
+ * Sets if the OfflinePlayer is allowed to fly via jump key double-tap like in
+ * creative mode.
+ *
+ * @param flight If flight should be allowed.
+ */
+ public void setAllowFlight(boolean flight);
+
+ /**
+ * Checks to see if this player is currently flying or not.
+ *
+ * @return True if the player is flying, else false.
+ */
+ public boolean isFlying();
+
+ /**
+ * Makes this player start or stop flying.
+ *
+ * @param value True to fly.
+ */
+ public void setFlying(boolean value);
+
+ /**
+ * Sets the speed at which a client will fly. Negative values indicate
+ * reverse directions.
+ *
+ * @param value The new speed, from -1 to 1.
+ * @throws IllegalArgumentException If new speed is less than -1 or
+ * greater than 1
+ */
+ public void setFlySpeed(float value) throws IllegalArgumentException;
+
+ /**
+ * Sets the speed at which a client will walk. Negative values indicate
+ * reverse directions.
+ *
+ * @param value The new speed, from -1 to 1.
+ * @throws IllegalArgumentException If new speed is less than -1 or
+ * greater than 1
+ */
+ public void setWalkSpeed(float value) throws IllegalArgumentException;
+
+ /**
+ * Gets the current allowed speed that a client can fly.
+ *
+ * @return The current allowed speed, from -1 to 1
+ */
+ public float getFlySpeed();
+
+ /**
+ * Gets the current allowed speed that a client can walk.
+ *
+ * @return The current allowed speed, from -1 to 1
+ */
+ public float getWalkSpeed();
+
+ /**
+ * Gets the entity's current position
+ *
+ * @return a new copy of Location containing the position of this offline player
+ */
+ @Nullable
+ public Location getLocation();
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
+ *
+ * @param destination
+ * @return true if teleportation was successful
+ */
+ public boolean teleportOffline(@NotNull org.bukkit.Location destination);
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
+ *
+ * @param destination
+ * @param cause Teleport cause used if player is online
+ * @return true if teleportation was successful
+ */
+ public boolean teleportOffline(@NotNull org.bukkit.Location destination, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.
+ *
+ * @param destination
+ * @return <code>true</code> if teleportation successful
+ */
+ @NotNull
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination);
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.
+ *
+ * @param destination
+ * @param cause Teleport cause used if player is online
+ * @return <code>true</code> if teleportation successful
+ */
+ @NotNull
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
+ // Purpur end - OfflinePlayer API
}

View File

@@ -0,0 +1,60 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Mon, 9 Aug 2021 13:22:03 +0200
Subject: [PATCH] Added the ability to add combustible items
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 167d8fa9f8cb5ee67149da3b9b63c613668f20b0..cdfda28119cb1c1f22ec42a37546413b3e4af8da 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2139,5 +2139,24 @@ public final class Bukkit {
public static boolean isLagging() {
return server.isLagging();
}
+
+ /**
+ * Add an Item as fuel for furnaces
+ *
+ * @param material The material that will be the fuel
+ * @param burnTime The time (in ticks) this item will burn for
+ */
+ public static void addFuel(@NotNull Material material, int burnTime) {
+ server.addFuel(material, burnTime);
+ }
+
+ /**
+ * Remove an item as fuel for furnaces
+ *
+ * @param material The material that will no longer be a fuel
+ */
+ public static void removeFuel(@NotNull Material material) {
+ server.removeFuel(material);
+ }
// Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c641822847c8f5c3753fa5a4ea97d86fa44b1fa0..f3b6ba687e3d96fbee592465977df29338dd9a27 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1867,5 +1867,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return True if lagging
*/
boolean isLagging();
+
+ /**
+ * Add an Item as fuel for furnaces
+ *
+ * @param material The material that will be the fuel
+ * @param burnTime The time (in ticks) this item will burn for
+ */
+ public void addFuel(@NotNull Material material, int burnTime);
+
+ /**
+ * Remove an item as fuel for furnaces
+ *
+ * @param material The material that will no longer be a fuel
+ */
+ public void removeFuel(@NotNull Material material);
// Purpur end
}