EVEN MOOOOOAAAAAAARRRRRRR patches :) (#5820)
This commit is contained in:
parent
9085da6e60
commit
2a46c72164
82 changed files with 971 additions and 1418 deletions
|
@ -9,10 +9,10 @@ on the real tile entity.
|
|||
This is useful for where performance is needed
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index d4c69573f250309adc442c7cf67ea6fc2f2e3ace..969a6cf404d99c186e73321659240195b8650ffc 100644
|
||||
index da0964b1b6555ad50cb2ee47f13a7b9dfb1ab6aa..3ca05a6e86a5329cf452041eac476e3636eec34a 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -269,6 +269,16 @@ public interface Block extends Metadatable {
|
||||
@@ -271,6 +271,16 @@ public interface Block extends Metadatable {
|
||||
@NotNull
|
||||
BlockState getState();
|
||||
|
||||
|
|
|
@ -122,23 +122,18 @@ index 9a2252fef56be1ed3ae2169aea46cb567e965c6c..11f38187fca830d974be01fea2966a31
|
|||
-public interface Pillager extends Illager, InventoryHolder { }
|
||||
+public interface Pillager extends Illager, InventoryHolder, RangedEntity { } // Paper
|
||||
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
index 16b1293887cee2bc5267f3da771fb5a6ece1b4e9..1c367f78eadf24850061a84ce63b950b79d3c435 100644
|
||||
index 01d838a60d056bf4b4a8ef9d0ac18c6f91f412e6..b7e424ea8a282f45fb8b91c919e4e4526c00be8b 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
@@ -2,11 +2,12 @@ package org.bukkit.entity;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+import com.destroystokyo.paper.entity.RangedEntity;
|
||||
|
||||
/**
|
||||
* Represents a Skeleton.
|
||||
@@ -7,7 +7,7 @@ package org.bukkit.entity;
|
||||
* Other skeleton-like entities, such as the {@link WitherSkeleton} or the
|
||||
* {@link Stray} are not related to this type.
|
||||
*/
|
||||
-public interface Skeleton extends Monster {
|
||||
+public interface Skeleton extends Monster, RangedEntity { // Paper
|
||||
-public interface Skeleton extends AbstractSkeleton {
|
||||
+public interface Skeleton extends AbstractSkeleton, com.destroystokyo.paper.entity.RangedEntity { // Paper
|
||||
|
||||
/**
|
||||
* Gets the current type of this skeleton.
|
||||
* Computes whether or not this skeleton is currently in the process of
|
||||
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
|
||||
index 818efe2a4d1ac0c4d8dca6c757850d99cdc2cb4b..10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Snowman.java
|
||||
|
|
|
@ -91,10 +91,10 @@ index f45bea24a350c3700bdbf4c44aeb1c0562e57d9e..a653a09968123724f9ec5501760257b3
|
|||
* Gets the highest non-empty (impassable) coordinate at the given
|
||||
* coordinates.
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 969a6cf404d99c186e73321659240195b8650ffc..b090938f883c486e703cb7c036c47925f3016704 100644
|
||||
index 3ca05a6e86a5329cf452041eac476e3636eec34a..18ab5cca036522df2d245f755d6c67904e6398e8 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -153,6 +153,72 @@ public interface Block extends Metadatable {
|
||||
@@ -155,6 +155,72 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
int getZ();
|
||||
|
||||
|
|
|
@ -64,21 +64,13 @@ index 0000000000000000000000000000000000000000..8cf87d228a7006658d52ce0da16c2d74
|
|||
+ Sound getFallSound();
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index b090938f883c486e703cb7c036c47925f3016704..5e2aa4fb8cf8130df21d3172dd94e857317f7653 100644
|
||||
index 18ab5cca036522df2d245f755d6c67904e6398e8..5ac36e0f90d0889853736390877aa92ec0ca181b 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import java.util.Collection;
|
||||
+
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Location;
|
||||
@@ -560,4 +561,16 @@ public interface Block extends Metadatable {
|
||||
@@ -587,4 +587,16 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
@NotNull
|
||||
BoundingBox getBoundingBox();
|
||||
VoxelShape getCollisionShape();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add effect to block break naturally
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 5e2aa4fb8cf8130df21d3172dd94e857317f7653..e1cc36fbe808973227c0e8ca7166453235c90279 100644
|
||||
index 5ac36e0f90d0889853736390877aa92ec0ca181b..786b8011e98b2fe93cc2418d624f6350ede62d90 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -469,6 +469,18 @@ public interface Block extends Metadatable {
|
||||
@@ -470,6 +470,18 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
boolean breakNaturally(@Nullable ItemStack tool);
|
||||
|
||||
|
|
62
patches/api/0191-Add-tick-times-API.patch
Normal file
62
patches/api/0191-Add-tick-times-API.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 5 Apr 2020 22:22:58 -0500
|
||||
Subject: [PATCH] Add tick times API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 02f91b446697b1c637fda3b65b48ec8cf38de66d..1eeb1257888ef2e2d92598e2b1a80286a087dfa5 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1590,6 +1590,25 @@ public final class Bukkit {
|
||||
public static double[] getTPS() {
|
||||
return server.getTPS();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Get a sample of the servers last tick times (in nanos)
|
||||
+ *
|
||||
+ * @return A sample of the servers last tick times (in nanos)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static long[] getTickTimes() {
|
||||
+ return server.getTickTimes();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the average tick time (in millis)
|
||||
+ *
|
||||
+ * @return Average tick time (in millis)
|
||||
+ */
|
||||
+ public static double getAverageTickTime() {
|
||||
+ return server == null ? 0D : server.getAverageTickTime();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index b038a82ffc298abb5129b6ec20538df5d0b6f595..3c9890ce33231070836ee471206b20cec74e00b4 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1345,6 +1345,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull
|
||||
public double[] getTPS();
|
||||
+
|
||||
+ /**
|
||||
+ * Get a sample of the servers last tick times (in nanos)
|
||||
+ *
|
||||
+ * @return A sample of the servers last tick times (in nanos)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ long[] getTickTimes();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the average tick time (in millis)
|
||||
+ *
|
||||
+ * @return Average tick time (in millis)
|
||||
+ */
|
||||
+ double getAverageTickTime();
|
||||
// Paper end
|
||||
|
||||
// Paper start
|
44
patches/api/0192-Expose-MinecraftServer-isRunning.patch
Normal file
44
patches/api/0192-Expose-MinecraftServer-isRunning.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JRoy <joshroy126@gmail.com>
|
||||
Date: Fri, 10 Apr 2020 21:24:35 -0400
|
||||
Subject: [PATCH] Expose MinecraftServer#isRunning
|
||||
|
||||
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 1eeb1257888ef2e2d92598e2b1a80286a087dfa5..847ba5143660d5c56ff8f2cae2169a51b8927757 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1858,6 +1858,15 @@ public final class Bukkit {
|
||||
public static int getCurrentTick() {
|
||||
return server.getCurrentTick();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the server is in the process of being shutdown.
|
||||
+ *
|
||||
+ * @return true if server is in the process of being shutdown
|
||||
+ */
|
||||
+ public static boolean isStopping() {
|
||||
+ return server.isStopping();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 3c9890ce33231070836ee471206b20cec74e00b4..e6b62ba32e089e2fd8563ec8430b72196f6680e0 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1631,5 +1631,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @return Current tick
|
||||
*/
|
||||
int getCurrentTick();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the server is in the process of being shutdown.
|
||||
+ *
|
||||
+ * @return true if server is in the process of being shutdown
|
||||
+ */
|
||||
+ boolean isStopping();
|
||||
// Paper end
|
||||
}
|
56
patches/api/0193-Add-Raw-Byte-ItemStack-Serialization.patch
Normal file
56
patches/api/0193-Add-Raw-Byte-ItemStack-Serialization.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Thu, 30 Apr 2020 16:56:31 +0200
|
||||
Subject: [PATCH] Add Raw Byte ItemStack Serialization
|
||||
|
||||
Serializes using NBT which is safer for server data migrations than bukkits format.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index d6897f43a0692e031bed8a212d9a637ef548cc60..e348034288c74ab80360086d71f0b7f61551df24 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -97,5 +97,9 @@ public interface UnsafeValues {
|
||||
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
||||
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
}
|
||||
+
|
||||
+ byte[] serializeItem(ItemStack item);
|
||||
+
|
||||
+ ItemStack deserializeItem(byte[] data);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 290c3f0fd6e8c3407d421b697e0ee01584f4cebd..9a878e4fde31c015e2f3fdf365d5d16c30198685 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -628,6 +628,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Deserializes this itemstack from raw NBT bytes. NBT is safer for data migrations as it will
|
||||
+ * use the built in data converter instead of bukkits dangerous serialization system.
|
||||
+ *
|
||||
+ * This expects that the DataVersion was stored on the root of the Compound, as saved from
|
||||
+ * the {@link #serializeAsBytes()} API returned.
|
||||
+ * @param bytes bytes representing an item in NBT
|
||||
+ * @return ItemStack migrated to this version of Minecraft if needed.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static ItemStack deserializeBytes(@NotNull byte[] bytes) {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().deserializeItem(bytes);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will
|
||||
+ * use the built in data converter instead of bukkits dangerous serialization system.
|
||||
+ * @return bytes representing this item in NBT.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public byte[] serializeAsBytes() {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().serializeItem(this);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Gets the Display name as seen in the Client.
|
||||
* Currently the server only supports the English language. To override this,
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 11 Apr 2020 21:38:59 -0400
|
||||
Subject: [PATCH] Disable Sync Events firing Async errors during shutdown
|
||||
|
||||
This is how it use to behave on Paper, and this is totally destroying
|
||||
the ability to try to shut the server down gracefully during the
|
||||
shutdown process as events firing on the watchdog thread are throwing
|
||||
errors.
|
||||
|
||||
This isn't an issue on Spigot
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index b83637f872be5fc73500b10c917d71802976b340..49e5d49eb09bb966e47d6a03ac08a527c963b43d 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -591,7 +591,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
// Paper - replace callEvent by merging to below method
|
||||
if (event.isAsynchronous() && server.isPrimaryThread()) {
|
||||
throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||
- } else if (!event.isAsynchronous() && !server.isPrimaryThread()) {
|
||||
+ } else if (!event.isAsynchronous() && !server.isPrimaryThread() && !server.isStopping() ) {
|
||||
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||
}
|
||||
|
53
patches/api/0195-Make-JavaPluginLoader-thread-safe.patch
Normal file
53
patches/api/0195-Make-JavaPluginLoader-thread-safe.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Wed, 15 Apr 2020 01:24:55 -0400
|
||||
Subject: [PATCH] Make JavaPluginLoader thread-safe
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index f26303315c9c93356f0b04440136855dd54d32b7..ce751577623eaad0f31e2eb7bf0842d1ab73e845 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -52,6 +52,8 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
public final class JavaPluginLoader implements PluginLoader {
|
||||
final Server server;
|
||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
||||
+ private final Map<String, java.util.concurrent.locks.ReentrantReadWriteLock> classLoadLock = new java.util.HashMap<String, java.util.concurrent.locks.ReentrantReadWriteLock>(); // Paper
|
||||
+ private final Map<String, Integer> classLoadLockCount = new java.util.HashMap<String, Integer>(); // Paper
|
||||
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||
private final LibraryLoader libraryLoader;
|
||||
|
||||
@@ -201,12 +203,33 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
|
||||
@Nullable
|
||||
Class<?> getClassByName(final String name, boolean resolve, PluginDescriptionFile description) {
|
||||
+ // Paper start - make MT safe
|
||||
+ java.util.concurrent.locks.ReentrantReadWriteLock lock;
|
||||
+ synchronized (classLoadLock) {
|
||||
+ lock = classLoadLock.computeIfAbsent(name, (x) -> new java.util.concurrent.locks.ReentrantReadWriteLock());
|
||||
+ classLoadLockCount.compute(name, (x, prev) -> prev != null ? prev + 1 : 1);
|
||||
+ }
|
||||
+ lock.writeLock().lock();try {
|
||||
+ // Paper end
|
||||
for (PluginClassLoader loader : loaders) {
|
||||
try {
|
||||
return loader.loadClass0(name, resolve, false, ((SimplePluginManager) server.getPluginManager()).isTransitiveDepend(description, loader.plugin.getDescription()));
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
}
|
||||
}
|
||||
+ // Paper start - make MT safe
|
||||
+ } finally {
|
||||
+ synchronized (classLoadLock) {
|
||||
+ lock.writeLock().unlock();
|
||||
+ if (classLoadLockCount.get(name) == 1) {
|
||||
+ classLoadLock.remove(name);
|
||||
+ classLoadLockCount.remove(name);
|
||||
+ } else {
|
||||
+ classLoadLockCount.compute(name, (x, prev) -> prev - 1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
return null;
|
||||
}
|
||||
|
202
patches/api/0196-Add-Player-Client-Options-API.patch
Normal file
202
patches/api/0196-Add-Player-Client-Options-API.patch
Normal file
|
@ -0,0 +1,202 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MiniDigger <admin@minidigger.me>
|
||||
Date: Mon, 20 Jan 2020 21:38:34 +0100
|
||||
Subject: [PATCH] Add Player Client Options API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9dad814cf51bc59ec5dfbf14474fea6557de38aa
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+
|
||||
+public final class ClientOption<T> {
|
||||
+
|
||||
+ public static final ClientOption<SkinParts> SKIN_PARTS = new ClientOption<>(SkinParts.class);
|
||||
+ public static final ClientOption<Boolean> CHAT_COLORS_ENABLED = new ClientOption<>(Boolean.class);
|
||||
+ public static final ClientOption<ChatVisibility> CHAT_VISIBILITY = new ClientOption<>(ChatVisibility.class);
|
||||
+ public static final ClientOption<String> LOCALE = new ClientOption<>(String.class);
|
||||
+ public static final ClientOption<MainHand> MAIN_HAND = new ClientOption<>(MainHand.class);
|
||||
+ public static final ClientOption<Integer> VIEW_DISTANCE = new ClientOption<>(Integer.class);
|
||||
+
|
||||
+ private final Class<T> type;
|
||||
+
|
||||
+ private ClientOption(@NotNull Class<T> type) {
|
||||
+ this.type = type;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Class<T> getType() {
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ public enum ChatVisibility {
|
||||
+ FULL,
|
||||
+ SYSTEM,
|
||||
+ HIDDEN,
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4a0c39405d4fbed457787e3c6ded4cc6591bc8c2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/SkinParts.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+public interface SkinParts {
|
||||
+
|
||||
+ boolean hasCapeEnabled();
|
||||
+
|
||||
+ boolean hasJacketEnabled();
|
||||
+
|
||||
+ boolean hasLeftSleeveEnabled();
|
||||
+
|
||||
+ boolean hasRightSleeveEnabled();
|
||||
+
|
||||
+ boolean hasLeftPantsEnabled();
|
||||
+
|
||||
+ boolean hasRightPantsEnabled();
|
||||
+
|
||||
+ boolean hasHatsEnabled();
|
||||
+
|
||||
+ int getRaw();
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f7f171c4ee0b8339b2f8fbe82442d65f17202f28
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
|
||||
@@ -0,0 +1,100 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.destroystokyo.paper.ClientOption;
|
||||
+import com.destroystokyo.paper.ClientOption.ChatVisibility;
|
||||
+import com.destroystokyo.paper.SkinParts;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the player changes his client settings
|
||||
+ */
|
||||
+public class PlayerClientOptionsChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final String locale;
|
||||
+ private final int viewDistance;
|
||||
+ private final ChatVisibility chatVisibility;
|
||||
+ private final boolean chatColors;
|
||||
+ private final SkinParts skinparts;
|
||||
+ private final MainHand mainHand;
|
||||
+
|
||||
+ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull String locale, int viewDistance, @NotNull ChatVisibility chatVisibility, boolean chatColors, @NotNull SkinParts skinParts, @NotNull MainHand mainHand) {
|
||||
+ super(player);
|
||||
+ this.locale = locale;
|
||||
+ this.viewDistance = viewDistance;
|
||||
+ this.chatVisibility = chatVisibility;
|
||||
+ this.chatColors = chatColors;
|
||||
+ this.skinparts = skinParts;
|
||||
+ this.mainHand = mainHand;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getLocale() {
|
||||
+ return locale;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasLocaleChanged() {
|
||||
+ return !locale.equals(player.getClientOption(ClientOption.LOCALE));
|
||||
+ }
|
||||
+
|
||||
+ public int getViewDistance() {
|
||||
+ return viewDistance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasViewDistanceChanged() {
|
||||
+ return viewDistance != player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChatVisibility getChatVisibility() {
|
||||
+ return chatVisibility;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatVisibilityChanged() {
|
||||
+ return chatVisibility != player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabled() {
|
||||
+ return chatColors;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabledChanged() {
|
||||
+ return chatColors != player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public SkinParts getSkinParts() {
|
||||
+ return skinparts;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasSkinPartsChanged() {
|
||||
+ return skinparts.getRaw() != player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public MainHand getMainHand() {
|
||||
+ return mainHand;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasMainHandChanged() {
|
||||
+ return mainHand != player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ }
|
||||
+
|
||||
+ @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 685975e7bb8938ce0b2d80855c4c5549f50b262d..e53f641e11dc74c99e656e985caa7c5943fb53a4 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.entity;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.UUID;
|
||||
+import com.destroystokyo.paper.ClientOption; // Paper
|
||||
import com.destroystokyo.paper.Title; // Paper
|
||||
import net.kyori.adventure.text.Component;
|
||||
import com.destroystokyo.paper.profile.PlayerProfile; // Paper
|
||||
@@ -1936,6 +1937,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* Reset the cooldown counter to 0, effectively starting the cooldown period.
|
||||
*/
|
||||
void resetCooldown();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the client option value of the player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ <T> T getClientOption(@NotNull ClientOption<T> option);
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
|
@ -0,0 +1,88 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: nossr50 <nossr50@gmail.com>
|
||||
Date: Thu, 26 Mar 2020 19:30:58 -0700
|
||||
Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ebdebe7b6ec6ed5aadc7ee925ba0147e61e6bc84
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java
|
||||
@@ -0,0 +1,76 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when processing a player's attack on an entity when the player's attack strength cooldown is reset
|
||||
+ */
|
||||
+public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private final float cooledAttackStrength;
|
||||
+ private boolean cancel = false;
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull private final Entity attackedEntity;
|
||||
+
|
||||
+ public PlayerAttackEntityCooldownResetEvent(@NotNull Player who, @NotNull Entity attackedEntity, float cooledAttackStrength) {
|
||||
+ super(who);
|
||||
+ this.attackedEntity = attackedEntity;
|
||||
+ this.cooledAttackStrength = cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * <p>
|
||||
+ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset.
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the value of the players cooldown attack strength when they initiated the attack
|
||||
+ *
|
||||
+ * @return returns the original player cooldown value
|
||||
+ */
|
||||
+ public float getCooledAttackStrength() {
|
||||
+ return cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity attacked by the player
|
||||
+ *
|
||||
+ * @return the entity attacked by the player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getAttackedEntity() {
|
||||
+ return attackedEntity;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,21 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Wesley Smith <me@wesjd.net>
|
||||
Date: Fri, 24 Apr 2020 18:30:26 -0400
|
||||
Subject: [PATCH] Fix Potion#toItemStack swapping the extended and upgraded
|
||||
constructor values.
|
||||
|
||||
While the Potion class is deprecated, it is still used in some plugins for cross-version potion handling. This issue has existed for a long time, and has caused many heaches along the way.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/potion/Potion.java b/src/main/java/org/bukkit/potion/Potion.java
|
||||
index b9dbbfd07dea643d7ac749822548571968adaa94..ac02ae4fc179483b4ac3d1adc41684a8426197eb 100644
|
||||
--- a/src/main/java/org/bukkit/potion/Potion.java
|
||||
+++ b/src/main/java/org/bukkit/potion/Potion.java
|
||||
@@ -267,7 +267,7 @@ public class Potion {
|
||||
}
|
||||
ItemStack itemStack = new ItemStack(material, amount);
|
||||
PotionMeta meta = (PotionMeta) itemStack.getItemMeta();
|
||||
- meta.setBasePotionData(new PotionData(type, level == 2, extended));
|
||||
+ meta.setBasePotionData(new PotionData(type, extended, level == 2)); // Paper - fix swapped values
|
||||
itemStack.setItemMeta(meta);
|
||||
return itemStack;
|
||||
}
|
31
patches/api/0199-Villager-Restocks-API.patch
Normal file
31
patches/api/0199-Villager-Restocks-API.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: zbk <zbk@projectsolaris.net>
|
||||
Date: Sun, 26 Apr 2020 23:49:03 -0400
|
||||
Subject: [PATCH] Villager Restocks API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
|
||||
index ef48ad9b28750ab7b33071f6b8e354e922731909..d1579153092c1b80350155110f1b9926b1a1ef57 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -77,6 +77,20 @@ public interface Villager extends AbstractVillager {
|
||||
*/
|
||||
public void setVillagerExperience(int experience);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the amount of times a villager has restocked their trades today
|
||||
+ * @return The amount of trade restocks.
|
||||
+ */
|
||||
+ public int getRestocksToday();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the amount of times a villager has restocked their trades today
|
||||
+ * @param restocksToday new restock count
|
||||
+ */
|
||||
+ public void setRestocksToday(int restocksToday);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Attempts to make this villager sleep at the given location.
|
||||
* <br>
|
50
patches/api/0200-Expose-game-version.patch
Normal file
50
patches/api/0200-Expose-game-version.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Fri, 1 May 2020 17:39:02 +0300
|
||||
Subject: [PATCH] Expose game version
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 847ba5143660d5c56ff8f2cae2169a51b8927757..2c9d2739e78d5c422574f5ddda078ca395c0fa6d 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -118,6 +118,18 @@ public final class Bukkit {
|
||||
return server.getBukkitVersion();
|
||||
}
|
||||
|
||||
+ // Paper start - expose game version
|
||||
+ /**
|
||||
+ * Gets the version of game this server implements
|
||||
+ *
|
||||
+ * @return version of game
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static String getMinecraftVersion() {
|
||||
+ return server.getMinecraftVersion();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets a view of all currently logged in players. This {@linkplain
|
||||
* Collections#unmodifiableCollection(Collection) view} is a reused
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index e6b62ba32e089e2fd8563ec8430b72196f6680e0..46d1086bd7d7f91b4337c8463974d4b9d501cbf0 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -97,6 +97,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public String getBukkitVersion();
|
||||
|
||||
+ // Paper start - expose game version
|
||||
+ /**
|
||||
+ * Gets the version of game this server implements
|
||||
+ *
|
||||
+ * @return version of game
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getMinecraftVersion();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets a view of all currently logged in players. This {@linkplain
|
||||
* Collections#unmodifiableCollection(Collection) view} is a reused
|
Loading…
Add table
Add a link
Reference in a new issue