ParkourPlugin class
Пакет: com.hypixel.hytale.builtin.parkour
Файл: com/hypixel/hytale/builtin/parkour/ParkourPlugin.java
extends: JavaPlugin
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
static |
ParkourPlugin |
instance |
|
|
instance |
|
EntityModule |
var1 |
|
ModelAsset |
var1 |
|
ResourceType |
var2 |
Методы (13)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
static |
ParkourPlugin |
getParkourPlugin get() |
public |
Int2ObjectMap<UUID> |
getCheckpointUUIDMapInt2ObjectMap<UUID> getCheckpointUUIDMap() |
public |
Object2IntMap<UUID> |
getCurrentCheckpointByPlayerMapObject2IntMap<UUID> getCurrentCheckpointByPlayerMap() |
public |
int |
getLastIndexint getLastIndex() |
public |
ComponentType<EntityStore, ParkourCheckpoint> |
getParkourCheckpointComponentTypeComponentType<EntityStore, ParkourCheckpoint> getParkourCheckpointComponentType() |
public |
Model |
getParkourCheckpointModelModel getParkourCheckpointModel() |
public |
Object2LongMap<UUID> |
getStartTimeByPlayerMapObject2LongMap<UUID> getStartTimeByPlayerMap() |
|
|
if if(var1 == null) |
|
|
if if(var1 > this.lastIndex) |
public |
void |
resetPlayervoid resetPlayer(UUID var1) |
abstract |
|
super super(var1) |
public |
void |
updateLastIndexvoid updateLastIndex(int var1) |
public |
void |
updateLastIndexvoid updateLastIndex() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.parkour;
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.spatial.SpatialResource;
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.modules.entity.EntityModule;
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.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
class="kw">import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2LongMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
class="kw">import java.util.Collections;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">public class ParkourPlugin class="kw">extends JavaPlugin {
class="kw">protected class="kw">static ParkourPlugin instance;
class="kw">public class="kw">static class="kw">final String PARKOUR_CHECKPOINT_MODEL_ID = "Objective_Location_Marker";
class="kw">private class="kw">final Object2IntMap<UUID> currentCheckpointByPlayerMap = new Object2IntOpenHashMap();
class="kw">private class="kw">final Object2LongMap<UUID> startTimeByPlayerMap = new Object2LongOpenHashMap();
class="kw">private class="kw">final Int2ObjectMap<UUID> checkpointUUIDMap = new Int2ObjectOpenHashMap();
class="kw">private ComponentType<EntityStore, ParkourCheckpoint> parkourCheckpointComponentType;
class="kw">private Model parkourCheckpointModel;
class="kw">private int lastIndex;
class="kw">public class="kw">static ParkourPlugin get() {
class="kw">return instance;
}
class="kw">public ParkourPlugin(@Nonnull JavaPluginInit var1) {
super(var1);
}
class="kw">public ComponentType<EntityStore, ParkourCheckpoint> getParkourCheckpointComponentType() {
class="kw">return this.parkourCheckpointComponentType;
}
class="kw">public Model getParkourCheckpointModel() {
class="kw">return this.parkourCheckpointModel;
}
class="kw">public Object2IntMap<UUID> getCurrentCheckpointByPlayerMap() {
class="kw">return this.currentCheckpointByPlayerMap;
}
class="kw">public Object2LongMap<UUID> getStartTimeByPlayerMap() {
class="kw">return this.startTimeByPlayerMap;
}
class="kw">public Int2ObjectMap<UUID> getCheckpointUUIDMap() {
class="kw">return this.checkpointUUIDMap;
}
class="kw">public int getLastIndex() {
class="kw">return this.lastIndex;
}
@Override
class="kw">protected void setup() {
instance = this;
this.parkourCheckpointComponentType = this.getEntityStoreRegistry()
.registerComponent(ParkourCheckpoint.class, "ParkourCheckpoint", ParkourCheckpoint.CODEC);
EntityModule var1 = EntityModule.get();
ResourceType var2 = var1.getPlayerSpatialResourceType();
this.getEntityStoreRegistry().registerSystem(new ParkourCheckpointSystems.EnsureNetworkSendable());
this.getEntityStoreRegistry().registerSystem(new ParkourCheckpointSystems.Init(this.parkourCheckpointComponentType));
this.getEntityStoreRegistry()
.registerSystem(new ParkourCheckpointSystems.Ticking(this.parkourCheckpointComponentType, PlayerRef.getComponentType(), var2));
this.getCommandRegistry().registerCommand(new ParkourCommand());
}
@Override
class="kw">protected void start() {
ModelAsset var1 = ModelAsset.getAssetMap().getAsset("Objective_Location_Marker");
if (var1 == null) {
throw new IllegalStateException(String.format("Default parkour checkpoint model '%s' not found", "Objective_Location_Marker"));
}
this.parkourCheckpointModel = Model.createUnitScaleModel(var1);
}
class="kw">public void updateLastIndex(int var1) {
if (var1 > this.lastIndex) {
this.lastIndex = var1;
}
}
class="kw">public void updateLastIndex() {
this.lastIndex = Collections.<Integer>max(this.checkpointUUIDMap.keySet());
}
class="kw">public void resetPlayer(UUID var1) {
this.currentCheckpointByPlayerMap.replace(var1, -1);
}
}