Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a member argument to choose a user more easily #38

Open
JblusItsMe opened this issue Jan 18, 2023 · 0 comments
Open

Adding a member argument to choose a user more easily #38

JblusItsMe opened this issue Jan 18, 2023 · 0 comments

Comments

@JblusItsMe
Copy link

Here is a file that you can add in the argument folder, it is a file that allows to obtain the player selector more easily.

<?php

namespace CortexPE\Commando\args;

use pocketmine\command\CommandSender;
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;

class MemberArguement extends BaseArgument {

    public function getNetworkType(): int {
        return AvailableCommandsPacket::ARG_TYPE_TARGET;
    }

    public function getTypeName(): string {
        return "member";
    }

    public function canParse(string $testString, CommandSender $sender): bool {
        /** Définir le regex des nom d'utilisateur */
        return (bool)preg_match("/^(?!rcon|console)[a-zA-Z0-9_ ]{1,16}$/i", $testString);
    }

    public function parse(string $argument, CommandSender $sender): mixed {
        // TODO: Implement parse() method.
        return $argument;
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant