mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
applied some fixes
This commit is contained in:
parent
d60258097d
commit
86797da84b
5 changed files with 27 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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})");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
21
src/utils/StopMessageThread.php
Normal file
21
src/utils/StopMessageThread.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
class StopMessageThread extends Thread
|
||||
{
|
||||
private $page, $msg;
|
||||
public function __construct(PocketMinecraftServer $server, $msg){
|
||||
if($server->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
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue