当前位置: 首页>>代码示例>>Java>>正文


Java SoundCategory类代码示例

本文整理汇总了Java中org.spongepowered.api.effect.sound.SoundCategory的典型用法代码示例。如果您正苦于以下问题:Java SoundCategory类的具体用法?Java SoundCategory怎么用?Java SoundCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SoundCategory类属于org.spongepowered.api.effect.sound包,在下文中一共展示了SoundCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onChat

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Listener
public void onChat(MessageChannelEvent.Chat event) {
    String message = event.getRawMessage().toPlain();
    for (Player p : Sponge.getServer().getOnlinePlayers()) {
        if (message.contains(p.getName())) {
            ModuleConfig config = Modules.POKE.get().getConfig().get();
            CommentedConfigurationNode node = config.get();
            String soundname = node.getNode("sound", "sound").getString();
            String categoryname = node.getNode("sound", "category").getString();
            Double volume = node.getNode("sound", "volume").getDouble();
            Double pitch = node.getNode("sound", "pitch").getDouble();
            Double minVolume = node.getNode("sound", "minVolume").getDouble();
            SoundType type = Sponge.getRegistry().getType(CatalogTypes.SOUND_TYPE, soundname.toUpperCase()).get();
            //TODO wait for CatalogTypes.SOUND_CATEGORY to be added
            SoundCategory category;
            try {
                category = Sponge.getRegistry().getType(CatalogTypes.SOUND_CATEGORY, categoryname.toUpperCase()).get();
            } catch (Error ex) {
                category = SoundCategories.PLAYER;
            }
            p.playSound(type, category, p.getLocation().getPosition(), volume, pitch, minVolume);
        }
    }
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:25,代码来源:PokeListener.java

示例2: playSound

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void playSound(SoundType sound, SoundCategory category, Vector3d position, double volume, double pitch, double minVolume) {
    checkNotNull(sound, "sound");
    checkNotNull(position, "position");
    checkNotNull(category, "category");
    this.broadcast(() -> ((LanternSoundType) sound).createMessage(position,
            category, (float) Math.max(minVolume, volume), (float) pitch));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternWorld.java

示例3: playSound

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void playSound(SoundType sound, SoundCategory category, Vector3d position, double volume, double pitch, double minVolume) {
    checkNotNull(sound, "sound");
    checkNotNull(position, "position");
    checkNotNull(category, "category");
    this.session.send(((LanternSoundType) sound).createMessage(position,
            category, (float) Math.max(minVolume, volume), (float) pitch));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternPlayer.java

示例4: createMessage

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
public MessagePlayOutSoundEffectBase createMessage(Vector3d position, SoundCategory soundCategory,
        float volume, float pitch) {
    checkNotNull(soundCategory, "soundCategory");
    checkNotNull(position, "position");
    if (this.eventId != -1) {
        return new MessagePlayOutSoundEffect(this.eventId, position, soundCategory, volume, pitch);
    } else {
        return new MessagePlayOutNamedSoundEffect(getName(), position, soundCategory, volume, pitch);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:LanternSoundType.java

示例5: getCategory

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public SoundCategory getCategory() {
    return (SoundCategory)(Object)category;
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:5,代码来源:MixinPacketCustomSound.java

示例6: setCategory

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void setCategory(SoundCategory cat) {
    category = (net.minecraft.util.SoundCategory)(Object)cat;
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:5,代码来源:MixinPacketCustomSound.java

示例7: playSound

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void playSound(Location location, Sound sound, org.bukkit.SoundCategory category, float volume, float pitch) {
    if (!Sponge.isServerAvailable()) return;
    Optional<Player> optionalP = Sponge.getServer().getPlayer(this.getUniqueId());
    optionalP.ifPresent(p -> p.playSound(SoundType.builder().build(sound.name()), new Vector3d(location.getX(), location.getY(), location.getZ()), volume, pitch));
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:7,代码来源:LinkedPlayer.java

示例8: stopSound

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void stopSound(Sound sound, org.bukkit.SoundCategory category) {
    if (!Sponge.isServerAvailable()) return;
    Optional<Player> optionalP = Sponge.getServer().getPlayer(this.getUniqueId());
    optionalP.ifPresent(p -> performCommand("stopsound "+this.getName()+" "+sound.name())); //TODO: Is there a better way to do this? On github there was an issue that was never answered
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:7,代码来源:LinkedPlayer.java

示例9: playSound

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void playSound(SoundType sound, SoundCategory category, Vector3d position, double volume) {
	this.player.playSound(sound, position, volume);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:5,代码来源:PlayerSponge.java

示例10: stopSounds

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void stopSounds(SoundCategory category) {
    stopSounds0(null, checkNotNull(category, "category"));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternWorld.java

示例11: stopSounds0

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
private void stopSounds0(@Nullable SoundType sound, @Nullable SoundCategory category) {
    broadcast(() -> new MessagePlayOutStopSounds(sound == null ? null : sound.getName(), category));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:LanternWorld.java

示例12: stopSounds0

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
private void stopSounds0(@Nullable SoundType sound, @Nullable SoundCategory category) {
    this.session.send(new MessagePlayOutStopSounds(sound == null ? null : sound.getName(), category));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:LanternPlayer.java

示例13: MessagePlayOutSoundEffect

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
public MessagePlayOutSoundEffect(int type, Vector3d position, SoundCategory category, float volume, float pitch) {
    super(type, position, category, volume, pitch);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:MessagePlayOutSoundEffect.java

示例14: MessagePlayOutStopSounds

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
public MessagePlayOutStopSounds(@Nullable String sound, @Nullable SoundCategory category) {
    this.soundCategory = category;
    this.sound = sound;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:MessagePlayOutStopSounds.java

示例15: getCategory

import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Nullable
public SoundCategory getCategory() {
    return this.soundCategory;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:MessagePlayOutStopSounds.java


注:本文中的org.spongepowered.api.effect.sound.SoundCategory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。