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


Java SoundTypes类代码示例

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


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

示例1: InstantView

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
public InstantView(HuskyCrates plugin, Player runner, VirtualCrate virtualCrate){
    this.plugin = plugin;
    ourplr = runner;
    vc = virtualCrate;
    items = vc.getItemSet();
    if(virtualCrate.scrambleRewards){
        scrambleRewards();
    }
    try {
        CrateReward rewardHolder = (CrateReward)vc.getItemSet().get(itemIndexSelected())[1];
        handleReward(rewardHolder);
        ourplr.playSound(SoundTypes.ENTITY_EXPERIENCE_ORB_PICKUP,ourplr.getLocation().getPosition(),1);
    } catch (RandomItemSelectionFailureException e) {
        plugin.logger.error("Failed to load instant view item: " + vc.displayName);
    }
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:17,代码来源:InstantView.java

示例2: registerPlayer

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
private void registerPlayer(Player player) {
    player.setSleepingIgnored(true); // Turn off vanilla sleeping to prevent a bug where the time advances (or doesn't, if /gamerule doDaylightCycle false, in which case it just kicks players out of bed without doing anything) but the plugin doesn't display the wakeup message.
    SVPlayerData svPlayerData = getSVPlayerData(player);

    svPlayerData.getSleepTask().ifPresent(Task::cancel);
    svPlayerData.setSleepTask(Task.builder().execute(() -> {
        if (isInBed(player) && !isIgnored(player)) {
            World world = player.getWorld();
            SVWorldData svWorldData = getSVWorldData(world);
            svWorldData.getSleepingPlayers().add(player.getUniqueId());

            Text text = messenger.parseMessage(enterBedMessage,
                    svWorldData.getSleepingPlayers().size(),
                    getRequiredPlayerCount(world),
                    player.getName(),
                    enablePrefix);
            messenger.sendWorldMessage(world, text);
            messenger.playWorldSound(world, SoundTypes.BLOCK_NOTE_HAT);

            if (messageLogging) {
                logger.info("[" + world.getName() + "] " + text.toPlain());
            }
        }
    }).async().delayTicks(80).submit(sleepVote));
}
 
开发者ID:Icohedron,项目名称:SleepVote,代码行数:26,代码来源:SleepVoteManager.java

示例3: run

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
@Override
public void run(Living owner, Living target, DamageEntityEvent event) {
  Optional<PotionEffectData> optPotionEffectData = target.getOrCreate(PotionEffectData.class);
  if (!optPotionEffectData.isPresent()) {
    return;
  }

  PotionEffectData potionEffectData = optPotionEffectData.get();

  int duration = (int) (EntityHealthUtil.getHealth(target) * 10);
  potionEffectData.addElement(PotionEffect.of(PotionEffectTypes.SLOWNESS, 9, duration));
  if (target instanceof Player) {
    potionEffectData.addElement(PotionEffect.of(PotionEffectTypes.BLINDNESS, 0, 20 * 4));
  }

  target.offer(potionEffectData);

  target.getWorld().playSound(SoundTypes.ENTITY_GHAST_SCREAM, target.getLocation().getPosition(), 1, .02F);

  notify(owner, Text.of(TextColors.YELLOW, "Your weapon traps your foe in their own sins."));
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:22,代码来源:EvilFocus.java

示例4: run

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
public void run() {
    countdownTime = 30;
    arena.broadcast(messages.getMessage("arena.joininggame", "count", String.valueOf(countdownTime), "label", "seconds"));
    countdownTask = Sponge.getScheduler().createTaskBuilder().execute(t -> {
        String label = "seconds";
        if (countdownTime == 1) {
            label = "second";
        }
        if (countdownTime == 10 || countdownTime == 20) {
            arena.broadcast(messages.getMessage("arena.joininggame", "count", String.valueOf(countdownTime), "label", label));
        }
        if (countdownTime <= 5 && countdownTime > 0) {
            arena.broadcastSound(SoundTypes.CLICK, 5, 1);
            arena.broadcast(messages.getMessage("arena.joininggame", "count", String.valueOf(countdownTime), "label", label));
        }
        if (countdownTime == 0) {
            arena.broadcastSound(SoundTypes.NOTE_PIANO, 5, 1);
            arena.arenaStateChange(ArenaStates.GAME_COUNTDOWN);
            cancelCountdown();
        }
        countdownTime--;
    }).interval(1, TimeUnit.SECONDS).submit(UltimateSpleef.access);
}
 
开发者ID:FlibioStudio,项目名称:Ultimate-Spleef,代码行数:24,代码来源:CountdownRunnable.java

示例5: onRightClick

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
@Listener
public void onRightClick(InteractBlockEvent event, @First Player player) {
    if (!cooldown.contains(player.getUniqueId())) {
        Optional<Location<World>> lOpt = event.getTargetBlock().getLocation();
        if (lOpt.isPresent()) {
            Location<World> targetLoc = lOpt.get();
            if (arena.getOnlinePlayers().contains(player.getUniqueId()) && arena.getBlocks().contains(targetLoc)) {
                if (arena.getCurrentState().equals(ArenaStates.GAME_PLAYING)) {
                    targetLoc.getExtent().setBlockType(targetLoc.getBlockPosition(), BlockTypes.AIR, true,
                            Cause.of(NamedCause.owner(UltimateSpleef.access.pluginContainer)));
                    player.playSound(SoundTypes.DIG_STONE, targetLoc.getPosition(), 3);
                    cooldown.add(player.getUniqueId());
                    Sponge.getScheduler().createTaskBuilder().execute(c -> {
                        cooldown.remove(player.getUniqueId());
                    }).async().delay(400, TimeUnit.MILLISECONDS).submit(UltimateSpleef.access);
                }
            }
        }
    }
}
 
开发者ID:FlibioStudio,项目名称:Ultimate-Spleef,代码行数:21,代码来源:GamePlayingRunnable.java

示例6: move

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
@Command(desc = "Moves a world into another universe")
public void move(CommandSource context, World world, String universe)
{
    // TODO old universe is not removed
    String previous = module.getUniverse(world);
    if (previous.equals(universe))
    {
        i18n.send(context, NEGATIVE, "{world} is already in the universe {name}", world, universe);
        return;
    }
    module.setUniverse(world, universe);
    i18n.send(context, POSITIVE, "{world} is now in the universe {input}!", world, universe);

    Sponge.getServer().getOnlinePlayers().stream().filter(player -> player.getWorld().equals(world)).forEach(
        p -> {
            MultiverseData data = p.get(MultiverseData.class).get();
            data.from(previous, world).applyFromPlayer(p);
            data.from(universe, world).applyToPlayer(p);
            i18n.send(p, NEUTRAL, "The sky opens up and sucks in the whole world.");
            p.playSound(SoundTypes.BLOCK_PORTAL_TRIGGER, p.getLocation().getPosition(), 1);
            p.offer(Keys.POTION_EFFECTS, Arrays.asList(PotionEffect.of(PotionEffectTypes.BLINDNESS, 1, 2 * 20)));
            i18n.send(p, NEUTRAL, "When you open your eyes you now are in {input#univserse}.", universe);
            p.offer(data);
        });
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:26,代码来源:MultiverseCommands.java

示例7: scheduleAutoClose

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
private void scheduleAutoClose(Player user)
{
    if (this.hasFlag(ProtectionFlag.AUTOCLOSE))
    {
        if (!this.manager.module.getConfig().autoCloseEnable) return;
        taskId = module.getTaskManager().runTaskDelayed(Locker.class, () -> {
            Sponge.getCauseStackManager().pushCause(user);
            int n = locations.size() / 2;
            for (Location location : locations)
            {
                if (n-- > 0)
                {
                    ((World)location.getExtent()).playSound(SoundTypes.BLOCK_WOODEN_DOOR_CLOSE, location.getPosition(), 1);
                }
                location.setBlock(location.getBlock().with(Keys.OPEN, false).get());
            }
        }, this.manager.module.getConfig().autoCloseSeconds * 20);
    }
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:20,代码来源:Lock.java

示例8: runAction

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
/**
 * Performs this Action.
 *
 * @param currentState the current State before the Action is performed
 */
public void runAction(@Nonnull final String currentState) {
    switch (this.type) {
        case CLOSE:
            InventoryUtil.close(this.observer);
            break;
        case BACK:
            if (this.container.hasState(currentState)) {
                if (this.container.getState(currentState).hasParent()) {
                    this.container.openState(this.observer, this.container.getState(currentState).getParent());
                } else {
                    this.observer.playSound(SoundTypes.BLOCK_ANVIL_LAND, this.observer.getLocation().getPosition(), 0.5);
                    if(container.scheduledTask != null){
                        container.scheduledTask.cancel();
                        container.scheduledTask = null;
                    }
                    InventoryUtil.close(this.observer);
                    this.observer.sendMessage(Text.of(TextColors.RED, "Impossible BACK action - closing broken State."));
                }
            }
            break;
        case NORMAL:
            this.container.openState(this.observer, this.goalState);
            break;
        case NONE:
            // do nothing
            break;
        default:
            this.observer.sendMessage(Text.of("??"));
            break;
    }
}
 
开发者ID:codeHusky,项目名称:HuskyUI-Plugin,代码行数:37,代码来源:Action.java

示例9: RouletteCrateView

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
public RouletteCrateView(HuskyCrates plugin, Player runner, VirtualCrate virtualCrate){
    this.plugin = plugin;
    vc = virtualCrate;
    ourplr = runner;
    items = vc.getItemSet();
    if(virtualCrate.scrambleRewards){
        scrambleRewards();
    }
    disp = Inventory.builder()
            .of(InventoryArchetypes.DISPENSER)
            .listener(InteractInventoryEvent.class, evt ->{
                if(!(evt instanceof InteractInventoryEvent.Open) && !(evt instanceof  InteractInventoryEvent.Close)){
                    evt.setCancelled(true);
                    if(!stopped && evt instanceof ClickInventoryEvent){
                        ourplr.playSound(SoundTypes.ENTITY_FIREWORK_LAUNCH,ourplr.getLocation().getPosition(),1);
                    }
                    stopped = true;
                }

            })
            .property(InventoryTitle.PROPERTY_NAME,InventoryTitle.of(TextSerializers.FORMATTING_CODE.deserialize(virtualCrate.displayName)))
            .build(plugin);
    updateInv(0);
    Scheduler scheduler = Sponge.getScheduler();
    Task.Builder taskBuilder = scheduler.createTaskBuilder();
    updater = taskBuilder.execute(this::updateTick).intervalTicks(1).submit(plugin);
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:28,代码来源:RouletteCrateView.java

示例10: InstantGUIView

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
public InstantGUIView(HuskyCrates plugin, Player runner, VirtualCrate virtualCrate){
    //System.out.println("AA");
    this.plugin = plugin;
    vc = virtualCrate;
    ourplr = runner;
    items = vc.getItemSet();
    if(virtualCrate.scrambleRewards){
        scrambleRewards();
    }
    disp = Inventory.builder()
            .of(InventoryArchetypes.DISPENSER)
            .listener(InteractInventoryEvent.class, evt ->{
                if(!(evt instanceof InteractInventoryEvent.Open) && !(evt instanceof  InteractInventoryEvent.Close)){
                    evt.setCancelled(true);
                }

            })
            .property(InventoryTitle.PROPERTY_NAME,InventoryTitle.of(TextSerializers.FORMATTING_CODE.deserialize(virtualCrate.displayName)))
            .build(plugin);
    updateInv(0);
    Scheduler scheduler = Sponge.getScheduler();
    Task.Builder taskBuilder = scheduler.createTaskBuilder();
    updater = taskBuilder.execute(this::updateTick).intervalTicks(1).submit(plugin);
    scheduler.createTaskBuilder().execute(() -> {
        updater.cancel();
        ourplr.closeInventory();
        handleReward(holder);
        ourplr.playSound(SoundTypes.ENTITY_EXPERIENCE_ORB_PICKUP,ourplr.getLocation().getPosition(),1);
    }).delay(3, TimeUnit.SECONDS).submit(HuskyCrates.instance);
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:31,代码来源:InstantGUIView.java

示例11: updateInv

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
private void updateInv(int state){
    int slotNum = 0;
    for(Inventory e : disp.slots()){
        double speed = 3;
        double confettiSpeed = 2;
        if(slotNum != 4) {
            if (tickCount == 0 || Math.round(tickCount / confettiSpeed) > Math.round((tickCount - 1) / confettiSpeed)) {
                e.set(confetti());
            } else {
                e.set(e.peek().get());
            }
        }else if(holder == null){
            try {
                int i = itemIndexSelected();
                e.set(((CrateReward)items.get(i)[1]).getDisplayItem());
                holder = (CrateReward)items.get(i)[1];
                ourplr.playSound(SoundTypes.ENTITY_FIREWORK_LAUNCH,ourplr.getLocation().getPosition(),1);
            } catch (RandomItemSelectionFailureException e1) {
                plugin.logger.error("Random Item Selection failed in Roulette Crate View: " + vc.displayName);
            }

            //e.set(((CrateRewardHolder)items.get(Math.round(tickCount/2) % items.size())[1]).getDisplayItem());
        }else{
            e.set(e.peek().get());
        }
        slotNum++;
    }
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:29,代码来源:InstantGUIView.java

示例12: registerDefaults

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
@Override
public void registerDefaults() {
    register(new LanternRecordType("minecraft", "thirteen", "item.record.13.desc", 0, SoundTypes.RECORD_13));
    register(new LanternRecordType("minecraft", "cat", "item.record.cat.desc", 1, SoundTypes.RECORD_CAT));
    register(new LanternRecordType("minecraft", "blocks", "item.record.blocks.desc", 2, SoundTypes.RECORD_BLOCKS));
    register(new LanternRecordType("minecraft", "chirp", "item.record.chirp.desc", 3, SoundTypes.RECORD_CHIRP));
    register(new LanternRecordType("minecraft", "far", "item.record.far.desc", 4, SoundTypes.RECORD_FAR));
    register(new LanternRecordType("minecraft", "mall", "item.record.mall.desc", 5, SoundTypes.RECORD_MALL));
    register(new LanternRecordType("minecraft", "mellohi", "item.record.mellohi.desc", 6, SoundTypes.RECORD_MELLOHI));
    register(new LanternRecordType("minecraft", "stal", "item.record.stal.desc", 7, SoundTypes.RECORD_STAL));
    register(new LanternRecordType("minecraft", "strad", "item.record.strad.desc", 8, SoundTypes.RECORD_STRAD));
    register(new LanternRecordType("minecraft", "ward", "item.record.ward.desc", 9, SoundTypes.RECORD_WARD));
    register(new LanternRecordType("minecraft", "eleven", "item.record.11.desc", 10, SoundTypes.RECORD_11));
    register(new LanternRecordType("minecraft", "wait", "item.record.wait.desc", 11, SoundTypes.RECORD_WAIT));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:16,代码来源:RecordTypeRegistryModule.java

示例13: registerDefaults

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
@Override
public void registerDefaults() {
    register(new LanternInstrumentType("minecraft", "harp", 0, SoundTypes.BLOCK_NOTE_HARP));
    register(new LanternInstrumentType("minecraft", "bass_drum", 1, SoundTypes.BLOCK_NOTE_BASEDRUM));
    register(new LanternInstrumentType("minecraft", "snare", 2, SoundTypes.BLOCK_NOTE_SNARE));
    register(new LanternInstrumentType("minecraft", "high_hat", 3, SoundTypes.BLOCK_NOTE_HAT));
    register(new LanternInstrumentType("minecraft", "bass_attack", 4, SoundTypes.BLOCK_NOTE_BASS));
    register(new LanternInstrumentType("minecraft", "flute", 5, SoundTypes.BLOCK_NOTE_FLUTE));
    register(new LanternInstrumentType("minecraft", "bell", 6, SoundTypes.BLOCK_NOTE_BELL));
    register(new LanternInstrumentType("minecraft", "guitar", 7, SoundTypes.BLOCK_NOTE_GUITAR));
    register(new LanternInstrumentType("minecraft", "chime", 8, SoundTypes.BLOCK_NOTE_CHIME));
    register(new LanternInstrumentType("minecraft", "xylophone", 9, SoundTypes.BLOCK_NOTE_XYLOPHONE));
    // Not officially registered as a instrument type
    register(new LanternInstrumentType("minecraft", "pling", 100, SoundTypes.BLOCK_NOTE_PLING));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:16,代码来源:InstrumentTypeRegistryModule.java

示例14: pulse

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
@Override
public void pulse(int deltaTicks) {
    super.pulse(deltaTicks);

    this.ticksToLive -= deltaTicks;
    if (this.ticksToLive > 0) {
        return;
    }
    if (this.remove) {
        try (CauseStack.Frame frame = CauseStack.current().pushCauseFrame()) {
            // Add this entity to the cause of removal
            frame.pushCause(this);
            // Remove the entity
            remove();
        }
    } else {
        // Remove the entity the next pulse
        this.remove = true;

        // Play the sound effects
        final Vector3d position = getPosition();
        getWorld().playSound(SoundTypes.ENTITY_LIGHTNING_THUNDER, SoundCategories.WEATHER, position,
                10000.0, 0.8 + getRandom().nextDouble() * 0.2);
        getWorld().playSound(SoundTypes.ENTITY_LIGHTNING_IMPACT, SoundCategories.WEATHER, position,
                2.0, 0.5 + getRandom().nextDouble() * 0.2);

        // TODO: Damage entities?
        // TODO: Create fire
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:31,代码来源:LanternLightning.java

示例15: ChangeDoor

import org.spongepowered.api.effect.sound.SoundTypes; //导入依赖的package包/类
public static void ChangeDoor(BlockSnapshot b, Region r){		
	if ((!RedProtect.get().cfgs.isFlagEnabled("smart-door") && !RedProtect.get().cfgs.getBool("flags.smart-door")) || !r.getFlagBool("smart-door")){
		return;
	}
	
	Location<World> loc = b.getLocation().get();
	World w = loc.getExtent();
	
	if (isDoor(b)){
		changeDoorState(b);
		if (getDoorState(b)){
			w.playSound(SoundTypes.BLOCK_CHEST_CLOSE, loc.getPosition(), 1);
		} else {
			w.playSound(SoundTypes.BLOCK_CHEST_OPEN, loc.getPosition(), 1);
		}
	}		
	
	//check side block if is door
	BlockSnapshot[] block = new BlockSnapshot[4];
	block[0] = w.createSnapshot(loc.getBlockX()+1, loc.getBlockY(), loc.getBlockZ());
	block[1] = w.createSnapshot(loc.getBlockX()-1, loc.getBlockY(), loc.getBlockZ());
	block[2] = w.createSnapshot(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()+1);
	block[3] = w.createSnapshot(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()-1);		
	
	for (BlockSnapshot b2:block){
		if (b.getExtendedState().getType().getName().equals(b2.getExtendedState().getType().getName())){
			//b.getWorld().playEffect(b.getLocation(), Effect.DOOR_TOGGLE, 0);
			changeDoorState(b);
			break;
		}
	}
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:33,代码来源:RPDoor.java


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