Paper/patches/server/0272-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
Upstream has released updates that appear 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:
09943450 Update SnakeYAML version
5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc
6f82b381 PR-788: Add getHand() to all relevant events

CraftBukkit Changes:
aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe
5329dd6fd PR-1107: Add getHand() to all relevant events
93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
2022-10-02 09:56:36 +02:00

36 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/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 273e1a6f4fd117e98732c66d9b168cab1d588127..2dfe2e655026e6da1f548779ab3b455a6e42fb0c 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -57,6 +57,18 @@ public abstract class Projectile extends Entity {
return this.cachedOwner;
} else if (this.ownerUUID != null && this.level instanceof ServerLevel) {
this.cachedOwner = ((ServerLevel) this.level).getEntity(this.ownerUUID);
+ // Paper start - check all worlds
+ if (this.cachedOwner == null) {
+ for (final ServerLevel level : this.level.getServer().getAllLevels()) {
+ if (level == this.level) continue;
+ final Entity entity = level.getEntity(this.ownerUUID);
+ if (entity != null) {
+ this.cachedOwner = entity;
+ break;
+ }
+ }
+ }
+ // Paper end
return this.cachedOwner;
} else {
return null;