diff --git a/modules/fabric/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java b/modules/fabric/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java index a51a08e..02e3dcd 100644 --- a/modules/fabric/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java +++ b/modules/fabric/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java @@ -11,8 +11,13 @@ public class DeployerProvider implements IDataProvider { @Override public void appendData(IDataWriter data, IServerAccessor accessor, IPluginConfig config) { - data.add(ItemData.class, res -> res.add(ItemData.of(config) - .add(accessor.getTarget().getPlayer().getMainHandItem()))); + data.add(ItemData.class, res -> { + var fakePlayer = accessor.getTarget().getPlayer(); + if (fakePlayer == null) + return; + + res.add(ItemData.of(config).add(fakePlayer.getMainHandItem())); + }); } } diff --git a/modules/forge/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java b/modules/forge/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java index a51a08e..02e3dcd 100644 --- a/modules/forge/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java +++ b/modules/forge/create/src/main/java/lol/bai/megane/module/create/provider/DeployerProvider.java @@ -11,8 +11,13 @@ public class DeployerProvider implements IDataProvider { @Override public void appendData(IDataWriter data, IServerAccessor accessor, IPluginConfig config) { - data.add(ItemData.class, res -> res.add(ItemData.of(config) - .add(accessor.getTarget().getPlayer().getMainHandItem()))); + data.add(ItemData.class, res -> { + var fakePlayer = accessor.getTarget().getPlayer(); + if (fakePlayer == null) + return; + + res.add(ItemData.of(config).add(fakePlayer.getMainHandItem())); + }); } }