mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
players are now invisible in spectator, methods for making player invisible added
This commit is contained in:
parent
c03653a050
commit
905192f9bf
3 changed files with 28 additions and 27 deletions
|
|
@ -145,7 +145,6 @@ class ServerAPI{
|
||||||
|
|
||||||
$this->loadProperties();
|
$this->loadProperties();
|
||||||
|
|
||||||
|
|
||||||
$this->loadAPI("console", "ConsoleAPI");
|
$this->loadAPI("console", "ConsoleAPI");
|
||||||
$this->loadAPI("level", "LevelAPI");
|
$this->loadAPI("level", "LevelAPI");
|
||||||
$this->loadAPI("block", "BlockAPI");
|
$this->loadAPI("block", "BlockAPI");
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class PocketMinecraftServer{
|
||||||
$this->serverip = $serverip;
|
$this->serverip = $serverip;
|
||||||
$this->load();
|
$this->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function load(){
|
private function load(){
|
||||||
global $dolog;
|
global $dolog;
|
||||||
|
|
||||||
|
|
@ -94,18 +95,20 @@ class PocketMinecraftServer{
|
||||||
}
|
}
|
||||||
}elseif($this->extraprops->get("version") == null){
|
}elseif($this->extraprops->get("version") == null){
|
||||||
console("[WARNING] Your extra.properties file is corrupted!");
|
console("[WARNING] Your extra.properties file is corrupted!");
|
||||||
console("To fix it - just remove it! Server will generate it again automatically.");
|
console("[WARNING] To fix it - just remove it! Server will generate it again automatically.");
|
||||||
}
|
}
|
||||||
$dolog = $this->extraprops->get("save-console-data");
|
$dolog = $this->extraprops->get("save-console-data");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onShutdown(){
|
public function onShutdown(){
|
||||||
console("Saving...");
|
console("[INFO] Saving...");
|
||||||
$save = $this->saveEnabled;
|
$save = $this->saveEnabled;
|
||||||
$this->saveEnabled = true;
|
$this->saveEnabled = true;
|
||||||
$this->api->level->saveAll();
|
$this->api->level->saveAll();
|
||||||
$this->saveEnabled = $save;
|
$this->saveEnabled = $save;
|
||||||
console("Shutting Down...");
|
$this->send2Discord('[INFO] Server stopped!');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startDatabase(){
|
public function startDatabase(){
|
||||||
$this->preparedSQL = new stdClass();
|
$this->preparedSQL = new stdClass();
|
||||||
$this->preparedSQL->entity = new stdClass();
|
$this->preparedSQL->entity = new stdClass();
|
||||||
|
|
@ -146,12 +149,11 @@ class PocketMinecraftServer{
|
||||||
$this->serverType = "MCCPP;MINECON;";
|
$this->serverType = "MCCPP;MINECON;";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function titleTick(){
|
public function titleTick(){
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
if(defined("DEBUG") and DEBUG >= 0 and ENABLE_ANSI === true){
|
if(defined("DEBUG") and DEBUG >= 0){
|
||||||
echo "\x1b]0;NostalgiaCore " . MAJOR_VERSION . " | Online " . count($this->clients) . "/" . $this->maxClients . " | RAM " . round((memory_get_usage() / 1024) / 1024, 2) . "MB | U " . round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2) . " D " . round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2) . " kB/s | TPS " . $this->getTPS() . "\x07";
|
echo "\x1b]0;NostalgiaCore " . MAJOR_VERSION . " | Online " . count($this->clients) . "/" . $this->maxClients . " | RAM " . round((memory_get_usage() / 1024) / 1024, 2) . "MB | U " . round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2) . " D " . round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2) . " kB/s | TPS " . $this->getTPS() . "\x07";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,7 +183,6 @@ class PocketMinecraftServer{
|
||||||
* @param string $reason
|
* @param string $reason
|
||||||
*/
|
*/
|
||||||
public function close($reason = "server stop"){
|
public function close($reason = "server stop"){
|
||||||
$this->send2Discord('[INFO] Server stopped!');
|
|
||||||
usleep(2);
|
usleep(2);
|
||||||
$this->onShutdown();
|
$this->onShutdown();
|
||||||
if($this->stop !== true){
|
if($this->stop !== true){
|
||||||
|
|
|
||||||
|
|
@ -644,27 +644,28 @@ class Utils{
|
||||||
|
|
||||||
public static function writeLong($value){
|
public static function writeLong($value){
|
||||||
$x = "";
|
$x = "";
|
||||||
if(strval($value[0] == null ? '' : $value[0]) === "-"){
|
if(!is_float($value)){
|
||||||
$negative = true;
|
if(strval($value[0] == null ? '' : $value[0]) === "-"){
|
||||||
$value = bcadd($value, "1");
|
$negative = true;
|
||||||
if(strval($value[0]) === "-"){
|
$value = bcadd($value, "1");
|
||||||
$value = substr($value, 1);
|
if(strval($value[0]) === "-"){
|
||||||
}
|
$value = substr($value, 1);
|
||||||
}else{
|
}
|
||||||
$negative = false;
|
}else{
|
||||||
}
|
$negative = false;
|
||||||
while(bccomp($value, "0", 0) > 0){
|
}
|
||||||
$temp = bcmod($value, "16777216");
|
while(bccomp($value, "0", 0) > 0){
|
||||||
$x = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $x;
|
$temp = bcmod($value, "16777216");
|
||||||
$value = bcdiv($value, "16777216", 0);
|
$x = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $x;
|
||||||
}
|
$value = bcdiv($value, "16777216", 0);
|
||||||
$x = str_pad(substr($x, 0, 8), 8, "\x00", STR_PAD_LEFT);
|
}
|
||||||
if($negative === true){
|
$x = str_pad(substr($x, 0, 8), 8, "\x00", STR_PAD_LEFT);
|
||||||
$x = ~$x;
|
if($negative === true){
|
||||||
}
|
$x = ~$x;
|
||||||
return $x;
|
}
|
||||||
|
return $x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(Utils::isOnline() === false){
|
//if(Utils::isOnline() === false){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue