use of net.silentchaos512.gear.api.util.PartGearKey in project Silent-Gear by SilentChaos512.
the class PartGearKey method read.
public static PartGearKey read(String key) {
String[] parts = key.split("/");
if (parts.length != 2) {
throw new JsonParseException("invalid key: " + key);
}
PartType partType = PartType.getNonNull(Objects.requireNonNull(SilentGear.getIdWithDefaultNamespace(parts[0])));
if (partType.isInvalid()) {
throw new JsonParseException("Unknown part type: " + parts[0]);
}
GearType gearType = GearType.get(parts[1]);
if (gearType.isInvalid()) {
throw new JsonParseException("Unknown gear type: " + parts[1]);
}
return new PartGearKey(gearType, partType);
}
Aggregations