public static Optional<PlayerCommand> createPlayerCommand(Identification source, Identification target,
                                                              String command, Capabilities capabilities,
                                                              Context context) {
    """
	Creates a new Event Object
	
	@param source      the source of the Event, most likely a this reference.
	@param target the target who should start playing
	@param capabilities the capabilities of the player
	@param command the command
	@param context the context to use
	@return the optional PlayerCommand
	@throws IllegalArgumentException if one of the Arguments is null or empty
    """
        try {
            Optional<CommandResource> commandResource = CommandResource.createCommandResource(source, command,
                    capabilities, context);
            if (!commandResource.isPresent()) {
                context.getLogger().error("unable to obtain commandResource");
                return Optional.empty();
            }
            PlayerCommand playerCommand = new PlayerCommand(source);
            playerCommand.addResource(new SelectorResource(source, target));
            playerCommand.addResource(commandResource.get());
            return Optional.of(playerCommand);
        } catch (IllegalArgumentException e) {
            return Optional.empty();
        }
    }
public static Optional<PlayerCommand> createPlayerCommand(Identification source, Identification target,
                                                              String command, Capabilities capabilities,
                                                              Context context) {
        try {
            Optional<CommandResource> commandResource = CommandResource.createCommandResource(source, command,
                    capabilities, context);
            if (!commandResource.isPresent()) {
                context.getLogger().error("unable to obtain commandResource");
                return Optional.empty();
            }
            PlayerCommand playerCommand = new PlayerCommand(source);
            playerCommand.addResource(new SelectorResource(source, target));
            playerCommand.addResource(commandResource.get());
            return Optional.of(playerCommand);
        } catch (IllegalArgumentException e) {
            return Optional.empty();
        }
    }
public static Optional < PlayerCommand > createPlayerCommand ( Identification source , Identification target , String command , Capabilities capabilities , Context context ) { try { Optional < CommandResource > commandResource = CommandResource . createCommandResource ( source , command , capabilities , context ) ; if ( ! commandResource . isPresent ( ) ) { context . getLogger ( ) . error ( "unable to obtain commandResource" ) ; return Optional . empty ( ) ; } PlayerCommand playerCommand = new PlayerCommand ( source ) ; playerCommand . addResource ( new SelectorResource ( source , target ) ) ; playerCommand . addResource ( commandResource . get ( ) ) ; return Optional . of ( playerCommand ) ; } catch ( IllegalArgumentException e ) { return Optional . empty ( ) ; } }
Creates a new Event Object

@param source      the source of the Event, most likely a this reference.
@param target the target who should start playing
@param capabilities the capabilities of the player
@param command the command
@param context the context to use
@return the optional PlayerCommand
@throws IllegalArgumentException if one of the Arguments is null or empty
Creates a new Event Object