Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
This commit is contained in:
Nassim Jahnke 2022-06-09 11:57:19 +02:00
parent 7be0194157
commit b26d590d0c
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
6 changed files with 15 additions and 28 deletions

View File

@ -2464,7 +2464,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa
public boolean isOp() {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ddc06ac935d7f35a66cbbaa3d4f974800ae0b3e8..3ac1d0f7ad41ac66d6061fffe32efd7ea4757653 100644
index eebd8c56d319100f1f5ad9bc0b4d5a0d01e27fba..028d7a4cec039312bef59c693ef3d9962c5fd467 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -269,14 +269,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2690,7 +2690,7 @@ index ddc06ac935d7f35a66cbbaa3d4f974800ae0b3e8..3ac1d0f7ad41ac66d6061fffe32efd7e
@Override
public int getPing() {
return this.getHandle().latency;
@@ -1902,6 +1995,207 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1902,6 +1995,193 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().allowsListing();
}
@ -2709,22 +2709,8 @@ index ddc06ac935d7f35a66cbbaa3d4f974800ae0b3e8..3ac1d0f7ad41ac66d6061fffe32efd7e
+ @Override
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
+ if (getHandle().connection == null) return;
+ // TODO this needs to be checked
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY);
+ final net.minecraft.network.protocol.Packet<?> packet;
+ if (identity.equals(net.kyori.adventure.identity.Identity.nil()) || type == net.kyori.adventure.audience.MessageType.SYSTEM) {
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.SYSTEM)));
+ } else {
+ final @Nullable Player source = this.getServer().getPlayer(identity.uuid());
+ final ChatSender sender;
+ if (source != null) {
+ sender = ((CraftPlayer) source).getHandle().asChatSender();
+ } else {
+ sender = new ChatSender(identity.uuid(), Component.empty(), null);
+ }
+ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.CHAT)), sender, java.time.Instant.now());
+ }
+ this.getHandle().connection.send(packet);
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.SYSTEM))));
+ }
+
+ @Override

View File

@ -1839,10 +1839,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3ac1d0f7ad41ac66d6061fffe32efd7ea4757653..fcff5e05818c81f72cb6e0f83a683c2bb3979737 100644
index 028d7a4cec039312bef59c693ef3d9962c5fd467..95fc7a52611284ca3a2d92cd6dab36d419bec3c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2288,6 +2288,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2274,6 +2274,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, i));
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 61aa7b0299bf29302f0ce2d7a9fe89d25d0a92e6..7839f3c136cc7e9bdda2f121001acbd6ed2fd6b3 100644
index d426534e7c16a307b93e9170c7eb9bcdbdac2ada..1a10eec46b9b0c3fb94b72e022e75ed89434c189 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2505,6 +2505,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2491,6 +2491,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.adventure$pointers;
}

View File

@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 26f7393e912722150f91e9c2891afb2c4942d3de..40e6f19449f5d87616097bb3e83fbf1ce796685c 100644
index fe50a54779e3ae7c26792dda740b2aa8c20b799b..f53b4041fc9ce961350649666521e3cf359cdfc1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2552,6 +2552,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2538,6 +2538,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() {
getHandle().resetAttackStrengthTicker();
}

View File

@ -56,10 +56,10 @@ index e257fbb337ea50f8e36e7e6015e231bd49751144..0017be03b57b337b010f56019a03e4d2
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c4f26fc66554c70ad4ca97737a1d1d0a04559ff0..7ba16160dcd74bc41bbd3102124aba9d19b3eb5f 100644
index 791889e540f03681e6432305772d30eca907716e..a9b80431323b71f171185b4c7bdc2f323c1de124 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2692,6 +2692,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2678,6 +2678,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

View File

@ -32,10 +32,10 @@ had to be specifically modified.
diff --git a/src/main/java/io/papermc/paper/util/PoiAccess.java b/src/main/java/io/papermc/paper/util/PoiAccess.java
new file mode 100644
index 0000000000000000000000000000000000000000..aaf94f0a47e09d9d23778df437820bc1556d7827
index 0000000000000000000000000000000000000000..1e7be5da4907616ad9e1e01a2227d29b6dd54b32
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/PoiAccess.java
@@ -0,0 +1,800 @@
@@ -0,0 +1,801 @@
+package io.papermc.paper.util;
+
+import com.mojang.datafixers.util.Pair;
@ -229,7 +229,8 @@ index 0000000000000000000000000000000000000000..aaf94f0a47e09d9d23778df437820bc1
+ final PoiManager.Occupancy occupancy,
+ final boolean load,
+ final List<PoiRecord> ret) {
+ findClosestPoiDataRecords(poiStorage, villagePlaceType, (type, pos) -> positionPredicate.test(pos), sourcePosition, range, maxDistance, occupancy, load, ret);
+ final BiPredicate<Holder<PoiType>, BlockPos> predicate = positionPredicate != null ? (type, pos) -> positionPredicate.test(pos) : null;
+ findClosestPoiDataRecords(poiStorage, villagePlaceType, predicate, sourcePosition, range, maxDistance, occupancy, load, ret);
+ }
+
+ public static void findClosestPoiDataRecords(final PoiManager poiStorage,