Paper/Spigot-Server-Patches/0298-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch
Mariell a0b8b886c8
Updated Upstream (CraftBukkit/Spigot) (#4318)
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

CraftBukkit Changes:
d5a72960 SPIGOT-6063: ConsoleSender sending extra lines in Java 13+

Spigot Changes:
2740d5ae Rebuild patches
2020-09-12 15:57:21 -04:00

37 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 17 Oct 2018 19:17:27 -0400
Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles
Say a player shoots an arrow through a nether portal, the game
would lose the shooter for determining things such as Player Kills,
because the entity is in another world.
If the projectile fails to find the shooter in the current world, check
other worlds.
diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
index 97aed437adb98bc468ec757df8b6d375b5101834..8d26521bc414b3d34f496e966f0c918b023f4833 100644
--- a/src/main/java/net/minecraft/server/IProjectile.java
+++ b/src/main/java/net/minecraft/server/IProjectile.java
@@ -29,7 +29,18 @@ public abstract class IProjectile extends Entity {
@Nullable
public Entity getShooter() {
- return this.shooter != null && this.world instanceof WorldServer ? ((WorldServer) this.world).getEntity(this.shooter) : (this.c != 0 ? this.world.getEntity(this.c) : null);
+ // Paper start - MC-50319 - shooter might be in another world (arrows through portals)
+ Entity entity = this.shooter != null && this.world instanceof WorldServer ? ((WorldServer) this.world).getEntity(this.shooter) : (this.c != 0 ? this.world.getEntity(this.c) : null);
+ if (entity == null) {
+ for (WorldServer world : world.getMinecraftServer().getWorlds()) {
+ entity = world.getEntity(this.shooter);
+ if (entity != null) {
+ break;
+ }
+ }
+ }
+ return entity;
+ // Paper end
}
@Override