and yet again, more patches
This commit is contained in:
parent
4664528315
commit
2e347b629d
36 changed files with 106 additions and 123 deletions
|
@ -0,0 +1,23 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Sat, 5 Jun 2021 10:29:39 +0200
|
||||
Subject: [PATCH] fix empty array elements in command arguments
|
||||
|
||||
Adjacent spaces caused empty array elements due to how String#split works.
|
||||
This change removes those empty array elements without modifying anything else.
|
||||
Adjacent spaces sent by players are removed in PlayerConnection, so this change doesn't affect players.
|
||||
But it does affect the console, command blocks, Bukkit.dispatchCommand, etc.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 460fda05a62b12db2edcfb7ea8b2a5dd8e4b110d..74252236b138969560e6513f24e7ecc6dc4a4127 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -134,7 +134,7 @@ public class SimpleCommandMap implements CommandMap {
|
||||
*/
|
||||
@Override
|
||||
public boolean dispatch(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException {
|
||||
- String[] args = commandLine.split(" ");
|
||||
+ String[] args = org.apache.commons.lang3.StringUtils.split(commandLine, ' '); // Paper - fix adjacent spaces (from console/plugins) causing empty array elements
|
||||
|
||||
if (args.length == 0) {
|
||||
return false;
|
47
patches/api/0319-Stinger-API.patch
Normal file
47
patches/api/0319-Stinger-API.patch
Normal file
|
@ -0,0 +1,47 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Tue, 22 Jun 2021 23:16:11 -0400
|
||||
Subject: [PATCH] Stinger API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index cda05df6784dd4d6a09710a416dcb71c016dabfc..31353bd20404a8c2acf6bf0df524dc3cae324272 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -336,6 +336,36 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
public void setArrowsInBody(int count);
|
||||
|
||||
+ // Paper Start - Bee Stinger API
|
||||
+ /**
|
||||
+ * Gets the time in ticks until the next bee stinger leaves the entity's body.
|
||||
+ *
|
||||
+ * @return ticks until bee stinger leaves
|
||||
+ */
|
||||
+ public int getBeeStingerCooldown();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the time in ticks until the next stinger leaves the entity's body.
|
||||
+ *
|
||||
+ * @param ticks time until bee stinger leaves
|
||||
+ */
|
||||
+ public void setBeeStingerCooldown(int ticks);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the amount of bee stingers in an entity's body.
|
||||
+ *
|
||||
+ * @return amount of bee stingers in body
|
||||
+ */
|
||||
+ public int getBeeStingersInBody();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the amount of bee stingers in the entity's body.
|
||||
+ *
|
||||
+ * @param count amount of bee stingers in entity's body
|
||||
+ */
|
||||
+ public void setBeeStingersInBody(int count);
|
||||
+ // Paper End - Stinger API
|
||||
+
|
||||
/**
|
||||
* Returns the living entity's current maximum no damage ticks.
|
||||
* <p>
|
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SirYwell <hannesgreule@outlook.de>
|
||||
Date: Sat, 10 Jul 2021 11:11:43 +0200
|
||||
Subject: [PATCH] Rewrite LogEvents to contain the source jars in stack traces
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index c4ffe80bc7b4903eb8b8b2dbb18b5ff2d9877508..8a39c48fce819d72a94d5309db8dfc42930989af 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -51,7 +51,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
}
|
||||
|
||||
PluginClassLoader(@NotNull final JavaPluginLoader loader, @Nullable final ClassLoader parent, @NotNull final PluginDescriptionFile description, @NotNull final File dataFolder, @NotNull final File file, @Nullable ClassLoader libraryLoader) throws IOException, InvalidPluginException, MalformedURLException {
|
||||
- super(new URL[] {file.toURI().toURL()}, parent);
|
||||
+ super(file.getName(), new URL[] {file.toURI().toURL()}, parent); // Paper - rewrite LogEvents to contain source jar info
|
||||
Validate.notNull(loader, "Loader cannot be null");
|
||||
|
||||
this.loader = loader;
|
185
patches/api/0321-Add-PlayerSetSpawnEvent.patch
Normal file
185
patches/api/0321-Add-PlayerSetSpawnEvent.patch
Normal file
|
@ -0,0 +1,185 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 19 May 2021 18:58:24 -0700
|
||||
Subject: [PATCH] Add PlayerSetSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b5f38a3b0efad52df07c74cfcef30f8e389b11be
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
@@ -0,0 +1,173 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.Location;
|
||||
+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;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player's spawn is set, either by themselves or otherwise.<br>
|
||||
+ * Cancelling this event will prevent the spawn from being set.
|
||||
+ */
|
||||
+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Cause cause;
|
||||
+ private Location location;
|
||||
+ private boolean forced;
|
||||
+ private boolean notifyPlayer;
|
||||
+ private Component notification;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerSetSpawnEvent(@NotNull Player who, @NotNull Cause cause, @Nullable Location location, boolean forced, boolean notifyPlayer, @Nullable Component notification) {
|
||||
+ super(who);
|
||||
+ this.cause = cause;
|
||||
+ this.location = location;
|
||||
+ this.forced = forced;
|
||||
+ this.notifyPlayer = notifyPlayer;
|
||||
+ this.notification = notification;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cause of this event.
|
||||
+ *
|
||||
+ * @return the cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location that the spawn is set to. The yaw
|
||||
+ * of this location is the spawn angle.
|
||||
+ *
|
||||
+ * @return the spawn location, or null if removing the location
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getLocation() {
|
||||
+ return location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the location to be set as the spawn location. The yaw
|
||||
+ * of this location is the spawn angle.
|
||||
+ *
|
||||
+ * @param location the spawn location, or null to remove the spawn location
|
||||
+ */
|
||||
+ public void setLocation(@Nullable Location location) {
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this is a force spawn location
|
||||
+ *
|
||||
+ * @return true if forced
|
||||
+ */
|
||||
+ public boolean isForced() {
|
||||
+ return forced;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this is a forced spawn location
|
||||
+ *
|
||||
+ * @param forced true to force
|
||||
+ */
|
||||
+ public void setForced(boolean forced) {
|
||||
+ this.forced = forced;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this action will notify the player their spawn
|
||||
+ * has been set.
|
||||
+ *
|
||||
+ * @return true to notify
|
||||
+ */
|
||||
+ public boolean willNotifyPlayer() {
|
||||
+ return notifyPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this action will notify the player that their spawn
|
||||
+ * has been set.
|
||||
+ *
|
||||
+ * @param notifyPlayer true to notify
|
||||
+ */
|
||||
+ public void setNotifyPlayer(boolean notifyPlayer) {
|
||||
+ this.notifyPlayer = notifyPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the notification message that will be sent to the player
|
||||
+ * if {@link #willNotifyPlayer()} returns true.
|
||||
+ *
|
||||
+ * @return null if no notification
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component getNotification() {
|
||||
+ return notification;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the notification message that will be sent to the player.
|
||||
+ *
|
||||
+ * @param notification null to send no message
|
||||
+ */
|
||||
+ public void setNotification(@Nullable Component notification) {
|
||||
+ this.notification = notification;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ /**
|
||||
+ * When a player interacts successfully with a bed.
|
||||
+ */
|
||||
+ BED,
|
||||
+ /**
|
||||
+ * When a player interacts successfully with a respawn anchor.
|
||||
+ */
|
||||
+ RESPAWN_ANCHOR,
|
||||
+ /**
|
||||
+ * When a player respawns.
|
||||
+ */
|
||||
+ PLAYER_RESPAWN,
|
||||
+ /**
|
||||
+ * When the {@code /spawnpoint} command is used on a player.
|
||||
+ */
|
||||
+ COMMAND,
|
||||
+ /**
|
||||
+ * When a plugin uses {@link Player#setBedSpawnLocation(Location)} or
|
||||
+ * {@link Player#setBedSpawnLocation(Location, boolean)}.
|
||||
+ */
|
||||
+ PLUGIN,
|
||||
+ /**
|
||||
+ * Fallback cause.
|
||||
+ */
|
||||
+ UNKNOWN,
|
||||
+ }
|
||||
+}
|
89
patches/api/0322-Added-EntityDamageItemEvent.patch
Normal file
89
patches/api/0322-Added-EntityDamageItemEvent.patch
Normal file
|
@ -0,0 +1,89 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 22 Dec 2020 13:51:06 -0800
|
||||
Subject: [PATCH] Added EntityDamageItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..13862939d7b633f08d5c70bfd2097c47278efcce
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityDamageItemEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item on or used by an entity takes durability damage as a result of being hit/used.
|
||||
+ * <p>
|
||||
+ * NOTE: default vanilla behaviour dictates that armor/tools picked up by
|
||||
+ * mobs do not take damage (except via Thorns).
|
||||
+ */
|
||||
+public class EntityDamageItemEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+ private final ItemStack item;
|
||||
+ private int damage;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public EntityDamageItemEvent(@NotNull Entity entity, @NotNull ItemStack item, int damage) {
|
||||
+ super(entity);
|
||||
+ this.item = item;
|
||||
+ this.damage = damage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item being damaged.
|
||||
+ *
|
||||
+ * @return the item
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the amount of durability damage this item will be taking.
|
||||
+ *
|
||||
+ * @return durability change
|
||||
+ */
|
||||
+ public int getDamage() {
|
||||
+ return damage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the amount of durability damage this item will be taking.
|
||||
+ *
|
||||
+ * @param damage the damage amount to cause
|
||||
+ */
|
||||
+ public void setDamage(int damage) {
|
||||
+ this.damage = damage;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
49
patches/api/0323-Make-EntityUnleashEvent-cancellable.patch
Normal file
49
patches/api/0323-Make-EntityUnleashEvent-cancellable.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 21:25:39 -0800
|
||||
Subject: [PATCH] Make EntityUnleashEvent cancellable
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
index e0e068799a1868c8e561869015f41f553ef4fbdb..95248d0f5cf9b62d31a4883955b9088a7fc8a3b3 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
@@ -6,11 +6,20 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called immediately prior to an entity being unleashed.
|
||||
+ * <p>
|
||||
+ * Cancelling this event when either:
|
||||
+ * <ul>
|
||||
+ * <li>the leashed entity dies,</li>
|
||||
+ * <li>the entity changes dimension, or</li>
|
||||
+ * <li>the client has disconnected the leash</li>
|
||||
+ * </ul>
|
||||
+ * will have no effect.
|
||||
*/
|
||||
-public class EntityUnleashEvent extends EntityEvent {
|
||||
+public class EntityUnleashEvent extends EntityEvent implements org.bukkit.event.Cancellable { // Paper
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final UnleashReason reason;
|
||||
private boolean dropLeash; // Paper
|
||||
+ private boolean cancelled; // Paper
|
||||
|
||||
// Paper start - drop leash variable
|
||||
@Deprecated
|
||||
@@ -53,6 +62,16 @@ public class EntityUnleashEvent extends EntityEvent {
|
||||
public void setDropLeash(boolean dropLeash) {
|
||||
this.dropLeash = dropLeash;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 12:14:00 -0700
|
||||
Subject: [PATCH] Change EnderEye target without changing other things
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/EnderSignal.java b/src/main/java/org/bukkit/entity/EnderSignal.java
|
||||
index 1bba155d80621852acd187e181423afc577899ea..c8c74651e1b434e5a0fce6d9e8d01754b2d7287a 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EnderSignal.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EnderSignal.java
|
||||
@@ -28,6 +28,17 @@ public interface EnderSignal extends Entity {
|
||||
*/
|
||||
public void setTargetLocation(@NotNull Location location);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set the {@link Location} this EnderSignal is moving towards.
|
||||
+ *
|
||||
+ * @param location the new target location
|
||||
+ * @param update true to reset the {@link #getDropItem()}
|
||||
+ * to a random value and {@link #getDespawnTimer()} to 0
|
||||
+ */
|
||||
+ public void setTargetLocation(@NotNull Location location, boolean update);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets if the EnderSignal should drop an item on death.<br>
|
||||
* If {@code true}, it will drop an item. If {@code false}, it will shatter.
|
Loading…
Add table
Add a link
Reference in a new issue