33 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.commands;
 | |
| 
 | |
| import com.mojang.brigadier.CommandDispatcher;
 | |
| import com.mojang.brigadier.Message;
 | |
| import com.mojang.brigadier.ResultConsumer;
 | |
| import com.mojang.brigadier.exceptions.CommandExceptionType;
 | |
| import com.mojang.brigadier.exceptions.CommandSyntaxException;
 | |
| import net.minecraft.commands.execution.TraceCallbacks;
 | |
| import org.jetbrains.annotations.Nullable;
 | |
| 
 | |
| public interface ExecutionCommandSource<T extends ExecutionCommandSource<T>> extends PermissionSource {
 | |
| 	T withCallback(CommandResultCallback callback);
 | |
| 
 | |
| 	CommandResultCallback callback();
 | |
| 
 | |
| 	default T clearCallbacks() {
 | |
| 		return this.withCallback(CommandResultCallback.EMPTY);
 | |
| 	}
 | |
| 
 | |
| 	CommandDispatcher<T> dispatcher();
 | |
| 
 | |
| 	void handleError(CommandExceptionType exceptionType, Message message, boolean success, @Nullable TraceCallbacks traceCallbacks);
 | |
| 
 | |
| 	boolean isSilent();
 | |
| 
 | |
| 	default void handleError(CommandSyntaxException exception, boolean success, @Nullable TraceCallbacks traceCallbacks) {
 | |
| 		this.handleError(exception.getType(), exception.getRawMessage(), success, traceCallbacks);
 | |
| 	}
 | |
| 
 | |
| 	static <T extends ExecutionCommandSource<T>> ResultConsumer<T> resultConsumer() {
 | |
| 		return (commandContext, bl, i) -> commandContext.getSource().callback().onResult(bl, i);
 | |
| 	}
 | |
| }
 |