mirror of
https://github.com/songoda/UltimateRepairing.git
synced 2024-11-01 00:10:19 +01:00
Fixed an issue where items were repairable if removed from the inv.
This commit is contained in:
parent
c3259a202a
commit
ab480dc587
@ -18,25 +18,23 @@ public class RepairGui extends Gui {
|
||||
|
||||
private final Location anvil;
|
||||
private final Player player;
|
||||
private final UltimateRepairing plugin = UltimateRepairing.getInstance();
|
||||
private final ItemStack item;
|
||||
private static final UltimateRepairing plugin = UltimateRepairing.getInstance();
|
||||
|
||||
public static void newGui(Player player, Location anvil) {
|
||||
RepairType type = RepairType.EXPERIENCE;
|
||||
if (!type.hasPermission(player))
|
||||
type = type.getNext(player);
|
||||
if (type == null) {
|
||||
UltimateRepairing.getInstance().getLocale().getMessage("event.general.nopermission").sendPrefixedMessage(player);
|
||||
plugin.getLocale().getMessage("event.general.nopermission").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
UltimateRepairing.getInstance().getGuiManager().showGUI(player, new RepairGui(player, anvil, null, type));
|
||||
plugin.getGuiManager().showGUI(player, new RepairGui(player, anvil, null, type));
|
||||
}
|
||||
|
||||
private RepairGui(Player player, Location anvil, Gui gui, RepairType type) {
|
||||
super(gui);
|
||||
this.anvil = anvil;
|
||||
this.player = player;
|
||||
this.item = player.getItemInHand();
|
||||
|
||||
setRows(6);
|
||||
setTitle(plugin.getLocale().getMessage("interface.repair.title").getMessage());
|
||||
@ -98,16 +96,19 @@ public class RepairGui extends Gui {
|
||||
int finalplayerslot = playerslot;
|
||||
setButton(i, item, (event) -> {
|
||||
exit();
|
||||
UltimateRepairing.getInstance().getRepairHandler().preRepair(toRepair, finalplayerslot, player, type, anvil);
|
||||
if (!player.getInventory().contains(toRepair)) {
|
||||
plugin.getLocale().getMessage("event.repair.notfound").sendPrefixedMessage(player);
|
||||
return;
|
||||
}
|
||||
plugin.getRepairHandler().preRepair(toRepair, finalplayerslot, player, type, anvil);
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
||||
if (Settings.RAINBOW.getBoolean()) {
|
||||
for (int cell = 0; cell < rows * 9; ++cell) {
|
||||
if (getItem(cell) == null) {
|
||||
if (getItem(cell) == null)
|
||||
setItem(cell, GuiUtils.getBorderItem(Methods.getRainbowGlass()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,3 +40,4 @@ event:
|
||||
notenough: '&cYou don''t have enough %type% &cto repair this item!'
|
||||
success: '&aYour item has been successfully repaired!'
|
||||
cancelled: '&cCancelled repairing.'
|
||||
notfound: '&cThe item you attempted to repair has disappeared.'
|
||||
|
Loading…
Reference in New Issue
Block a user