Skip to content

Commit

Permalink
Merge pull request #2 from Tethered/master
Browse files Browse the repository at this point in the history
Added support for FactionsPro. (Thanks to @Tethered)
  • Loading branch information
64FF00 committed Dec 29, 2014
2 parents a62f502 + 9df058e commit 08905e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
enable-multiworld-formats: false

# A list of all PurePerms groups
# If you have FactionsPro installed, add %faction% anywhere
groups:
Guest:
default: "[Guest] %user_name% > %message%"
Expand Down
9 changes: 8 additions & 1 deletion src/_64FF00/PureChat/PureChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class PureChat extends PluginBase
{
private $config, $plugin;
private $config, $plugin, $factionspro;

public function onLoad()
{
Expand All @@ -29,6 +29,7 @@ public function onLoad()
public function onEnable()
{
$this->plugin = $this->getServer()->getPluginManager()->getPlugin("PurePerms");
$this->factionspro = $this->getServer()->getPluginManager()->getPlugin("FactionsPro");

$this->getServer()->getPluginManager()->registerEvents(new ChatListener($this), $this);
}
Expand All @@ -49,6 +50,12 @@ public function formatMessage(Player $player, $message, $levelName = null)
$chatFormat = str_replace("%world_name%", $levelName, $chatFormat);
$chatFormat = str_replace("%user_name%", $player->getName(), $chatFormat);
$chatFormat = str_replace("%message%", $message, $chatFormat);
if(!$this->factionspro == false) {
if($this->factionspro->isInFaction($player->getName())) {
$chatformat = str_replace("%faction%", $this->factionspro->getPlayerFaction($player->getName()), $chatFormat);
}
}


return $chatFormat;
}
Expand Down

0 comments on commit 08905e3

Please sign in to comment.