SoundPlay2DCommand class
Пакет: com.hypixel.hytale.server.core.command.commands.utility.sound
Файл: com/hypixel/hytale/server/core/command/commands/utility/sound/SoundPlay2DCommand.java
extends: AbstractTargetPlayerCommand
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
|
SoundEvent |
var7 |
|
SoundCategory |
var8 |
|
int |
var9 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("2d", "server.commands.sound.2d.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.commands.utility.sound;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.protocol.SoundCategory;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.DefaultArg;
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.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.AbstractTargetPlayerCommand;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.SoundUtil;
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 javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class SoundPlay2DCommand class="kw">extends AbstractTargetPlayerCommand {
@Nonnull
class="kw">private class="kw">final RequiredArg<SoundEvent> soundEventArg = this.withRequiredArg("sound", "server.commands.sound.play.sound.desc", ArgTypes.SOUND_EVENT_ASSET);
@Nonnull
class="kw">private class="kw">final DefaultArg<SoundCategory> categoryArg = this.withDefaultArg(
"category", "server.commands.sound.category.desc", ArgTypes.SOUND_CATEGORY, SoundCategory.SFX, "server.commands.sound.category.class="kw">default"
);
@Nonnull
class="kw">private class="kw">final FlagArg allFlag = this.withFlagArg("all", "server.commands.sound.all.desc");
class="kw">public SoundPlay2DCommand() {
super("2d", "server.commands.sound.2d.desc");
this.addAliases("play");
}
@Override
class="kw">protected void execute(
@Nonnull CommandContext var1,
@Nullable Ref<EntityStore> var2,
@Nonnull Ref<EntityStore> var3,
@Nonnull PlayerRef var4,
@Nonnull World var5,
@Nonnull Store<EntityStore> var6
) {
SoundEvent var7 = this.soundEventArg.get(var1);
SoundCategory var8 = this.categoryArg.get(var1);
int var9 = SoundEvent.getAssetMap().getIndex(var7.getId());
if (this.allFlag.provided(var1)) {
SoundUtil.playSoundEvent2d(var9, var8, var6);
} else {
SoundUtil.playSoundEvent2d(var3, var9, var8, var6);
}
}
}