Skip to content

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

Description

@JblusItsMe

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;
    }

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions