geforkt von Mirrors/Paper
5792c8626a
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: 93e39ce1 Clarify documentation regarding getMaterial with legacyName = true c3aeaea0 Improve dependency tracker 14c9d275 Add support for transitive depends in load access warning c8afe560 SPIGOT-5526: Add EntityEnterBlockEvent 6bb6f07d SPIGOT-5548: Show error that hints towards plugins misusing reflection ed75537d SPIGOT-5546: Fix bad depend access using wrong provider in message 4e4c0ee9 Fix buggy classloader warning triggering for all classes 89586a4c Print warning when loading classes from depends that have not been specified d4fe9680 Fix bug where disablePlugin could remove ConfigurationSerializable classes from other plugins 85e683b7 Add additional checkstyle checks 612fd8e1 Correct max page count in BookMeta docs fa8a9781 Correct max title length in BookMeta docs CraftBukkit Changes:ab13a117
SPIGOT-5550: Cancelled ProjectileLaunchEvent still plays sound for eggs44016b1d
SPIGOT-5538: Using javaw to run GUI prints input errore653ae76
SPIGOT-5526: Call EntityEnterBlockEvent for bees trying to enter hives6515ea49
SPIGOT-5537: Bee nests generated by growing trees near flower have no beesd82b3149
Remove unused CraftWorld.getId method10763a88
Change some block == AIR checks to isAir to catch CAVE_AIR Spigot Changes: f2c1cd15 Rebuild patches bcd458ad Reformat patches
86 Zeilen
5.6 KiB
Diff
86 Zeilen
5.6 KiB
Diff
From cb12a917cc83d97e3290ad2ba868745f2f6c3b95 Mon Sep 17 00:00:00 2001
|
|
From: Mystiflow <mystiflow@gmail.com>
|
|
Date: Fri, 6 Jul 2018 13:21:30 +0100
|
|
Subject: [PATCH] Send nearby packets from world player list not server list
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
|
index fd0f5c6f29..e46436623c 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
|
@@ -923,8 +923,25 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, DimensionManager dimensionmanager, Packet<?> packet) {
|
|
- for (int i = 0; i < this.players.size(); ++i) {
|
|
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
|
+ // Paper start - Use world list instead of server list where preferable
|
|
+ sendPacketNearby(entityhuman, d0, d1, d2, d3, dimensionmanager, null, packet); // Retained for compatibility
|
|
+ }
|
|
+
|
|
+ public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, WorldServer world, Packet<?> packet) {
|
|
+ sendPacketNearby(entityhuman, d0, d1, d2, d3, world.worldProvider.getDimensionManager(), world, packet);
|
|
+ }
|
|
+
|
|
+ public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, DimensionManager dimensionmanager, @Nullable WorldServer world, Packet<?> packet) {
|
|
+ if (world == null && entityhuman != null && entityhuman.world instanceof WorldServer) {
|
|
+ world = (WorldServer) entityhuman.world;
|
|
+ }
|
|
+
|
|
+ List<? extends EntityHuman> players1 = world == null ? players : world.players;
|
|
+ for (int j = 0; j < players1.size(); ++j) {
|
|
+ EntityHuman entity = players1.get(j);
|
|
+ if (!(entity instanceof EntityPlayer)) continue;
|
|
+ EntityPlayer entityplayer = (EntityPlayer) entity;
|
|
+ // Paper end
|
|
|
|
// CraftBukkit start - Test if player receiving packet can see the source of the packet
|
|
if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
|
|
@@ -932,7 +949,7 @@ public abstract class PlayerList {
|
|
}
|
|
// CraftBukkit end
|
|
|
|
- if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) {
|
|
+ if (entityplayer != entityhuman && (world != null || entityplayer.dimension == dimensionmanager)) { // Paper
|
|
double d4 = d0 - entityplayer.locX();
|
|
double d5 = d1 - entityplayer.locY();
|
|
double d6 = d2 - entityplayer.locZ();
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 12cdb0cc9a..f12cadc735 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1271,7 +1271,7 @@ public class WorldServer extends World {
|
|
}
|
|
// CraftBukkit end
|
|
this.globalEntityList.add(entitylightning);
|
|
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning));
|
|
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension
|
|
}
|
|
|
|
@Override
|
|
@@ -1403,7 +1403,7 @@ public class WorldServer extends World {
|
|
BlockActionData blockactiondata = (BlockActionData) this.I.removeFirst();
|
|
|
|
if (this.a(blockactiondata)) {
|
|
- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
|
|
+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, (double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.b(), blockactiondata.c(), blockactiondata.d()));
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index fe91e08f22..bb908f0712 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -2080,7 +2080,7 @@ public class CraftWorld implements World {
|
|
double z = loc.getZ();
|
|
|
|
PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(new MinecraftKey(sound), SoundCategory.valueOf(category.name()), new Vec3D(x, y, z), volume, pitch);
|
|
- world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.getWorldProvider().getDimensionManager(), packet);
|
|
+ world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world, packet); // Paper - this.world.dimension -> this.world
|
|
}
|
|
|
|
private static Map<String, GameRules.GameRuleKey<?>> gamerules;
|
|
--
|
|
2.25.0
|
|
|