Add implementation for crown and xp toggles in ProgressingKit
This commit is contained in:
parent
ac98213d28
commit
97a4b8e94d
@ -18,7 +18,6 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@ -319,7 +318,23 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
{
|
||||
PlayerKit playerKit = _dataManager.get(player);
|
||||
Donor donor = Manager.GetDonation().Get(Bukkit.getPlayer(player));
|
||||
return Calculations.canUpgrade(Calculations.getNextUpgradeLevel(playerKit.getLevel(getInternalName())), donor.getBalance(GlobalCurrency.GEM)) && playerKit.getLevel(getInternalName()) >= Calculations.getLevelRequiredFor(upgradeLevel);
|
||||
int balance = donor.getBalance(GlobalCurrency.GEM);
|
||||
|
||||
if (crownsEnabled())
|
||||
{
|
||||
if (getUpgradeLevel(player) != (upgradeLevel - 1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
balance = Manager.GetDonation().getCrowns(player);
|
||||
}
|
||||
|
||||
if (!usesXp())
|
||||
{
|
||||
return Calculations.canUpgradeXpLess(upgradeLevel, balance);
|
||||
}
|
||||
|
||||
return Calculations.canUpgrade(Calculations.getNextUpgradeLevel(playerKit.getLevel(getInternalName())), balance) && playerKit.getLevel(getInternalName()) >= Calculations.getLevelRequiredFor(upgradeLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -427,7 +442,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
|
||||
|
||||
public static String receiveItem(String item, int amount)
|
||||
{
|
||||
return "Receive " + (amount == 1 ? (UtilText.startsWithVowel(item) ? "an" :" a") : C.cGreen + amount) + " " + item;
|
||||
return "Receive " + (amount == 1 ? (UtilText.startsWithVowel(item) ? "an" :"a") : C.cGreen + amount) + " " + item;
|
||||
}
|
||||
|
||||
public static String click(boolean left, String comp)
|
||||
|
Loading…
Reference in New Issue
Block a user