|
6 | 6 | import com.google.common.collect.Lists; |
7 | 7 | import com.mojang.authlib.GameProfile; |
8 | 8 | import com.mojang.datafixers.util.Either; |
| 9 | +import io.papermc.paper.adventure.PaperAdventure; |
| 10 | +import io.papermc.paper.connection.HorriblePlayerLoginEventHack; |
| 11 | +import io.papermc.paper.connection.PlayerConnection; |
| 12 | +import io.papermc.paper.event.connection.PlayerConnectionValidateLoginEvent; |
| 13 | +import io.papermc.paper.event.entity.ItemTransportingEntityValidateTargetEvent; |
9 | 14 | import java.util.ArrayList; |
10 | 15 | import java.util.Collections; |
11 | 16 | import java.util.EnumMap; |
|
14 | 19 | import java.util.Set; |
15 | 20 | import java.util.stream.Collectors; |
16 | 21 | import java.util.stream.Stream; |
17 | | -import io.papermc.paper.adventure.PaperAdventure; |
18 | | -import io.papermc.paper.connection.HorriblePlayerLoginEventHack; |
19 | | -import io.papermc.paper.connection.PlayerConnection; |
20 | | -import io.papermc.paper.event.connection.PlayerConnectionValidateLoginEvent; |
21 | | -import io.papermc.paper.event.entity.ItemTransportingEntityValidateTargetEvent; |
22 | 22 | import net.minecraft.core.BlockPos; |
23 | 23 | import net.minecraft.core.Direction; |
24 | 24 | import net.minecraft.network.Connection; |
25 | 25 | import net.minecraft.network.chat.Component; |
26 | 26 | import net.minecraft.network.protocol.game.ServerboundContainerClosePacket; |
27 | | -import net.minecraft.resources.ResourceLocation; |
28 | 27 | import net.minecraft.server.MinecraftServer; |
29 | 28 | import net.minecraft.server.level.ServerLevel; |
30 | 29 | import net.minecraft.server.level.ServerPlayer; |
@@ -1540,8 +1539,8 @@ public static boolean handlePlayerUnleashEntityEvent( |
1540 | 1539 | } |
1541 | 1540 |
|
1542 | 1541 | public static boolean handlePlayerLeashEntityEvent(Leashable leashed, Entity leashHolder, net.minecraft.world.entity.player.Player player, InteractionHand hand) { |
1543 | | - if (!(leashed instanceof final Entity leashedEntity)) return false; |
1544 | | - return callPlayerLeashEntityEvent(leashedEntity, leashHolder, player, hand).callEvent(); |
| 1542 | + if (!(leashed instanceof final Entity leashedEntity)) return true; |
| 1543 | + return !callPlayerLeashEntityEvent(leashedEntity, leashHolder, player, hand).isCancelled(); |
1545 | 1544 | } |
1546 | 1545 |
|
1547 | 1546 | public static @Nullable PlayerLeashEntityEvent callPlayerLeashEntityEvent(Leashable leashed, Entity leashHolder, net.minecraft.world.entity.player.Player player, InteractionHand hand) { |
|
0 commit comments