ClearBlocksCommand.java
package com.hypixel.hytale.builtin.buildertools.commands;
import com.hypixel.hytale.builtin.buildertools.BuilderToolsPlugin;
import com.hypixel.hytale.builtin.buildertools.PrototypePlayerBuilderToolSettings;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.math.vector.Vector3d;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.protocol.GameMode;
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.RequiredArg;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
import com.hypixel.hytale.server.core.command.system.arguments.types.RelativeIntPosition;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
import com.hypixel.hytale.server.core.prefab.selection.mask.BlockPattern;
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.ChunkStore;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;
public class ClearBlocksCommand {
Message.translation();
{
(, );
.setPermissionGroup(GameMode.Creative);
.addAliases( []{});
.addUsageVariant( () {
RequiredArg<RelativeIntPosition> positionOneArg;
RequiredArg<RelativeIntPosition> positionTwoArg;
{
.positionOneArg = .withRequiredArg(, , ArgTypes.RELATIVE_BLOCK_POSITION);
.positionTwoArg = .withRequiredArg(, , ArgTypes.RELATIVE_BLOCK_POSITION);
}
{
world.getChunkStore();
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
(TransformComponent)store.getComponent(ref, TransformComponent.getComponentType());
transformComponent != ;
(PrototypePlayerBuilderToolSettings.isOkayToDoCommandsOnSelection(ref, playerComponent, store)) {
transformComponent.getPosition();
(RelativeIntPosition).positionOneArg.get(context);
(RelativeIntPosition).positionTwoArg.get(context);
relativeIntPositionOne.getBlockPosition(position, chunkStore);
relativeIntPositionTwo.getBlockPosition(position, chunkStore);
Vector3i.min(posOne, posTwo);
Vector3i.max(posOne, posTwo);
BuilderToolsPlugin.addToQueue(playerComponent, playerRef, (r, s, componentAccessor) -> s.clear(min.x, min.y, min.z, max.x, max.y, max.z, componentAccessor));
}
}
});
}
{
(Player)store.getComponent(ref, Player.getComponentType());
playerComponent != ;
(PrototypePlayerBuilderToolSettings.isOkayToDoCommandsOnSelection(ref, playerComponent, store)) {
BuilderToolsPlugin. BuilderToolsPlugin.getState(playerComponent, playerRef);
(builderState.getSelection() == ) {
playerRef.sendMessage(MESSAGE_COMMANDS_CLEAR_NO_SELECTION);
} {
BuilderToolsPlugin.addToQueue(playerComponent, playerRef, (r, s, componentAccessor) -> s.set(BlockPattern.EMPTY, componentAccessor));
}
}
}
}