<commit_before><?php

namespace serverhelp;

use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;

class ServerHelpLoader extends PluginBase implements Listener{

    public function onEnable(){
        $this->saveDefaultConfig();
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
        $this->getServer()->getLogger()->info("§aEnabling ".$this->getDescription()->getFullName()."...");
    }
    
    public function onDisable(){
      	$this->getServer()->getLogger()->info("§cDisabling ".$this->getDescription()->getFullName()."...");
    }
    
    public function onPlayerCommandPreprocess(PlayerCommandPreprocess $event){
        $command = explode(" ", strtolower($event->getMessage()));
        if($command[0] === "/help"){
            $event->setCancelled(true);
            if(isset($command[1])){
                if(isset($this->getConfig()->getNested("help.".$command[1]))){
                    foreach($this->getConfig()->getNested("help.".$command[1]) as $message){
                        $event->getPlayer()->sendMessage($message);
                    }
                }
                else{
                    $event->getPlayer()->sendMessage($this->getConfig()->get("on-error-message"));
                }
            }
            else{
                if(isset($this->getConfig()->getNested("help.1")){
                    foreach($this->getConfig()->getNested("help.1") as $message){
                        $event->getPlayer()->sendMessage($message);
                    }
                }
                else{
                    $event->getPlayer()->sendMessage($this->getConfig()->get("on-error-message"));
                }
            }
        }
    }
}
<commit_msg>Update ServerHelpLoader.php<commit_after><?php

namespace serverhelp;

use pocketmine\event\player\PlayerCommandPreprocessEvent;
use pocketmine\event\Listener;
use pocketmine\plugin\PluginBase;

class ServerHelpLoader extends PluginBase implements Listener{

    public function onEnable(){
        $this->saveDefaultConfig();
        $this->getServer()->getPluginManager()->registerEvents($this, $this);
        $this->getServer()->getLogger()->info("§aEnabling ".$this->getDescription()->getFullName()."...");
    }
    
    public function onDisable(){
      	$this->getServer()->getLogger()->info("§cDisabling ".$this->getDescription()->getFullName()."...");
    }
    
    public function onPlayerCommandPreprocess(PlayerCommandPreprocess $event){
        $command = explode(" ", strtolower($event->getMessage()));
        if($command[0] === "/help"){
            $event->setCancelled(true);
            if(isset($command[1])){
                if(isset($this->getConfig()->getNested("help.".$command[1]))){
                    foreach($this->getConfig()->getNested("help.".$command[1]) as $message){
                        $event->getPlayer()->sendMessage($message);
                    }
                }
                else{
                    $event->getPlayer()->sendMessage($this->getConfig()->getNested("message.on-error"));
                }
            }
            else{
                if(isset($this->getConfig()->getNested("help.1")){
                    foreach($this->getConfig()->getNested("help.1") as $message){
                        $event->getPlayer()->sendMessage($message);
                    }
                }
                else{
                    $event->getPlayer()->sendMessage($this->getConfig()->getNested("message.on-error"));
                }
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.17366096079514082, 'fraction_numerical': 0.0033130866924351186, 'mean_word_length': 2.0992301112061593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6193395', 'n_tokens_mistral': 956, 'n_tokens_neox': 921, 'n_words': 109}