|
| __construct ($name) |
|
| execute (CommandSender $sender, $currentAlias, array $args) |
|
Public Member Functions inherited from VanillaCommand |
| __construct ($name, $description="", $usageMessage=null, array $aliases=[]) |
|
Public Member Functions inherited from Command |
| __construct ($name, $description="", $usageMessage=null, array $aliases=[]) |
|
| getDefaultCommandData () |
|
| generateCustomCommandData (Player $player) |
|
| getOverloads () |
|
| execute (CommandSender $sender, $commandLabel, array $args) |
|
| getName () |
|
| getPermission () |
|
| setPermission ($permission) |
|
| testPermission (CommandSender $target) |
|
| testPermissionSilent (CommandSender $target) |
|
| getLabel () |
|
| setLabel ($name) |
|
| register (CommandMap $commandMap) |
|
| unregister (CommandMap $commandMap) |
|
| isRegistered () |
|
| getAliases () |
|
| getPermissionMessage () |
|
| getDescription () |
|
| getUsage () |
|
| setAliases (array $aliases) |
|
| setDescription ($description) |
|
| setPermissionMessage ($permissionMessage) |
|
| setUsage ($usage) |
|
| __toString () |
|
|
Static Public Member Functions inherited from Command |
static | generateDefaultData () |
|
static | broadcastCommandMessage (CommandSender $source, $message, $sendToSource=true) |
|
Data Fields inherited from VanillaCommand |
const | MAX_COORD = 30000000 |
|
const | MIN_COORD = -30000000 |
|
Data Fields inherited from Command |
| $timings |
|
Protected Member Functions inherited from VanillaCommand |
| getInteger (CommandSender $sender, $value, $min=self::MIN_COORD, $max=self::MAX_COORD) |
|
| getRelativeDouble ($original, CommandSender $sender, $input, $min=self::MIN_COORD, $max=self::MAX_COORD) |
|
| getDouble (CommandSender $sender, $value, $min=self::MIN_COORD, $max=self::MAX_COORD) |
|
Protected Attributes inherited from Command |
| $commandData = null |
|
| $description = "" |
|
| $usageMessage |
|
◆ __construct()
SummonCommand constructor.
- Parameters
-
45 "%pocketmine.command.summon.description",
46 "%pocketmine.command.summon.usage"
◆ execute()
- Parameters
-
- Returns
- bool
63 if(count($args) != 1 and count($args) != 4 and count($args) != 5){
64 $sender->sendMessage(
new TranslationContainer(
"commands.generic.usage", [$this->usageMessage]));
71 if(count($args) == 4 or count($args) == 5){
74 if(is_numeric($args[1])){
76 }elseif(strcmp($args[1],
"~") >= 0){
77 $offset_x = trim($args[1],
"~");
78 if($sender instanceof Player){
79 $x = is_numeric($offset_x) ? ($sender->x + $offset_x) : $sender->x;
81 $sender->sendMessage(
TextFormat::RED .
"You must specify a position where the entity is spawned to when using in console");
90 if(is_numeric($args[2])){
92 }elseif(strcmp($args[2],
"~") >= 0){
93 $offset_y = trim($args[2],
"~");
94 if($sender instanceof Player){
95 $y = is_numeric($offset_y) ? ($sender->y + $offset_y) : $sender->y;
96 $y = min(128, max(0, $y));
98 $sender->sendMessage(
TextFormat::RED .
"You must specify a position where the entity is spawned to when using in console");
107 if(is_numeric($args[3])){
109 }elseif(strcmp($args[3],
"~") >= 0){
110 $offset_z = trim($args[3],
"~");
111 if($sender instanceof Player){
112 $z = is_numeric($offset_z) ? ($sender->z + $offset_z) : $sender->z;
114 $sender->sendMessage(
TextFormat::RED .
"You must specify a position where the entity is spawned to when using in console");
123 if(count($args) == 1){
124 if($sender instanceof Player){
129 $sender->sendMessage(
TextFormat::RED .
"You must specify a position where the entity is spawned to when using in console");
136 $level = ($sender instanceof Player) ? $sender->getLevel() : $sender->getServer()->getDefaultLevel();
139 new DoubleTag(
"", $x),
140 new DoubleTag(
"", $y),
141 new DoubleTag(
"", $z)
143 "Motion" =>
new ListTag(
"Motion", [
144 new DoubleTag(
"", 0),
145 new DoubleTag(
"", 0),
148 "Rotation" =>
new ListTag(
"Rotation", [
149 new FloatTag(
"", lcg_value() * 360),
153 if(count($args) == 5 and $args[4]{0} ==
"{"){
159 if($entity instanceof Entity){
160 $entity->spawnToAll();
161 $sender->sendMessage(
"Successfully spawned entity $type at ($x, $y, $z)");
164 $sender->sendMessage(
TextFormat::RED .
"An error occurred when spawning the entity $type");
The documentation for this class was generated from the following file:
- src/pocketmine/command/defaults/SummonCommand.php