ChunkMarkSaveCommand class
Пакет: com.hypixel.hytale.server.core.command.commands.world.chunk
Файл: com/hypixel/hytale/server/core/command/commands/world/chunk/ChunkMarkSaveCommand.java
extends: AbstractWorldCommand
Поля (7)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Ref |
var10 |
|
WorldChunk |
var11 |
|
RelativeChunkPosition |
var4 |
|
Vector2i |
var5 |
|
ChunkStore |
var6 |
|
Store |
var7 |
|
long |
var8 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("marksave", "server.commands.chunk.marksave.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.commands.world.chunk;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.util.ChunkUtil;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.RelativeChunkPosition;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.AbstractWorldCommand;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
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 javax.annotation.Nonnull;
class="kw">import org.joml.Vector2i;
class="kw">public class ChunkMarkSaveCommand class="kw">extends AbstractWorldCommand {
@Nonnull
class="kw">private class="kw">final RequiredArg<RelativeChunkPosition> chunkPosArg = this.withRequiredArg(
"x z", "server.commands.chunk.marksave.position.desc", ArgTypes.RELATIVE_CHUNK_POSITION
);
class="kw">public ChunkMarkSaveCommand() {
super("marksave", "server.commands.chunk.marksave.desc");
}
@Override
class="kw">protected void execute(@Nonnull CommandContext var1, @Nonnull World var2, @Nonnull Store<EntityStore> var3) {
RelativeChunkPosition var4 = this.chunkPosArg.get(var1);
Vector2i var5 = var4.getChunkPosition(var1, var3);
ChunkStore var6 = var2.getChunkStore();
Store var7 = var6.getStore();
long var8 = ChunkUtil.indexChunk(var5.x, var5.y);
Ref var10 = var6.getChunkReference(var8);
if (var10 != null && var10.isValid()) {
WorldChunk var11 = var7.getComponent(var10, WorldChunk.getComponentType());
assert var11 != null;
var11.markNeedsSaving();
var1.sendMessage(
Message.translation("server.commands.chunk.marksave.markingAlreadyLoaded").param("x", var5.x).param("z", var5.y).param("worldName", var2.getName())
);
} else {
var1.sendMessage(
Message.translation("server.commands.chunk.load.loading").param("chunkX", var5.x).param("chunkZ", var5.y).param("worldName", var2.getName())
);
var2.getChunkAsync(var5.x, var5.y)
.thenAccept(
var3x -> var2.execute(
() -> {
var3x.markNeedsSaving();
var1.sendMessage(
Message.translation("server.commands.chunk.marksave.loaded").param("x", var5.x).param("z", var5.y).param("worldName", var2.getName())
);
}
)
);
}
}
}