diff --git a/src/main/java/com/comandante/creeper/command/LootCommand.java b/src/main/java/com/comandante/creeper/command/LootCommand.java index 8695e66f15e1736badeab01b3efa76f31ab43079..f7d1e606e1f42c897135aff0f1a489d87577e569 100644 --- a/src/main/java/com/comandante/creeper/command/LootCommand.java +++ b/src/main/java/com/comandante/creeper/command/LootCommand.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.Set; -import java.util.function.Consumer; public class LootCommand extends Command { @@ -39,7 +38,7 @@ public class LootCommand extends Command { } Set<Item> items = lootManager.lootItemsReturn(loot); for (Item i: items) { - gameManager.acquireItem(player, i.getItemId()); + gameManager.acquireItem(player, i.getItemId(), true); write("You looted " + i.getItemName() + " from a " + item.getItemName() + ".\r\n"); } if (gold < 0 && items.size() == 0) { diff --git a/src/main/java/com/comandante/creeper/managers/GameManager.java b/src/main/java/com/comandante/creeper/managers/GameManager.java index 2c3f26b0888ba76047b7c0e78fc139eaf916abae..258865bc32331b748a00123119fa8b78c4585575 100755 --- a/src/main/java/com/comandante/creeper/managers/GameManager.java +++ b/src/main/java/com/comandante/creeper/managers/GameManager.java @@ -374,6 +374,10 @@ public class GameManager { } public boolean acquireItem(Player player, String itemId) { + return acquireItem(player, itemId, false); + } + + public boolean acquireItem(Player player, String itemId, boolean isFromLoot) { synchronized (interner.intern(itemId)) { Stats playerStatsWithEquipmentAndLevel = player.getPlayerStatsWithEquipmentAndLevel(); if (player.getInventory().size() < playerStatsWithEquipmentAndLevel.getInventorySize()) { @@ -385,8 +389,10 @@ public class GameManager { } else { Item itemEntity = entityManager.getItemEntity(itemId); channelUtils.write(player.getPlayerId(), "Your inventory is full, drop some items to free up room.\r\n"); - player.getCurrentRoom().addPresentItem(itemId); - roomSay(player.getCurrentRoom().getRoomId(), player.getPlayerName() + " dropped " + itemEntity.getItemName(), player.getPlayerId()); + if (isFromLoot) { + player.getCurrentRoom().addPresentItem(itemId); + roomSay(player.getCurrentRoom().getRoomId(), player.getPlayerName() + " dropped " + itemEntity.getItemName(), player.getPlayerId()); + } return false; } }