Skip to content

Commit

Permalink
Release 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Rollczi committed Jun 14, 2022
1 parent 17add47 commit 0e70804
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Expand Up @@ -13,7 +13,7 @@ plugins {

allprojects {
group = "dev.rollczi.litecommands"
version = "2.0.2"
version = "2.0.3"

apply(plugin = "java-library")
apply(plugin = "maven-publish")
Expand Down
@@ -1,14 +1,19 @@
package dev.rollczi.litecommands;

import dev.rollczi.litecommands.command.CommandService;
import dev.rollczi.litecommands.handle.ExecuteResultHandler;
import dev.rollczi.litecommands.injector.Injector;
import dev.rollczi.litecommands.platform.RegistryPlatform;

public interface LiteCommands<SENDER> {

Class<SENDER> getSenderType();

CommandService<SENDER> getCommandService();

RegistryPlatform<SENDER> getPlatform();

Injector<SENDER> getInjector();

Class<SENDER> getSenderType();

ExecuteResultHandler<SENDER> getExecuteResultHandler();
}
Expand Up @@ -48,12 +48,4 @@ public void register(CommandSection<SENDER> section) {
);
}

public ExecuteResultHandler<SENDER> getHandler() {
return handler;
}

public RegistryPlatform<SENDER> getPlatform() {
return platform;
}

}
Expand Up @@ -205,8 +205,8 @@ public LiteCommands<SENDER> register() {
throw new IllegalStateException("Registry platform is not set");
}

LiteCommands<SENDER> commands = new LiteCommandsImpl<>(senderType, registryPlatform, executeResultHandler);
Injector<SENDER> injector = this.injectorSettings.create();
LiteCommands<SENDER> commands = new LiteCommandsImpl<>(senderType, registryPlatform, executeResultHandler, injector);

if (this.commandStateFactory == null) {
this.commandStateFactory = new LiteCommandFactory<>(injector, this.argumentsRegistry, this.editorRegistry);
Expand Down
Expand Up @@ -3,23 +3,23 @@
import dev.rollczi.litecommands.LiteCommands;
import dev.rollczi.litecommands.command.CommandService;
import dev.rollczi.litecommands.handle.ExecuteResultHandler;
import dev.rollczi.litecommands.injector.Injector;
import dev.rollczi.litecommands.platform.RegistryPlatform;

class LiteCommandsImpl<SENDER> implements LiteCommands<SENDER> {

private final Class<SENDER> senderType;
private final CommandService<SENDER> commandService;
private final RegistryPlatform<SENDER> platform;
private final Injector<SENDER> injector;
private final Class<SENDER> senderType;
private final ExecuteResultHandler<SENDER> executeResultHandler;

LiteCommandsImpl(Class<SENDER> senderType, RegistryPlatform<SENDER> platform, ExecuteResultHandler<SENDER> handler) {
LiteCommandsImpl(Class<SENDER> senderType, RegistryPlatform<SENDER> platform, ExecuteResultHandler<SENDER> handler, Injector<SENDER> injector) {
this.senderType = senderType;
this.injector = injector;
this.commandService = new CommandService<>(platform, handler);
this.platform = platform;
}

@Override
public Class<SENDER> getSenderType() {
return this.senderType;
this.executeResultHandler = handler;
}

@Override
Expand All @@ -32,4 +32,19 @@ public RegistryPlatform<SENDER> getPlatform() {
return this.platform;
}

@Override
public Injector<SENDER> getInjector() {
return injector;
}

@Override
public Class<SENDER> getSenderType() {
return this.senderType;
}

@Override
public ExecuteResultHandler<SENDER> getExecuteResultHandler() {
return executeResultHandler;
}

}

0 comments on commit 0e70804

Please sign in to comment.