ParseResult class

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

Файл: com/hypixel/hytale/server/core/command/system/ParseResult.java

Поля (2)

МодификаторыТипИмя
private boolean failed
StringBuilder var3

Методы (12)

МодификаторыВозвратСигнатура
public void failvoid fail(@Nonnull Message var1, @Nullable Message... var2)
public void failvoid fail(@Nonnull Message var1)
public boolean failedboolean failed()
for for(Message var7 : var2)
for for(Message var3 : this.reasons)
if if(this.reasons == null)
if if(var2 != null)
if if(this.throwExceptionWhenFailed)
if if(var2 != null)
if if(this.reasons != null)
public void sendMessagesvoid sendMessages(@Nonnull CommandSender var1)
abstract this this(false)

Исходный код

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

class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.exceptions.GeneralCommandException;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectArrayList;
class="kw">import java.util.Collections;
class="kw">import java.util.List;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class ParseResult {
   class="kw">private boolean failed;
   @Nullable
   class="kw">private List<Message> reasons;
   class="kw">private class="kw">final boolean throwExceptionWhenFailed;

   class="kw">public ParseResult() {
      this(false);
   }

   class="kw">public ParseResult(boolean var1) {
      this.throwExceptionWhenFailed = var1;
   }

   class="kw">public void fail(@Nonnull Message var1, @Nullable Message... var2) {
      this.failed = true;
      if (this.reasons == null) {
         this.reasons = new ObjectArrayList();
      }

      this.reasons.add(var1);
      if (var2 != null) {
         Collections.addAll(this.reasons, var2);
      }

      if (this.throwExceptionWhenFailed) {
         StringBuilder var3 = new StringBuilder(var1.getAnsiMessage());
         if (var2 != null) {
            for (Message var7 : var2) {
               var3.append("\n").append(var7.getAnsiMessage());
            }
         }

         throw new GeneralCommandException(Message.raw(var3.toString()));
      }
   }

   class="kw">public void fail(@Nonnull Message var1) {
      this.fail(var1, (Message[])null);
   }

   class="kw">public boolean failed() {
      class="kw">return this.failed;
   }

   class="kw">public void sendMessages(@Nonnull CommandSender var1) {
      if (this.reasons != null) {
         for (Message var3 : this.reasons) {
            var1.sendMessage(var3);
         }
      }
   }
}