Skip to content

Commit 26fe710

Browse files
committed
Move execute method away from top level command class
1 parent 5d7fcfc commit 26fe710

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

common/src/main/java/gs/mclo/commands/Command.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
44
import com.mojang.brigadier.context.CommandContext;
55
import gs.mclo.Constants;
6-
import gs.mclo.api.Log;
76
import gs.mclo.api.MclogsClient;
87
import gs.mclo.components.ClickEventAction;
98
import gs.mclo.components.IComponent;
109
import gs.mclo.components.IComponentFactory;
1110
import gs.mclo.components.IStyle;
1211

13-
import java.io.FileNotFoundException;
1412
import java.io.IOException;
1513
import java.nio.file.Path;
1614

@@ -60,16 +58,6 @@ public abstract <T> LiteralArgumentBuilder<T> build(
6058
LiteralArgumentBuilder<T> builder
6159
);
6260

63-
/**
64-
* Execute the command
65-
*
66-
* @param context the command context
67-
* @param buildContext Contains the environment and various methods to execute the command.
68-
* @param <T> the command source type
69-
* @return the result of the command
70-
*/
71-
public abstract <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext);
72-
7361
/**
7462
* Share a log or crash report
7563
* @param context The command context

common/src/main/java/gs/mclo/commands/MclogsCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public <T> LiteralArgumentBuilder<T> build(
3131
return builder.executes(context -> execute(context, buildContext));
3232
}
3333

34-
@Override
35-
public <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext) {
34+
protected <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext) {
3635
ICommandSourceAccessor<?> source = buildContext.mapSource(context.getSource());
3736
return share(context, buildContext, source.getCurrentLogFileName());
3837
}

common/src/main/java/gs/mclo/commands/MclogsListCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public <T> LiteralArgumentBuilder<T> build(
3838
return builder.then(list);
3939
}
4040

41-
@Override
42-
public <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext) {
41+
protected <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext) {
4342
var source = buildContext.mapSource(context.getSource());
4443
try {
4544
int total = 0;

common/src/main/java/gs/mclo/commands/MclogsShareCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ private <T> CompletableFuture<Suggestions> suggest(
7171
}
7272
}
7373

74-
@Override
75-
public <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext) {
74+
protected <T> int execute(CommandContext<T> context, BuildContext<T, ComponentType> buildContext) {
7675
return share(context, buildContext, context.getArgument(ARGUMENT_NAME, String.class));
7776
}
7877
}

0 commit comments

Comments
 (0)