diff --git a/Spigot/src/main/java/net/notfab/hubbasics/spigot/entities/CustomItem.java b/Spigot/src/main/java/net/notfab/hubbasics/spigot/entities/CustomItem.java index b5e8f78..8f55388 100644 --- a/Spigot/src/main/java/net/notfab/hubbasics/spigot/entities/CustomItem.java +++ b/Spigot/src/main/java/net/notfab/hubbasics/spigot/entities/CustomItem.java @@ -119,6 +119,21 @@ public void onCommand(Player player) { HubBasics.getInstance().getMessenger().send(player, Messages.get(player, "INVALID_MENU")); else menu.open(player); + } else if (operator.equalsIgnoreCase("item")) { + CustomItem item = HubBasics.getInstance().getItemManager().get(command); + if (item == null) { + HubBasics.getInstance().getMessenger().send(player, Messages.get(player, "ITEM_NOT_FOUND")); + return; + } + if (item.getPermission() != null && !player.hasPermission(item.getPermission())) { + HubBasics.getInstance().getMessenger().send(player, Messages.get(player, "NO_PERMISSION_ITEM")); + return; + } + if (item.getSlot() == null || item.getSlot() == -1) { + player.getInventory().addItem(item.toItemStack(player)); + } else { + player.getInventory().setItem(item.getSlot(), item.toItemStack(player)); + } } else { player.chat("/" + command); } diff --git a/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinItems.java b/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinItems.java index e05a9f4..72eef1a 100644 --- a/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinItems.java +++ b/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinItems.java @@ -99,7 +99,6 @@ public void onWorldChange(PlayerChangedWorldEvent event) { }); } - @SuppressWarnings("ConstantConditions") private void removeItem(CustomItem item, Inventory inventory) { for (ItemStack content : inventory.getContents()) { if (content == null || (content.getType() != item.getMaterial())) { @@ -113,4 +112,4 @@ private void removeItem(CustomItem item, Inventory inventory) { } } -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index 7e99440..49018fe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ allprojects { group 'net.notfab.hubbasics' - version = '6.11.8' + version = '6.11.9' wrapper { gradleVersion = '6.3' }