BuilderActionFlockBeacon class

Пакет: com.hypixel.hytale.server.flock.corecomponents.builders

Файл: com/hypixel/hytale/server/flock/corecomponents/builders/BuilderActionFlockBeacon.java

extends: BuilderActionBase

Поля (1)

МодификаторыТипИмя
final StringHolder message

Методы (6)

МодификаторыВозвратСигнатура
abstract return new ActionFlockBeaconreturn new ActionFlockBeacon(this, var1)
public double getExpirationTimedouble getExpirationTime()
public String getMessageString getMessage(@Nonnull BuilderSupport var1)
public int getSendTargetSlotint getSendTargetSlot(@Nonnull BuilderSupport var1)
public boolean isSendToLeaderOnlyboolean isSendToLeaderOnly()
public boolean isSendToSelfboolean isSendToSelf()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.flock.corecomponents.builders;

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.server.flock.corecomponents.ActionFlockBeacon;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderDescriptorState;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.InstructionType;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.holder.StringHolder;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.DoubleOrValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.StringNotEmptyValidator;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.validators.StringNullOrNotEmptyValidator;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.builders.BuilderActionBase;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BuilderActionFlockBeacon class="kw">extends BuilderActionBase {
   class="kw">protected class="kw">final StringHolder message = new StringHolder();
   class="kw">protected String sendTargetSlot;
   class="kw">protected double expirationTime;
   class="kw">protected boolean sendToSelf;
   class="kw">protected boolean sendToLeaderOnly;

   class="kw">public BuilderActionFlockBeacon() {
   }

   @Nonnull
   class="kw">public ActionFlockBeacon build(@Nonnull BuilderSupport var1) {
      class="kw">return new ActionFlockBeacon(this, var1);
   }

   @Nonnull
   @Override
   class="kw">public String getShortDescription() {
      class="kw">return "Send beacon message to flock";
   }

   @Nonnull
   @Override
   class="kw">public String getLongDescription() {
      class="kw">return "Let the NPC send out a message to the flock members";
   }

   @Override
   class="kw">public void registerTags(@Nonnull Set<String> var1) {
      super.registerTags(var1);
      var1.add("message");
   }

   @Nonnull
   @Override
   class="kw">public BuilderDescriptorState getBuilderDescriptorState() {
      class="kw">return BuilderDescriptorState.Experimental;
   }

   @Nonnull
   class="kw">public BuilderActionFlockBeacon readConfig(@Nonnull JsonElement var1) {
      this.requireString(var1, "Message", this.message, StringNotEmptyValidator.get(), BuilderDescriptorState.Stable, "Message to send to targets", null);
      this.getString(
         var1,
         "SendTargetSlot",
         var1x -> this.sendTargetSlot = var1x,
         null,
         StringNullOrNotEmptyValidator.get(),
         BuilderDescriptorState.Stable,
         "The marked target slot to send. If omitted, sends own position",
         null
      );
      this.getDouble(
         var1,
         "ExpirationTime",
         var1x -> this.expirationTime = var1x,
         1.0,
         DoubleOrValidator.greaterEqual0OrMinus1(),
         BuilderDescriptorState.Stable,
         "The number of seconds that the message should last. -1 represents infinite time.",
         "The number of seconds that the message should last and be acknowledged by the receiving NPC. -1 represents infinite time."
      );
      this.getBoolean(var1, "SendToSelf", var1x -> this.sendToSelf = var1x, true, BuilderDescriptorState.Stable, "Send the message to self", null);
      this.getBoolean(
         var1,
         "SendToLeaderOnly",
         var1x -> this.sendToLeaderOnly = var1x,
         false,
         BuilderDescriptorState.Stable,
         "Only send the message to the leader of the flock",
         null
      );
      this.requireInstructionType(InstructionType.NPCOnlyInstructions);
      class="kw">return this;
   }

   class="kw">public String getMessage(@Nonnull BuilderSupport var1) {
      class="kw">return this.message.get(var1.getExecutionContext());
   }

   class="kw">public int getSendTargetSlot(@Nonnull BuilderSupport var1) {
      class="kw">return this.sendTargetSlot == null ? Integer.MIN_VALUE : var1.getTargetSlot(this.sendTargetSlot);
   }

   class="kw">public double getExpirationTime() {
      class="kw">return this.expirationTime;
   }

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

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