Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Outdated AutoPost Plugin 1.1

Allows you to set messages to be displayed after so many minutes.

  1. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    It may just be outdated.
  2. 0becca0
    Offline

    0becca0 New Member

    Joined:
    Oct 4, 2013
    Posts:
    133
    Minecraft User:
    0becca0
    it doesnt let the server start, it crashes it imediately. I cant figufe out why im really reallyyyy noob at php
  3. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    As I said, the plugin may be outdated and probably doesn't work with the latest API, as some things have changed in the latest build.
  4. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
  5. MarcusRocks56
    Offline

    MarcusRocks56 New Member

    Joined:
    Jun 18, 2014
    Posts:
    9
    Minecraft User:
    MarcusRocks56
    PLZ HELP WHEN I INSTALLED THE AUTOPOST PLUGIN IT GAVE ME THIS ERROR




    __PocketMine Plugin__
    name=AutoPostBot
    version=1.1
    author=Antinty
    class=AutoPostBot
    apiversion=9
    */

    class AutoPostBot implements plugin {

    private $api, $server;
    private $config;
    private $nr = 0;
    private $interval;

    public function __construct(ServerAPI $api, $server = false) {
    $this->api = $api;
    $this->server = ServerAPI::request();
    }

    public function __destruct() {
    $this->config->save();
    }

    public function init() {
    $this->config = new Config($this->api->plugin->configPath($this) . "config.yml", CONFIG_YAML, array('interval' => 1, 'messages' => array("Example message")));
    $this->interval = $this->config->get("interval");
    $this->api->schedule(20 * 60 * $this->interval, array($this, "msg"), array(), false);
    $this->api->console->register('autopost', "AutoPost Bot", array($this, 'commandHandler'));
    }

    public function msg() {
    $messagesArray = $this->config->get("messages");
    if (count($messagesArray) > 1) {
    $message = $messagesArray[$this->nr];
    $this->api->chat->broadcast("[AutoPost Bot] " . $message);
    if ($this->nr < count($messagesArray)-1) {
    $this->nr++;
    } else {
    $this->nr = 0;
    }
    }
    $this->api->schedule(20 * 60 * $this->interval, array($this, "msg"), array(), false);
    }

    public function commandHandler($cmd, $params, $issuer, $alias) {
    $c = array_shift($params);
    if($c === 'add' && isset($params)){
    $s = implode(" ",$params);
    $a = $this->config->get("messages");
    array_push($a,$s);
    $this->saveConfig("messages",$a);
    console("Message added");
    } else if($c === 'del' && isset($params)){
    $n = implode(" ",$params);
    $a = $this->config->get("messages");
    array_splice($a, (int)$params, 1);
    $this->saveConfig("messages",$a);
    console("Deleted message");
    } else if($c === 'time' && isset($params)){
    $n = implode(" ",$params);
    $this->saveConfig("interval",(int)$n);
    $this->interval = (int)$n;
    console("Interval changed to ".(int)$n." minutes");
    } else {
    $i = 0;
    console("\tAutoPost Bot Usage:\nAdd new message:\tautopost add <text>\nRemove a message:\tautopost del <nr>\nChange interval:\ttimeautopost time <nr>");
    foreach($this->config->get("messages") as $m) {
    console($i . ". " . $m);
    $i++;
    }
    }
    }

    public function saveConfig($k,$v) {
    $this->config->set($k,$v);
    $this->config->save();
    }
    }
    ?>04:50:13 [WARNING] Plugin "AutoPostBot" may not be compatible with the API (9 != 12)! It can crash or corrupt the server!

    Fatal error: Class 'autopostbot' not found in C:\Users\MaKayla\Desktop\PocketMine-MP\src\API\PluginAPI.php on line 109
    bin\php\php.exe: Exit 255

Share This Page

Advertisement