Overview

Namespaces

  • aliuly
    • common
      • selectors
    • loader
  • xPaw

Classes

  • aliuly\common\ArmorItems
  • aliuly\common\BasicCli
  • aliuly\common\BasicHelp
  • aliuly\common\BasicPlugin
  • aliuly\common\ChatSession
  • aliuly\common\Cmd
  • aliuly\common\CmdSelector
  • aliuly\common\ExpandVars
  • aliuly\common\FastTransfer
  • aliuly\common\FileUtils
  • aliuly\common\FreezeSession
  • aliuly\common\GetMotd
  • aliuly\common\GetMotdAsyncTask
  • aliuly\common\InvisibleSession
  • aliuly\common\InvUtils
  • aliuly\common\ItemName
  • aliuly\common\mc
  • aliuly\common\mc2
  • aliuly\common\MoneyAPI
  • aliuly\common\MPMU
  • aliuly\common\Npc
  • aliuly\common\PermUtils
  • aliuly\common\PluginAsyncTask
  • aliuly\common\PluginCallbackTask
  • aliuly\common\PMScript
  • aliuly\common\QueryAsyncTask
  • aliuly\common\Rcon
  • aliuly\common\RconTask
  • aliuly\common\selectors\All
  • aliuly\common\selectors\AllEntity
  • aliuly\common\selectors\BaseSelector
  • aliuly\common\selectors\Random
  • aliuly\common\Session
  • aliuly\common\ShieldSession
  • aliuly\common\ShoppingCart
  • aliuly\common\SignUtils
  • aliuly\common\SkinUtils
  • aliuly\common\SpySession
  • aliuly\common\SubCommandMap
  • aliuly\common\TPUtils
  • aliuly\loader\Main
  • xPaw\MinecraftQuery

Exceptions

  • xPaw\MinecraftQueryException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace aliuly\common;
 3: 
 4: use pocketmine\utils\TextFormat;
 5: use aliuly\common\mc;
 6: 
 7: /**
 8:  * Very PocketMine-MP specific extension to the mc package
 9:  */
10: abstract class mc2 {
11:     /**
12:      * Checks message files and nags the user to submit translations...
13:      *
14:      * @param Plugin $plugin - owning plugin
15:      * @param str $path - output of $plugin->getFile()
16:      * @return int|false - false on error or the number of messages loaded
17:      */
18:     public static function plugin_init_alt($plugin,$path) {
19:         $lang = $plugin->getServer()->getProperty("settings.language");
20:         if (mc::plugin_init($plugin,$path) === false && $lang != "eng") {
21:             list($fp,$fill) = [$plugin->getResource("messages/eng.ini"),"English"];
22:             if ($fp === null) list($fp,$fill) = [ $plugin->getResource("messages/messages.ini"),"EMPTY"];
23:             if ($fp === null) return false;
24:             file_put_contents($plugin->getDataFolder()."messages.ini",stream_get_contents($fp)."\n\"<nagme>\"=\"yes\"\n");
25:             mc::plugin_init($plugin,$path);
26:             $plugin->getLogger()->error(TextFormat::RED."Your selected language \"".$lang."\" is not supported");
27:             $plugin->getLogger()->error(TextFormat::YELLOW."Creating a custom \"messages.ini\" with ".$fill." strings");
28:             $plugin->getLogger()->error(TextFormat::AQUA."Please consider translating and submitting a translation");
29:             $plugin->getLogger()->error(TextFormat::AQUA."to the developer");
30:             $plugin->getLogger()->error(TextFormat::YELLOW."If you later change your language in \"pocketmine.yml\"");
31:             $plugin->getLogger()->error(TextFormat::YELLOW."make sure you delete this \"messages.ini\"");
32:             $plugin->getLogger()->error(TextFormat::YELLOW."otherwise your changes will not be recognized");
33:             return;
34:         }
35:         if (mc::_("<nagme>") !== "yes") return;
36: 
37:         // Potentially the language may exists since this was created...
38:         $fp = $plugin->getResource("messages/".$lang.".ini");
39:         if($fp === null && $lang != "eng"){
40:             $plugin->getLogger()->error(TextFormat::RED."Your selected language \"".$lang."\" is not supported");
41:             $plugin->getLogger()->error(TextFormat::AQUA."Please consider translating \"messages.ini\"");
42:             $plugin->getLogger()->error(TextFormat::AQUA."and submitting a translation to the  developer");
43:             return;
44:         }
45:         if ($fp !== null) fclose($fp);
46:         // This language is actually supported...
47:         $plugin->getLogger()->error(TextFormat::RED."Using a supported language: \"".$lang."\"");
48:         $plugin->getLogger()->error(TextFormat::YELLOW."Saving/Fixing \"messages.ini\" as");
49:         $plugin->getLogger()->error(TextFormat::YELLOW."\"messages.bak\"...");
50:         $orig = file_get_contents($plugin->getDataFolder()."messages.ini");
51:         file_put_contents($plugin->getDataFolder()."messages.bak",strtr($orig,["<nagme>"=>"<don't nagme>"]));
52:         unlink($plugin->getDataFolder()."messages.ini");
53:     }
54: }
55: 
API documentation generated by ApiGen