PIDCheckCommand class

Пакет: com.hypixel.hytale.server.core.command.commands.debug

Файл: com/hypixel/hytale/server/core/command/commands/debug/PIDCheckCommand.java

extends: CommandBase

Поля (4)

МодификаторыТипИмя
int var2
Message var3
int var4
Message var5

Методы (2)

МодификаторыВозвратСигнатура
if if(!Constants.SINGLEPLAYER)
abstract super super("pidcheck", "server.commands.pidcheck.desc")

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.commands.debug;

class="kw">import com.hypixel.hytale.server.core.Constants;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.Options;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.FlagArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.OptionalArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
class="kw">import com.hypixel.hytale.server.core.util.ProcessUtil;
class="kw">import javax.annotation.Nonnull;

class="kw">public class PIDCheckCommand class="kw">extends CommandBase {
   @Nonnull
   class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_PID_CHECK_SINGLEPLAYER_ONLY = Message.translation("server.commands.pidcheck.singlePlayerOnly");
   @Nonnull
   class="kw">private class="kw">final FlagArg singleplayerFlag = this.withFlagArg("singleplayer", "server.commands.pidcheck.singleplayer.desc");
   @Nonnull
   class="kw">private class="kw">final OptionalArg<Integer> pidArg = this.withOptionalArg("pid", "server.commands.pidcheck.pid.desc", ArgTypes.INTEGER);

   class="kw">public PIDCheckCommand() {
      super("pidcheck", "server.commands.pidcheck.desc");
   }

   @Override
   class="kw">protected void executeSync(@Nonnull CommandContext var1) {
      if (this.singleplayerFlag.get(var1)) {
         if (!Constants.SINGLEPLAYER) {
            var1.sendMessage(MESSAGE_COMMANDS_PID_CHECK_SINGLEPLAYER_ONLY);
         } else {
            int var4 = (Integer)Options.getOptionSet().valueOf(Options.CLIENT_PID);
            Message var5 = Message.translation(
               ProcessUtil.isProcessRunning(var4) ? "server.commands.pidcheck.isRunning" : "server.commands.pidcheck.isNotRunning"
            );
            var1.sendMessage(Message.translation("server.commands.pidcheck.clientPIDRunning").param("pid", var4).param("running", var5));
         }
      } else if (!this.pidArg.provided(var1)) {
         var1.sendMessage(Message.translation("server.commands.pidcheck.pidRequired"));
      } else {
         int var2 = this.pidArg.get(var1);
         Message var3 = Message.translation(ProcessUtil.isProcessRunning(var2) ? "server.commands.pidcheck.isRunning" : "server.commands.pidcheck.isNotRunning");
         var1.sendMessage(Message.translation("server.commands.pidcheck.PIDRunning").param("pid", var2).param("running", var3));
      }
   }
}