Removed deprecated ServerCommandEvent and RemoteServerCommandEvent

if you get rekt by these changes... USE A RELEASE like we've been telling you for so long!
This commit is contained in:
Dylan K. Taylor 2018-08-19 14:23:41 +01:00
parent b629738312
commit 475ec413e5
4 changed files with 2 additions and 130 deletions

View File

@ -42,7 +42,6 @@ use pocketmine\event\player\PlayerDataSaveEvent;
use pocketmine\event\server\CommandEvent;
use pocketmine\event\server\DataPacketBroadcastEvent;
use pocketmine\event\server\QueryRegenerateEvent;
use pocketmine\event\server\ServerCommandEvent;
use pocketmine\inventory\CraftingManager;
use pocketmine\item\enchantment\Enchantment;
use pocketmine\item\Item;
@ -1979,10 +1978,7 @@ class Server{
public function checkConsole(){
Timings::$serverCommandTimer->startTiming();
while(($line = $this->console->getLine()) !== null){
$this->pluginManager->callEvent($ev = new ServerCommandEvent($this->consoleSender, $line));
if(!$ev->isCancelled()){
$this->dispatchCommand($ev->getSender(), $ev->getCommand());
}
$this->dispatchCommand($this->consoleSender, $line);
}
Timings::$serverCommandTimer->stopTiming();
}

View File

@ -1,42 +0,0 @@
<?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\command\CommandSender;
/**
* This event is called when a command is received over RCON.
*
* @deprecated Use CommandEvent instead.
*/
class RemoteServerCommandEvent extends ServerCommandEvent{
/**
* @param CommandSender $sender
* @param string $command
*/
public function __construct(CommandSender $sender, string $command){
parent::__construct($sender, $command);
}
}

View File

@ -1,75 +0,0 @@
<?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\command\CommandSender;
use pocketmine\event\Cancellable;
/**
* Called when the console runs a command, early in the process
*
* You don't want to use this except for a few cases like logging commands,
* blocking commands on certain places, or applying modifiers.
*
* The message DOES NOT contain a slash at the start
*
* @deprecated Use CommandEvent instead.
*/
class ServerCommandEvent extends ServerEvent implements Cancellable{
/** @var string */
protected $command;
/** @var CommandSender */
protected $sender;
/**
* @param CommandSender $sender
* @param string $command
*/
public function __construct(CommandSender $sender, string $command){
$this->sender = $sender;
$this->command = $command;
}
/**
* @return CommandSender
*/
public function getSender() : CommandSender{
return $this->sender;
}
/**
* @return string
*/
public function getCommand() : string{
return $this->command;
}
/**
* @param string $command
*/
public function setCommand(string $command) : void{
$this->command = $command;
}
}

View File

@ -28,7 +28,6 @@ declare(strict_types=1);
namespace pocketmine\network\rcon;
use pocketmine\command\RemoteConsoleCommandSender;
use pocketmine\event\server\RemoteServerCommandEvent;
use pocketmine\Server;
use pocketmine\snooze\SleeperNotifier;
use pocketmine\utils\TextFormat;
@ -95,13 +94,7 @@ class RCON{
public function check() : void{
$response = new RemoteConsoleCommandSender();
$command = $this->instance->cmd;
$this->server->getPluginManager()->callEvent($ev = new RemoteServerCommandEvent($response, $command));
if(!$ev->isCancelled()){
$this->server->dispatchCommand($ev->getSender(), $ev->getCommand());
}
$this->server->dispatchCommand($response, $this->instance->cmd);
$this->instance->response = TextFormat::clean($response->getMessage());
$this->instance->synchronized(function(RCONInstance $thread){