mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Merge branch 'master' into pthreads-fix
This commit is contained in:
commit
d298adabad
5
.mailmap
Normal file
5
.mailmap
Normal file
@ -0,0 +1,5 @@
|
||||
Shoghi Cervantes <shoghicp@gmail.com>
|
||||
Shoghi Cervantes <shoghicp@gmail.com> Shoghi Cervantes <shoghicp@pocketmine.net>
|
||||
Brandon V <brandon15811@gmail.com>
|
||||
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <michael@yoo.id.au>
|
||||
Michael Yoo <sekjun9878@gmail.com> Michael Yoo <sekjun9878@sekjun9878.info>
|
@ -1368,7 +1368,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
$this->setRotation($packet->yaw, $packet->pitch);
|
||||
//$this->inBlock = $this->checkObstruction($this->x, ($this->boundingBox->minY + $this->boundingBox->maxY) / 2, $this->z);
|
||||
$this->move($dx, $dy, $dz);
|
||||
$revert = !$this->move($dx, $dy, $dz);
|
||||
|
||||
$diffX = $this->x - $newPos->x;
|
||||
$diffZ = $this->z - $newPos->z;
|
||||
|
@ -715,7 +715,7 @@ abstract class Entity extends Position implements Metadatable{
|
||||
//$collision = [];
|
||||
//$this->checkBlockCollision($collision);
|
||||
if($dx == 0 and $dz == 0 and $dy == 0){
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
//if($this->inBlock){ //TODO: noclip
|
||||
@ -887,8 +887,11 @@ abstract class Entity extends Position implements Metadatable{
|
||||
($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2
|
||||
);
|
||||
|
||||
$result = true;
|
||||
|
||||
if(!$this->setPosition($pos)){
|
||||
$this->boundingBox->setBB($axisalignedbb);
|
||||
$result = false;
|
||||
}else{
|
||||
|
||||
if($this instanceof Player){
|
||||
@ -922,6 +925,8 @@ abstract class Entity extends Position implements Metadatable{
|
||||
//TODO: vehicle collision events (first we need to spawn them!)
|
||||
|
||||
Timings::$entityMoveTimer->stopTiming();
|
||||
|
||||
return $result;
|
||||
//}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,9 @@ abstract class BlockEvent extends Event{
|
||||
$this->block = $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Block
|
||||
*/
|
||||
public function getBlock(){
|
||||
return $this->block;
|
||||
}
|
||||
|
@ -913,6 +913,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
$this->changedBlocks[$index][$Y][] = clone $block;
|
||||
}
|
||||
|
||||
if($update === true){
|
||||
$this->updateAround($pos, self::BLOCK_UPDATE_NORMAL);
|
||||
$block->onUpdate(self::BLOCK_UPDATE_NORMAL);
|
||||
|
@ -97,8 +97,6 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
/** @var ServerHandler */
|
||||
private $interface;
|
||||
|
||||
private $tickTask;
|
||||
|
||||
private $upload = 0;
|
||||
private $download = 0;
|
||||
|
||||
@ -109,7 +107,6 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
$server = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
|
||||
$this->interface = new ServerHandler($server, $this);
|
||||
$this->setName($this->server->getMotd());
|
||||
$this->tickTask = $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "doTick"]), 1);
|
||||
}
|
||||
|
||||
public function doTick(){
|
||||
@ -124,6 +121,8 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
}
|
||||
}
|
||||
|
||||
$this->doTick();
|
||||
|
||||
return $work;
|
||||
}
|
||||
|
||||
@ -147,12 +146,10 @@ class RakLibInterface implements ServerInstance, SourceInterface{
|
||||
}
|
||||
|
||||
public function shutdown(){
|
||||
$this->tickTask->cancel();
|
||||
$this->interface->shutdown();
|
||||
}
|
||||
|
||||
public function emergencyShutdown(){
|
||||
$this->tickTask->cancel();
|
||||
$this->interface->emergencyShutdown();
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,6 @@ interface Permissible extends ServerOperator{
|
||||
public function recalculatePermissions();
|
||||
|
||||
/**
|
||||
* TODO: Check this
|
||||
* @return Permission[]
|
||||
*/
|
||||
public function getEffectivePermissions();
|
||||
|
@ -194,10 +194,10 @@ class PermissibleBase implements Permissible{
|
||||
* @param bool $invert
|
||||
* @param PermissionAttachment $attachment
|
||||
*/
|
||||
public function calculateChildPermissions(array $children, $invert, $attachment){
|
||||
foreach(array_keys($children) as $name){
|
||||
private function calculateChildPermissions(array $children, $invert, $attachment){
|
||||
foreach($children as $name => $v){
|
||||
$perm = Server::getInstance()->getPluginManager()->getPermission($name);
|
||||
$value = $invert === true ? !$children[$name] : $children[$name];
|
||||
$value = ($v xor $invert);
|
||||
$this->permissions[$name] = new PermissionAttachmentInfo($this->parent, $name, $attachment, $value);
|
||||
Server::getInstance()->getPluginManager()->subscribeToPermission($name, $this->parent);
|
||||
|
||||
|
@ -88,12 +88,47 @@ class PermissionAttachment{
|
||||
return $this->permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool[]
|
||||
*/
|
||||
public function clearPermissions(){
|
||||
$this->permissions = [];
|
||||
$this->permissible->recalculatePermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool[] $permissions
|
||||
*/
|
||||
public function setPermissions(array $permissions){
|
||||
foreach($permissions as $key => $value){
|
||||
$this->permissions[$key] = (bool) $value;
|
||||
}
|
||||
$this->permissible->recalculatePermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $permissions
|
||||
*/
|
||||
public function unsetPermissions(array $permissions){
|
||||
foreach($permissions as $node){
|
||||
unset($this->permissions[$node]);
|
||||
}
|
||||
$this->permissible->recalculatePermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|Permission $name
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setPermission($name, $value){
|
||||
$this->permissions[$name instanceof Permission ? $name->getName() : $name] = $value;
|
||||
$name = $name instanceof Permission ? $name->getName() : $name;
|
||||
if(isset($this->permissions[$name])){
|
||||
if($this->permissions[$name] === $value){
|
||||
return;
|
||||
}
|
||||
unset($this->permissions[$name]); //Fixes children getting overwritten
|
||||
}
|
||||
$this->permissions[$name] = $value;
|
||||
$this->permissible->recalculatePermissions();
|
||||
}
|
||||
|
||||
@ -101,7 +136,11 @@ class PermissionAttachment{
|
||||
* @param string|Permission $name
|
||||
*/
|
||||
public function unsetPermission($name){
|
||||
unset($this->permissions[$name instanceof Permission ? $name->getName() : $name]);
|
||||
$name = $name instanceof Permission ? $name->getName() : $name;
|
||||
if(isset($this->permissions[$name])){
|
||||
unset($this->permissions[$name]);
|
||||
$this->permissible->recalculatePermissions();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -435,6 +435,9 @@ class PluginManager{
|
||||
if(isset($this->permSubs[$permission])){
|
||||
$this->permSubs[$permission][spl_object_hash($permissible)]->release();
|
||||
unset($this->permSubs[$permission][spl_object_hash($permissible)]);
|
||||
if(count($this->permSubs[$permission]) === 0){
|
||||
unset($this->permSubs[$permission]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user