Solved Send packet with custom sound from resourcepack

Discussion in 'Plugin Development' started by PDKnight, Mar 24, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    PDKnight

    Hi Bukkit (Again),
    I have another question, if is there a way, how to send a sound packet for player with the sound from resourcepack? I have DMR.ogg in /sounds directory in RP, for example. I've been finding the solution for hours, but I didn't find a great one, but only this site (http://wiki.vg/Protocol#Sound_Effect) should be helpful. But okay, I know, which parameters I should use, but I don't know how :(. So if is there any example how to do it, can you please paste it there?
     
  2. Offline

    sgavster

    You can't use playSound(loc, sound, int, int); ?
     
  3. Offline

    PDKnight

    I can, but what to type in sound property?
     
  4. Offline

    sgavster

  5. Offline

    PDKnight

    @sgavster It doesn't work. I've tried 6 variations of the property: Sounds.DMR.ogg, Sounds.DMR, Sound.DMR.ogg, Sound.DMR, sound.DMR.ogg, sound.DMR...
    My code:
    Code:java
    1.  
    2. @SuppressWarnings("deprecation")
    3. public boolean onCommand(final CommandSender sender, final Command cmd, final String commandLabel, final String[] args) {
    4. if(sender instanceof Player) {
    5. Player player = (Player) sender;
    6. if(commandLabel.equalsIgnoreCase("csd")) { //CraftSounds play DMR
    7. Location l = player.getLocation();
    8. player.playSound(l, "sound.DMR.ogg", 1F, 1F);
    9. player.sendMessage("Playing sound...");
    10. }
    11. }
    12. return false;
    13. }
    14.  
     
  6. Offline

    xTigerRebornx

    PDKnight likes this.
  7. Offline

    PDKnight

    @xTigerRebornx OH GOOOOOOOOODDDDDDD It works perfectly!!! Many thanks dude!
     
  8. Offline

    nverdier

    @PDKnight Please mark your thread as solved! See this for more info.
     
Thread Status:
Not open for further replies.

Share This Page