Skip to content

Commit

Permalink
Version Bump + Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
64FF00 committed Dec 29, 2014
1 parent 08905e3 commit 14079e1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
5 changes: 3 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: PureChat
main: _64FF00\PureChat\PureChat
version: "1.1.0"
version: "1.2.0"
api: [1.9.0]
load: STARTUP
author: 64FF00
website: https://github.com/64FF00/PureChat
depend: [PurePerms]
depend: [PurePerms]
softdepend: [FactionsPro]
11 changes: 0 additions & 11 deletions src/_64FF00/PureChat/ChatListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@

use pocketmine\event\player\PlayerChatEvent;

/*
# # ##### # ####### ####### ### ###
# # # # # # # # # # # #
####### # # # # # # # # #
# # ###### # # ##### ##### # # # #
####### # # ####### # # # # # #
# # # # # # # # # # #
# # ##### # # # ### ###
*/

class ChatListener implements Listener
{
private $plugin;
Expand Down
21 changes: 15 additions & 6 deletions 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, $factionspro;
private $config, $plugin, $factionsPro;

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

$this->getServer()->getPluginManager()->registerEvents(new ChatListener($this), $this);
}
Expand All @@ -45,18 +45,27 @@ public function formatMessage(Player $player, $message, $levelName = null)
else
{
$chatFormat = $this->getConfig()->getNested("groups.$groupName.worlds.$levelName");

if($chatFormat == null)
{
$this->getConfig()->setNested("groups.$groupName.worlds.$levelName", "[$groupName] %user_name% > %message%");

$this->getConfig()->save();
}
}

$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);

if($this->factionsPro != null)
{
if($this->factionsPro->isInFaction($player->getName()))
{
$chatFormat = str_replace("%faction%", $this->factionsPro->getPlayerFaction($player->getName()), $chatFormat);
}
}


return $chatFormat;
}

Expand Down

0 comments on commit 14079e1

Please sign in to comment.