本文整理汇总了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);
}
}
}
示例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));
}
示例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));
}
示例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);
}
}
示例5: getCategory
import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public SoundCategory getCategory() {
return (SoundCategory)(Object)category;
}
示例6: setCategory
import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void setCategory(SoundCategory cat) {
category = (net.minecraft.util.SoundCategory)(Object)cat;
}
示例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));
}
示例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
}
示例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);
}
示例10: stopSounds
import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Override
public void stopSounds(SoundCategory category) {
stopSounds0(null, checkNotNull(category, "category"));
}
示例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));
}
示例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));
}
示例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);
}
示例14: MessagePlayOutStopSounds
import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
public MessagePlayOutStopSounds(@Nullable String sound, @Nullable SoundCategory category) {
this.soundCategory = category;
this.sound = sound;
}
示例15: getCategory
import org.spongepowered.api.effect.sound.SoundCategory; //导入依赖的package包/类
@Nullable
public SoundCategory getCategory() {
return this.soundCategory;
}