Skip to content

API methods guide

Leo edited this page May 27, 2016 · 1 revision

Starting from version 3.1.0, RealMute gives you three API methods that you can use in your code in order to make your plugin work with RealMute.

How to call API methods

First, you need to assign RealMute to a variable:

$this->RealMute = $this->getServer()->getPluginManager()->getPlugin("RealMute");

Then you will be able to access RealMute API methods, like $this->RealMute->isMuted($player).
It is advised that you add the following line to plugin.yml of your plugin, so if anyone uses your plugin without RealMute, there will not be any runtime error.

depend: RealMute

Method details

isMuted

Checks if a player is muted, either muted by username or muted by device/IP address.

bool isMuted(mixed $player)
Parameters
  • $player
    The player you want to query.
    Both player instance and player's name are accepted. RealMute will try to detect the type of $player automatically.
Return values

Returns TRUE if $player is muted, FALSE otherwise.

mutePlayer

Mute a player.

bool mutePlayer(mixed $player)
Parameters
  • $player
    The player you want to mute.
    Both player instance and player's name are accepted. RealMute will try to detect the type of $player automatically.
Return values

Returns TRUE if $player is successfully muted, FALSE otherwise.

unmutePlayer

Unmute a player.

bool unmutePlayer(mixed $player)
Parameters
  • $player
    The player you want to unmute.
    Both player instance and player's name are accepted. RealMute will try to detect the type of $player automatically.
Return values

Returns TRUE if $player is successfully unmuted, FALSE otherwise.