ObjectiveLineAsset class
Пакет: com.hypixel.hytale.builtin.adventure.objectives.config
Файл: com/hypixel/hytale/builtin/adventure/objectives/config/ObjectiveLineAsset.java
implements: JsonAssetWithMap<String, DefaultAssetMap<String, ObjectiveLineAsset>>
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
ASSET_STORE |
Методы (13)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(int var2 = 0; var2 < this.objectiveIds.length - 1; var2++) |
static |
DefaultAssetMap<String, ObjectiveLineAsset> |
getAssetMapDefaultAssetMap<String, ObjectiveLineAsset> getAssetMap() |
static |
AssetStore<String, ObjectiveLineAsset, DefaultAssetMap<String, ObjectiveLineAsset>> |
getAssetStoreAssetStore<String, ObjectiveLineAsset, DefaultAssetMap<String, ObjectiveLineAsset>> getAssetStore() |
public |
String |
getCategoryString getCategory() |
public |
String |
getIdString getId() |
public |
String[] |
getNextObjectiveLineIdsString[] getNextObjectiveLineIds() |
public |
String |
getObjectiveDescriptionKeyString getObjectiveDescriptionKey() |
public |
String[] |
getObjectiveIdsString[] getObjectiveIds() |
public |
String |
getObjectiveTitleKeyString getObjectiveTitleKey() |
|
|
if if(var0.objectiveTitleKey == null) |
|
|
if if(var0.objectiveDescriptionKey == null) |
|
|
if if(ASSET_STORE == null) |
|
|
if if(this.objectiveIds != null && this.objectiveIds.length != 0) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.objectives.config;
class="kw">import com.hypixel.hytale.assetstore.AssetExtraInfo;
class="kw">import com.hypixel.hytale.assetstore.AssetKeyValidator;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.AssetStore;
class="kw">import com.hypixel.hytale.assetstore.codec.AssetBuilderCodec;
class="kw">import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
class="kw">import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIEditor;
class="kw">import com.hypixel.hytale.codec.validation.ValidatorCache;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import java.text.MessageFormat;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ObjectiveLineAsset class="kw">implements JsonAssetWithMap<String, DefaultAssetMap<String, ObjectiveLineAsset>> {
@Nonnull
class="kw">public class="kw">static class="kw">final AssetBuilderCodec<String, ObjectiveLineAsset> CODEC = AssetBuilderCodec.builder(
ObjectiveLineAsset.class,
ObjectiveLineAsset::new,
Codec.STRING,
(var0, var1) -> var0.id = var1,
var0 -> var0.id,
(var0, var1) -> var0.extraData = var1,
var0 -> var0.extraData
)
.appendInherited(
new KeyedCodec<>("Category", Codec.STRING), (var0, var1) -> var0.category = var1, var0 -> var0.category, (var0, var1) -> var0.category = var1.category
)
.add()
.<String[]>appendInherited(
new KeyedCodec<>("ObjectiveIds", Codec.STRING_ARRAY),
(var0, var1) -> var0.objectiveIds = var1,
var0 -> var0.objectiveIds,
(var0, var1) -> var0.objectiveIds = var1.objectiveIds
)
.addValidator(Validators.nonEmptyArray())
.addValidator(Validators.uniqueInArray())
.addValidator(ObjectiveAsset.VALIDATOR_CACHE.getArrayValidator())
.add()
.<String[]>appendInherited(
new KeyedCodec<>("NextObjectiveLineIds", Codec.STRING_ARRAY),
(var0, var1) -> var0.nextObjectiveLineIds = var1,
var0 -> var0.nextObjectiveLineIds,
(var0, var1) -> var0.nextObjectiveLineIds = var1.nextObjectiveLineIds
)
.addValidator(Validators.uniqueInArray())
.add()
.<String>appendInherited(
new KeyedCodec<>("TitleId", Codec.STRING),
(var0, var1) -> var0.objectiveTitleKey = var1,
var0 -> var0.objectiveTitleKey,
(var0, var1) -> var0.objectiveTitleKey = var1.objectiveTitleKey
)
.metadata(new UIEditor(new UIEditor.LocalizationKeyField("objectivelines.{assetId}.title", true)))
.add()
.<String>appendInherited(
new KeyedCodec<>("DescriptionId", Codec.STRING),
(var0, var1) -> var0.objectiveDescriptionKey = var1,
var0 -> var0.objectiveDescriptionKey,
(var0, var1) -> var0.objectiveDescriptionKey = var1.objectiveDescriptionKey
)
.metadata(new UIEditor(new UIEditor.LocalizationKeyField("objectivelines.{assetId}.desc", true)))
.add()
.afterDecode(var0 -> {
if (var0.objectiveTitleKey == null) {
var0.objectiveTitleKey = MessageFormat.format("objectivelines.{0}.title", var0.id);
}
if (var0.objectiveDescriptionKey == null) {
var0.objectiveDescriptionKey = MessageFormat.format("objectivelines.{0}.desc", var0.id);
}
})
.build();
@Nonnull
class="kw">public class="kw">static class="kw">final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ObjectiveLineAsset::getAssetStore));
class="kw">private class="kw">static AssetStore<String, ObjectiveLineAsset, DefaultAssetMap<String, ObjectiveLineAsset>> ASSET_STORE;
class="kw">protected AssetExtraInfo.Data extraData;
class="kw">protected String id;
class="kw">protected String category;
class="kw">protected String[] objectiveIds;
class="kw">protected String objectiveTitleKey;
class="kw">protected String objectiveDescriptionKey;
class="kw">protected String[] nextObjectiveLineIds;
class="kw">public class="kw">static AssetStore<String, ObjectiveLineAsset, DefaultAssetMap<String, ObjectiveLineAsset>> getAssetStore() {
if (ASSET_STORE == null) {
ASSET_STORE = AssetRegistry.getAssetStore(ObjectiveLineAsset.class);
}
class="kw">return ASSET_STORE;
}
class="kw">public class="kw">static DefaultAssetMap<String, ObjectiveLineAsset> getAssetMap() {
class="kw">return (DefaultAssetMap<String, ObjectiveLineAsset>)getAssetStore().getAssetMap();
}
class="kw">public ObjectiveLineAsset(String var1, String var2, String[] var3, String var4, String var5, String[] var6) {
this.id = var1;
this.category = var2;
this.objectiveIds = var3;
this.objectiveTitleKey = var4;
this.objectiveDescriptionKey = var5;
this.nextObjectiveLineIds = var6;
}
class="kw">protected ObjectiveLineAsset() {
}
class="kw">public String getId() {
class="kw">return this.id;
}
class="kw">public String getCategory() {
class="kw">return this.category;
}
class="kw">public String[] getObjectiveIds() {
class="kw">return this.objectiveIds;
}
@Nullable
class="kw">public String getNextObjectiveId(String var1) {
if (this.objectiveIds != null && this.objectiveIds.length != 0) {
for (int var2 = 0; var2 < this.objectiveIds.length - 1; var2++) {
if (this.objectiveIds[var2].equals(var1)) {
class="kw">return this.objectiveIds[var2 + 1];
}
}
class="kw">return null;
} else {
class="kw">return null;
}
}
class="kw">public String getObjectiveTitleKey() {
class="kw">return this.objectiveTitleKey;
}
class="kw">public String getObjectiveDescriptionKey() {
class="kw">return this.objectiveDescriptionKey;
}
class="kw">public String[] getNextObjectiveLineIds() {
class="kw">return this.nextObjectiveLineIds;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ObjectiveLineAsset{id='"
+ this.id
+ "', category='"
+ this.category
+ "', objectiveIds="
+ Arrays.toString(this.objectiveIds)
+ ", objectiveTitleKey='"
+ this.objectiveTitleKey
+ "', objectiveDescriptionKey='"
+ this.objectiveDescriptionKey
+ "', nextObjectiveLineIds="
+ Arrays.toString(this.nextObjectiveLineIds)
+ "}";
}
}