mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
Merge changes from master
This commit is contained in:
@@ -31,7 +31,7 @@ use pocketmine\Player;
|
||||
|
||||
class BanCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.ban.player.description",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\Player;
|
||||
|
||||
class BanIpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.ban.ip.description",
|
||||
@@ -71,7 +71,7 @@ class BanIpCommand extends VanillaCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function processIPBan($ip, CommandSender $sender, $reason){
|
||||
private function processIPBan(string $ip, CommandSender $sender, string $reason){
|
||||
$sender->getServer()->getIPBans()->addBan($ip, $reason, null, $sender->getName());
|
||||
|
||||
foreach($sender->getServer()->getOnlinePlayers() as $player){
|
||||
|
@@ -30,7 +30,7 @@ use pocketmine\permission\BanEntry;
|
||||
|
||||
class BanListCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.banlist.description",
|
||||
|
@@ -30,7 +30,7 @@ use pocketmine\Server;
|
||||
|
||||
class DefaultGamemodeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.defaultgamemode.description",
|
||||
|
@@ -32,7 +32,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class DeopCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.deop.description",
|
||||
|
@@ -32,7 +32,7 @@ use pocketmine\Server;
|
||||
|
||||
class DifficultyCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.difficulty.description",
|
||||
|
@@ -29,7 +29,7 @@ class DumpMemoryCommand extends VanillaCommand{
|
||||
|
||||
private static $executions = 0;
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"Dumps the memory",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class EffectCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.effect.description",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class EnchantCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.enchant.description",
|
||||
|
@@ -33,7 +33,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class GamemodeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.gamemode.description",
|
||||
|
@@ -28,7 +28,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class GarbageCollectorCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.gc.description",
|
||||
|
@@ -27,7 +27,7 @@ use pocketmine\command\Command;
|
||||
use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\event\TranslationContainer;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\nbt\JsonNBTParser;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\Player;
|
||||
@@ -35,7 +35,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class GiveCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.give.description",
|
||||
@@ -54,7 +54,7 @@ class GiveCommand extends VanillaCommand{
|
||||
}
|
||||
|
||||
$player = $sender->getServer()->getPlayer($args[0]);
|
||||
$item = Item::fromString($args[1]);
|
||||
$item = ItemFactory::fromString($args[1]);
|
||||
|
||||
if(!isset($args[2])){
|
||||
$item->setCount($item->getMaxStackSize());
|
||||
|
@@ -30,7 +30,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class HelpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.help.description",
|
||||
|
@@ -32,7 +32,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class KickCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.kick.description",
|
||||
|
@@ -33,7 +33,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class KillCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.kill.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\Player;
|
||||
|
||||
class ListCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.list.description",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class MeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.me.description",
|
||||
|
@@ -32,7 +32,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class OpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.op.description",
|
||||
|
@@ -30,7 +30,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class PardonCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.unban.player.description",
|
||||
|
@@ -30,7 +30,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class PardonIpCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.unban.ip.description",
|
||||
|
@@ -28,6 +28,7 @@ use pocketmine\command\CommandSender;
|
||||
use pocketmine\command\utils\InvalidCommandSyntaxException;
|
||||
use pocketmine\event\TranslationContainer;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\ItemFactory;
|
||||
use pocketmine\level\particle\AngryVillagerParticle;
|
||||
use pocketmine\level\particle\BlockForceFieldParticle;
|
||||
use pocketmine\level\particle\BubbleParticle;
|
||||
@@ -63,7 +64,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class ParticleCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.particle.description",
|
||||
@@ -125,7 +126,6 @@ class ParticleCommand extends VanillaCommand{
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @param Vector3 $pos
|
||||
* @param float $xd
|
||||
* @param float $yd
|
||||
@@ -134,7 +134,7 @@ class ParticleCommand extends VanillaCommand{
|
||||
*
|
||||
* @return Particle|null
|
||||
*/
|
||||
private function getParticle($name, Vector3 $pos, $xd, $yd, $zd, $data){
|
||||
private function getParticle(string $name, Vector3 $pos, float $xd, float $yd, float $zd, int $data = null){
|
||||
switch($name){
|
||||
case "explode":
|
||||
return new ExplodeParticle($pos);
|
||||
@@ -173,12 +173,12 @@ class ParticleCommand extends VanillaCommand{
|
||||
case "reddust":
|
||||
return new RedstoneParticle($pos, $data ?? 1);
|
||||
case "snowballpoof":
|
||||
return new ItemBreakParticle($pos, Item::get(Item::SNOWBALL));
|
||||
return new ItemBreakParticle($pos, ItemFactory::get(Item::SNOWBALL));
|
||||
case "slime":
|
||||
return new ItemBreakParticle($pos, Item::get(Item::SLIMEBALL));
|
||||
return new ItemBreakParticle($pos, ItemFactory::get(Item::SLIMEBALL));
|
||||
case "itembreak":
|
||||
if($data !== null and $data !== 0){
|
||||
return new ItemBreakParticle($pos, Item::get($data));
|
||||
return new ItemBreakParticle($pos, ItemFactory::get($data));
|
||||
}
|
||||
break;
|
||||
case "terrain":
|
||||
@@ -206,7 +206,7 @@ class ParticleCommand extends VanillaCommand{
|
||||
if(strpos($name, "iconcrack_") === 0){
|
||||
$d = explode("_", $name);
|
||||
if(count($d) === 3){
|
||||
return new ItemBreakParticle($pos, Item::get((int) $d[1], (int) $d[2]));
|
||||
return new ItemBreakParticle($pos, ItemFactory::get((int) $d[1], (int) $d[2]));
|
||||
}
|
||||
}elseif(strpos($name, "blockcrack_") === 0){
|
||||
$d = explode("_", $name);
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class PluginsCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.plugins.description",
|
||||
|
@@ -30,7 +30,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class ReloadCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.reload.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class SaveCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.save.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class SaveOffCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.saveoff.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class SaveOnCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.saveon.description",
|
||||
|
@@ -32,7 +32,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class SayCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.say.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\Player;
|
||||
|
||||
class SeedCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.seed.description",
|
||||
|
@@ -33,7 +33,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class SetWorldSpawnCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.setworldspawn.description",
|
||||
|
@@ -34,7 +34,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class SpawnpointCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.spawnpoint.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\utils\Utils;
|
||||
|
||||
class StatusCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.status.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class StopCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.stop.description",
|
||||
|
@@ -33,7 +33,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class TeleportCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.tp.description",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class TellCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.tell.description",
|
||||
|
@@ -33,7 +33,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class TimeCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.time.description",
|
||||
|
@@ -35,7 +35,7 @@ class TimingsCommand extends VanillaCommand{
|
||||
|
||||
public static $timingStart = 0;
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.timings.description",
|
||||
|
@@ -29,7 +29,7 @@ use pocketmine\event\TranslationContainer;
|
||||
|
||||
class TitleCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.title.description",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\Player;
|
||||
|
||||
class TransferServerCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.transferserver.description",
|
||||
|
@@ -30,11 +30,15 @@ abstract class VanillaCommand extends Command{
|
||||
const MAX_COORD = 30000000;
|
||||
const MIN_COORD = -30000000;
|
||||
|
||||
public function __construct($name, $description = "", $usageMessage = null, array $aliases = []){
|
||||
parent::__construct($name, $description, $usageMessage, $aliases);
|
||||
}
|
||||
|
||||
protected function getInteger(CommandSender $sender, $value, $min = self::MIN_COORD, $max = self::MAX_COORD){
|
||||
/**
|
||||
* @param CommandSender $sender
|
||||
* @param mixed $value
|
||||
* @param int $min
|
||||
* @param int $max
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getInteger(CommandSender $sender, $value, int $min = self::MIN_COORD, int $max = self::MAX_COORD) : int{
|
||||
$i = (int) $value;
|
||||
|
||||
if($i < $min){
|
||||
@@ -46,7 +50,16 @@ abstract class VanillaCommand extends Command{
|
||||
return $i;
|
||||
}
|
||||
|
||||
protected function getRelativeDouble($original, CommandSender $sender, $input, $min = self::MIN_COORD, $max = self::MAX_COORD){
|
||||
/**
|
||||
* @param float $original
|
||||
* @param CommandSender $sender
|
||||
* @param string $input
|
||||
* @param float $min
|
||||
* @param float $max
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected function getRelativeDouble(float $original, CommandSender $sender, string $input, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{
|
||||
if($input{0} === "~"){
|
||||
$value = $this->getDouble($sender, substr($input, 1));
|
||||
|
||||
@@ -56,7 +69,15 @@ abstract class VanillaCommand extends Command{
|
||||
return $this->getDouble($sender, $input, $min, $max);
|
||||
}
|
||||
|
||||
protected function getDouble(CommandSender $sender, $value, $min = self::MIN_COORD, $max = self::MAX_COORD){
|
||||
/**
|
||||
* @param CommandSender $sender
|
||||
* @param mixed $value
|
||||
* @param float $min
|
||||
* @param float $max
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected function getDouble(CommandSender $sender, $value, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{
|
||||
$i = (double) $value;
|
||||
|
||||
if($i < $min){
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class VersionCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.version.description",
|
||||
|
@@ -31,7 +31,7 @@ use pocketmine\utils\TextFormat;
|
||||
|
||||
class WhitelistCommand extends VanillaCommand{
|
||||
|
||||
public function __construct($name){
|
||||
public function __construct(string $name){
|
||||
parent::__construct(
|
||||
$name,
|
||||
"%pocketmine.command.whitelist.description",
|
||||
@@ -108,7 +108,7 @@ class WhitelistCommand extends VanillaCommand{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function badPerm(CommandSender $sender, $perm){
|
||||
private function badPerm(CommandSender $sender, string $perm) : bool{
|
||||
if(!$sender->hasPermission("pocketmine.command.whitelist.$perm")){
|
||||
$sender->sendMessage(new TranslationContainer(TextFormat::RED . "%commands.generic.permission"));
|
||||
|
||||
|
Reference in New Issue
Block a user