当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugin::getServer方法代码示例

本文整理汇总了PHP中pocketmine\plugin\Plugin::getServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::getServer方法的具体用法?PHP Plugin::getServer怎么用?PHP Plugin::getServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\plugin\Plugin的用法示例。


在下文中一共展示了Plugin::getServer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(Plugin $plugin)
 {
     $this->plugin = $plugin;
     $config = $this->plugin->getConfig()->get("dataProviderSettings");
     if (!isset($config["host"]) or !isset($config["user"]) or !isset($config["password"]) or !isset($config["database"])) {
         $this->plugin->getLogger()->critical("Invalid MySQL settings");
         $this->plugin->setDataProvider(new DummyDataProvider($this->plugin));
         return;
     }
     $this->database = new \mysqli($config["host"], $config["user"], $config["password"], $config["database"], isset($config["port"]) ? $config["port"] : 3306);
     if ($this->database->connect_error) {
         $this->plugin->getLogger()->critical("Couldn't connect to MySQL: " . $this->database->connect_error);
         $this->plugin->setDataProvider(new DummyDataProvider($this->plugin));
         return;
     }
     $resource = $this->plugin->getResource("mysql.sql");
     $this->database->query(stream_get_contents($resource));
     fclose($resource);
     $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new MySQLPingTask($this->plugin, $this->database), 600);
     // Each 30 seconds
     $this->plugin->getLogger()->info("Connected to MySQL server");
 }
开发者ID:RedstoneAlmeida,项目名称:UUIDAuth,代码行数:22,代码来源:MySQLDataProvider.php

示例2: Execute

 static function Execute(Plugin $owner, $callback, $delay = 1, $mode = 0)
 {
     switch ($mode) {
         case 0:
             return $owner->getServer()->getScheduler()->scheduleDelayedTask(new ExecuteTask($owner, $callback), $delay);
             break;
         case 1:
             return $owner->getServer()->getScheduler()->scheduleRepeatingTask(new ExecuteTask($owner, $callback), $delay);
             break;
     }
 }
开发者ID:GracieWargo,项目名称:PocketMine,代码行数:11,代码来源:ExecuteTask.php

示例3: onLogin

 public function onLogin(PlayerLoginEvent $event)
 {
     $player = $event->getPlayer()->getName();
     $this->plugin->getServer()->getScheduler()->scheduleDelayedTask(new timeoutKickTask($this->plugin, $this, $event->getPlayer()), 20 * $this->db->config["kick-time"]);
     if (strtolower($player) == "config") {
         $event->setKickMessage(TextFormat::RED . $this->db->get("cant-use-this-name"));
         $event->setCancelled();
     }
     if ($this->isLogin($this->getServer()->getPlayer($player))) {
         $event->setKickMessage(TextFormat::RED . $this->db->get("already-login"));
         $event->setCancelled();
         return true;
     }
     if ($this->db->db["config"]["allowsubaccount"] == false) {
         $puuid = $event->getPlayer()->getClientId();
         foreach ($this->db->db as $playername => $key) {
             if (!isset($this->db->db[$playername]["uuid"])) {
                 continue;
             }
             if ($this->db->db[$playername]["uuid"] == $puuid && strtolower($playername) != strtolower($player)) {
                 $event->setKickMessage(TextFormat::RED . str_replace("%player%", $playername, $this->db->get("already-have-account")));
                 $event->setCancelled();
                 break;
             }
         }
     }
 }
开发者ID:pid011,项目名称:SimpleLogin,代码行数:27,代码来源:EventListener.php

示例4: __construct

 public function __construct(Plugin $plugin)
 {
     $this->plugin = $plugin;
     if ($plugin->getServer()->getPluginManager()->getPlugin("SimpleArea") != null) {
         $plugin->getServer()->getPluginManager()->registerEvents($this, $plugin);
     }
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:7,代码来源:OutEventListner.php

示例5: __construct

 public function __construct(Plugin $plugin)
 {
     if ($this->getResultType() !== self::TYPE_RAW and $this->getExpectedColumns() === null) {
         echo "Fatal: Plugin error. ", static::class . " must override getExpectedColumns(), but it didn't. Committing suicide.";
         sleep(604800);
         die;
     }
     $plugin->getServer()->getScheduler()->scheduleAsyncTask($this);
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:9,代码来源:AsyncQuery.php

示例6: __construct

 public function __construct(Plugin $plugin)
 {
     $this->plugin = $plugin;
     if ($plugin->getServer()->getPluginManager()->getPlugin("EDGE") != null) {
         $plugin->getServer()->getPluginManager()->registerEvents($this, $plugin);
         // $this->edge = EDGE::getInstance ();
         $this->edge = $plugin->getServer()->getPluginManager()->getPlugin("EDGE");
         $this->callback = $this->plugin->getServer()->getScheduler()->scheduleRepeatingTask(new EDGEControlTask($this), 20);
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:10,代码来源:EDGEControl.php

示例7: getCommonVars

 /**
  * If GrabBag is available, try to get a single shared instance of
  * ExpandVars
  */
 public static function getCommonVars(Plugin $owner)
 {
     $pm = $owner->getServer()->getPluginManager();
     if (($gb = $pm->getPlugin("GrabBag")) !== null) {
         if ($gb->isEnabled() && MPMU::apiCheck($gb->getDescription()->getVersion(), "2.3")) {
             $vars = $gb->api->getVars();
             if ($vars instanceof ExpandVars) {
                 return $vars;
             }
         }
     }
     return new ExpandVars($owner);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:17,代码来源:ExpandVars.php

示例8: __construct

 public function __construct(Plugin $owner, $Level, $Mode)
 {
     $this->Task = new PopupInfoTask($owner, $Level, $this, $Mode);
     $owner->getServer()->getScheduler()->scheduleRepeatingTask($this->Task, 7);
 }
开发者ID:SuperAdam47,项目名称:BedWarsPE,代码行数:5,代码来源:PopupInfo.php

示例9: TP

 static function TP(Plugin $owner, Player $Target, Position $Position, $delay = 1)
 {
     return $owner->getServer()->getScheduler()->scheduleDelayedTask(new TPTask($owner, $Target, $Position), $delay);
 }
开发者ID:SuperAdam47,项目名称:BedWarsPE,代码行数:4,代码来源:TPTask.php

示例10: breakSignLater

 public static function breakSignLater(Plugin $plugin, Sign $tile, $ticks = 5)
 {
     $plugin->getServer()->getScheduler()->scheduleDelayedTask(new PluginCallbackTask($this, [self::class, "breakSign"], [$tile]), $ticks);
 }
开发者ID:PocketMine-PHP7,项目名称:KillRate-PHP7,代码行数:4,代码来源:SignUtils.php

示例11: add

 /**
  * Register a permission on the fly...
  * @param Plugin $plugin - owning plugin
  * @param str $name - permission name
  * @param str $desc - permission description
  * @param str $default - one of true,false,op,notop
  */
 public static function add(Plugin $plugin, $name, $desc, $default)
 {
     $perm = new Permission($name, $desc, $default);
     $plugin->getServer()->getPluginManager()->addPermission($perm);
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:12,代码来源:PermUtils.php


注:本文中的pocketmine\plugin\Plugin::getServer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。