mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-26 20:27:38 +01:00
Fixed anvil
This commit is contained in:
parent
73a2411dc4
commit
c9d57938cf
@ -4,6 +4,7 @@ import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.config.ConfigManager;
|
||||
import com.willfp.ecoenchants.integrations.anvilgui.AnvilGUIManager;
|
||||
import com.willfp.ecoenchants.nms.RepairCost;
|
||||
import com.willfp.ecoenchants.util.Logger;
|
||||
import com.willfp.ecoenchants.util.NumberUtils;
|
||||
import com.willfp.ecoenchants.util.tuplets.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -68,7 +69,9 @@ public class AnvilListeners implements Listener {
|
||||
int preCost = event.getInventory().getRepairCost();
|
||||
ItemStack item = newOut.getFirst();
|
||||
|
||||
if(event.getInventory().getItem(0) == null) return;
|
||||
if(event.getInventory().getItem(0) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Objects.requireNonNull(event.getInventory().getItem(0)).getType().equals(item.getType())) return;
|
||||
|
||||
@ -89,6 +92,12 @@ public class AnvilListeners implements Listener {
|
||||
cost = preCost;
|
||||
}
|
||||
|
||||
if(!Objects.equals(left, player.getOpenInventory().getItem(0))) {
|
||||
return;
|
||||
}
|
||||
if(cost == 0)
|
||||
return;
|
||||
|
||||
event.getInventory().setRepairCost(cost);
|
||||
event.setResult(item);
|
||||
event.getInventory().setItem(2, item);
|
||||
|
Loading…
Reference in New Issue
Block a user