mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
PMF & Multiworld [part 2]
This commit is contained in:
parent
9b212ae034
commit
5938747083
39 changed files with 239 additions and 301 deletions
|
|
@ -345,7 +345,7 @@ class BlockAPI{
|
|||
return false;
|
||||
}
|
||||
|
||||
if($item->isActivable === true and $item->onActivate($this, $player, $block, $target, $face, $fx, $fy, $fz)){
|
||||
if($item->isActivable === true and $item->onActivate($player, $block, $target, $face, $fx, $fy, $fz)){
|
||||
return $this->cancelAction($block, $player);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class LevelAPI{
|
|||
$gen->init();
|
||||
$gen->generate();
|
||||
$gen->save($path, $this->default);
|
||||
$this->loadLevel($this->default)
|
||||
$this->loadLevel($this->default);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,21 +243,34 @@ class PlayerAPI{
|
|||
return false;
|
||||
}
|
||||
$CID = $this->server->query("SELECT ip,port FROM players WHERE name ".($alike === true ? "LIKE '%".$name."%'":"= '".$name."'").";", true);
|
||||
$CID = $this->server->clientID($CID["ip"], $CID["port"]);
|
||||
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
|
||||
if(isset($this->server->clients[$CID])){
|
||||
return $this->server->clients[$CID];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAll(){
|
||||
public function getAll($level = null){
|
||||
if($level instanceof Level){
|
||||
$clients = array();
|
||||
$l = $this->server->query("SELECT EID FROM entities WHERE level = '".$this->level->getName()."' AND class = '".ENTITY_PLAYER."';");
|
||||
if($l !== false and $l !== true){
|
||||
while(($e = $l->fetchArray(SQLITE3_ASSOC)) !== false){
|
||||
$e = $this->getByEID($e["EID"]);
|
||||
if($e instanceof Player){
|
||||
$clients[$e->clientID] = $e->player;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $clients;
|
||||
}
|
||||
return $this->server->clients;
|
||||
}
|
||||
|
||||
public function getByEID($eid){
|
||||
$eid = (int) $eid;
|
||||
$CID = $this->server->query("SELECT ip,port FROM players WHERE EID = '".$eid."';", true);
|
||||
$CID = $this->server->clientID($CID["ip"], $CID["port"]);
|
||||
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
|
||||
if(isset($this->server->clients[$CID])){
|
||||
return $this->server->clients[$CID];
|
||||
}
|
||||
|
|
@ -267,7 +280,7 @@ class PlayerAPI{
|
|||
public function getByClientID($clientID){
|
||||
$clientID = (int) $clientID;
|
||||
$CID = $this->server->query("SELECT ip,port FROM players WHERE clientID = '".$clientID."';", true);
|
||||
$CID = $this->server->clientID($CID["ip"], $CID["port"]);
|
||||
$CID = PocketMinecraftServer::clientID($CID["ip"], $CID["port"]);
|
||||
if(isset($this->server->clients[$CID])){
|
||||
return $this->server->clients[$CID];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class TileEntityAPI{
|
|||
}
|
||||
|
||||
public function addSign(Level $level, $x, $y, $z, $lines = array("", "", "", "")){
|
||||
return $this->add(TILE_SIGN, $x, $y, $z, $data = array(
|
||||
return $this->add($level, TILE_SIGN, $x, $y, $z, $data = array(
|
||||
"id" => "Sign",
|
||||
"x" => $x,
|
||||
"y" => $y,
|
||||
|
|
@ -110,7 +110,7 @@ class TileEntityAPI{
|
|||
$t->spawn($player, $queue);
|
||||
}
|
||||
|
||||
public function spawnToAll($id){
|
||||
public function spawnToAll(Level $level, $id){
|
||||
$t = $this->getByID($id);
|
||||
if($t === false){
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue