mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Added - NetworkInterfaceRegisterEvent (cancellable) - NetworkInterfaceUnregisterEvent - NetworkInterfaceCrashEvent
This commit is contained in:
50
src/pocketmine/event/server/NetworkInterfaceCrashEvent.php
Normal file
50
src/pocketmine/event/server/NetworkInterfaceCrashEvent.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\server;
|
||||
|
||||
use pocketmine\network\SourceInterface;
|
||||
|
||||
/**
|
||||
* Called when a network interface crashes, with relevant crash information.
|
||||
*/
|
||||
class NetworkInterfaceCrashEvent extends NetworkInterfaceEvent{
|
||||
public static $handlerList = null;
|
||||
|
||||
/**
|
||||
* @var \Throwable
|
||||
*/
|
||||
private $exception;
|
||||
|
||||
public function __construct(SourceInterface $interface, \Throwable $throwable){
|
||||
parent::__construct($interface);
|
||||
$this->exception = $throwable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Throwable
|
||||
*/
|
||||
public function getCrashInformation() : \Throwable{
|
||||
return $this->exception;
|
||||
}
|
||||
}
|
45
src/pocketmine/event/server/NetworkInterfaceEvent.php
Normal file
45
src/pocketmine/event/server/NetworkInterfaceEvent.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\server;
|
||||
|
||||
use pocketmine\network\SourceInterface;
|
||||
|
||||
class NetworkInterfaceEvent extends ServerEvent{
|
||||
/** @var SourceInterface */
|
||||
protected $interface;
|
||||
|
||||
/**
|
||||
* @param SourceInterface $interface
|
||||
*/
|
||||
public function __construct(SourceInterface $interface){
|
||||
$this->interface = $interface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SourceInterface
|
||||
*/
|
||||
public function getInterface() : SourceInterface{
|
||||
return $this->interface;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\server;
|
||||
|
||||
use pocketmine\event\Cancellable;
|
||||
use pocketmine\network\SourceInterface;
|
||||
|
||||
/**
|
||||
* Called when a network interface is registered into the network, for example the RakLib interface.
|
||||
*/
|
||||
class NetworkInterfaceRegisterEvent extends NetworkInterfaceEvent implements Cancellable{
|
||||
public static $handlerList = null;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\server;
|
||||
|
||||
/**
|
||||
* Called when a network interface is unregistered
|
||||
*/
|
||||
class NetworkInterfaceUnregisterEvent extends NetworkInterfaceEvent{
|
||||
public static $handlerList = null;
|
||||
|
||||
}
|
Reference in New Issue
Block a user