From 40768b2ec1b63984ab521d7b64b25a2816daf266 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Tue, 29 Aug 2023 22:50:21 +0200 Subject: [PATCH] Added Command and AbstractCommand --- .../toolbox/core/command/AbstractCommand.java | 15 +++++++++++++++ .../fr/altarik/toolbox/core/command/Command.java | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 Core/src/main/java/fr/altarik/toolbox/core/command/AbstractCommand.java create mode 100644 Core/src/main/java/fr/altarik/toolbox/core/command/Command.java diff --git a/Core/src/main/java/fr/altarik/toolbox/core/command/AbstractCommand.java b/Core/src/main/java/fr/altarik/toolbox/core/command/AbstractCommand.java new file mode 100644 index 0000000..6ee5fc9 --- /dev/null +++ b/Core/src/main/java/fr/altarik/toolbox/core/command/AbstractCommand.java @@ -0,0 +1,15 @@ +package fr.altarik.toolbox.core.command; + +import com.mojang.brigadier.context.CommandContext; +import net.minecraft.server.command.ServerCommandSource; + +public abstract class AbstractCommand implements Command { + + protected final ServerCommandSource source; + protected final CommandContext context; + + protected AbstractCommand(CommandContext c) { + this.context = c; + this.source = c.getSource(); + } +} diff --git a/Core/src/main/java/fr/altarik/toolbox/core/command/Command.java b/Core/src/main/java/fr/altarik/toolbox/core/command/Command.java new file mode 100644 index 0000000..978cc79 --- /dev/null +++ b/Core/src/main/java/fr/altarik/toolbox/core/command/Command.java @@ -0,0 +1,9 @@ +package fr.altarik.toolbox.core.command; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; + +public interface Command { + + int run() throws CommandSyntaxException; + +}