Skip to content

Commit

Permalink
786 Mystery Dust With Full Inventory (#791)
Browse files Browse the repository at this point in the history
* Inv Full Check
Add a check to ensure the player's inventory is not full before trying to give them an item.
  • Loading branch information
TrueDarkLord committed Feb 19, 2024
1 parent 68f8c50 commit abd8024
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ issues = https://github.com/Crazy-Crew/CrazyEnchantments/issues

group = com.badbones69.crazyenchantments
description = Adds over 80 unique enchantments to your server and more!
version = 2.2.5
version = 2.2.6
apiVersion = 1.20

minecraftVersion = 1.20.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.badbones69.crazyenchantments.paper.api.CrazyManager;
import com.badbones69.crazyenchantments.paper.api.FileManager.Files;
import com.badbones69.crazyenchantments.paper.api.enums.Dust;
import com.badbones69.crazyenchantments.paper.api.enums.Messages;
import com.badbones69.crazyenchantments.paper.api.enums.pdc.DustData;
import com.badbones69.crazyenchantments.paper.api.enums.pdc.EnchantedBook;
import com.badbones69.crazyenchantments.paper.api.enums.pdc.DataKeys;
Expand Down Expand Up @@ -190,6 +191,11 @@ private boolean openAnyHandDust(Player player, PlayerInteractEvent event, boolea
} else if(data.getConfigName().equals(Dust.MYSTERY_DUST.getConfigName())) {
event.setCancelled(true);

if (methods.isInventoryFull(player)) {
player.sendMessage(Messages.INVENTORY_FULL.getMessage());
return true;
}

if (mainHand) {
player.getInventory().setItemInMainHand(this.methods.removeItem(item));
} else {
Expand Down

0 comments on commit abd8024

Please sign in to comment.