Download the PHP package valiant-bedrock/libcommand without Composer

On this page you can find all versions of the php package valiant-bedrock/libcommand. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package libcommand

libcommand

A small PocketMine-MP command library meant to simplify the process of creating commands while also enhancing the user experience.

NOTE: This library is still in development and as such, the API is subject to change.

Installation

Composer

The following command can be used to install the library using Composer:

Virion (Poggit)

Virion support can be accessed through Poggit using this link.

Usage

Parameter

At the basis of the library, there is the parameter. In most instances, the parameter class accepts two properties:

A simple raw-text parameter looks like so:

Parameter Types

This is a list of all current parameter types:

Standard

Class Name Return Type Description
CommandParameter Command Accepts any registered command that has been sent to the client.
EquipmentSlotParameter string A hardcoded client enum that can take any equipment slot (See [Equipment Slot](#Equipment Slot))
EnumParameter string A list of accepted string values that can be used to filter the results of a command.
FilepathParameter string Accepts a filepath (In progress / Not fully researched yet)
FloatParameter float Accepts any float value.
IntParameter int Accepts any integer value.
IntVector3Parameter Vector3<int> Accepts positional coordinates and returns a integer-oriented Vector3
JsonParameter string Returns a JSON string (In progress / Not fully researched yet)
MessageParameter string Returns a message (used for chat commands like /tell)
OperatorParameter string Accepts one of the following: "+", "-", "*", "/", "%"
RawTextParameter string Returns a string (No parameters can be accepted after this)
StringParameter string Accepts any string value.
TargetParameter Player Accepts a target (only supported for Players at the moment)
ValueParameter string (Not fully researched yet)
Vector3Parameter Vector3<float> Accepts positional coordinates and returns a float-oriented Vector3
WildcardIntParameter int (In progress / Not fully researched yet)
WildcardTargetParameter Player (In progress / Not fully researched yet)

Custom

Class Name Return Type Description
BoolParameter bool An Enum parameter that can be true, false, 1, or 0
SubcommandParameter string A parameter that allows for nothing but the subcommand name to be passed.
BlockEnumParameter Block An Enum parameter that displays a list of blocks to the client
ItemEnumParameter Item An Enum parameter that displays a list of items to the client

Overload

In the terms of commands, an overload is a set of parameters that a command can take. An overload is defined by an array of Parameter objects. Here is how a simple overload class looks:

Command

Finally, to tie these features together, it uses the Command class. This class is meant to be extended to create new commands. The class extends \pocketmine\command\Command and accepts one more parameter, $overloads, which is an array of Overload objects, though you can use the methods addOverload(Overload $overload): void and addOverloads(Overload ...$overloads) to add them separately from the constructor.

onExecute(CommandSender $sender, string $overload, array<Parameter> $arguments): bool|string

This method is the heart of the command and runs the actual logic of the command. The command will look for a compatible overload and then pass it to $arguments. With $arguments, you can access the parameter values through their name (e.g., new StringParameter("name") would be accessed through $arguments["name"]). If the return type from this method is string, the returned value will be sent to the command sender.

Command Sender Access

To limit the access to the command, you can use the ConsoleCommand class or PlayerCommand class. This will verify the command sender before executing the command. Each of these classes have their own special methods that are called after the sender is verified:

NOTE: These methods do replace the onExecute() method.

Simple Example

Below is a simple example on how to create and register commands.

Command Class

Registration

ClosureCommand

If you would like to create a command without using a separate class, the ClosureCommand class can be used.

This foregoes the need for a separate class and allows you to use a closure to define the command logic.

A simple example of a closure command would look something like:

Vanilla Command Rendering

While not supported by default, libcommand\VanillaCommandPatcher::register(PluginBase $plugin) can be used to patch the default vanilla commands and render them client-side.

NOTE: This may be separated into a separate plugin in the future, but as of now, it is bundled with the library.

Types

These types are associated with the various parameters.

Equipment Slot

Roadmap


All versions of libcommand with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package valiant-bedrock/libcommand contains the following files

Loading the files please wait ....