diff --git a/src/API/EntityAPI.php b/src/API/EntityAPI.php index fec603a8..a4366886 100644 --- a/src/API/EntityAPI.php +++ b/src/API/EntityAPI.php @@ -185,7 +185,7 @@ class EntityAPI{ $pk = new RemovePlayerPacket; $pk->eid = $eid; $pk->clientID = 0; - $this->server->api->player->broadcastPacket($this->entities[$eid]->level->players, $pk); + $this->server->api->player->broadcastPacket($this->server->api->player->getAll(), $pk); }else{ $pk = new RemoveEntityPacket; $pk->eid = $eid; diff --git a/src/API/PluginAPI.php b/src/API/PluginAPI.php index 91b1b514..f8b87aa8 100644 --- a/src/API/PluginAPI.php +++ b/src/API/PluginAPI.php @@ -147,7 +147,7 @@ class PluginAPI extends stdClass{ console("[INFO] Loading PHAR plugin \"".FORMAT_GREEN.$pluginInfo["name"].FORMAT_RESET."\" ".FORMAT_AQUA.$pluginInfo["version"].FORMAT_RESET." by ".FORMAT_AQUA.$pluginInfo["author"].FORMAT_RESET); $aver = CURRENT_API_VERSION; - if($pluginInfo["api"] != $aver){ + if(!in_array((string) CURRENT_API_VERSION, $pluginInfo["api"])){ console("[WARNING] API is not the same as Core, might cause bugs({$pluginInfo["api"]} != {$aver})"); } diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 1ceaee07..3d6c1164 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -118,7 +118,7 @@ class PocketMinecraftServer{ $this->saveEnabled = true; $this->api->level->saveAll(); $this->saveEnabled = $save; - $this->send2Discord('[INFO] Server stopped!'); + //$this->send2Discord('[INFO] Server stopped!'); } public function startDatabase(){ @@ -203,7 +203,8 @@ class PocketMinecraftServer{ } if(($this->api instanceof ServerAPI) === true){ if(($this->api->chat instanceof ChatAPI) === true){ - $this->api->chat->broadcast("Stopping server..."); + $this->api->chat->send(false, "Stopping server..."); + new StopMessageThread($this, "[INFO] Stopping server..."); //broadcast didnt want to send message to discord for some reason } } $this->stop = true; diff --git a/src/plugin/phar/PharUtils.php b/src/plugin/phar/PharUtils.php index 6aaea321..07ae80b7 100644 --- a/src/plugin/phar/PharUtils.php +++ b/src/plugin/phar/PharUtils.php @@ -19,7 +19,7 @@ class PharUtils{ $pluginData["version"] = trim($content["version"]); $pluginData["author"] = trim($content["author"]); $pluginData["mainFile"] = trim($content["mainFile"]); - $pluginData["api"] = trim($content["api"]); + $pluginData["api"] = explode(",", trim($content["api"])); $pluginData["classLoader"] = trim($content["classLoader"]); $pluginData["CLClass"] = self::getNameSpaceClass($pluginData["classLoader"]); return $pluginData; diff --git a/src/utils/StopMessageThread.php b/src/utils/StopMessageThread.php new file mode 100644 index 00000000..5e23086a --- /dev/null +++ b/src/utils/StopMessageThread.php @@ -0,0 +1,21 @@ +extraprops->get("discord-msg") == true and ($this->page = $server->extraprops->get("discord-webhook-url")) !== "none"){ + $this->msg = $server->extraprops->get("discord-ru-smiles") ? str_replace("@", " ", str_replace("Û", "<:ru_cool:960113011383738369>", str_replace("Ü", "<:ru_cry:960112920346390548>", str_replace("Ú", "<:ru_happy:960112868601237504>", $msg)))) : str_replace("@", "", $msg); + $this->name = $server->extraprops->get("discord-bot-name"); + $this->start(); + } + + } + + public function run(){ + Utils::curl_post($this->page, [ + "username" => $this->name, + "content" => $this->msg + ]); + } +} \ No newline at end of file