mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
Enhancing discord bridge
This commit is contained in:
parent
113ecd1edc
commit
6f50beeeb5
5 changed files with 6 additions and 5 deletions
|
|
@ -109,6 +109,7 @@ class ChatAPI{
|
||||||
*/
|
*/
|
||||||
public function broadcast($message){
|
public function broadcast($message){
|
||||||
$this->send(false, $message);
|
$this->send(false, $message);
|
||||||
|
$this->server->send2Discord($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ class PlayerAPI{
|
||||||
$this->server->api->console->alias("lag", "ping");
|
$this->server->api->console->alias("lag", "ping");
|
||||||
$this->server->api->console->alias("suicide", "kill");
|
$this->server->api->console->alias("suicide", "kill");
|
||||||
$this->server->api->console->alias("tppos", "tp");
|
$this->server->api->console->alias("tppos", "tp");
|
||||||
|
$this->server->api->console->alias("who", "list");
|
||||||
$this->server->api->ban->cmdWhitelist("list");
|
$this->server->api->ban->cmdWhitelist("list");
|
||||||
$this->server->api->ban->cmdWhitelist("ping");
|
$this->server->api->ban->cmdWhitelist("ping");
|
||||||
$this->server->api->ban->cmdWhitelist("spawn");
|
$this->server->api->ban->cmdWhitelist("spawn");
|
||||||
|
|
@ -110,7 +111,6 @@ class PlayerAPI{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->server->api->chat->broadcast($data["player"]->username . $message);
|
$this->server->api->chat->broadcast($data["player"]->username . $message);
|
||||||
$this->server->send2Discord($data["player"]->username . $message);
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@ class ServerAPI{
|
||||||
$this->server = new PocketMinecraftServer($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed:false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0");
|
$this->server = new PocketMinecraftServer($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed:false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0");
|
||||||
$this->server->api = $this;
|
$this->server->api = $this;
|
||||||
self::$serverRequest = $this->server;
|
self::$serverRequest = $this->server;
|
||||||
|
$this->server->send2Discord("[INFO] Starting Minecraft PE server version ".CURRENT_MINECRAFT_VERSION);
|
||||||
console("[INFO] This server is running NostalgiaCore version ".($version->isDev() ? FORMAT_YELLOW:"").MAJOR_VERSION.FORMAT_RESET." \"".CODENAME."\" (MCPE: ".CURRENT_MINECRAFT_VERSION.") (API ".CURRENT_API_VERSION.")", true, true, 0);
|
console("[INFO] This server is running NostalgiaCore version ".($version->isDev() ? FORMAT_YELLOW:"").MAJOR_VERSION.FORMAT_RESET." \"".CODENAME."\" (MCPE: ".CURRENT_MINECRAFT_VERSION.") (API ".CURRENT_API_VERSION.")", true, true, 0);
|
||||||
console("[INFO] NostalgiaCore is distributed under the LGPL License", true, true, 0);
|
console("[INFO] NostalgiaCore is distributed under the LGPL License", true, true, 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -303,11 +303,10 @@ class Player{
|
||||||
$this->ackQueue = array();
|
$this->ackQueue = array();
|
||||||
$this->server->api->player->remove($this->CID);
|
$this->server->api->player->remove($this->CID);
|
||||||
if($msg === true and $this->username != "" and $this->spawned !== false){
|
if($msg === true and $this->username != "" and $this->spawned !== false){
|
||||||
$this->server->api->chat->broadcast($this->username." left the game");
|
$this->server->api->chat->broadcast($this->username." left the game: ".$reason);
|
||||||
}
|
}
|
||||||
$this->spawned = false;
|
$this->spawned = false;
|
||||||
console("[INFO] ".FORMAT_AQUA.$this->username.FORMAT_RESET."[/".$this->ip.":".$this->port."] logged out due to ".$reason);
|
console("[INFO] ".FORMAT_AQUA.$this->username.FORMAT_RESET."[/".$this->ip.":".$this->port."] logged out due to ".$reason);
|
||||||
$this->server->send2Discord($this->username . " left the game: ".$reason);
|
|
||||||
$this->windows = array();
|
$this->windows = array();
|
||||||
$this->armor = array();
|
$this->armor = array();
|
||||||
$this->inventory = array();
|
$this->inventory = array();
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ class PocketMinecraftServer{
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($POST));
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($POST));
|
||||||
$response = curl_exec($ch)
|
$response = curl_exec($ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue