addAttribute() public static method

public static addAttribute ( integer $id, string $name, float $minValue, float $maxValue, float $defaultValue, boolean $shouldSend = true ) : Attribute
$id integer
$name string
$minValue float
$maxValue float
$defaultValue float
$shouldSend boolean
return Attribute
Example #1
0
 public function __construct(Plugin $plugin)
 {
     $this->plugin = $plugin;
     $this->db = PluginData::getInstance();
     $this->listenerloader = ListenerLoader::getInstance();
     $this->server = Server::getInstance();
     $this->attributeprovider = AttributeProvider::getInstance();
     Attribute::addAttribute(3, "player.hunger", 0, 20, 20, true);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new HungerTask($this), 80);
     $this->getServer()->getPluginManager()->registerEvents($this, $plugin);
 }
Example #2
0
 public function onEnable()
 {
     @mkdir($this->getDataFolder());
     self::$instance = $this;
     self::$translation = (new Config($this->getDataFolder() . "translation.yml", Config::YAML, yaml_parse(stream_get_contents($this->getResource("translation.yml")))))->getAll();
     self::$configuration = (new Config($this->getDataFolder() . "config.yml", Config::YAML))->getAll();
     self::$pvpEnabled = self::getConfiguration("pvp-enabled", false);
     XcelUpdater::chkUpdate($this);
     $this->players = [];
     JobManager::registerJob(new JobAdventure());
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new HealTask($this), 1200);
     $this->getServer()->getScheduler()->scheduleRepeatingTask(new UITask($this), 15);
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $autoSaveTerm = self::getConfiguration("auto-save", 10);
     if ($autoSaveTerm < 0) {
         $this->getLogger()->alert(TextFormat::YELLOW . "Auto save turned-off!");
     } else {
         $this->getServer()->getScheduler()->scheduleRepeatingTask(new AutoSaveTask($this), $autoSaveTerm * 60 * 20);
     }
     Attribute::addAttribute(self::ATTRIBUTE_HUNGER, "player.huger", 0, 20, 20, true);
 }