diff --git a/build.gradle b/build.gradle index 046e4a0..08c2594 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = 'com.artillexstudios.axsmithing' -version = '1.0' +version = '1.2' repositories { mavenCentral() @@ -40,6 +40,12 @@ compileJava { options.encoding = "UTF-8" } +processResources { + filesMatching("plugin.yml") { + expand(version: version) + } +} + shadowJar { relocate("net.byteflux.libby", "com.artillexstudios.axsmithing.libs.libby") relocate("net.kyori", "com.artillexstudios.axsmithing.libs.kyori") diff --git a/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_16.java b/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_16.java index 15a913f..262eb05 100644 --- a/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_16.java +++ b/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_16.java @@ -116,6 +116,12 @@ public void handleClose(InventoryCloseEvent event) { public void handleDrag(InventoryDragEvent event) { if (!(event.getInventory().getHolder() instanceof SmithingTable_V1_16)) return; + ItemStack outputItem = event.getInventory().getItem(outputSlot); + if (event.getRawSlots().contains(outputSlot) && (outputItem == null || outputItem.getType().isAir()) && !event.getOldCursor().getType().isAir()) { + event.setCancelled(true); + return; + } + if (event.getInventory().getItem(outputSlot) != null && event.getInventory().getItem(outputSlot).getType() != Material.AIR) { event.getInventory().getItem(outputSlot).setAmount(0); } diff --git a/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_20.java b/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_20.java index 6235c98..c160380 100644 --- a/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_20.java +++ b/src/main/java/com/artillexstudios/axsmithing/gui/impl/SmithingTable_V1_20.java @@ -133,11 +133,11 @@ public void handleClick(InventoryClickEvent event) { public void handleClose(InventoryCloseEvent event) { if (!(event.getInventory().getHolder() instanceof SmithingTable_V1_20)) return; - if (event.getInventory().getItem(templateSlot) != null) + if (event.getInventory().getItem(templateSlot) != null && event.getInventory().getItem(templateSlot).getType() != Material.AIR) event.getPlayer().getInventory().addItem(event.getInventory().getItem(templateSlot)); - if (event.getInventory().getItem(itemSlot) != null) + if (event.getInventory().getItem(itemSlot) != null && event.getInventory().getItem(itemSlot).getType() != Material.AIR) event.getPlayer().getInventory().addItem(event.getInventory().getItem(itemSlot)); - if (event.getInventory().getItem(upgradeSlot) != null) + if (event.getInventory().getItem(upgradeSlot) != null && event.getInventory().getItem(upgradeSlot).getType() != Material.AIR) event.getPlayer().getInventory().addItem(event.getInventory().getItem(upgradeSlot)); } @@ -145,6 +145,12 @@ public void handleClose(InventoryCloseEvent event) { public void handleDrag(InventoryDragEvent event) { if (!(event.getInventory().getHolder() instanceof SmithingTable_V1_20)) return; + ItemStack outputItem = event.getInventory().getItem(outputSlot); + if (event.getRawSlots().contains(outputSlot) && (outputItem == null || outputItem.getType().isAir()) && !event.getOldCursor().getType().isAir()) { + event.setCancelled(true); + return; + } + if (event.getInventory().getItem(outputSlot) != null) { event.getInventory().getItem(outputSlot).setAmount(0); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 93d6b32..1a18081 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: "AxSmithing" main: "com.artillexstudios.axsmithing.AxSmithingPlugin" -version: "1.0" +version: "$version" api-version: "1.16" depend: - ViaVersion