mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
124 lines
4.9 KiB
Diff
124 lines
4.9 KiB
Diff
From f8c9a0bd1f8a4bf5e8b808717dc641354e6e6e9b Mon Sep 17 00:00:00 2001
|
|
From: Jedediah Smith <jedediah@silencegreys.com>
|
|
Date: Sat, 4 Apr 2015 22:59:54 -0400
|
|
Subject: [PATCH] Complete resource pack API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
|
index 40246fb99..495d43e78 100644
|
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
|
@@ -1214,7 +1214,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
* @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.
|
|
+ * @deprecated use {@link #setResourcePack(String, String)}
|
|
*/
|
|
+ @Deprecated // Paper
|
|
public void setResourcePack(@NotNull String url);
|
|
|
|
/**
|
|
@@ -1652,6 +1654,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
|
*/
|
|
public void openBook(@NotNull ItemStack book);
|
|
|
|
+ // Paper 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 the same
|
|
+ * resource pack in the past, it will perform a quick timestamp check
|
|
+ * over the network to determine if the resource pack has changed and
|
|
+ * needs to be downloaded again. 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.
|
|
+ * <li>There is no concept of resetting resource packs back to default
|
|
+ * within Minecraft, so players will have to relog to do so.
|
|
+ * </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 A 40 character hexadecimal and lowercase SHA-1 digest of
|
|
+ * the resource pack file.
|
|
+ * @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.
|
|
+ */
|
|
+ void setResourcePack(@NotNull String url, @NotNull String hash);
|
|
+
|
|
+ /**
|
|
+ * @return the most recent resource pack status received from the player,
|
|
+ * or null if no status has ever been received from this player.
|
|
+ */
|
|
+ @Nullable
|
|
+ org.bukkit.event.player.PlayerResourcePackStatusEvent.Status getResourcePackStatus();
|
|
+
|
|
+ /**
|
|
+ * @return the most recent resource pack hash received from the player,
|
|
+ * or null if no hash has ever been received from this player.
|
|
+ *
|
|
+ * @deprecated This is no longer sent from the client and will always be null
|
|
+ */
|
|
+ @Nullable
|
|
+ @Deprecated
|
|
+ String getResourcePackHash();
|
|
+
|
|
+ /**
|
|
+ * @return true if the last resource pack status received from this player
|
|
+ * was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}
|
|
+ */
|
|
+ boolean hasResourcePack();
|
|
+ // Paper end
|
|
+
|
|
// Spigot start
|
|
public class Spigot extends Entity.Spigot
|
|
{
|
|
diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
|
index b98195650..4c2102a11 100644
|
|
--- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java
|
|
@@ -11,13 +11,32 @@ import org.jetbrains.annotations.NotNull;
|
|
public class PlayerResourcePackStatusEvent extends PlayerEvent {
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
+ @Deprecated
|
|
+ private final String hash; // Paper
|
|
private final Status status;
|
|
|
|
public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull Status resourcePackStatus) {
|
|
super(who);
|
|
+ this.hash = null; // Paper
|
|
this.status = resourcePackStatus;
|
|
}
|
|
|
|
+ @Deprecated // Paper
|
|
+ public PlayerResourcePackStatusEvent(final Player who, Status resourcePackStatus, String hash) {
|
|
+ super(who);
|
|
+ this.hash = hash; // Paper
|
|
+ this.status = resourcePackStatus;
|
|
+ }
|
|
+
|
|
+ @Deprecated
|
|
+ /**
|
|
+ * @deprecated Hash does not seem to ever be set
|
|
+ */
|
|
+ public String getHash() {
|
|
+ return this.hash;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
/**
|
|
* Gets the status of this pack.
|
|
*
|
|
--
|
|
2.21.0
|
|
|