From 980ac8683dbab44b6275a84ed99d14e68d142ff9 Mon Sep 17 00:00:00 2001 From: DeltaHelios Date: Wed, 24 Jul 2024 10:02:12 +0300 Subject: [PATCH] Fix duplicate item on picking up an unprimed grenade --- .../com/parzivail/pswg/entity/FragmentationGrenadeEntity.java | 4 ++-- .../com/parzivail/pswg/entity/ThermalDetonatorEntity.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/pswg/src/main/java/com/parzivail/pswg/entity/FragmentationGrenadeEntity.java b/projects/pswg/src/main/java/com/parzivail/pswg/entity/FragmentationGrenadeEntity.java index 35c5c93a0..62ae46de6 100644 --- a/projects/pswg/src/main/java/com/parzivail/pswg/entity/FragmentationGrenadeEntity.java +++ b/projects/pswg/src/main/java/com/parzivail/pswg/entity/FragmentationGrenadeEntity.java @@ -55,8 +55,8 @@ public ActionResult interact(PlayerEntity player, Hand hand) { if (!isPrimed() && age > MIN_PICKUP_AGE && player.getInventory().getMainHandStack().isEmpty()) { - player.giveItemStack(new ItemStack(SwgItems.Explosives.FragmentationGrenade)); - + if (getWorld() instanceof ServerWorld) + player.giveItemStack(new ItemStack(SwgItems.Explosives.FragmentationGrenade)); this.discard(); } return super.interact(player, hand); diff --git a/projects/pswg/src/main/java/com/parzivail/pswg/entity/ThermalDetonatorEntity.java b/projects/pswg/src/main/java/com/parzivail/pswg/entity/ThermalDetonatorEntity.java index d7d87673f..53d91bd1a 100644 --- a/projects/pswg/src/main/java/com/parzivail/pswg/entity/ThermalDetonatorEntity.java +++ b/projects/pswg/src/main/java/com/parzivail/pswg/entity/ThermalDetonatorEntity.java @@ -95,8 +95,8 @@ public ActionResult interact(PlayerEntity player, Hand hand) { if (!isPrimed() && age > MIN_PICKUP_AGE && player.getInventory().getMainHandStack().isEmpty()) { - player.giveItemStack(new ItemStack(SwgItems.Explosives.ThermalDetonator)); - + if (getWorld() instanceof ServerWorld) + player.giveItemStack(new ItemStack(SwgItems.Explosives.ThermalDetonator)); this.discard(); } return super.interact(player, hand);