<commit_before><?php

  namespace JoinLeaveMessages;
  
  use pocketmine\plugin\PluginBase;
  use pocketmine\event\Listener;
  use pocketmine\utils\TextFormat as TF;
  use pocketmine\event\player\PlayerJoinEvent;
  use pocketmine\event\player\PlayerQuitEvent;
  use pocketmine\command\Command;
  use pocketmine\command\CommandSender;
  
  class Main extends PluginBase implements Listener {
  
    public function onEnable() {
    
      $this->getServer()->getPluginManager()->registerEvents($this, $this);
      
      if(!(file_exists($this->getDataFolder()))) {
      
        @mkdir($this->getDataFolder());
        
        chdir($this->getDataFolder());
        
        touch("config.yml");
        
        $array = [
        
          "join-message:" => "{player} joined the server!",
          "quit-message:" => "{player} left the server!"
          
        ];
        
        file_put_contents("config.yml", json_encode($array));
        
      }
      
    }
    
    public function onJoin(PlayerJoinEvent $event) {
    
      chdir($this->getDataFolder());
      
      $data = file_get_contents("config.yml");
      
      $file_array = json_decode($data, true);
      
      $join_message = $file_array["join-message:"];
      
      $event->setJoinMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $join_message));
      
    }
    
    public function onQuit(PlayerQuitEvent $event) {
    
      chdir($this->getDataFolder());
      
      $data = file_get_contents("config.yml");
      
      $file_array = json_decode($data, true);
      
      $quit_message = $file_array["quit-message:"];
      
      $event->setQuitMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $quit_message));
      
    }
    <commit_msg>Update Main.php<commit_after><?php

  namespace JoinLeaveMessages;
  
  use pocketmine\plugin\PluginBase;
  use pocketmine\event\Listener;
  use pocketmine\utils\TextFormat as TF;
  use pocketmine\event\player\PlayerJoinEvent;
  use pocketmine\event\player\PlayerQuitEvent;
  use pocketmine\command\Command;
  use pocketmine\command\CommandSender;
  
  class Main extends PluginBase implements Listener {
  
    public function onEnable() {
    
      $this->getServer()->getPluginManager()->registerEvents($this, $this);
      
      if(!(file_exists($this->getDataFolder()))) {
      
        @mkdir($this->getDataFolder());
        
        chdir($this->getDataFolder());
        
        touch("config.yml");
        
        $array = [
        
          "join-message:" => "{player} joined the server!",
          "quit-message:" => "{player} left the server!"
          
        ];
        
        file_put_contents("config.yml", json_encode($array));
        
      }
      
    }
    
    public function onJoin(PlayerJoinEvent $event) {
    
      chdir($this->getDataFolder());
      
      $data = file_get_contents("config.yml");
      
      $file_array = json_decode($data, true);
      
      $join_message = $file_array["join-message:"];
      
      $event->setJoinMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $join_message));
      
    }
    
    public function onQuit(PlayerQuitEvent $event) {
    
      chdir($this->getDataFolder());
      
      $data = file_get_contents("config.yml");
      
      $file_array = json_decode($data, true);
      
      $quit_message = $file_array["quit-message:"];
      
      $event->setQuitMessage(str_replace("{player}", $event->getPlayer()->getDisplayName(), $quit_message));
      
    }

    public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) {

      if(strtolower($cmd->getName()) === "setjoinmessage") {

        if(!(isset($args[0]))) {

          $sender->sendMessage(TF::RED . "Error: not enough args. Usage: /setjoinmessage < message >");

          return true;

        } else {

          chdir($this->getDataFolder());

          $data = file_get_contents("config.yml");

          $file_array = json_decode($data, true);

          $old_join_message = $file_array["join-message:"];

          $new_join_message = implode(" ", $args);

          $update_message = str_replace($old_join_message, $new_join_message, file_get_contents("config.yml"));

          file_put_contents("config.yml", $update_message);

          $sender->sendMessage(TF::GREEN . "Join Message Was Successfully Updated!");

          return true;

        }

      }

    }
    
{'fraction_non_alphanumeric': 0.14250559284116332, 'fraction_numerical': 0.00022371364653243848, 'mean_word_length': 2.465891472868217, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 40, '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': '5913214', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1308, 'n_words': 203}