Exemple #1
0
 public function onEnable()
 {
     self::$instance = $this;
     $folder = $this->getDataFolder();
     if (!is_dir($folder)) {
         mkdir($folder);
     }
     if (!is_dir($folder . "worlds")) {
         mkdir($folder . "worlds");
     }
     Generator::addGenerator(MyPlotGenerator::class, "myplot");
     $this->saveDefaultConfig();
     $this->reloadConfig();
     $this->getLogger()->info(TextFormat::GREEN . "Loading the Plot Framework!");
     $this->getLogger()->warning(TextFormat::YELLOW . "It seems that you are running the development build of MyPlot! Thats cool, but it CAN be very, very buggy! Just be careful when using this plugin and report any issues to" . TextFormat::GOLD . " http://github.com/wiez/MyPlot/issues");
     $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
     $this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
     switch (strtolower($this->getConfig()->get("DataProvider"))) {
         case "sqlite":
         default:
             $this->dataProvider = new SQLiteDataProvider($this);
             break;
     }
     if ($this->getConfig()->get("UseEconomy") == true) {
         if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
             $this->economyProvider = new EconomySProvider();
         } elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
             $this->economyProvider = new PocketMoneyProvider($plugin);
         } else {
             $this->economyProvider = null;
         }
     } else {
         $this->economyProvider = null;
     }
 }
Exemple #2
0
 public function onEnable()
 {
     $this->getLogger()->info("Loading MyPlot");
     self::$instance = $this;
     $this->saveDefaultConfig();
     $this->reloadConfig();
     @mkdir($this->getDataFolder());
     @mkdir($this->getDataFolder() . "worlds");
     Generator::addGenerator(MyPlotGenerator::class, "myplot");
     $lang = $this->getConfig()->get("language", BaseLang::FALLBACK_LANGUAGE);
     $this->baseLang = new BaseLang($lang, $this->getFile() . "resources/");
     // Initialize DataProvider
     $cacheSize = $this->getConfig()->get("PlotCacheSize");
     switch (strtolower($this->getConfig()->get("DataProvider"))) {
         case "sqlite":
         default:
             $this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
             break;
     }
     // Initialize EconomyProvider
     if ($this->getConfig()->get("UseEconomy") == true) {
         if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
             $this->economyProvider = new EconomySProvider();
         } elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
             $this->economyProvider = new PocketMoneyProvider($plugin);
         }
     }
     $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
     $this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
 }
Exemple #3
0
 public function onEnable()
 {
     self::$instance = $this;
     $folder = $this->getDataFolder();
     if (!is_dir($folder)) {
         mkdir($folder);
     }
     if (!is_dir($folder . "worlds")) {
         mkdir($folder . "worlds");
     }
     Generator::addGenerator(MyPlotGenerator::class, "myplot");
     $this->saveDefaultConfig();
     $this->reloadConfig();
     $this->getLogger()->info(TextFormat::GREEN . "Loading the Plot Framework!");
     $this->getLogger()->warning(TextFormat::YELLOW . "It seems that you are running the development build of MyPlot! Thats cool, but it CAN be very, very buggy! Just be careful when using this plugin and report any issues to" . TextFormat::GOLD . " http://github.com/wiez/MyPlot/issues");
     $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
     $this->getServer()->getCommandMap()->register(Commands::class, new Commands($this));
     $cacheSize = $this->getConfig()->get("PlotCacheSize");
     $cacheAll = $this->getConfig()->get("CacheAllPlots") == true;
     switch (strtolower($this->getConfig()->get("DataProvider"))) {
         case "sqlite":
             die("sqlite not supported for myplot in this fork");
             $this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
             break;
         default:
             die("only mysql supported for myplot in this fork");
             $this->dataProvider = new SQLiteDataProvider($this, $cacheSize);
             break;
         case "mysql":
             $this->dataProvider = new MYSQLDataProvider($this, $cacheSize, $cacheAll);
             break;
     }
     if ($this->getConfig()->get("UseEconomy") == true) {
         if ($this->getServer()->getPluginManager()->getPlugin("EconomyAPI") !== null) {
             $this->economyProvider = new EconomySProvider();
         } elseif (($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
             $this->economyProvider = new PocketMoneyProvider($plugin);
         } else {
             $this->economyProvider = null;
         }
     } else {
         $this->economyProvider = null;
     }
     $this->usesVotingAPI = false;
     if ($this->getConfig()->get("UseMPServers_voting") == true) {
         $this->usesVotingAPI = true;
         $apiKey = $this->getConfig()->get("MPServers_voting_API_key");
         $votingURL = $this->getConfig()->get("MPServers_voting_direct_URL");
         $freePlotsBeforeVoting = $this->getConfig()->get("FreePlotsBeforeVoting");
         $this->votingProvider = new VotingProvider($this, $apiKey, $freePlotsBeforeVoting, $votingURL);
     }
     $bcPlugin = $this->getServer()->getPluginManager()->getPlugin("BuddyChannels");
     if (!is_null($bcPlugin)) {
         $chatFormatter = new \MyPlot\ChatMessageFormatter($this);
     }
 }