mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
26 lines
1.5 KiB
Diff
26 lines
1.5 KiB
Diff
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 b560d28562c27bfa2f4da5e79d73eed8eea80e15..6fed863a0400ba23e0e299b0f0a0f28af19fa226 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -603,6 +603,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
|
|
});
|
|
}
|