summaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0544-Fix-villager-boat-exploit.patch
blob: e8e565dcf7d4c34fa3c8a55c938819b46325b6e5 (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.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 cd8e11b073f53c824965c91129d502f89ac2b465..8b683ffd930155adf7b1cd1088322621d4e0a037 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -591,6 +591,14 @@ public abstract class PlayerList {
                 PlayerList.LOGGER.debug("Removing player mount");
                 entityplayer.stopRiding();
                 entity.getPassengersAndSelf().forEach((entity1) -> {
+                    // Paper start
+                    if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) {
+                        final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
+                        if (human != null) {
+                            villager.setTradingPlayer(null);
+                        }
+                    }
+                    // Paper end
                     entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
                 });
             }