aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0646-Fix-villager-boat-exploit.patch
blob: 33fa1b3d4eda173b369f3128b672f5856fcdaefd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Mon, 11 Jan 2021 12:43:51 -0800
Subject: [PATCH] Fix villager boat exploit


diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a7ca1dbebf30262d7c526f96b7a45482b1f898f4..0757cfcb96778258ba2593756e4ca9cbb16e2f87 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -77,6 +77,7 @@ import net.minecraft.util.MathHelper;
 import net.minecraft.world.effect.MobEffect;
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.entity.EntityTypes;
+import net.minecraft.world.entity.npc.EntityVillagerAbstract;
 import net.minecraft.world.entity.player.EntityHuman;
 import net.minecraft.world.level.ChunkCoordIntPair;
 import net.minecraft.world.level.EnumGamemode;
@@ -621,6 +622,15 @@ public abstract class PlayerList {
 
                 for (Iterator iterator = entity.getAllPassengers().iterator(); iterator.hasNext(); entity1.dead = true) {
                     entity1 = (Entity) iterator.next();
+                    // Paper start
+                    if (entity1 instanceof EntityVillagerAbstract) {
+                        final EntityVillagerAbstract villager = (EntityVillagerAbstract) entity1;
+                        final EntityHuman human = villager.getTrader();
+                        if (human != null) {
+                            villager.setTradingPlayer(null);
+                        }
+                    }
+                    // Paper end
                     worldserver.removeEntity(entity1);
                 }