papermc/patches/server/0067-Complete-resource-pack-API.patch

50 lines
2.9 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 23:17:52 -0400
Subject: [PATCH] Complete resource pack API
2023-09-21 20:14:58 +00:00
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
2024-06-13 23:32:45 +00:00
index 678f12679985c6fa9effe8beec306d95d5e0bdac..8520f0f2b4b4e758b2e2fae206b7fd818a6fa14f 100644
2023-09-21 20:14:58 +00:00
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
2024-06-13 17:30:39 +00:00
@@ -202,7 +202,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
2023-12-25 10:51:44 +00:00
callback.packEventReceived(packet.id(), net.kyori.adventure.resource.ResourcePackStatus.valueOf(packet.action().name()), this.getCraftPlayer());
2021-06-12 00:57:04 +00:00
}
2023-12-25 10:51:44 +00:00
// Paper end
- this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()])); // CraftBukkit
2023-12-25 10:51:44 +00:00
+ // Paper start - store last pack status
2023-12-05 19:54:55 +00:00
+ PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()];
+ player.getBukkitEntity().resourcePackStatus = packStatus;
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), packStatus)); // CraftBukkit
2023-12-25 10:51:44 +00:00
+ // Paper end - store last pack status
2023-09-21 20:14:58 +00:00
2021-06-11 12:02:28 +00:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2024-06-14 12:11:52 +00:00
index bbc8f648fc8287d84a8948947e1321a47417fefa..bb4bef4e2a13aebca543136d51aa8eefead8c329 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2024-06-13 17:30:39 +00:00
@@ -208,6 +208,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2021-06-11 12:02:28 +00:00
private double healthScale = 20;
private CraftWorldBorder clientWorldBorder = null;
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
+ public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
2021-06-11 12:02:28 +00:00
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
2024-06-13 17:30:39 +00:00
@@ -2093,6 +2094,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2021-06-11 12:02:28 +00:00
}
// Paper end - adventure
+ // Paper start - more resource pack API
2021-07-12 19:42:17 +00:00
+ @Override
2021-06-11 12:02:28 +00:00
+ public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status getResourcePackStatus() {
+ return this.resourcePackStatus;
+ }
+ // Paper end - more resource pack API
2021-06-11 12:02:28 +00:00
+
@Override
public void removeResourcePack(UUID id) {
Preconditions.checkArgument(id != null, "Resource pack id cannot be null");