CheckpointRemoveCommand class

Пакет: com.hypixel.hytale.builtin.parkour.commands

Файл: com/hypixel/hytale/builtin/parkour/commands/CheckpointRemoveCommand.java

extends: AbstractWorldCommand

Поля (4)

МодификаторыТипИмя
int var4
Int2ObjectMap var5
UUID var6
Ref var7

Методы (2)

МодификаторыВозвратСигнатура
if if(var6 == null)
abstract super super("remove", "server.commands.checkpoint.remove.desc")

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.parkour.commands;

class="kw">import com.hypixel.hytale.builtin.parkour.ParkourPlugin;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.RemoveReason;
class="kw">import com.hypixel.hytale.component.Store;
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.basecommands.AbstractWorldCommand;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;

class="kw">public class CheckpointRemoveCommand class="kw">extends AbstractWorldCommand {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_CHECKPOINT_REMOVE_FAILED = Message.translation("server.commands.checkpoint.remove.failed");
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_CHECKPOINT_REMOVE_SUCCESS = Message.translation("server.commands.checkpoint.remove.success");
   @Nonnull
   class="kw">private class="kw">final RequiredArg<Integer> indexArg = this.withRequiredArg("index", "server.commands.checkpoint.remove.index.desc", ArgTypes.INTEGER);

   class="kw">public CheckpointRemoveCommand() {
      super("remove", "server.commands.checkpoint.remove.desc");
   }

   @Override
   class="kw">protected void execute(@Nonnull CommandContext var1, @Nonnull World var2, @Nonnull Store<EntityStore> var3) {
      int var4 = this.indexArg.get(var1);
      Int2ObjectMap var5 = ParkourPlugin.get().getCheckpointUUIDMap();
      UUID var6 = (UUID)var5.get(var4);
      if (var6 == null) {
         var1.sendMessage(MESSAGE_COMMANDS_CHECKPOINT_REMOVE_FAILED);
      } else {
         Ref var7 = var3.getExternalData().getRefFromUUID(var6);
         if (var7 != null && var7.isValid()) {
            var3.removeEntity(var7, RemoveReason.REMOVE);
            var5.remove(var4);
            ParkourPlugin.get().updateLastIndex();
            var1.sendMessage(MESSAGE_COMMANDS_CHECKPOINT_REMOVE_SUCCESS);
         } else {
            var1.sendMessage(MESSAGE_COMMANDS_CHECKPOINT_REMOVE_FAILED);
         }
      }
   }
}