package net.saltymc.eaa.handler.commands; import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; import net.minecraft.text.Text; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.Arrays; public class EaaCommand implements Command { private static final String COMMAND = "echo"; private static final boolean INTERCEPT = true; private static final Logger LOGGER = LogManager.getLogger(); public EaaCommand(){ LOGGER.info("Init EaaCommand"); } @Override public boolean run( final FabricClientCommandSource cs, String[] args) { System.out.println("on Command: " + args[0]); if (!args[0].equalsIgnoreCase(COMMAND)) { return false; } StringBuilder sb = new StringBuilder(); for (String arg : args) sb.append(arg); cs.sendFeedback(Text.of(sb.toString().replaceFirst(args[0], ""))); return true; } @Override public boolean intercept() { return INTERCEPT; } }