Paper/patches/server/0598-Fix-villager-boat-exploit.patch

27 lines
1.4 KiB
Diff
Raw Normal View History

2021-06-14 21:58:32 +02:00
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
2021-06-15 04:59:31 +02:00
index 720fa2b74d3f9257a32e4bd5d21050626d136668..bbb2b5d96b35328e0b6041145a3d8234fd43dd03 100644
2021-06-14 21:58:32 +02:00
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -613,6 +613,15 @@ 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) {
+ final net.minecraft.world.entity.npc.AbstractVillager villager = (net.minecraft.world.entity.npc.AbstractVillager) entity1;
+ 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);
});
}