Package org.getspout.spoutapi.event.sound

Examples of org.getspout.spoutapi.event.sound.BackgroundMusicEvent


  }

  @Override
  public void playMusic(SpoutPlayer target, Music music, int volumePercent) {
    if (target.isSpoutCraftEnabled()) {
      BackgroundMusicEvent event = new BackgroundMusicEvent(music, volumePercent, target);
      Bukkit.getServer().getPluginManager().callEvent(event);
      if (event.isCancelled()) {
        return;
      }

      ((SpoutCraftPlayer) target).sendPacket(new PacketPlaySound(music, event.getVolumePercent()));
    }
  }
View Full Code Here


      }
      String extension = Url.substring(Url.length() - 4, Url.length());
      if (extension.equalsIgnoreCase(".ogg") || extension.equalsIgnoreCase(".wav") || extension.equalsIgnoreCase(".mp3") || extension.matches(".*[mM][iI][dD][iI]?$")) {
        if (location == null || location.getWorld().equals(target.getWorld())) {
          if (!soundEffect) {
            BackgroundMusicEvent event = new BackgroundMusicEvent(Url, volumePercent, target);
            Bukkit.getServer().getPluginManager().callEvent(event);
            if (event.isCancelled()) {
              return;
            }
            volumePercent = event.getVolumePercent();
          }
          SpoutCraftPlayer ccp = (SpoutCraftPlayer) target;
          ccp.sendPacket(new PacketDownloadMusic(plugin != null ? plugin.getDescription().getName() : "temp", Url, location, distance, volumePercent, soundEffect, notify));
        }
      } else {
View Full Code Here

  @Override
  public void run(int playerId) {
    SpoutPlayer player = SpoutManager.getPlayerFromId(playerId);
    Music music = Music.getMusicFromId(id);
    if (player != null && music != null) {
      BackgroundMusicEvent event = new BackgroundMusicEvent(music, volumePercent, player);
      Bukkit.getServer().getPluginManager().callEvent(event);
      if (event.isCancelled()) {
        cancel = true;
      }
      player.sendPacket(this);
    }
  }
View Full Code Here

TOP

Related Classes of org.getspout.spoutapi.event.sound.BackgroundMusicEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.