ObjectiveLocationMarkerAsset class
Пакет: com.hypixel.hytale.builtin.adventure.objectives.config
Файл: com/hypixel/hytale/builtin/adventure/objectives/config/ObjectiveLocationMarkerAsset.java
implements: JsonAssetWithMap<String, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>>
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
ASSET_STORE |
|
String |
var2 |
|
int |
var3 |
Методы (13)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
throw new |
IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + var2) |
|
|
for for(int var1 = 0; var1 < var0.environmentIds.length; var1++) |
public |
ObjectiveLocationMarkerArea |
getAreaObjectiveLocationMarkerArea getArea() |
static |
DefaultAssetMap<String, ObjectiveLocationMarkerAsset> |
getAssetMapDefaultAssetMap<String, ObjectiveLocationMarkerAsset> getAssetMap() |
static |
AssetStore<String, ObjectiveLocationMarkerAsset, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> |
getAssetStoreAssetStore<String, ObjectiveLocationMarkerAsset, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> getAssetStore() |
public |
String[] |
getEnvironmentIdsString[] getEnvironmentIds() |
public |
int[] |
getEnvironmentIndexesint[] getEnvironmentIndexes() |
public |
String |
getIdString getId() |
public |
ObjectiveTypeSetup |
getObjectiveTypeSetupObjectiveTypeSetup getObjectiveTypeSetup() |
public |
ObjectiveLocationTriggerCondition[] |
getTriggerConditionsObjectiveLocationTriggerCondition[] getTriggerConditions() |
|
|
if if(var0.environmentIds != null && var0.environmentIds.length > 0) |
|
|
if if(var3 == Integer.MIN_VALUE) |
|
|
if if(ASSET_STORE == null) |
Исходный код
Показать/скрыть
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.builtin.adventure.objectives.config.markerarea.ObjectiveLocationMarkerArea;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.objectivesetup.ObjectiveTypeSetup;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.triggercondition.ObjectiveLocationTriggerCondition;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.validation.ValidatorCache;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.server.core.asset.type.environment.config.Environment;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">public class ObjectiveLocationMarkerAsset class="kw">implements JsonAssetWithMap<String, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> {
@Nonnull
class="kw">public class="kw">static class="kw">final AssetBuilderCodec<String, ObjectiveLocationMarkerAsset> CODEC = AssetBuilderCodec.builder(
ObjectiveLocationMarkerAsset.class,
ObjectiveLocationMarkerAsset::new,
Codec.STRING,
(var0, var1) -> var0.id = var1,
var0 -> var0.id,
(var0, var1) -> var0.data = var1,
var0 -> var0.data
)
.append(new KeyedCodec<>("Setup", ObjectiveTypeSetup.CODEC), (var0, var1) -> var0.objectiveTypeSetup = var1, var0 -> var0.objectiveTypeSetup)
.addValidator(Validators.nonNull())
.add()
.<ObjectiveLocationMarkerArea>append(new KeyedCodec<>("Area", ObjectiveLocationMarkerArea.CODEC), (var0, var1) -> var0.area = var1, var0 -> var0.area)
.addValidator(Validators.nonNull())
.add()
.<String[]>append(new KeyedCodec<>("EnvironmentIds", Codec.STRING_ARRAY), (var0, var1) -> var0.environmentIds = var1, var0 -> var0.environmentIds)
.addValidator(Environment.VALIDATOR_CACHE.getArrayValidator())
.add()
.append(
new KeyedCodec<>("TriggerConditions", new ArrayCodec<>(ObjectiveLocationTriggerCondition.CODEC, ObjectiveLocationTriggerCondition[]::new)),
(var0, var1) -> var0.triggerConditions = var1,
var0 -> var0.triggerConditions
)
.add()
.afterDecode(var0 -> {
if (var0.environmentIds != null && var0.environmentIds.length > 0) {
var0.environmentIndexes = new int[var0.environmentIds.length];
for (int var1 = 0; var1 < var0.environmentIds.length; var1++) {
String var2 = var0.environmentIds[var1];
int var3 = Environment.getAssetMap().getIndex(var2);
if (var3 == Integer.MIN_VALUE) {
throw new IllegalArgumentException("Unknown key! " + var2);
}
var0.environmentIndexes[var1] = var3;
}
Arrays.sort(var0.environmentIndexes);
}
})
.build();
@Nonnull
class="kw">public class="kw">static class="kw">final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ObjectiveLocationMarkerAsset::getAssetStore));
class="kw">private class="kw">static AssetStore<String, ObjectiveLocationMarkerAsset, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> ASSET_STORE;
class="kw">protected AssetExtraInfo.Data data;
class="kw">protected String id;
class="kw">protected ObjectiveTypeSetup objectiveTypeSetup;
class="kw">protected ObjectiveLocationMarkerArea area;
class="kw">protected String[] environmentIds;
class="kw">protected int[] environmentIndexes;
class="kw">protected ObjectiveLocationTriggerCondition[] triggerConditions;
class="kw">public class="kw">static AssetStore<String, ObjectiveLocationMarkerAsset, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> getAssetStore() {
if (ASSET_STORE == null) {
ASSET_STORE = AssetRegistry.getAssetStore(ObjectiveLocationMarkerAsset.class);
}
class="kw">return ASSET_STORE;
}
class="kw">public class="kw">static DefaultAssetMap<String, ObjectiveLocationMarkerAsset> getAssetMap() {
class="kw">return (DefaultAssetMap<String, ObjectiveLocationMarkerAsset>)getAssetStore().getAssetMap();
}
class="kw">public ObjectiveLocationMarkerAsset() {
}
class="kw">public String getId() {
class="kw">return this.id;
}
class="kw">public ObjectiveTypeSetup getObjectiveTypeSetup() {
class="kw">return this.objectiveTypeSetup;
}
class="kw">public ObjectiveLocationMarkerArea getArea() {
class="kw">return this.area;
}
class="kw">public String[] getEnvironmentIds() {
class="kw">return this.environmentIds;
}
class="kw">public int[] getEnvironmentIndexes() {
class="kw">return this.environmentIndexes;
}
class="kw">public ObjectiveLocationTriggerCondition[] getTriggerConditions() {
class="kw">return this.triggerConditions;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ObjectiveLocationMarkerAsset{id='"
+ this.id
+ "', objectiveTypeSetup="
+ this.objectiveTypeSetup
+ ", area="
+ this.area
+ ", environmentIds="
+ Arrays.toString(this.environmentIds)
+ ", triggerConditions="
+ Arrays.toString(this.triggerConditions)
+ "}";
}
}