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
Simple Configuring
Ace Sobremont edited this page Jul 2, 2022
·
2 revisions
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