This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Ace Sobremont edited this page Jun 27, 2022
·
14 revisions
Welcome to Plugin Wiki, Here's the basic of sequence in structure of Plugin API. It's introduce the speech of the chat block them.
It is easy to find out more with profanities. Make sure you have listed of profanities want you to block.
Make sure you have list of profanities that will be use.
$words = ["your-word","another-word"];
Or simplify it on your config.
$words = $this->getConfig()->get("profanity-words");
Your config must be formatted like this:
profanity-words:
- "your-word"
- "another-word"
Make sure its in array
otherwise cause of error's.
This how's formatted to use the function.
PluginAPI::detectProfanity(string $message, array $words)
Now $words
can be defined here
You can now execute these plugin api by using this method:
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerChatEvent;
use xqwtxon\ProfanityFilter\PluginAPI;
class Example implements Listener {
public function onChat(PlayerChatEvent $ev): void {
$player = $ev->getPlayer();
$message = $ev->getMessage();
$words = ["your-word","another-word"];
if(PluginAPI::detectProfanity($message, $words)){
$ev->cancel();
$player->sendMessage("Watch your language!");
}
}
This is one of my examples which working as of now.
This plugin was made by @xqwtxon