This is a based virion api plugin for developers.
Use DeVirion or VirionTool to inject the code or download this source code.
An example plugin can give you an example of basic usage of api.
- Import the class first.
use ReinfyTeam\libpf\ProfanityFilter;
- Import the chat event class & write the following:
use pocketmine\event\Listener; use pocketmine\event\player\PlayerChatEvent;
public function onChat(PlayerChatEvent $event) : void{ // the function event if(ProfanityFilter::detectProfanity($event->getMessage(), ["test"])){ $event->cancel(); // cancel the chat event $event->getPlayer()->sendMessage("§cPlease Watch your language!"); // the warning message } }
- Removing the unicode messages
You can use the following:
ProfanityFilter::removeUnicode($message, false); // This removes ONLY non-printable characters like ® ProfanityFilter::removeUnicode($message, true); // This removes non-printable AND other mcpe characters such as emoji.
- You can use default profanity list by:
ProfanityFilter::defaultProfanity(); // returns array can be used as: ProfanityFilter::detectProfanity($message, ProfanityFilter::defaultProfanity());
Made by ReinfyTeam ❤️