mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Merge branch 'next-minor' into next-major
This commit is contained in:
@ -1392,7 +1392,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
/**
|
||||
* Returns whether the player can interact with the specified position. This checks distance and direction.
|
||||
*
|
||||
* @param float $maxDiff defaults to half of the 3D diagonal width of a block
|
||||
* @param float $maxDiff defaults to half of the 3D diagonal width of a block
|
||||
*/
|
||||
public function canInteract(Vector3 $pos, float $maxDistance, float $maxDiff = M_SQRT3 / 2) : bool{
|
||||
$eyePos = $this->getEyePos();
|
||||
@ -1836,7 +1836,17 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
|
||||
$ev->call();
|
||||
|
||||
$item = $this->inventory->getItemInHand();
|
||||
$oldItem = clone $item;
|
||||
if(!$ev->isCancelled()){
|
||||
if($item->onInteractEntity($this, $entity, $clickPos)){
|
||||
if($this->hasFiniteResources() && !$item->equalsExact($oldItem) && $oldItem->equalsExact($this->inventory->getItemInHand())){
|
||||
if($item instanceof Durable && $item->isBroken()){
|
||||
$this->broadcastSound(new ItemBreakSound());
|
||||
}
|
||||
$this->inventory->setItemInHand($item);
|
||||
}
|
||||
}
|
||||
return $entity->onInteract($this, $clickPos);
|
||||
}
|
||||
return false;
|
||||
@ -1934,9 +1944,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
/**
|
||||
* Adds a title text to the user's screen, with an optional subtitle.
|
||||
*
|
||||
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
|
||||
* @param int $stay Duration in ticks to stay on screen for
|
||||
* @param int $fadeOut Duration in ticks for fade-out.
|
||||
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
|
||||
* @param int $stay Duration in ticks to stay on screen for
|
||||
* @param int $fadeOut Duration in ticks for fade-out.
|
||||
*/
|
||||
public function sendTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1) : void{
|
||||
$this->setTitleDuration($fadeIn, $stay, $fadeOut);
|
||||
@ -1977,8 +1987,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
/**
|
||||
* Sets the title duration.
|
||||
*
|
||||
* @param int $fadeIn Title fade-in time in ticks.
|
||||
* @param int $stay Title stay time in ticks.
|
||||
* @param int $fadeIn Title fade-in time in ticks.
|
||||
* @param int $stay Title stay time in ticks.
|
||||
* @param int $fadeOut Title fade-out time in ticks.
|
||||
*/
|
||||
public function setTitleDuration(int $fadeIn, int $stay, int $fadeOut) : void{
|
||||
@ -2076,7 +2086,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
* Transfers a player to another server.
|
||||
*
|
||||
* @param string $address The IP address or hostname of the destination server
|
||||
* @param int $port The destination port, defaults to 19132
|
||||
* @param int $port The destination port, defaults to 19132
|
||||
* @param string $message Message to show in the console when closing the player
|
||||
*
|
||||
* @return bool if transfer was successful.
|
||||
@ -2120,7 +2130,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
*
|
||||
* Note for internals developers: Do not call this from network sessions. It will cause a feedback loop.
|
||||
*
|
||||
* @param string $reason Shown to the player, usually this will appear on their disconnect screen.
|
||||
* @param string $reason Shown to the player, usually this will appear on their disconnect screen.
|
||||
* @param Translatable|string|null $quitMessage Message to broadcast to online players (null will use default)
|
||||
*/
|
||||
public function disconnect(string $reason, Translatable|string|null $quitMessage = null) : void{
|
||||
@ -2136,7 +2146,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
* @internal
|
||||
* This method executes post-disconnect actions and cleanups.
|
||||
*
|
||||
* @param string $reason Shown to the player, usually this will appear on their disconnect screen.
|
||||
* @param string $reason Shown to the player, usually this will appear on their disconnect screen.
|
||||
* @param Translatable|string|null $quitMessage Message to broadcast to online players (null will use default)
|
||||
*/
|
||||
public function onPostDisconnect(string $reason, Translatable|string|null $quitMessage) : void{
|
||||
|
Reference in New Issue
Block a user