Shift Click Attribute View

This commit is contained in:
Ka0rX 2022-07-02 08:25:28 +02:00
parent 6a896fcc32
commit f8f51e0f29
2 changed files with 14 additions and 11 deletions

View File

@ -47,17 +47,19 @@ public class AttributeView extends EditableInventory {
public static class AttributeItem extends InventoryItem {
private final PlayerAttribute attribute;
private int shiftCost;
private int shiftCost=1;
public AttributeItem(String function, ConfigurationSection config) {
super(config);
attribute = MMOCore.plugin.attributeManager
.get(function.substring("attribute_".length()).toLowerCase().replace(" ", "-").replace("_", "-"));
shiftCost = config.getInt("shift-cost");
if (shiftCost < 1) {
MMOCore.log(Level.WARNING, "Level up points cost must not be less than 1. Using default value: 1");
shiftCost = 1;
if(config.contains("shift-cost")) {
shiftCost = config.getInt("shift-cost");
if (shiftCost < 1) {
MMOCore.log(Level.WARNING, "Level up points cost must not be less than 1. Using default value: 1");
shiftCost = 1;
}
}
}

View File

@ -225,15 +225,16 @@ public class SkillList extends EditableInventory {
}
public class UpgradeItem extends InventoryItem<SkillViewerInventory> {
private int shiftCost;
private int shiftCost=1;
public UpgradeItem(ConfigurationSection config) {
super(config);
this.shiftCost = config.getInt("shift-cost");
if (shiftCost < 1) {
MMOCore.log(Level.WARNING, "Upgrade shift-cost cannot be less than 1. Using default value: 1");
shiftCost = 1;
if(config.contains("shift-cost")) {
this.shiftCost = config.getInt("shift-cost");
if (shiftCost < 1) {
MMOCore.log(Level.WARNING, "Upgrade shift-cost cannot be less than 1. Using default value: 1");
shiftCost = 1;
}
}
}