Exemplo n.º 1
0
 public function onRun($tick)
 {
     if ($this->getPlugin()->getConfig()->get("auto-update-checker") !== false) {
         $this->getPlugin()->getLogger()->info("Checking for update..");
         $updatechecker = new UpdateChecker($this->getPlugin(), $this->getPlugin()->getConfig()->get("default-channel"));
         $updatechecker->checkUpdate();
     }
 }
Exemplo n.º 2
0
 public function onEnable()
 {
     $this->getLogger()->info("Loading configurations..");
     if (!is_dir($this->getDataFolder())) {
         mkdir($this->getDataFolder());
     }
     $this->saveDefaultConfig();
     if ($this->getConfig()->get("v") != $this::VERSION_STRING) {
         unlink($this->getDataFolder() . "config.yml");
         $this->saveDefaultConfig();
     }
     $this->reloadConfig();
     $this->data = new Config($this->getDataFolder() . "players.yml", Config::YAML, array());
     $this->data2 = new Config($this->getDataFolder() . "jails.yml", Config::YAML, array());
     self::$instance = $this;
     $this->getLogger()->info("Checking for update..");
     try {
         $updatechecker = new UpdateChecker($this, $this->getConfig()->get("default-channel"));
         $updatechecker->checkUpdate();
     } catch (Exception $e) {
         echo "Unable to check update! Error: {$e}";
     }
     $this->getLogger()->info("Loading economy plugins..");
     $plugins = ["EconomyAPI", "PocketMoney", "MassiveEconomy"];
     foreach ($plugins as $plugin_name) {
         $plugin = $this->getServer()->getPluginManager()->getPlugin($plugin_name);
         if ($plugin !== null && $this->eco === null) {
             $this->eco = $plugin;
             $this->getLogger()->info("Loaded with " . $plugin_name . "!");
         }
     }
     if ($this->eco === null) {
         $this->getLogger()->info("No economy plugin found!");
     }
     $this->getLogger()->info("Loading plugin..");
     $this->getCommand("jail")->setExecutor(new JailCommand($this));
     $this->getCommand("unjail")->setExecutor(new UnjailCommand($this));
     $this->getCommand("setjail")->setExecutor(new SetjailCommand($this));
     $this->getCommand("deljail")->setExecutor(new DeljailCommand($this));
     $this->getCommand("jailed")->setExecutor(new JailedCommand($this));
     $this->getCommand("jails")->setExecutor(new JailsCommand($this));
     $this->getCommand("jailtp")->setExecutor(new JailtpCommand($this));
     $this->getCommand("bail")->setExecutor(new BailCommand($this));
     $this->getServer()->getPluginManager()->registerEvents(new PlayerListener($this), $this);
     $this->getServer()->getPluginManager()->registerEvents(new BlockListener($this), $this);
     $this->getServer()->getPluginManager()->registerEvents(new EntityListener($this), $this);
     $this->getServer()->getPluginManager()->registerEvents(new SignPlayerListener($this), $this);
     $this->getServer()->getPluginManager()->registerEvents(new SignBlockListener($this), $this);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new Timer($this), 20);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new TipBroadcaster($this), 10);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new UpdateCheckingTask($this), $this->getConfig()->get("check-update-time") * 1200);
     $this->getLogger()->info($this->colourMessage("&aLoaded Successfully!"));
 }