Added API Version check

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-04 19:39:00 +01:00
parent 4f0517a5a7
commit 719dff6e3c
2 changed files with 5 additions and 1 deletions

View File

@ -84,8 +84,11 @@ class PluginAPI extends stdClass{
console("[ERROR] [PluginAPI] Failed loading plugin: evaluation error");
}
$className = trim($info["class"]);
if(!isset($info["apiversion"]) or intval($info["apiversion"]) < CURRENT_API_VERSION){
console("[ERROR] [PluginAPI] Plugin \"".$info["name"]."\" uses an outdated API! It can crash or corrupt the server!");
}
if(isset($info["api"]) and $info["api"] !== true){
console("[NOTICE] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" got raw access to Server methods");
console("[INFO] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" got raw access to Server methods");
}
$object = new $className($this->server->api, ((isset($info["api"]) and $info["api"] !== true) ? $this->server:false));
if(!($object instanceof Plugin)){

View File

@ -42,4 +42,5 @@ define("MAJOR_VERSION", "Alpha_1.2dev");
define("CURRENT_STRUCTURE", 5);
define("CURRENT_PROTOCOL", 9);
define("CURRENT_MINECRAFT_VERSION", "v0.6.1 alpha");
define("CURRENT_API_VERSION", 1);
define("CURRENT_PHP_VERSION", "5.4.11");