Fixes colored NPC names, and cleans up a bit
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2024-12-15 14:20:03 +01:00
parent b01ccfc537
commit 7e17122bb2
10 changed files with 24 additions and 41 deletions

View File

@@ -11,14 +11,18 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/**
* The cost of performing an action
*
* @param monetaryCost <p>The monetary cost of the action</p>
* @param expCost <p>The experience cost of the action</p>
* @param itemCost <p>The item-based cost of the action</p>
*
* @param monetaryCost <p>The monetary cost of the action</p>
* @param expCost <p>The experience cost of the action</p>
* @param itemCost <p>The item-based cost of the action</p>
* @param requiredPermissions <p>The permission required for the action</p>
*/
public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack itemCost,
@@ -43,7 +47,7 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
/**
* Checks whether the given player is able to pay this action cost
*
*
* @param player <p>The player to check</p>
* @return <p>True if the player is able to pay</p>
*/
@@ -53,11 +57,11 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
return false;
}
}
if (player.getExp() < this.expCost || !EconomyManager.hasEnough(player, this.monetaryCost)) {
return false;
}
return hasEnoughValidItemsInInventory(player);
}
@@ -168,7 +172,7 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
* Loads an action cost from a configuration section
*
* @param configurationSection <p>The configuration section to load from</p>
* @param key <p>The key of the cost to load</p>
* @param key <p>The key of the cost to load</p>
* @return <p>The loaded cost</p>
*/
private static ActionCost loadActionCost(@NotNull ConfigurationSection configurationSection, @NotNull String key) {