Adds more unfinished code for parsing and tab-completing advanced cost
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2025-02-03 19:34:57 +01:00
parent 42ca42c571
commit ad5066af4b
4 changed files with 333 additions and 17 deletions

View File

@@ -0,0 +1,49 @@
package net.knarcraft.blacksmith.property;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* The type of costs applicable to an advanced cost configuration
*/
public enum CostType {
/**
* A monetary cost from an economy plugin
*/
ECONOMY,
/**
* A permission requirement, rather than a cost
*/
PERMISSION,
/**
* In-game experience levels
*/
EXP,
/**
* A specific item is consumed
*/
ITEM,
;
/**
* Parses a text string denoting a cost type
*
* @param input <p>The input to parse</p>
* @return <p>The parsed cost type, or null if not matched</p>
*/
@Nullable
public static CostType parse(@NotNull String input) {
String normalized = input.trim().toUpperCase();
for (CostType costType : CostType.values()) {
if (normalized.equals(costType.name())) {
return costType;
}
}
return null;
}
}