This repository has been archived by the owner on Feb 2, 2018. It is now read-only.
forked from pmmp/PocketMine-MP
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.0.3.0
- Loading branch information
Showing
8 changed files
with
204 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?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/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\command\defaults; | ||
|
||
use pocketmine\command\CommandSender; | ||
use pocketmine\command\ConsoleCommandSender; | ||
use pocketmine\event\TranslationContainer; | ||
use pocketmine\Player; | ||
use pocketmine\utils\TextFormat; | ||
|
||
class TransferserverCommand extends VanillaCommand { | ||
|
||
public function __construct($name) { | ||
parent::__construct( | ||
$name, | ||
"Connect to another server", | ||
"transferserver address:string port:short", | ||
["ts"] | ||
); | ||
$this->setPermission("pocketmine.command.transferserver"); | ||
} | ||
|
||
public function execute(CommandSender $sender, $currentAlias, array $args) { | ||
if (!$this->testPermission($sender)) { | ||
return true; | ||
} | ||
if ($sender instanceof ConsoleCommandSender) { | ||
$sender->sendMessage(TextFormat::RED . 'A console can not be transferred!'); | ||
return true; | ||
} | ||
|
||
/** @var string $address | ||
* @var int $port | ||
*/ | ||
if (count($args) < 2 || !is_string(($address = $args[0])) || !is_numeric(($port = $args[1]))) { | ||
$sender->sendMessage(new TranslationContainer("commands.generic.usage", [$this->usageMessage])); | ||
|
||
return false; | ||
} | ||
|
||
/** @var Player $sender */ | ||
$success = $sender->transferTo($address, $port); | ||
|
||
return $success; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?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/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\event\player; | ||
|
||
use pocketmine\event\Cancellable; | ||
use pocketmine\event\player\PlayerEvent; | ||
use pocketmine\Player; | ||
|
||
class PlayerTransferEvent extends PlayerEvent implements Cancellable { | ||
public static $handlerList = null; | ||
|
||
/** @var string $address */ | ||
private $address; | ||
/** @var int $port */ | ||
private $port; | ||
|
||
public function __construct(Player $player, string $address, int $port) { | ||
$this->player = $player; | ||
$this->address = $address; | ||
$this->port = $port; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getAddress() { | ||
return $this->address; | ||
} | ||
|
||
/** | ||
* @param string $address | ||
*/ | ||
public function setAddress(string $address) { | ||
$this->address = $address; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getPort() { | ||
return $this->port; | ||
} | ||
|
||
/** | ||
* @param int $port | ||
*/ | ||
public function setPort(int $port) { | ||
$this->port = $port; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?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/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\network\protocol; | ||
|
||
class TransferPacket extends DataPacket { | ||
const NETWORK_ID = Info::TRANSFER_PACKET; | ||
|
||
public $address; | ||
public $port; | ||
|
||
public function decode() { } | ||
|
||
public function encode() { | ||
$this->reset(); | ||
$this->putString($this->address); | ||
$this->putLShort($this->port); | ||
} | ||
|
||
} |