summaryrefslogtreecommitdiffhomepage
path: root/patches/server/0469-Fix-villager-boat-exploit.patch
blob: 5856a8c32b7fea1c1b9357109bb4f180aa5a58d9 (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 98eb00a8ee23543714d424d3ff5ca19887d6db19..9436a9614dea81d14c4f77cc21ca91f85ca87152 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -595,6 +595,14 @@ public abstract class PlayerList {
                 PlayerList.LOGGER.debug("Removing player mount");
                 entityplayer.stopRiding();
                 entity.getPassengersAndSelf().forEach((entity1) -> {
+                    // Paper start - Fix villager boat exploit
+                    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 - Fix villager boat exploit
                     entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER, EntityRemoveEvent.Cause.PLAYER_QUIT); // CraftBukkit - add Bukkit remove cause
                 });
             }