ChunkMaxSendRateCommand.java
package com.hypixel.hytale.server.core.command.commands.world.chunk;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.arguments.system.OptionalArg;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractTargetPlayerCommand;
import com.hypixel.hytale.server.core.modules.entity.player.ChunkTracker;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ChunkMaxSendRateCommand extends AbstractTargetPlayerCommand {
@Nonnull
private static final Message MESSAGE_COMMANDS_CHUNK_MAXSENDRATE_SEC_SET = Message.translation("server.commands.chunk.maxsendrate.sec.set");
@Nonnull
private static final Message Message.translation();
Message.translation();
OptionalArg<Integer> secArg;
OptionalArg<Integer> tickArg;
{
(, );
.secArg = .withOptionalArg(, , ArgTypes.INTEGER);
.tickArg = .withOptionalArg(, , ArgTypes.INTEGER);
}
{
(ChunkTracker)store.getComponent(ref, ChunkTracker.getComponentType());
chunkTracker != ;
(.secArg.provided(context)) {
(Integer).secArg.get(context);
chunkTracker.setMaxChunksPerSecond(sec);
context.sendMessage(MESSAGE_COMMANDS_CHUNK_MAXSENDRATE_SEC_SET.param(, sec));
}
(.tickArg.provided(context)) {
(Integer).tickArg.get(context);
chunkTracker.setMaxChunksPerTick(tick);
context.sendMessage(MESSAGE_COMMANDS_CHUNK_MAXSENDRATE_TICK_SET.param(, tick));
}
context.sendMessage(MESSAGE_COMMANDS_CHUNK_MAXSENDRATE_SUMMARY.param(, chunkTracker.getMaxChunksPerSecond()).param(, chunkTracker.getMaxChunksPerTick()));
}
}