Skip to content

ReinfyTeam/libpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libpf (ProfanityFilter Library)

This is a based virion api plugin for developers.
Use DeVirion or VirionTool to inject the code or download this source code.

How to use the code?

An example plugin can give you an example of basic usage of api.

  1. Import the class first.
    use ReinfyTeam\libpf\ProfanityFilter;
  2. 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 ❤️

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages