Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
Updated command selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Aug 25, 2015
1 parent 942cd22 commit a3fcc20
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
30 changes: 14 additions & 16 deletions GrabBag/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ administration.

### Server Management

* --list : List defined aliases
* --rm : Remove an alias
* --rmcmd : Remove an existing command
* after : schedule command after a number of seconds
* alias : Create a new command alias
* at : schedule command at an appointed date/time
Expand Down Expand Up @@ -144,22 +141,18 @@ plugins.

The following commands are available:

* --list : List defined aliases

* --rm : Remove an alias
* --rmcmd : Remove an existing command
* **after** _<seconds>_ _<command>_|list|cancel _<id>_
schedule command after a number of seconds

Will schedule to run *command* after *seconds*.
The **list** sub command will show all the queued commands.
The **cancel** sub command allows you to cancel queued commands.

* **alias** _[--rm|--list|--rmcmd]_ _<alias>_ _<command>_ _[options]_
* **alias** **[-f]** _<alias>_ _<command>_ _[options]_
Create a new command alias

Create an alias to a command.
The following sub commands are possible:
Use the **-f** to override existing commands

* **as** _<player>_ _<command>_
run command as somebody else
Expand Down Expand Up @@ -190,7 +183,10 @@ The following commands are available:
* **chat-on|chat-off** _[player|--list|--server]_
Allow players to opt-out from chat

Prevents players from receiving chat messages.
Prevents players from sending/receiving chat messages.
The following options are recognized:
- --list : Lists the players that have chat on/off status
- --server : Globally toggles on/off chat.

* **clearchat**
Clears your chat window
Expand Down Expand Up @@ -253,7 +249,7 @@ The following commands are available:
* **followme-off** _<player>_
stop making a player follow you

* **freeze|thaw** [_player_|**--hard|--soft**]
* **freeze|thaw** [ _player_ | **--hard|--soft** ]
freeze/unfreeze a player so they cannot move.

Stops players from moving. If no player specified it will show
Expand Down Expand Up @@ -319,7 +315,7 @@ The following commands are available:

* **players**
Shows what players are on-line
* **pluginmgr** _<enable|disable|reload|info|commands|permissions|load>_ _plugin>
* **pluginmgr** _<enable|disable|reload|info|commands|permissions|load>_ _<plugin>_
manage plugins

Manage plugins.
Expand All @@ -338,6 +334,8 @@ The following commands are available:
- Show permissions registered by plugin
- **pluginmgr** **load** _<path>_
- Load a plugin from file path (presumably outside the **plugin** folder.)
- **pluginmgr** **dumpmsg** _<plugin>_
- Dump messages.ini.

* **poptp**
Returns to the previous location
Expand Down Expand Up @@ -522,7 +520,7 @@ This listener module will broadcast when a player uses FastTransfer
Broadcast player's teleports

This listener module will broadcast when a player teleports to
another location.
another location. It also generates some smoke and plays a sound.

#### CommandSelector

Expand Down Expand Up @@ -773,9 +771,8 @@ languages currently available are:
* Spanish

You can provide your own message file by creating a file called
`messages.ini` in the plugin config directory. Check
[github](https://github.com/alejandroliu/pocketmine-plugins/tree/master/GrabBag/resources/messages)
for sample files.
`messages.ini` in the plugin config directory. Use the `GrabBag`'s
`pluginmgr dumpmsgs` command to create an empty `messages.ini` file.

## Additional Libraries

Expand Down Expand Up @@ -944,3 +941,4 @@ The following third party libraries are included:
along with this program. If not, see <http://www.gnu.org/licenses/>.

* * *

2 changes: 1 addition & 1 deletion GrabBag/src/aliuly/grabbag/CmdFreezeMgr.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
** COMMANDS
**
** * freeze|thaw : freeze/unfreeze a player so they cannot move.
** usage: **freeze|thaw** [_player_|**--hard|--soft**]
** usage: **freeze|thaw** [ _player_ | **--hard|--soft** ]
**
** Stops players from moving. If no player specified it will show
** the list of frozen players.
Expand Down
2 changes: 1 addition & 1 deletion GrabBag/src/aliuly/grabbag/CmdSelMgr.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

use aliuly\grabbag\common\BasicCli;
use aliuly\grabbag\common\mc;
use aliuly\common\CmdSelector;
use aliuly\grabbag\common\CmdSelector;

class PlayerCommandPreprocessEvent_sub extends PlayerCommandPreprocessEvent{
}
Expand Down
4 changes: 2 additions & 2 deletions libcommon/src/aliuly/common/CmdSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use aliuly\common\mc;

use aliuly\common\selectors\BaseSelector;
use aliuly\common\selectors\All;
use aliuly\common\selectors\AllEntity;
use aliuly\common\selectors\Random;
Expand Down Expand Up @@ -44,10 +45,9 @@ static public function expandSelectors(Server $server, CommandSender $sender, $c
$sargs[$kvp[0]] = strtolower($kvp[1]);
}
$selector = substr($selector,0,$i);
print_r($sargs);//##DEBUG
}
$results = self::dispatchSelector($server, $sender , $selector, $sargs);
if (!is_array($results)) continue;
if (!is_array($results) || count($results) == 0) continue;
$ret = true;
$new = [];

Expand Down
2 changes: 1 addition & 1 deletion libcommon/src/aliuly/common/selectors/All.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use pocketmine\command\CommandSender;
use pocketmine\Server;

class All implements BaseSelector {
class All extends BaseSelector {
static public function select(Server $srv, CommandSender $sender, array $args) {
$result = [];
foreach ($srv->getOnlinePlayers() as $p) {
Expand Down
4 changes: 3 additions & 1 deletion libcommon/src/aliuly/common/selectors/BaseSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use pocketmine\Server;

abstract class BaseSelector {
static public function select(Server $srv, CommandSender $sender, array $args);
static public function select(Server $srv, CommandSender $sender, array $args) {
throw new RuntimeException("unimplmented!");
}
static public function checkSelectors(array $args,CommandSender $sender, Entity $item) {
foreach($args as $name => $value){
switch($name){
Expand Down

0 comments on commit a3fcc20

Please sign in to comment.