mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-27 20:37:34 +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.config.ConfigManager;
|
||||||
import com.willfp.ecoenchants.integrations.anvilgui.AnvilGUIManager;
|
import com.willfp.ecoenchants.integrations.anvilgui.AnvilGUIManager;
|
||||||
import com.willfp.ecoenchants.nms.RepairCost;
|
import com.willfp.ecoenchants.nms.RepairCost;
|
||||||
|
import com.willfp.ecoenchants.util.Logger;
|
||||||
import com.willfp.ecoenchants.util.NumberUtils;
|
import com.willfp.ecoenchants.util.NumberUtils;
|
||||||
import com.willfp.ecoenchants.util.tuplets.Pair;
|
import com.willfp.ecoenchants.util.tuplets.Pair;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -68,7 +69,9 @@ public class AnvilListeners implements Listener {
|
|||||||
int preCost = event.getInventory().getRepairCost();
|
int preCost = event.getInventory().getRepairCost();
|
||||||
ItemStack item = newOut.getFirst();
|
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;
|
if(!Objects.requireNonNull(event.getInventory().getItem(0)).getType().equals(item.getType())) return;
|
||||||
|
|
||||||
@ -89,6 +92,12 @@ public class AnvilListeners implements Listener {
|
|||||||
cost = preCost;
|
cost = preCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!Objects.equals(left, player.getOpenInventory().getItem(0))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(cost == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
event.getInventory().setRepairCost(cost);
|
event.getInventory().setRepairCost(cost);
|
||||||
event.setResult(item);
|
event.setResult(item);
|
||||||
event.getInventory().setItem(2, item);
|
event.getInventory().setItem(2, item);
|
||||||
|
Loading…
Reference in New Issue
Block a user