ObjectivePlugin class
Пакет: com.hypixel.hytale.builtin.adventure.objectives
Файл: com/hypixel/hytale/builtin/adventure/objectives/ObjectivePlugin.java
extends: JavaPlugin
Поля (110)
| Модификаторы | Тип | Имя |
|---|---|---|
|
public static final BuilderCodec<ObjectivePlugin.ObjectivePluginConfig> |
CODEC |
|
|
break |
|
private DataStoreProvider |
dataStoreProvider |
static |
ObjectivePlugin |
instance |
|
|
instance |
|
EventRegistry |
var1 |
|
ModelAsset |
var1 |
|
Map |
var1 |
|
StringBuilder |
var1 |
|
ComponentType |
var10 |
|
Message |
var10 |
|
PlayerConfigData |
var10 |
|
Ref |
var10 |
|
PlayerRef |
var10 |
|
Model |
var10 |
|
ComponentType |
var11 |
|
TrackOrUpdateObjective |
var11 |
|
HashSet |
var11 |
|
Store |
var11 |
|
Player |
var11 |
|
PlayerRef |
var11 |
|
PersistentModel |
var11 |
|
String |
var12 |
|
PlayerRef |
var12 |
|
UUID |
var12 |
|
World |
var12 |
|
HashSet |
var12 |
|
Ref |
var12 |
|
Model |
var12 |
|
Ref |
var13 |
|
ObjectiveLineAsset |
var13 |
|
Player |
var13 |
|
Player |
var14 |
|
Objective |
var14 |
|
HashSet |
var14 |
|
Message |
var15 |
|
Objective |
var16 |
|
ComponentRegistryProxy |
var2 |
|
String |
var2 |
|
PlayerRef |
var2 |
|
AndQuery |
var2 |
|
Map |
var2 |
|
EntityModule |
var3 |
|
PlayerRef |
var3 |
|
Set |
var3 |
|
Set |
var3 |
|
Universe |
var3 |
|
Map |
var3 |
|
Objective |
var3 |
|
UUID |
var3 |
|
Ref |
var3 |
|
Store |
var3 |
|
World |
var3 |
|
ModelAsset |
var3 |
|
ComponentType |
var4 |
|
String |
var4 |
|
ObjectiveTask[] |
var4 |
|
Objective |
var4 |
|
Objective |
var4 |
|
Store |
var4 |
|
UUID |
var4 |
|
String |
var4 |
|
ResourceType |
var5 |
|
ObjectiveLineHistoryData |
var5 |
|
Universe |
var5 |
|
ObjectiveDataStore |
var5 |
|
World |
var5 |
|
Player |
var5 |
|
String[] |
var5 |
|
ObjectiveLocationMarker |
var5 |
|
ComponentType |
var6 |
|
Objective |
var6 |
|
ObjectiveLineAsset |
var6 |
|
Objective |
var6 |
|
String |
var6 |
|
PlayerRef |
var6 |
|
ObjectiveHistoryComponent |
var6 |
|
ObjectiveHistoryComponent |
var6 |
|
ObjectiveTask[] |
var6 |
|
Set |
var6 |
|
ObjectiveLocationMarkerAsset |
var6 |
|
ComponentType |
var7 |
|
ObjectiveAsset |
var7 |
|
Player |
var7 |
|
String[] |
var7 |
|
ObjectiveLineHistoryData |
var7 |
|
String[] |
var7 |
|
Ref |
var7 |
|
Map |
var7 |
|
Map |
var7 |
|
TransformComponent |
var7 |
|
ComponentType |
var8 |
|
Objective |
var8 |
|
PlayerRef |
var8 |
|
Universe |
var8 |
|
Store |
var8 |
|
ObjectiveHistoryData |
var8 |
|
UUID |
var8 |
|
ObjectiveLineHistoryData |
var8 |
|
ObjectiveLineHistoryData |
var8 |
|
Rotation3f |
var8 |
|
ComponentType |
var9 |
|
boolean |
var9 |
|
UUIDComponent |
var9 |
|
HashSet |
var9 |
|
World |
var9 |
|
PlayerRef |
var9 |
|
Objective |
var9 |
|
World |
var9 |
|
ModelComponent |
var9 |
Методы (81)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public |
ObjectivePluginConfigpublic ObjectivePluginConfig() |
public |
void |
addPlayerToExistingObjectivevoid addPlayerToExistingObjective(@Nonnull Store<EntityStore> var1, @Nonnull UUID var2, @Nonnull UUID var3) |
public |
boolean |
canPlayerDoObjectiveboolean canPlayerDoObjective(@Nonnull Player var1, @Nonnull String var2) |
public |
boolean |
canPlayerDoObjectiveLineboolean canPlayerDoObjectiveLine(@Nonnull Player var1, @Nonnull String var2) |
public |
void |
cancelObjectivevoid cancelObjective(@Nonnull UUID var1, @Nonnull Store<EntityStore> var2) |
public |
ObjectiveCompletion |
createCompletionObjectiveCompletion createCompletion(@Nonnull ObjectiveCompletionAsset var1) |
public |
ObjectiveTask |
createTaskObjectiveTask createTask(@Nonnull ObjectiveTaskAsset var1, int var2, int var3) |
|
|
for for(UUID var5 : var3) |
|
|
for for(UUID var11 : var3) |
|
|
for for(UUID var5 : var3) |
|
|
for for(String var11 : var7) |
|
|
for for(ObjectiveTask var8 : var4) |
|
|
for for(ObjectiveTask var10 : var6) |
|
|
for for(UUID var8 : var6) |
abstract |
|
for for(int var4 = 0; var4 < var2xx.size() |
static |
ObjectivePlugin |
getObjectivePlugin get() |
|
public DataStoreProvider |
getDataStoreProviderpublic DataStoreProvider getDataStoreProvider() |
public |
ComponentType<EntityStore, ObjectiveHistoryComponent> |
getObjectiveHistoryComponentTypeComponentType<EntityStore, ObjectiveHistoryComponent> getObjectiveHistoryComponentType() |
public |
ComponentType<EntityStore, ObjectiveLocationMarker> |
getObjectiveLocationMarkerComponentTypeComponentType<EntityStore, ObjectiveLocationMarker> getObjectiveLocationMarkerComponentType() |
public |
Model |
getObjectiveLocationMarkerModelModel getObjectiveLocationMarkerModel() |
public |
ComponentType<EntityStore, ReachLocationMarker> |
getReachLocationMarkerComponentTypeComponentType<EntityStore, ReachLocationMarker> getReachLocationMarkerComponentType() |
public |
ComponentType<ChunkStore, TreasureChestBlock> |
getTreasureChestComponentTypeComponentType<ChunkStore, TreasureChestBlock> getTreasureChestComponentType() |
|
|
if if(var1 == null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(this.objectiveDataStore == null) |
|
|
if if(var7 == null) |
|
|
if if(var3 != null) |
|
|
if if(var7 != null) |
|
|
if if(this.objectiveDataStore == null) |
|
|
if if(var3 == null) |
|
|
if if(var6 == null) |
|
|
if if(var7 != null && var7.length != 0) |
|
|
if if(var12 != null) |
|
|
if if(var16 == null) |
|
|
if if(this.objectiveDataStore == null) |
|
|
if if(var3 == null) |
|
|
if if(var6 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var13 == null) |
|
|
if if(var6 != null) |
|
|
if if(var14 != null) |
|
|
if if(var7 != null) |
|
|
if if(var8 != null) |
|
|
if if(var8 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var3 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var8 instanceof UseEntityObjectiveTask var9) |
|
|
if if(var10 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var4 != null) |
|
|
if if(var10 instanceof UseEntityObjectiveTask) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var4 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var3 != null) |
|
|
if if(var5 != null) |
|
|
if if(var6 == null) |
|
|
if if(var9 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var9 != null) |
|
|
if if(this.objectiveDataStore != null) |
|
|
if if(var6 != null) |
|
|
if if(var3 != null) |
|
|
if if(this.objectiveDataStore != null) |
public |
void |
objectiveCompletedvoid objectiveCompleted(@Nonnull Objective var1, @Nonnull Store<EntityStore> var2) |
private |
void |
onModelAssetChangevoid onModelAssetChange(@Nonnull LoadedAssetsEvent<String, ModelAsset, DefaultAssetMap<String, ModelAsset>> var1) |
private |
void |
onObjectiveAssetLoadedvoid onObjectiveAssetLoaded(@Nonnull LoadedAssetsEvent<String, ObjectiveAsset, DefaultAssetMap<String, ObjectiveAsset>> var1) |
private |
void |
onObjectiveLineAssetLoadedvoid onObjectiveLineAssetLoaded(@Nonnull LoadedAssetsEvent<String, ObjectiveLineAsset, DefaultAssetMap<String, ObjectiveLineAsset>> var1) |
static |
void |
onObjectiveLocationMarkerChangevoid onObjectiveLocationMarkerChange(@Nonnull LoadedAssetsEvent<String, ObjectiveLocationMarkerAsset, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> var0) |
private |
void |
onPlayerDisconnectvoid onPlayerDisconnect(@Nonnull PlayerDisconnectEvent var1) |
private |
void |
onWorldAddedvoid onWorldAdded(@Nonnull AddWorldEvent var1) |
public |
<T extends ObjectiveCompletionAsset, U extends ObjectiveCompletion> void |
registerCompletion<T extends ObjectiveCompletionAsset, U extends ObjectiveCompletion> void registerCompletion(String var1, Class<T> var2, Codec<T> var3, Function<T, U> var4) |
public |
<T extends ObjectiveTaskAsset, U extends ObjectiveTask> void |
registerTask<T extends ObjectiveTaskAsset, U extends ObjectiveTask> void registerTask(String var1, Class<T> var2, Codec<T> var3, Class<U> var4, Codec<U> var5, TriFunction<T, Integer, Integer, U> var6) |
public |
void |
removePlayerFromExistingObjectivevoid removePlayerFromExistingObjective(@Nonnull Store<EntityStore> var1, @Nonnull UUID var2, @Nonnull UUID var3) |
public |
void |
storeObjectiveHistoryDatavoid storeObjectiveHistoryData(@Nonnull Objective var1) |
public |
void |
storeObjectiveLineHistoryDatavoid storeObjectiveLineHistoryData(@Nonnull ObjectiveLineHistoryData var1, @Nonnull Set<UUID> var2) |
abstract |
|
super super(var1) |
public |
void |
untrackObjectiveForPlayervoid untrackObjectiveForPlayer(@Nonnull Objective var1, @Nonnull UUID var2) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.objectives;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.event.LoadedAssetsEvent;
class="kw">import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.blockstates.TreasureChestBlock;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.commands.ObjectiveCommand;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.completion.ClearObjectiveItemsCompletion;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.completion.GiveItemsCompletion;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.completion.ObjectiveCompletion;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.components.ObjectiveHistoryComponent;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.ObjectiveAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.ObjectiveLineAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.ObjectiveLocationMarkerAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.completion.ClearObjectiveItemsCompletionAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.completion.GiveItemsCompletionAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.completion.ObjectiveCompletionAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.gameplayconfig.ObjectiveGameplayConfig;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.CraftObjectiveTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.GatherObjectiveTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.ObjectiveTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.ReachLocationTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.TreasureMapObjectiveTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.UseBlockObjectiveTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.config.task.UseEntityObjectiveTaskAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.historydata.CommonObjectiveHistoryData;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.historydata.ItemObjectiveRewardHistoryData;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.historydata.ObjectiveHistoryData;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.historydata.ObjectiveLineHistoryData;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.historydata.ObjectiveRewardHistoryData;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.interactions.CanBreakRespawnPointInteraction;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.interactions.DestroyTreasureConditionInteraction;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.interactions.OpenTreasureContainerInteraction;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.interactions.StartObjectiveInteraction;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.markers.ObjectiveMarkerProvider;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.markers.objectivelocation.ObjectiveLocationMarker;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.markers.objectivelocation.ObjectiveLocationMarkerSystems;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.markers.reachlocation.ReachLocationMarker;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.markers.reachlocation.ReachLocationMarkerAsset;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.markers.reachlocation.ReachLocationMarkerSystems;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.systems.ObjectiveInventoryChangeSystem;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.systems.ObjectiveItemEntityRemovalSystem;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.systems.ObjectivePlayerSetupSystem;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.CraftObjectiveTask;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.GatherObjectiveTask;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.ObjectiveTask;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.ReachLocationTask;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.TreasureMapObjectiveTask;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.UseBlockObjectiveTask;
class="kw">import com.hypixel.hytale.builtin.adventure.objectives.task.UseEntityObjectiveTask;
class="kw">import com.hypixel.hytale.builtin.weather.components.WeatherTracker;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.common.util.ArrayUtil;
class="kw">import com.hypixel.hytale.component.ComponentRegistryProxy;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.ResourceType;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.query.AndQuery;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.component.spatial.SpatialResource;
class="kw">import com.hypixel.hytale.event.EventRegistry;
class="kw">import com.hypixel.hytale.function.function.TriFunction;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.protocol.packets.assets.TrackOrUpdateObjective;
class="kw">import com.hypixel.hytale.protocol.packets.assets.UntrackObjective;
class="kw">import com.hypixel.hytale.server.core.HytaleServer;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.asset.HytaleAssetStore;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.asset.type.environment.config.Environment;
class="kw">import com.hypixel.hytale.server.core.asset.type.gameplay.GameplayConfig;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.Item;
class="kw">import com.hypixel.hytale.server.core.asset.type.item.config.ItemDropList;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.Model;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelAsset;
class="kw">import com.hypixel.hytale.server.core.asset.type.weather.config.Weather;
class="kw">import com.hypixel.hytale.server.core.entity.UUIDComponent;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.entity.entities.player.data.PlayerConfigData;
class="kw">import com.hypixel.hytale.server.core.event.events.player.PlayerDisconnectEvent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.ModelComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.PersistentModel;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.Interaction;
class="kw">import com.hypixel.hytale.server.core.plugin.JavaPlugin;
class="kw">import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
class="kw">import com.hypixel.hytale.server.core.prefab.PrefabCopyableComponent;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.Universe;
class="kw">import com.hypixel.hytale.server.core.universe.datastore.DataStoreProvider;
class="kw">import com.hypixel.hytale.server.core.universe.datastore.DiskDataStoreProvider;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.events.AddWorldEvent;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.core.util.Config;
class="kw">import java.util.Arrays;
class="kw">import java.util.HashSet;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import java.util.UUID;
class="kw">import java.util.Map.Entry;
class="kw">import java.util.concurrent.ConcurrentHashMap;
class="kw">import java.util.concurrent.TimeUnit;
class="kw">import java.util.function.Function;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ObjectivePlugin class="kw">extends JavaPlugin {
class="kw">protected class="kw">static ObjectivePlugin instance;
@Nonnull
class="kw">public class="kw">static class="kw">final String OBJECTIVE_LOCATION_MARKER_MODEL_ID = "Objective_Location_Marker";
class="kw">public class="kw">static class="kw">final long SAVE_INTERVAL_MINUTES = 5L;
@Nonnull
class="kw">private class="kw">final Map<Class<? class="kw">extends ObjectiveTaskAsset>, TriFunction<ObjectiveTaskAsset, Integer, Integer, ? class="kw">extends ObjectiveTask>> taskGenerators = new ConcurrentHashMap<>();
@Nonnull
class="kw">private class="kw">final Map<Class<? class="kw">extends ObjectiveCompletionAsset>, Function<ObjectiveCompletionAsset, ? class="kw">extends ObjectiveCompletion>> completionGenerators = new ConcurrentHashMap<>();
@Nonnull
class="kw">private class="kw">final Config<ObjectivePlugin.ObjectivePluginConfig> config = this.withConfig(ObjectivePlugin.ObjectivePluginConfig.CODEC);
class="kw">private Model objectiveLocationMarkerModel;
class="kw">private ComponentType<EntityStore, ObjectiveHistoryComponent> objectiveHistoryComponentType;
class="kw">private ComponentType<EntityStore, ReachLocationMarker> reachLocationMarkerComponentType;
class="kw">private ComponentType<EntityStore, ObjectiveLocationMarker> objectiveLocationMarkerComponentType;
class="kw">private ComponentType<ChunkStore, TreasureChestBlock> treasureChestComponentType;
@Nullable
class="kw">private ObjectiveDataStore objectiveDataStore;
class="kw">public class="kw">static ObjectivePlugin get() {
class="kw">return instance;
}
class="kw">public ObjectivePlugin(@Nonnull JavaPluginInit var1) {
super(var1);
}
class="kw">public ComponentType<EntityStore, ObjectiveHistoryComponent> getObjectiveHistoryComponentType() {
class="kw">return this.objectiveHistoryComponentType;
}
class="kw">public Model getObjectiveLocationMarkerModel() {
class="kw">return this.objectiveLocationMarkerModel;
}
@Nullable
class="kw">public ObjectiveDataStore getObjectiveDataStore() {
class="kw">return this.objectiveDataStore;
}
@Override
class="kw">protected void setup() {
instance = this;
EventRegistry var1 = this.getEventRegistry();
ComponentRegistryProxy var2 = this.getEntityStoreRegistry();
AssetRegistry.register(
((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)HytaleAssetStore.builder(
ObjectiveAsset.class, new DefaultAssetMap()
)
.setPath("Objective/Objectives"))
.setCodec(ObjectiveAsset.CODEC))
.setKeyFunction(ObjectiveAsset::getId))
.loadsAfter(ItemDropList.class, Item.class, BlockType.class, ReachLocationMarkerAsset.class))
.build()
);
AssetRegistry.register(
((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)HytaleAssetStore.builder(
ObjectiveLineAsset.class, new DefaultAssetMap()
)
.setPath("Objective/ObjectiveLines"))
.setCodec(ObjectiveLineAsset.CODEC))
.setKeyFunction(ObjectiveLineAsset::getId))
.loadsAfter(ObjectiveAsset.class))
.loadsBefore(GameplayConfig.class))
.build()
);
AssetRegistry.register(
((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)HytaleAssetStore.builder(
ObjectiveLocationMarkerAsset.class, new DefaultAssetMap()
)
.setPath("Objective/ObjectiveLocationMarkers"))
.setCodec(ObjectiveLocationMarkerAsset.CODEC))
.setKeyFunction(ObjectiveLocationMarkerAsset::getId))
.loadsAfter(ObjectiveAsset.class, Environment.class, Weather.class))
.build()
);
AssetRegistry.register(
((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)((HytaleAssetStore.Builder)HytaleAssetStore.builder(
ReachLocationMarkerAsset.class, new DefaultAssetMap()
)
.setPath("Objective/ReachLocationMarkers"))
.setCodec(ReachLocationMarkerAsset.CODEC))
.setKeyFunction(ReachLocationMarkerAsset::getId))
.build()
);
this.objectiveDataStore = new ObjectiveDataStore(this.config.get().getDataStoreProvider().create(Objective.CODEC));
this.reachLocationMarkerComponentType = var2.registerComponent(ReachLocationMarker.class, "ReachLocationMarker", ReachLocationMarker.CODEC);
this.objectiveLocationMarkerComponentType = var2.registerComponent(ObjectiveLocationMarker.class, "ObjectiveLocation", ObjectiveLocationMarker.CODEC);
this.registerTask(
"Craft", CraftObjectiveTaskAsset.class, CraftObjectiveTaskAsset.CODEC, CraftObjectiveTask.class, CraftObjectiveTask.CODEC, CraftObjectiveTask::new
);
this.registerTask(
"Gather",
GatherObjectiveTaskAsset.class,
GatherObjectiveTaskAsset.CODEC,
GatherObjectiveTask.class,
GatherObjectiveTask.CODEC,
GatherObjectiveTask::new
);
this.registerTask(
"UseBlock",
UseBlockObjectiveTaskAsset.class,
UseBlockObjectiveTaskAsset.CODEC,
UseBlockObjectiveTask.class,
UseBlockObjectiveTask.CODEC,
UseBlockObjectiveTask::new
);
this.registerTask(
"UseEntity",
UseEntityObjectiveTaskAsset.class,
UseEntityObjectiveTaskAsset.CODEC,
UseEntityObjectiveTask.class,
UseEntityObjectiveTask.CODEC,
UseEntityObjectiveTask::new
);
this.registerTask(
"TreasureMap",
TreasureMapObjectiveTaskAsset.class,
TreasureMapObjectiveTaskAsset.CODEC,
TreasureMapObjectiveTask.class,
TreasureMapObjectiveTask.CODEC,
TreasureMapObjectiveTask::new
);
this.registerTask(
"ReachLocation", ReachLocationTaskAsset.class, ReachLocationTaskAsset.CODEC, ReachLocationTask.class, ReachLocationTask.CODEC, ReachLocationTask::new
);
this.registerCompletion("GiveItems", GiveItemsCompletionAsset.class, GiveItemsCompletionAsset.CODEC, GiveItemsCompletion::new);
this.registerCompletion(
"ClearObjectiveItems", ClearObjectiveItemsCompletionAsset.class, ClearObjectiveItemsCompletionAsset.CODEC, ClearObjectiveItemsCompletion::new
);
var1.register(LoadedAssetsEvent.class, ObjectiveLineAsset.class, this::onObjectiveLineAssetLoaded);
var1.register(LoadedAssetsEvent.class, ObjectiveAsset.class, this::onObjectiveAssetLoaded);
var1.register(PlayerDisconnectEvent.class, this::onPlayerDisconnect);
var1.register(LoadedAssetsEvent.class, ObjectiveLocationMarkerAsset.class, ObjectivePlugin::onObjectiveLocationMarkerChange);
var1.register(LoadedAssetsEvent.class, ModelAsset.class, this::onModelAssetChange);
var1.registerGlobal(AddWorldEvent.class, this::onWorldAdded);
this.getCommandRegistry().registerCommand(new ObjectiveCommand());
EntityModule var3 = EntityModule.get();
ComponentType var4 = PlayerRef.getComponentType();
ResourceType var5 = var3.getPlayerSpatialResourceType();
ComponentType var6 = NetworkId.getComponentType();
ComponentType var7 = TransformComponent.getComponentType();
ComponentType var8 = UUIDComponent.getComponentType();
ComponentType var9 = WeatherTracker.getComponentType();
ComponentType var10 = ModelComponent.getComponentType();
ComponentType var11 = PrefabCopyableComponent.getComponentType();
var2.registerSystem(new ReachLocationMarkerSystems.EntityAdded(this.reachLocationMarkerComponentType, var7));
var2.registerSystem(new ReachLocationMarkerSystems.EnsureNetworkSendable(this.reachLocationMarkerComponentType, var6));
var2.registerSystem(new ReachLocationMarkerSystems.Ticking(this.reachLocationMarkerComponentType, var5, var7, var8));
var2.registerSystem(new ObjectiveLocationMarkerSystems.EnsureNetworkSendableSystem(this.objectiveLocationMarkerComponentType, var6));
var2.registerSystem(new ObjectiveLocationMarkerSystems.InitSystem(this.objectiveLocationMarkerComponentType, var10, var7, var11));
var2.registerSystem(new ObjectiveLocationMarkerSystems.TickingSystem(this.objectiveLocationMarkerComponentType, var4, var5, var7, var9, var8));
CommonObjectiveHistoryData.CODEC.register("Objective", ObjectiveHistoryData.class, ObjectiveHistoryData.CODEC);
CommonObjectiveHistoryData.CODEC.register("ObjectiveLine", ObjectiveLineHistoryData.class, ObjectiveLineHistoryData.CODEC);
ObjectiveRewardHistoryData.CODEC.register("Item", ItemObjectiveRewardHistoryData.class, ItemObjectiveRewardHistoryData.CODEC);
this.objectiveHistoryComponentType = var2.registerComponent(ObjectiveHistoryComponent.class, "ObjectiveHistory", ObjectiveHistoryComponent.CODEC);
var2.registerSystem(new ObjectivePlayerSetupSystem(this.objectiveHistoryComponentType, Player.getComponentType()));
var2.registerSystem(new ObjectiveItemEntityRemovalSystem());
var2.registerSystem(new ObjectiveInventoryChangeSystem());
this.getCodecRegistry(Interaction.CODEC).register("StartObjective", StartObjectiveInteraction.class, StartObjectiveInteraction.CODEC);
this.getCodecRegistry(Interaction.CODEC).register("CanBreakRespawnPoint", CanBreakRespawnPointInteraction.class, CanBreakRespawnPointInteraction.CODEC);
this.getCodecRegistry(Interaction.CODEC)
.register("DestroyTreasureCondition", DestroyTreasureConditionInteraction.class, DestroyTreasureConditionInteraction.CODEC);
this.getCodecRegistry(Interaction.CODEC)
.register("OpenTreasureContainer", OpenTreasureContainerInteraction.class, OpenTreasureContainerInteraction.CODEC);
this.treasureChestComponentType = this.getChunkStoreRegistry().registerComponent(TreasureChestBlock.class, "TreasureChest", TreasureChestBlock.CODEC);
this.getCodecRegistry(GameplayConfig.PLUGIN_CODEC).register(ObjectiveGameplayConfig.class, "Objective", ObjectiveGameplayConfig.CODEC);
}
@Override
class="kw">protected void start() {
ModelAsset var1 = ModelAsset.getAssetMap().getAsset("Objective_Location_Marker");
if (var1 == null) {
throw new IllegalStateException(String.format("Default objective location marker model '%s' not found", "Objective_Location_Marker"));
}
this.objectiveLocationMarkerModel = Model.createUnitScaleModel(var1);
if (this.objectiveDataStore != null) {
HytaleServer.SCHEDULED_EXECUTOR.scheduleWithFixedDelay(() -> this.objectiveDataStore.saveToDiskAllObjectives(), 5L, 5L, TimeUnit.MINUTES);
}
}
@Override
class="kw">protected void shutdown() {
if (this.objectiveDataStore != null) {
this.objectiveDataStore.saveToDiskAllObjectives();
}
}
class="kw">public ComponentType<EntityStore, ReachLocationMarker> getReachLocationMarkerComponentType() {
class="kw">return this.reachLocationMarkerComponentType;
}
class="kw">public ComponentType<EntityStore, ObjectiveLocationMarker> getObjectiveLocationMarkerComponentType() {
class="kw">return this.objectiveLocationMarkerComponentType;
}
class="kw">public ComponentType<ChunkStore, TreasureChestBlock> getTreasureChestComponentType() {
class="kw">return this.treasureChestComponentType;
}
class="kw">public <T class="kw">extends ObjectiveTaskAsset, U class="kw">extends ObjectiveTask> void registerTask(
String var1, Class<T> var2, Codec<T> var3, Class<U> var4, Codec<U> var5, TriFunction<T, Integer, Integer, U> var6
) {
if (this.objectiveDataStore != null) {
ObjectiveTaskAsset.CODEC.register(var1, var2, var3);
ObjectiveTask.CODEC.register(var1, var4, var5);
this.taskGenerators.put(var2, var6);
this.objectiveDataStore.registerTaskRef(var4);
}
}
class="kw">public <T class="kw">extends ObjectiveCompletionAsset, U class="kw">extends ObjectiveCompletion> void registerCompletion(
String var1, Class<T> var2, Codec<T> var3, Function<T, U> var4
) {
ObjectiveCompletionAsset.CODEC.register(var1, var2, var3);
this.completionGenerators.put(var2, var4);
}
class="kw">public ObjectiveTask createTask(@Nonnull ObjectiveTaskAsset var1, int var2, int var3) {
class="kw">return this.taskGenerators.get(var1.getClass()).apply(var1, var2, var3);
}
class="kw">public ObjectiveCompletion createCompletion(@Nonnull ObjectiveCompletionAsset var1) {
class="kw">return this.completionGenerators.get(var1.getClass()).apply(var1);
}
@Nullable
class="kw">public Objective startObjective(@Nonnull String var1, @Nonnull Set<UUID> var2, @Nonnull UUID var3, @Nullable UUID var4, @Nonnull Store<EntityStore> var5) {
class="kw">return this.startObjective(var1, null, var2, var3, var4, var5);
}
@Nullable
class="kw">public Objective startObjective(
@Nonnull String var1, @Nullable UUID var2, @Nonnull Set<UUID> var3, @Nonnull UUID var4, @Nullable UUID var5, @Nonnull Store<EntityStore> var6
) {
if (this.objectiveDataStore == null) {
class="kw">return null;
}
ObjectiveAsset var7 = ObjectiveAsset.getAssetMap().getAsset(var1);
if (var7 == null) {
this.getLogger().at(Level.WARNING).log("Failed to find objective asset '%s'", var1);
class="kw">return null;
}
if (var5 == null && !var7.isValidForPlayer()) {
this.getLogger().at(Level.WARNING).log("Objective %s can't be used for Player", var7.getId());
class="kw">return null;
}
Objective var8 = new Objective(var7, var2, var3, var4, var5);
boolean var9 = var8.setup(var6);
Message var10 = Message.translation(var7.getTitleKey());
if (!var9 || !this.objectiveDataStore.addObjective(var8.getObjectiveUUID(), var8)) {
this.getLogger().at(Level.WARNING).log("Failed to start objective %s", var7.getId());
if (var8.getPlayerUUIDs() == null) {
class="kw">return null;
}
var8.forEachParticipant(var2x -> {
PlayerRef var3 = var6.getComponent(var2x, PlayerRef.getComponentType());
if (var3 != null) {
var3.sendMessage(Message.translation("server.modules.objective.start.failed").param("title", var10));
}
});
class="kw">return null;
} else {
if (var8.getPlayerUUIDs() == null) {
class="kw">return var8;
}
TrackOrUpdateObjective var11 = new TrackOrUpdateObjective(var8.toPacket());
String var12 = var7.getId();
var8.forEachParticipant(var6x -> {
Player var7 = var6.getComponent(var6x, Player.getComponentType());
if (var7 != null) {
PlayerRef var8 = var6.getComponent(var6x, PlayerRef.getComponentType());
assert var8 != null;
if (!this.canPlayerDoObjective(var7, var12)) {
var8.sendMessage(Message.translation("server.modules.objective.playerAlreadyDoingObjective").param("title", var10));
} else {
UUIDComponent var9 = var6.getComponent(var6x, UUIDComponent.getComponentType());
assert var9 != null;
var8.addActivePlayerUUID(var9.getUuid());
PlayerConfigData var10 = var7.getPlayerConfigData();
HashSet var11 = new HashSet<>(var10.getActiveObjectiveUUIDs());
var11.add(var8.getObjectiveUUID());
var10.setActiveObjectiveUUIDs(var11);
var8.sendMessage(Message.translation("server.modules.objective.start.success").param("title", var10));
var8.getPacketHandler().writeNoCache(var11);
}
}
});
var8.markDirty();
class="kw">return var8;
}
}
class="kw">public boolean canPlayerDoObjective(@Nonnull Player var1, @Nonnull String var2) {
if (this.objectiveDataStore == null) {
class="kw">return false;
}
Set var3 = var1.getPlayerConfigData().getActiveObjectiveUUIDs();
if (var3 == null) {
class="kw">return true;
}
for (UUID var5 : var3) {
Objective var6 = this.objectiveDataStore.getObjective(var5);
if (var6 != null && var6.getObjectiveId().equals(var2)) {
class="kw">return false;
}
}
class="kw">return true;
}
@Nullable
class="kw">public Objective startObjectiveLine(@Nonnull Store<EntityStore> var1, @Nonnull String var2, @Nonnull Set<UUID> var3, @Nonnull UUID var4, @Nullable UUID var5) {
ObjectiveLineAsset var6 = ObjectiveLineAsset.getAssetMap().getAsset(var2);
if (var6 == null) {
class="kw">return null;
}
String[] var7 = var6.getObjectiveIds();
if (var7 != null && var7.length != 0) {
Universe var8 = Universe.get();
HashSet var9 = new HashSet<>();
for (UUID var11 : var3) {
PlayerRef var12 = var8.getPlayer(var11);
if (var12 != null) {
Ref var13 = var12.getReference();
if (var13 != null && var13.isValid()) {
Player var14 = var1.getComponent(var13, Player.getComponentType());
assert var14 != null;
if (this.canPlayerDoObjectiveLine(var14, var2)) {
var9.add(var11);
} else {
Message var15 = Message.translation(var2);
var12.sendMessage(Message.translation("server.modules.objective.playerAlreadyDoingObjectiveLine").param("id", var15));
}
}
}
}
Objective var16 = this.startObjective(var6.getObjectiveIds()[0], var9, var4, var5, var1);
if (var16 == null) {
class="kw">return null;
}
var16.setObjectiveLineHistoryData(new ObjectiveLineHistoryData(var2, var6.getCategory(), var6.getNextObjectiveLineIds()));
var16.checkTaskSetCompletion(var1);
class="kw">return var16;
} else {
class="kw">return null;
}
}
class="kw">public boolean canPlayerDoObjectiveLine(@Nonnull Player var1, @Nonnull String var2) {
if (this.objectiveDataStore == null) {
class="kw">return false;
}
Set var3 = var1.getPlayerConfigData().getActiveObjectiveUUIDs();
if (var3 == null) {
class="kw">return true;
}
for (UUID var5 : var3) {
Objective var6 = this.objectiveDataStore.getObjective(var5);
if (var6 != null) {
ObjectiveLineHistoryData var7 = var6.getObjectiveLineHistoryData();
if (var7 != null && var2.equals(var7.getId())) {
class="kw">return false;
}
}
}
class="kw">return true;
}
class="kw">public void objectiveCompleted(@Nonnull Objective var1, @Nonnull Store<EntityStore> var2) {
if (this.objectiveDataStore != null) {
for (UUID var4 : var1.getPlayerUUIDs()) {
this.untrackObjectiveForPlayer(var1, var4);
}
UUID var12 = var1.getObjectiveUUID();
this.objectiveDataStore.removeObjective(var12);
if (this.objectiveDataStore.removeFromDisk(var12.toString())) {
ObjectiveLineAsset var13 = var1.getObjectiveLineAsset();
if (var13 == null) {
this.storeObjectiveHistoryData(var1);
} else {
ObjectiveLineHistoryData var5 = var1.getObjectiveLineHistoryData();
assert var5 != null;
var5.addObjectiveHistoryData(var1.getObjectiveHistoryData());
String var6 = var13.getNextObjectiveId(var1.getObjectiveId());
if (var6 != null) {
Objective var14 = this.startObjective(var6, var12, var1.getPlayerUUIDs(), var1.getWorldUUID(), var1.getMarkerUUID(), var2);
if (var14 != null) {
var14.setObjectiveLineHistoryData(var5);
var14.checkTaskSetCompletion(var2);
}
} else {
this.storeObjectiveLineHistoryData(var5, var1.getPlayerUUIDs());
String[] var7 = var5.getNextObjectiveLineIds();
if (var7 != null) {
for (String var11 : var7) {
this.startObjectiveLine(var2, var11, var1.getPlayerUUIDs(), var1.getWorldUUID(), var1.getMarkerUUID());
}
}
}
}
}
}
}
class="kw">public void storeObjectiveHistoryData(@Nonnull Objective var1) {
String var2 = var1.getObjectiveId();
Universe var3 = Universe.get();
for (UUID var5 : var1.getPlayerUUIDs()) {
PlayerRef var6 = var3.getPlayer(var5);
if (var6 != null && var6.isValid()) {
Ref var7 = var6.getReference();
if (var7 != null && var7.isValid()) {
Store var8 = var7.getStore();
World var9 = var8.getExternalData().getWorld();
var9.execute(() -> {
ObjectiveHistoryComponent var6 = var8.getComponent(var7, this.objectiveHistoryComponentType);
assert var6 != null;
Map var7 = var6.getObjectiveHistoryMap();
ObjectiveHistoryData var8 = var7.get(var2);
if (var8 != null) {
var8.completed(var5, var1.getObjectiveHistoryData());
} else {
var7.put(var2, var1.getObjectiveHistoryData().cloneForPlayer(var5));
}
});
}
}
}
}
class="kw">public void storeObjectiveLineHistoryData(@Nonnull ObjectiveLineHistoryData var1, @Nonnull Set<UUID> var2) {
Map var3 = var1.cloneForPlayers(var2);
String var4 = var1.getId();
Universe var5 = Universe.get();
for (Entry var7 : var3.entrySet()) {
UUID var8 = var7.getKey();
PlayerRef var9 = var5.getPlayer(var8);
if (var9 != null && var9.isValid()) {
Ref var10 = var9.getReference();
if (var10 != null && var10.isValid()) {
Store var11 = var10.getStore();
World var12 = var11.getExternalData().getWorld();
var12.execute(() -> {
ObjectiveHistoryComponent var6 = var11.getComponent(var10, this.objectiveHistoryComponentType);
assert var6 != null;
Map var7 = var6.getObjectiveLineHistoryMap();
ObjectiveLineHistoryData var8 = var7.get(var4);
if (var8 != null) {
var8.completed(var8, var7.getValue());
} else {
var7.put(var4, var7.getValue());
}
});
}
}
}
}
class="kw">public void cancelObjective(@Nonnull UUID var1, @Nonnull Store<EntityStore> var2) {
if (this.objectiveDataStore != null) {
Objective var3 = this.objectiveDataStore.loadObjective(var1, var2);
if (var3 != null) {
var3.cancel();
for (UUID var5 : var3.getPlayerUUIDs()) {
this.untrackObjectiveForPlayer(var3, var5);
}
this.objectiveDataStore.removeObjective(var1);
this.objectiveDataStore.removeFromDisk(var1.toString());
}
}
}
class="kw">public void untrackObjectiveForPlayer(@Nonnull Objective var1, @Nonnull UUID var2) {
if (this.objectiveDataStore != null) {
UUID var3 = var1.getObjectiveUUID();
ObjectiveTask[] var4 = var1.getCurrentTasks();
for (ObjectiveTask var8 : var4) {
if (var8 class="kw">instanceof UseEntityObjectiveTask var9) {
this.objectiveDataStore.removeEntityTaskForPlayer(var3, var9.getAsset().getTaskId(), var2);
}
}
PlayerRef var10 = Universe.get().getPlayer(var2);
if (var10 != null) {
Player var11 = var10.getComponent(Player.getComponentType());
HashSet var12 = new HashSet<>(var11.getPlayerConfigData().getActiveObjectiveUUIDs());
var12.remove(var3);
var11.getPlayerConfigData().setActiveObjectiveUUIDs(var12);
var10.getPacketHandler().writeNoCache(new UntrackObjective(var3));
}
}
}
class="kw">public void addPlayerToExistingObjective(@Nonnull Store<EntityStore> var1, @Nonnull UUID var2, @Nonnull UUID var3) {
if (this.objectiveDataStore != null) {
Objective var4 = this.objectiveDataStore.loadObjective(var3, var1);
if (var4 != null) {
var4.addActivePlayerUUID(var2);
ObjectiveDataStore var5 = get().getObjectiveDataStore();
ObjectiveTask[] var6 = var4.getCurrentTasks();
for (ObjectiveTask var10 : var6) {
if (var10 class="kw">instanceof UseEntityObjectiveTask) {
var5.addEntityTaskForPlayer(var2, ((UseEntityObjectiveTask)var10).getAsset().getTaskId(), var3);
}
}
PlayerRef var11 = Universe.get().getPlayer(var2);
if (var11 != null && var11.isValid()) {
Ref var12 = var11.getReference();
if (var12 != null && var12.isValid()) {
Player var13 = var1.getComponent(var12, Player.getComponentType());
assert var13 != null;
HashSet var14 = new HashSet<>(var13.getPlayerConfigData().getActiveObjectiveUUIDs());
var14.add(var3);
var13.getPlayerConfigData().setActiveObjectiveUUIDs(var14);
var11.getPacketHandler().writeNoCache(new TrackOrUpdateObjective(var4.toPacket()));
}
}
}
}
}
class="kw">public void removePlayerFromExistingObjective(@Nonnull Store<EntityStore> var1, @Nonnull UUID var2, @Nonnull UUID var3) {
if (this.objectiveDataStore != null) {
Objective var4 = this.objectiveDataStore.loadObjective(var3, var1);
if (var4 != null) {
var4.removeActivePlayerUUID(var2);
if (var4.getActivePlayerUUIDs().isEmpty()) {
this.objectiveDataStore.saveToDisk(var3.toString(), var4);
this.objectiveDataStore.unloadObjective(var3);
}
this.untrackObjectiveForPlayer(var4, var2);
}
}
}
class="kw">private void onPlayerDisconnect(@Nonnull PlayerDisconnectEvent var1) {
if (this.objectiveDataStore != null) {
PlayerRef var2 = var1.getPlayerRef();
Ref var3 = var2.getReference();
if (var3 != null) {
Store var4 = var3.getStore();
World var5 = var4.getExternalData().getWorld();
var5.execute(() -> {
if (var3.isValid()) {
UUID var4 = var2.getUuid();
this.getLogger().at(Level.INFO).log("Checking objectives for disconnecting player '%s' (%s)", var2.getUsername(), var4);
Player var5 = var4.getComponent(var3, Player.getComponentType());
if (var5 != null) {
Set var6 = var5.getPlayerConfigData().getActiveObjectiveUUIDs();
if (var6 == null) {
this.getLogger().at(Level.INFO).log("No active objectives found for player '%s' (%s)", var2.getUsername(), var4);
} else {
this.getLogger().at(Level.INFO).log("Processing %d active objectives for '%s' (%s)", var6.size(), var2.getUsername(), var4);
for (UUID var8 : var6) {
Objective var9 = this.objectiveDataStore.getObjective(var8);
if (var9 != null) {
var9.removeActivePlayerUUID(var4);
if (var9.getActivePlayerUUIDs().isEmpty()) {
this.objectiveDataStore.saveToDisk(var8.toString(), var9);
this.objectiveDataStore.unloadObjective(var8);
}
}
}
}
}
}
});
}
}
}
class="kw">private void onObjectiveLineAssetLoaded(@Nonnull LoadedAssetsEvent<String, ObjectiveLineAsset, DefaultAssetMap<String, ObjectiveLineAsset>> var1) {
if (this.objectiveDataStore != null) {
for (Entry var3 : var1.getLoadedAssets().entrySet()) {
String var4 = var3.getKey();
String[] var5 = var3.getValue().getObjectiveIds();
for (Objective var7 : this.objectiveDataStore.getObjectiveCollection()) {
ObjectiveLineHistoryData var8 = var7.getObjectiveLineHistoryData();
if (var8 != null && var4.equals(var8.getId()) && !ArrayUtil.contains(var5, var7.getObjectiveId())) {
World var9 = Universe.get().getWorld(var7.worldUUID);
if (var9 != null) {
var9.execute(() -> {
Store var3 = var9.getEntityStore().getStore();
this.cancelObjective(var7.getObjectiveUUID(), var3);
});
}
break;
}
}
}
}
}
class="kw">private void onObjectiveAssetLoaded(@Nonnull LoadedAssetsEvent<String, ObjectiveAsset, DefaultAssetMap<String, ObjectiveAsset>> var1) {
if (this.objectiveDataStore != null) {
for (Objective var3 : this.objectiveDataStore.getObjectiveCollection()) {
var3.reloadObjectiveAsset(var1.getLoadedAssets());
}
}
}
class="kw">private class="kw">static void onObjectiveLocationMarkerChange(
@Nonnull LoadedAssetsEvent<String, ObjectiveLocationMarkerAsset, DefaultAssetMap<String, ObjectiveLocationMarkerAsset>> var0
) {
Map var1 = var0.getLoadedAssets();
AndQuery var2 = Query.and(ObjectiveLocationMarker.getComponentType(), ModelComponent.getComponentType(), TransformComponent.getComponentType());
Universe.get()
.getWorlds()
.forEach(
(var2x, var3) -> var3.execute(
() -> {
World var3 = var3.getEntityStore().getStore();
var3.forEachChunk(
var2,
(var2xx, var3x) -> {
for (int var4 = 0; var4 < var2xx.size(); var4++) {
ObjectiveLocationMarker var5 = var2xx.getComponent(var4, ObjectiveLocationMarker.getComponentType());
assert var5 != null;
ObjectiveLocationMarkerAsset var6 = var1.get(var5.getObjectiveLocationMarkerId());
if (var6 != null) {
TransformComponent var7 = var2xx.getComponent(var4, TransformComponent.getComponentType());
assert var7 != null;
Rotation3f var8 = var7.getRotation();
var5.updateLocationMarkerValues(var6, var8.yaw(), var3);
ModelComponent var9 = var2xx.getComponent(var4, ModelComponent.getComponentType());
assert var9 != null;
Model var10 = var9.getModel();
PersistentModel var11 = var2xx.getComponent(var4, PersistentModel.getComponentType());
assert var11 != null;
Model var12 = new Model(
var10.getModelAssetId(),
var10.getScale(),
var10.getRandomAttachmentIds(),
var10.getAttachments(),
var5.getArea().getBoxForEntryArea(),
var10.getModel(),
var10.getTexture(),
var10.getGradientSet(),
var10.getGradientId(),
var10.getEyeHeight(),
var10.getCrouchOffset(),
var10.getSittingOffset(),
var10.getSleepingOffset(),
var10.getAnimationSetMap(),
var10.getCamera(),
var10.getLight(),
var10.getParticles(),
var10.getTrails(),
var10.getPhysicsValues(),
var10.getDetailBoxes(),
var10.getPhobia(),
var10.getPhobiaModelAssetId()
);
var11.setModelReference(var12.toReference());
var3x.putComponent(var2xx.getReferenceTo(var4), ModelComponent.getComponentType(), new ModelComponent(var12));
}
}
}
);
}
)
);
}
class="kw">private void onModelAssetChange(@Nonnull LoadedAssetsEvent<String, ModelAsset, DefaultAssetMap<String, ModelAsset>> var1) {
Map var2 = var1.getLoadedAssets();
ModelAsset var3 = var2.get("Objective_Location_Marker");
if (var3 != null) {
this.objectiveLocationMarkerModel = Model.createUnitScaleModel(var3);
}
}
class="kw">private void onWorldAdded(@Nonnull AddWorldEvent var1) {
var1.getWorld().getWorldMapManager().addMarkerProvider("objectives", ObjectiveMarkerProvider.INSTANCE);
}
@Nonnull
class="kw">public String getObjectiveDataDump() {
StringBuilder var1 = new StringBuilder("Objective Data\n");
if (this.objectiveDataStore != null) {
for (Objective var3 : this.objectiveDataStore.getObjectiveCollection()) {
var1.append("Objective ID: ")
.append(var3.getObjectiveId())
.append("\n\t")
.append("UUID: ")
.append(var3.getObjectiveUUID())
.append("\n\t")
.append("Players: ")
.append(Arrays.toString(var3.getPlayerUUIDs().toArray()))
.append("\n\t")
.append("Active players: ")
.append(Arrays.toString(var3.getActivePlayerUUIDs().toArray()))
.append("\n\n");
}
} else {
var1.append("Objective data store is not initialized.\n");
}
class="kw">return var1.toString();
}
class="kw">public class="kw">static class ObjectivePluginConfig {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<ObjectivePlugin.ObjectivePluginConfig> CODEC = BuilderCodec.builder(
ObjectivePlugin.ObjectivePluginConfig.class, ObjectivePlugin.ObjectivePluginConfig::new
)
.append(new KeyedCodec<>("DataStore", DataStoreProvider.CODEC), (var0, var1) -> var0.dataStoreProvider = var1, var0 -> var0.dataStoreProvider)
.add()
.build();
class="kw">private DataStoreProvider dataStoreProvider = new DiskDataStoreProvider("objectives");
class="kw">public ObjectivePluginConfig() {
}
class="kw">public DataStoreProvider getDataStoreProvider() {
class="kw">return this.dataStoreProvider;
}
}
}