diff --git a/README.md b/README.md index e484530..cd04503 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ PocketMine-MP plugins ## Requirements -PocketMine-MP 1.7dev API 3.0.0-ALPHA7 -> 3.0.0-ALPHA12 +PocketMine-MP API 3.0.0 ## Overview @@ -27,7 +27,8 @@ You can also customize spawn settings, spawn messages... and you can also set al ## Donate -Support the development of this plugin with a small donation by clicking [:dollar: here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flavius.c.1999@gmail.com&lc=US&item_name=www.evolsoft.tk&no_note=0&cn=&curency_code=EUR&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted). Thank you :smile: +Please support the development of this plugin with a small donation by clicking [:dollar: here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flavius.c.1999@gmail.com&lc=US&item_name=www.evolsoft.tk&no_note=0&cn=&curency_code=EUR&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted). +Your small donation will help me paying web hosting, domains, buying programs (such as IDEs, debuggers, etc...) and new hardware to improve software development. Thank you :smile: ## Documentation diff --git a/plugin.yml b/plugin.yml index 8feb915..b0dc730 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: MSpawns main: MSpawns\MSpawns -version: 2.1 +version: 2.2 api: [3.0.0] load: STARTUP author: EvolSoft diff --git a/src/MSpawns/Alias.php b/src/MSpawns/Alias.php index f9de762..5e2f9df 100644 --- a/src/MSpawns/Alias.php +++ b/src/MSpawns/Alias.php @@ -1,11 +1,10 @@ plugin->cfg["enable-aliases"]){ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("aliases-disabled"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName())))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("aliases-disabled"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName())))); return true; } if($sender->hasPermission("mspawns.spawn")){ @@ -35,22 +35,22 @@ public function execute(CommandSender $sender, $label, array $args) : bool { $level = Server::getInstance()->getLevelByName($dest); if($this->plugin->teleportToSpawn($sender, $level)){ if($this->plugin->isSpawnMessageEnabled()){ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->getFormattedSpawnMessage($sender))); + $sender->sendMessage(TextFormat::colorize($this->plugin->getFormattedSpawnMessage($sender))); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $level->getName())))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $level->getName())))); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $dest)))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $dest)))); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c No alias")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c No alias")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c You can only perform this command as a player")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c You can only perform this command as a player")); } return true; } diff --git a/src/MSpawns/AliasesMap.php b/src/MSpawns/AliasesMap.php index a8206a8..43eae20 100644 --- a/src/MSpawns/AliasesMap.php +++ b/src/MSpawns/AliasesMap.php @@ -1,11 +1,10 @@ plugin = $plugin; @@ -32,49 +35,46 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar goto help; case "info": if($sender->hasPermission("mspawns.info")){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&6 MSpawns &cv" . $this->plugin->getDescription()->getVersion() . "&6 developed by &cEvolSoft")); - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&6 Website &c" . $this->plugin->getDescription()->getWebsite())); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&6 MSpawns &cv" . $this->plugin->getDescription()->getVersion() . "&6 developed by &cEvolSoft")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&6 Website &c" . $this->plugin->getDescription()->getWebsite())); break; } - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); break; case "reload": if($sender->hasPermission("mspawns.reload")){ - $this->plugin->reloadConfig(); - $this->plugin->cfg = $this->plugin->getConfig()->getAll(); - $this->plugin->spawns->reload(); - $this->plugin->aliases->reload(); - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Configuration Reloaded.")); + $this->plugin->reload(); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Configuration Reloaded.")); break; } - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); break; default: if($sender->hasPermission("mspawns")){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Subcommand &b" . $args[0] . " &cnot found. Use &b/ms &cto see available commands")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Subcommand &b" . $args[0] . " &cnot found. Use &b/ms &cto see available commands")); break; } - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); break; } return true; } help: if($sender->hasPermission("mspawns")){ - $sender->sendMessage($this->plugin->translateColors("&", "&c>> &6Available Commands &c<<")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/sethub &c>> &6Set hub")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/delhub &c>> &6Delete hub")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/hub &c>> &6Teleport player to hub")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/setspawn &c>> &6Set world spawn")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/delspawn &c>> &6Delete world spawn")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/spawn &c>> &6Teleport player to world spawn")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/setalias &c>> &6Set alias")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/delalias &c>> &6Delete alias")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/ms info &c>> &6Show info about this plugin")); - $sender->sendMessage($this->plugin->translateColors("&", "&6/ms reload &c>> &6Reload the config")); + $sender->sendMessage(TextFormat::colorize("&c>> &6Available Commands &c<<")); + $sender->sendMessage(TextFormat::colorize("&6/sethub &c>> &6Set hub")); + $sender->sendMessage(TextFormat::colorize("&6/delhub &c>> &6Delete hub")); + $sender->sendMessage(TextFormat::colorize("&6/hub &c>> &6Teleport player to hub")); + $sender->sendMessage(TextFormat::colorize("&6/setspawn &c>> &6Set world spawn")); + $sender->sendMessage(TextFormat::colorize("&6/delspawn &c>> &6Delete world spawn")); + $sender->sendMessage(TextFormat::colorize("&6/spawn &c>> &6Teleport player to world spawn")); + $sender->sendMessage(TextFormat::colorize("&6/setalias &c>> &6Set alias")); + $sender->sendMessage(TextFormat::colorize("&6/delalias &c>> &6Delete alias")); + $sender->sendMessage(TextFormat::colorize("&6/ms info &c>> &6Show info about this plugin")); + $sender->sendMessage(TextFormat::colorize("&6/ms reload &c>> &6Reload the config")); return true; } - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); return true; } } diff --git a/src/MSpawns/Commands/DelAlias.php b/src/MSpawns/Commands/DelAlias.php index 87d337a..d69e489 100644 --- a/src/MSpawns/Commands/DelAlias.php +++ b/src/MSpawns/Commands/DelAlias.php @@ -1,25 +1,28 @@ plugin = $plugin; } @@ -28,15 +31,15 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar if($sender->hasPermission("mspawns.delalias")){ if(isset($args[0])){ if($this->plugin->removeAlias($args[0])){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Alias " . $args[0] . " removed")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Alias " . $args[0] . " removed")); }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Alias " . $args[0] . " doesn't exist")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Alias " . $args[0] . " doesn't exist")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Usage /delalias ")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Usage /delalias ")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } return true; } diff --git a/src/MSpawns/Commands/DelHub.php b/src/MSpawns/Commands/DelHub.php index 69c37b4..de76f41 100644 --- a/src/MSpawns/Commands/DelHub.php +++ b/src/MSpawns/Commands/DelHub.php @@ -1,25 +1,28 @@ plugin = $plugin; } @@ -27,12 +30,12 @@ public function __construct(MSpawns $plugin){ public function onCommand(CommandSender $sender, Command $cmd, $label, array $args) : bool { if($sender->hasPermission("mspawns.delhub")){ if($this->plugin->removeHub()){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Hub deleted")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Hub deleted")); }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c No hub set")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c No hub set")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } return true; } diff --git a/src/MSpawns/Commands/DelSpawn.php b/src/MSpawns/Commands/DelSpawn.php index 294c85a..8db805a 100644 --- a/src/MSpawns/Commands/DelSpawn.php +++ b/src/MSpawns/Commands/DelSpawn.php @@ -1,11 +1,10 @@ plugin = $plugin; } @@ -35,16 +38,16 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar $level = $sender->getLevel()->getName(); delspw: if($this->plugin->removeSpawn($level)){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Spawn removed on world &e" . $level)); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Spawn removed on world &e" . $level)); }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c No spawn found on world " . $level)); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c No spawn found on world " . $level)); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Usage /delspawn ")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Usage /delspawn ")); } } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } return true; } diff --git a/src/MSpawns/Commands/Hub.php b/src/MSpawns/Commands/Hub.php index d7699f0..b4394cd 100644 --- a/src/MSpawns/Commands/Hub.php +++ b/src/MSpawns/Commands/Hub.php @@ -1,11 +1,10 @@ plugin = $plugin; @@ -30,26 +33,26 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar if($sender->hasPermission("mspawns.hub")){ switch($this->plugin->teleportToHub($sender)){ case MSpawns::ERR_HUB_INVALID_WORLD: - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $this->plugin->getHubName())))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $this->plugin->getHubName())))); break; case MSpawns::ERR_NO_HUB: - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("no-hub"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $this->plugin->getHubName())))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("no-hub"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $this->plugin->getHubName())))); break; case MSpawns::ERR_HUB_TRANSFER: - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("transfer-error"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $this->plugin->getHubName())))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("transfer-error"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $this->plugin->getHubName())))); break; default: case MSpawns::SUCCESS: if($this->plugin->isHubMessageEnabled()){ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->getFormattedHubMessage($sender))); + $sender->sendMessage(TextFormat::colorize($this->plugin->getFormattedHubMessage($sender))); } break; } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c You can only perform this command as a player")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c You can only perform this command as a player")); } return true; } diff --git a/src/MSpawns/Commands/SetAlias.php b/src/MSpawns/Commands/SetAlias.php index c5484c2..4888070 100644 --- a/src/MSpawns/Commands/SetAlias.php +++ b/src/MSpawns/Commands/SetAlias.php @@ -1,24 +1,27 @@ plugin = $plugin; @@ -28,15 +31,15 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar if($sender->hasPermission("mspawns.setalias")){ if(isset($args[0]) && isset($args[1])){ if($this->plugin->setAlias($args[0], $args[1])){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Alias &e" . $args[0] ."&a set to &e" . $args[1])); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Alias &e" . $args[0] ."&a set to &e" . $args[1])); }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Can't set alias. No spawn found in world " . $args[1])); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Can't set alias. No spawn found in world " . $args[1])); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c Usage /setalias ")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c Usage /setalias ")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } return true; } diff --git a/src/MSpawns/Commands/SetHub.php b/src/MSpawns/Commands/SetHub.php index 06cb7e1..3b6234a 100644 --- a/src/MSpawns/Commands/SetHub.php +++ b/src/MSpawns/Commands/SetHub.php @@ -1,11 +1,10 @@ hasPermission("mspawns.sethub")){ if($this->plugin->isHubExternal()){ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&e Your hub is currently set on an external server. Disable that feature to set a local hub.")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&e Your hub is currently set on an external server. Disable that feature to set a local hub.")); } $this->plugin->setHub($sender->getLevel(), $sender->getX(), $sender->getY(), $sender->getZ(), $sender->getYaw(), $sender->getPitch()); - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Hub set on world &e" . $sender->getLevel()->getName())); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Hub set on world &e" . $sender->getLevel()->getName())); }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c You can only perform this command as a player")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c You can only perform this command as a player")); } return true; } diff --git a/src/MSpawns/Commands/SetSpawn.php b/src/MSpawns/Commands/SetSpawn.php index 6e4e0a2..e460a58 100644 --- a/src/MSpawns/Commands/SetSpawn.php +++ b/src/MSpawns/Commands/SetSpawn.php @@ -1,11 +1,10 @@ plugin = $plugin; @@ -29,12 +32,12 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar if($sender instanceof Player){ if($sender->hasPermission("mspawns.setspawn")){ $this->plugin->setSpawn($sender->getLevel(), $sender->getX(), $sender->getY(), $sender->getZ(), $sender->getYaw(), $sender->getPitch()); - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&a Spawn set on world &e" . $sender->getLevel()->getName())); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&a Spawn set on world &e" . $sender->getLevel()->getName())); }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c You can only perform this command as a player")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c You can only perform this command as a player")); } return true; } diff --git a/src/MSpawns/Commands/Spawn.php b/src/MSpawns/Commands/Spawn.php index 78719e6..a664ddf 100644 --- a/src/MSpawns/Commands/Spawn.php +++ b/src/MSpawns/Commands/Spawn.php @@ -1,11 +1,10 @@ plugin = $plugin; @@ -30,16 +33,16 @@ public function onCommand(CommandSender $sender, Command $cmd, $label, array $ar if($sender->hasPermission("mspawns.spawn")){ if($this->plugin->teleportToSpawn($sender)){ if($this->plugin->isSpawnMessageEnabled()){ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->getFormattedSpawnMessage($sender))); + $sender->sendMessage(TextFormat::colorize($this->plugin->getFormattedSpawnMessage($sender))); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $sender->getLevel()->getName())))); + $sender->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $sender->getName(), "WORLD" => $sender->getLevel()->getName())))); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", "&cYou don't have permissions to use this command")); + $sender->sendMessage(TextFormat::colorize("&cYou don't have permissions to use this command")); } }else{ - $sender->sendMessage($this->plugin->translateColors("&", MSpawns::PREFIX . "&c You can only perform this command as a player")); + $sender->sendMessage(TextFormat::colorize(MSpawns::PREFIX . "&c You can only perform this command as a player")); } return true; } diff --git a/src/MSpawns/EventListener.php b/src/MSpawns/EventListener.php index 5acc79f..58cdeb2 100644 --- a/src/MSpawns/EventListener.php +++ b/src/MSpawns/EventListener.php @@ -1,11 +1,10 @@ plugin = $plugin; @@ -69,28 +70,28 @@ public function onPlayerJoin(PlayerJoinEvent $event){ if($this->plugin->isForceHubEnabled()){ switch($this->plugin->teleportToHub($player)){ case MSpawns::ERR_HUB_INVALID_WORLD: - $player->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $this->plugin->getHubName())))); + $player->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("invalid-world"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $this->plugin->getHubName())))); break; case MSpawns::ERR_NO_HUB: - $player->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("no-hub"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $this->plugin->getHubName())))); + $player->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("no-hub"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $this->plugin->getHubName())))); break; case MSpawns::ERR_HUB_TRANSFER: - $player->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("transfer-error"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $this->plugin->getHubName())))); + $player->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("transfer-error"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $this->plugin->getHubName())))); break; default: case MSpawns::SUCCESS: if($this->plugin->cfg["show-messages-onjoin"] && $this->plugin->isHubMessageEnabled()){ - $player->sendMessage($this->plugin->translateColors("&", $this->plugin->getFormattedHubMessage($player))); + $player->sendMessage(TextFormat::colorize($this->plugin->getFormattedHubMessage($player))); } break; } }else if($this->plugin->isForceSpawnEnabled()){ if($this->plugin->teleportToSpawn($player)){ if($this->plugin->cfg["show-messages-onjoin"] && $this->plugin->isSpawnMessageEnabled()){ - $player->sendMessage($this->plugin->translateColors("&", $this->plugin->getFormattedSpawnMessage($player))); + $player->sendMessage(TextFormat::colorize($this->plugin->getFormattedSpawnMessage($player))); } }else{ - $player->sendMessage($this->plugin->translateColors("&", $this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $player->getLevel())))); + $player->sendMessage(TextFormat::colorize($this->plugin->replaceVars($this->plugin->getMessage("no-spawn"), array("PREFIX" => MSpawns::PREFIX, "PLAYER" => $player->getName(), "WORLD" => $player->getLevel())))); } } } diff --git a/src/MSpawns/MSpawns.php b/src/MSpawns/MSpawns.php index 25ef0fd..8a80c23 100644 --- a/src/MSpawns/MSpawns.php +++ b/src/MSpawns/MSpawns.php @@ -1,11 +1,10 @@ getServer()->getPluginManager()->registerEvents(new EventListener($this), $this); } + /** + * Get MSpawns API + * + * @return MSpawns + */ + public static function getAPI(){ + return self::$instance; + } + + /** + * Get MSpawns version + * + * @return string + */ + public function getVersion(){ + return $this->getVersion(); + } + + /** + * Get MSpawns API version + * + * @return string + */ + public function getAPIVersion(){ + return self::API_VERSION; + } + + /** + * Reload MSpawns configuration + */ + public function reload(){ + $this->reloadConfig(); + $this->cfg = $this->getConfig()->getAll(); + $this->spawns->reload(); + $this->aliases->reload(); + if($this->cfg["enable-aliases"]){ + $this->reloadAliases(); + } + } + /** * Set world spawn *