From 14079e146eb56ec397b5820981f5a708b601604b Mon Sep 17 00:00:00 2001 From: 64FF00 <64ff00@gmail.com> Date: Mon, 29 Dec 2014 23:32:14 +0900 Subject: [PATCH] Version Bump + Small fix --- plugin.yml | 5 +++-- src/_64FF00/PureChat/ChatListener.php | 11 ----------- src/_64FF00/PureChat/PureChat.php | 21 +++++++++++++++------ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/plugin.yml b/plugin.yml index bc0cacb..06b600f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -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] \ No newline at end of file +depend: [PurePerms] +softdepend: [FactionsPro] \ No newline at end of file diff --git a/src/_64FF00/PureChat/ChatListener.php b/src/_64FF00/PureChat/ChatListener.php index 426ce64..4062b5f 100644 --- a/src/_64FF00/PureChat/ChatListener.php +++ b/src/_64FF00/PureChat/ChatListener.php @@ -6,17 +6,6 @@ use pocketmine\event\player\PlayerChatEvent; -/* - # # ##### # ####### ####### ### ### - # # # # # # # # # # # # - ####### # # # # # # # # # - # # ###### # # ##### ##### # # # # - ####### # # ####### # # # # # # - # # # # # # # # # # # - # # ##### # # # ### ### - -*/ - class ChatListener implements Listener { private $plugin; diff --git a/src/_64FF00/PureChat/PureChat.php b/src/_64FF00/PureChat/PureChat.php index ad97cf5..cd29a08 100644 --- a/src/_64FF00/PureChat/PureChat.php +++ b/src/_64FF00/PureChat/PureChat.php @@ -19,7 +19,7 @@ class PureChat extends PluginBase { - private $config, $plugin, $factionspro; + private $config, $plugin, $factionsPro; public function onLoad() { @@ -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); } @@ -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; }