1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Sounds that are not within sourcecode

Discussion in 'Development' started by OnTheVerge, Dec 29, 2017.

  1. OnTheVerge

    OnTheVerge Spider Jockey

    Messages:
    46
    Hello there!
    Ok I am new to developing plugins and I had an Idea which was to use BlockBreakEvent and make it have a xp sound whenever a player breaks stone, but I do not have the slightest Idea how to add it can I Please get some assistance from anyone?
    Thanks in Advance

    My Try:

    PHP:
      public function onBreak(BlockBreakEvent $event){
         
    $player $event->getPlayer();
         
    $block $event->getBlock();

       if(
    $block->getId() == 1){
    $player->getLevel()->addSound(new //XPSound???($player));
        
    }
      }
    }
     
  2. Caulfergi

    Caulfergi Spider

    Messages:
    8
    GitHub:
    xxcauldevsyt
    Yes
    PHP:
    public function onBreak(BlockBreakEvent $event){
    $player = $event->getPlayer();
    $block = $event->getBlock();

    if($block->getId() == 1){
    $player->getLevel()->addSound(new //XPSound???($player)(soundname));
    }
    }
     
  3. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    You must use generic sound class to play sounds that are not registred
     
  4. OnTheVerge

    OnTheVerge Spider Jockey

    Messages:
    46
    Can u please help me? I really dont know how :(
     
  5. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    PHP:
    new GenericSound($pos$id);
     
  6. OnTheVerge

    OnTheVerge Spider Jockey

    Messages:
    46
    Nvm i found a new way! Thanks alot for the assistance tho:)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.