Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.
/ SoundAPI Public archive

This is a plugin that allows you to send to any vanilla minecraft audio in an easy way

License

Notifications You must be signed in to change notification settings

ArchiveArea/SoundAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SoundAPI

This is a plugin that allows you to send to any vanilla minecraft audio in an easy way.

How to use

Send to the coordinates of the player standing any sound

First, you have to register the plugin, you can do this during the onEnable() of your plugin main class.

protected function onEnable(): void {
	$this->getServer()->getPluginManager()->registerEvents($this, $this);
	$this->SoundAPI = $this->getServer()->getPluginManager()->getPlugin("SoundAPI");
}

You can then send the player an sound track with the following code:

Click here to see the sound list

$soundName = "sound.name";
$player = $event->getPlayer();
$this->SoundAPI->playSound($soundName, $player);

I will now send the player a thunderclap sound when they join the server using the code below:

public function onJoin(PlayerJoinEvent $event): void {
	$soundName = "ambient.weather.lightning.impact";
	$player = $event->getPlayer();
	$this->SoundAPI->playSound($soundName, $player);
}

How to stop the sound that is playing

# Remember to register the plugin in `onEnable()`

To stop an sound, follow the steps below

$soundName = "sound.name";
/**
 * $soundName = "";
 * This will stop all playing sound!
 */
$stopAll = true;
$player = $event->getPlayer();
$this->SoundAPI->stopSound($soundName, $stopAll, $player);

I will now stop any audio when a player joins the server

public function onJoin(PlayerJoinEvent $event): void {
	$soundName = "ambient.cave";
	$stopAll = true;
	$player = $event->getPlayer();
	$this->SoundAPI->stopSound($soundName, $stopAll, $player);
}

Still sending the player an sound track, but it allows for more customization

You should use playSound() to make it easier to send sounds to players

# Remember to register the plugin in `onEnable()`

I'll send players a bell sound when they join the server

public function onJoin(PlayerJoinEvent $event): void {
	$player = $event->getPlayer();
	$soundName = "block.bell.hit"
	$x = $player->getPosition()->getX();
	$y = $player->getPosition()->getY();
	$z = $player->getPosition()->getZ();
	$volume = 1.0;
	$pitch = 1.0;
	$this->SoundAPI->playSoundCustom($soundName, $x, $y, $z, $volume, $pitch, $player);
}

Sounds

Click on the link below to see the sound list

https://www.digminecraft.com/lists/sound_list_pe.php

Contact

Discord
You can contact me directly via Discord NhanAZ#9115

About

This is a plugin that allows you to send to any vanilla minecraft audio in an easy way

Topics

Resources

License

Stars

Watchers

Forks

Languages