Skip to content

Commit

Permalink
Properly Remove Item
Browse files Browse the repository at this point in the history
Better For Performance
  • Loading branch information
TrueDarkLord committed Mar 23, 2024
1 parent aa6f6d7 commit 783d0fd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void onInventoryClick(InventoryClickEvent event) {

if (!this.settings.getEnchantments(item).isEmpty() || this.settings.isEnchantmentBook(item)) {
if (inventory.getItem(this.mainSlot) == null) {
event.setCurrentItem(new ItemStack(Material.AIR));
event.setCurrentItem(null);
inventory.setItem(this.mainSlot, item); // Moves clicked item to main slot.
playSound(player, this.click);

Expand All @@ -105,7 +105,7 @@ public void onInventoryClick(InventoryClickEvent event) {
setBorder(resultItem, inventory);
}
} else {
event.setCurrentItem(new ItemStack(Material.AIR));
event.setCurrentItem(null);

// Sub item slot is not empty.
// Moves sub slot item to clicked items slot.
Expand All @@ -119,7 +119,7 @@ public void onInventoryClick(InventoryClickEvent event) {
}
} else {
if (event.getRawSlot() == this.mainSlot || event.getRawSlot() == this.subSlot) { // Clicked either the main slot or sub slot.
event.setCurrentItem(new ItemStack(Material.AIR)); // Sets the clicked slot to air.
event.setCurrentItem(null); // Sets the clicked slot to air.
this.methods.addItemToInventory(player, item);
inventory.setItem(outputSlot, BlackSmithManager.getExitButton());
resultBorder.forEach(slot -> inventory.setItem(slot, BlackSmithManager.getRedGlass()));
Expand Down

0 comments on commit 783d0fd

Please sign in to comment.