Skip to content

Commit

Permalink
Add checks in disconnect dupe fix for FakePlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
jchung01 committed Aug 14, 2024
1 parent ba0bdfe commit c6c553a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mod.acgaming.universaltweaks.bugfixes.entities.disconnectdupe;

import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
Expand All @@ -19,7 +20,7 @@ public static void utDisconnectDupe(ItemTossEvent event)
{
if (!UTConfigBugfixes.ENTITIES.utDisconnectDupeToggle || event.getPlayer().world.isRemote) return;
EntityPlayerMP player = (EntityPlayerMP) event.getPlayer();
if (!player.connection.getNetworkManager().channel().isOpen())
if (!(player instanceof FakePlayer) && player.connection != null && !player.connection.getNetworkManager().channel().isOpen())
{
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTDisconnectDupe ::: Player dropped item but is disconnected! Ignoring drop.");
event.setCanceled(true);
Expand Down

0 comments on commit c6c553a

Please sign in to comment.