mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-29 14:49:59 +00:00
Merge branch 'release/3.1'
This commit is contained in:
commit
ee5165b040
@ -6,9 +6,9 @@ php:
|
|||||||
before_script:
|
before_script:
|
||||||
# - pecl install channel://pecl.php.net/pthreads-3.1.6
|
# - pecl install channel://pecl.php.net/pthreads-3.1.6
|
||||||
- echo | pecl install channel://pecl.php.net/yaml-2.0.2
|
- echo | pecl install channel://pecl.php.net/yaml-2.0.2
|
||||||
- git clone https://github.com/krakjoe/pthreads.git
|
- git clone https://github.com/pmmp/pthreads.git
|
||||||
- cd pthreads
|
- cd pthreads
|
||||||
- git checkout d32079fb4a88e6e008104d36dbbf0c2dd7deb403
|
- git checkout c8cfacda84f21032d6014b53e72bf345ac901dac
|
||||||
- phpize
|
- phpize
|
||||||
- ./configure
|
- ./configure
|
||||||
- make
|
- make
|
||||||
|
@ -2170,7 +2170,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
$message = TextFormat::clean($message, $this->removeFormat);
|
$message = TextFormat::clean($message, $this->removeFormat);
|
||||||
foreach(explode("\n", $message) as $messagePart){
|
foreach(explode("\n", $message) as $messagePart){
|
||||||
@ -2245,7 +2245,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
if(!$this->spawned or !$this->isAlive()){
|
if(!$this->spawned or !$this->isAlive()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
switch($packet->event){
|
switch($packet->event){
|
||||||
case EntityEventPacket::EATING_ITEM:
|
case EntityEventPacket::EATING_ITEM:
|
||||||
@ -2396,7 +2396,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
case InventoryTransactionPacket::USE_ITEM_ACTION_BREAK_BLOCK:
|
case InventoryTransactionPacket::USE_ITEM_ACTION_BREAK_BLOCK:
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
$item = $this->inventory->getItemInHand();
|
$item = $this->inventory->getItemInHand();
|
||||||
$oldItem = clone $item;
|
$oldItem = clone $item;
|
||||||
@ -2656,7 +2656,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
$target = $this->level->getEntity($packet->target);
|
$target = $this->level->getEntity($packet->target);
|
||||||
if($target === null){
|
if($target === null){
|
||||||
@ -2870,7 +2870,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
if(isset($this->windowIndex[$packet->windowId])){
|
if(isset($this->windowIndex[$packet->windowId])){
|
||||||
$this->server->getPluginManager()->callEvent(new InventoryCloseEvent($this->windowIndex[$packet->windowId], $this));
|
$this->server->getPluginManager()->callEvent(new InventoryCloseEvent($this->windowIndex[$packet->windowId], $this));
|
||||||
@ -2920,7 +2920,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
if(!$this->spawned or !$this->isAlive()){
|
if(!$this->spawned or !$this->isAlive()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
$pos = new Vector3($packet->x, $packet->y, $packet->z);
|
$pos = new Vector3($packet->x, $packet->y, $packet->z);
|
||||||
if($pos->distanceSquared($this) > 10000 or $this->level->checkSpawnProtection($this, $pos)){
|
if($pos->distanceSquared($this) > 10000 or $this->level->checkSpawnProtection($this, $pos)){
|
||||||
@ -3640,7 +3640,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
//Crafting grid must always be evacuated even if keep-inventory is true. This dumps the contents into the
|
//Crafting grid must always be evacuated even if keep-inventory is true. This dumps the contents into the
|
||||||
//main inventory and drops the rest on the ground.
|
//main inventory and drops the rest on the ground.
|
||||||
$this->resetCraftingGridType();
|
$this->doCloseInventory();
|
||||||
|
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerDeathEvent($this, $this->getDrops(), new TranslationContainer($message, $params)));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerDeathEvent($this, $this->getDrops(), new TranslationContainer($message, $params)));
|
||||||
|
|
||||||
@ -3823,15 +3823,19 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->craftingGrid = $grid;
|
$this->craftingGrid = $grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetCraftingGridType() : void{
|
public function doCloseInventory() : void{
|
||||||
$contents = $this->craftingGrid->getContents();
|
/** @var Inventory[] $inventories */
|
||||||
|
$inventories = [$this->craftingGrid, $this->cursorInventory];
|
||||||
|
foreach($inventories as $inventory){
|
||||||
|
$contents = $inventory->getContents();
|
||||||
if(count($contents) > 0){
|
if(count($contents) > 0){
|
||||||
$drops = $this->inventory->addItem(...$contents);
|
$drops = $this->inventory->addItem(...$contents);
|
||||||
foreach($drops as $drop){
|
foreach($drops as $drop){
|
||||||
$this->dropItem($drop);
|
$this->dropItem($drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->craftingGrid->clearAll();
|
$inventory->clearAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->craftingGrid->getGridWidth() > CraftingGrid::SIZE_SMALL){
|
if($this->craftingGrid->getGridWidth() > CraftingGrid::SIZE_SMALL){
|
||||||
|
@ -1627,7 +1627,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
$spawnLocation = $this->getSpawnLocation();
|
$spawnLocation = $this->getSpawnLocation();
|
||||||
$s = new Vector2($spawnLocation->x, $spawnLocation->z);
|
$s = new Vector2($spawnLocation->x, $spawnLocation->z);
|
||||||
if(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){
|
if($t->distance($s) <= $distance){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -793,7 +793,21 @@ class PluginManager{
|
|||||||
}catch(\InvalidArgumentException $e){
|
}catch(\InvalidArgumentException $e){
|
||||||
throw new PluginException("Event handler " . get_class($listener) . "->" . $method->getName() . "() declares invalid/unknown priority \"" . $tags["priority"] . "\"");
|
throw new PluginException("Event handler " . get_class($listener) . "->" . $method->getName() . "() declares invalid/unknown priority \"" . $tags["priority"] . "\"");
|
||||||
}
|
}
|
||||||
$ignoreCancelled = isset($tags["ignoreCancelled"]) && strtolower($tags["ignoreCancelled"]) === "true";
|
|
||||||
|
$ignoreCancelled = false;
|
||||||
|
if(isset($tags["ignoreCancelled"])){
|
||||||
|
switch(strtolower($tags["ignoreCancelled"])){
|
||||||
|
case "true":
|
||||||
|
case "":
|
||||||
|
$ignoreCancelled = true;
|
||||||
|
break;
|
||||||
|
case "false":
|
||||||
|
$ignoreCancelled = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new PluginException("Event handler " . get_class($listener) . "->" . $method->getName() . "() declares invalid @ignoreCancelled value \"" . $tags["ignoreCancelled"] . "\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$parameters = $method->getParameters();
|
$parameters = $method->getParameters();
|
||||||
try{
|
try{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user