Skip to content

Commit

Permalink
Fix #15
Browse files Browse the repository at this point in the history
  • Loading branch information
xqwtxon authored Jul 25, 2022
1 parent 793c619 commit 26abe78
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Utils/PluginUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,14 @@ public static function colorize(string $message) : string {
$message = str_replace(array_keys($replacements), array_values($replacements), $message);
return $message;
}

public static function formatMessage(?Player $player = null, string $message) : string {
if($player === null){
$message = str_replace("{player_name}", "Unknown Player Name", $message);
return $message;
} else {
$message = str_replace("{player_name}", $player->getName(), $message);
return $message;
}
}
}

0 comments on commit 26abe78

Please sign in to comment.