Target enum
Пакет: com.hypixel.hytale.server.core.modules.interaction.interaction.config.server
Файл: com/hypixel/hytale/server/core/modules/interaction/interaction/config/server/ShowEventTitleInteraction.java
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
|
Universe, |
World |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.interaction.interaction.config.server;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.EnumCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.entity.InteractionContext;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.CooldownHandler;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.SimpleInstantInteraction;
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 com.hypixel.hytale.server.core.util.EventTitleUtil;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ShowEventTitleInteraction class="kw">extends SimpleInstantInteraction {
@Nonnull
class="kw">private class="kw">static class="kw">final EnumCodec<ShowEventTitleInteraction.Target> TARGET_CODEC = new EnumCodec<>(ShowEventTitleInteraction.Target.class)
.documentKey(ShowEventTitleInteraction.Target.Universe, "Show the title to every player of every live world.")
.documentKey(ShowEventTitleInteraction.Target.World, "Show the title to every player of the world the interaction runs in.");
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<ShowEventTitleInteraction> CODEC = BuilderCodec.builder(
ShowEventTitleInteraction.class, ShowEventTitleInteraction::new, SimpleInstantInteraction.CODEC
)
.documentation("Shows an event title to the players of one world or of the whole universe.")
.<ShowEventTitleInteraction.Target>appendInherited(
new KeyedCodec<>("Target", TARGET_CODEC), (var0, var1) -> var0.target = var1, var0 -> var0.target, (var0, var1) -> var0.target = var1.target
)
.documentation("The set of players that see the title.")
.addValidator(Validators.nonNull())
.add()
.<Message>appendInherited(
new KeyedCodec<>("PrimaryTitle", Message.CODEC),
(var0, var1) -> var0.primaryTitle = var1,
var0 -> var0.primaryTitle,
(var0, var1) -> var0.primaryTitle = var1.primaryTitle
)
.documentation("The main line of the title.")
.addValidator(Validators.nonNull())
.add()
.<Message>appendInherited(
new KeyedCodec<>("SecondaryTitle", Message.CODEC),
(var0, var1) -> var0.secondaryTitle = var1 != null ? var1 : Message.empty(),
var0 -> var0.secondaryTitle,
(var0, var1) -> var0.secondaryTitle = var1.secondaryTitle
)
.documentation("The line below the primary title. Leave it out for a title of one line.")
.add()
.<Boolean>appendInherited(
new KeyedCodec<>("IsMajor", Codec.BOOLEAN), (var0, var1) -> var0.isMajor = var1, var0 -> var0.isMajor, (var0, var1) -> var0.isMajor = var1.isMajor
)
.documentation("Whether the client presents this as a major event rather than a minor one.")
.add()
.<String>appendInherited(
new KeyedCodec<>("Icon", Codec.STRING), (var0, var1) -> var0.icon = var1, var0 -> var0.icon, (var0, var1) -> var0.icon = var1.icon
)
.documentation("The icon to show beside the title. Leave it empty for a title with no icon.")
.add()
.<Float>appendInherited(
new KeyedCodec<>("DurationS", Codec.FLOAT),
(var0, var1) -> var0.durationS = var1,
var0 -> var0.durationS,
(var0, var1) -> var0.durationS = var1.durationS
)
.documentation("The time in seconds the title stays on screen, after the fade in.")
.addValidator(Validators.greaterThanOrEqual(0.0F))
.add()
.<Float>appendInherited(
new KeyedCodec<>("FadeInDurationS", Codec.FLOAT),
(var0, var1) -> var0.fadeInDurationS = var1,
var0 -> var0.fadeInDurationS,
(var0, var1) -> var0.fadeInDurationS = var1.fadeInDurationS
)
.documentation("The time in seconds the title takes to fade in.")
.addValidator(Validators.greaterThanOrEqual(0.0F))
.add()
.<Float>appendInherited(
new KeyedCodec<>("FadeOutDurationS", Codec.FLOAT),
(var0, var1) -> var0.fadeOutDurationS = var1,
var0 -> var0.fadeOutDurationS,
(var0, var1) -> var0.fadeOutDurationS = var1.fadeOutDurationS
)
.documentation("The time in seconds the title takes to fade out.")
.addValidator(Validators.greaterThanOrEqual(0.0F))
.add()
.build();
@Nonnull
class="kw">private ShowEventTitleInteraction.Target target = ShowEventTitleInteraction.Target.World;
class="kw">private Message primaryTitle;
@Nonnull
class="kw">private Message secondaryTitle = Message.empty();
class="kw">private boolean isMajor;
@Nullable
class="kw">private String icon;
class="kw">private float durationS = 4.0F;
class="kw">private float fadeInDurationS = 1.5F;
class="kw">private float fadeOutDurationS = 1.5F;
class="kw">public ShowEventTitleInteraction() {
}
@Override
class="kw">protected void firstRun(@Nonnull InteractionType var1, @Nonnull InteractionContext var2, @Nonnull CooldownHandler var3) {
class="kw">switch (this.target) {
case Universe:
EventTitleUtil.showEventTitleToUniverse(
this.primaryTitle, this.secondaryTitle, this.isMajor, this.icon, this.durationS, this.fadeInDurationS, this.fadeOutDurationS
);
break;
case World:
CommandBuffer var4 = var2.getCommandBuffer();
assert var4 != null;
World var5 = var4.getExternalData().getWorld();
EventTitleUtil.showEventTitleToWorld(
this.primaryTitle, this.secondaryTitle, this.isMajor, this.icon, this.durationS, this.fadeInDurationS, this.fadeOutDurationS, var5
);
}
}
@Override
class="kw">protected void simulateFirstRun(@Nonnull InteractionType var1, @Nonnull InteractionContext var2, @Nonnull CooldownHandler var3) {
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ShowEventTitleInteraction{scope="
+ this.target
+ ", primaryTitle="
+ this.primaryTitle
+ ", secondaryTitle="
+ this.secondaryTitle
+ ", isMajor="
+ this.isMajor
+ ", icon="
+ this.icon
+ ", durationS="
+ this.durationS
+ ", fadeInDurationS="
+ this.fadeInDurationS
+ ", fadeOutDurationS="
+ this.fadeOutDurationS
+ "} "
+ super.toString();
}
class="kw">public enum Target {
Universe,
World;
Target() {
}
}
}