Allow disabling of command exception stack trace
This commit is contained in:
@@ -3,10 +3,13 @@ package com.mojang.brigadier.exceptions;
|
||||
import java.util.Map;
|
||||
|
||||
public class CommandException extends Exception {
|
||||
public static boolean ENABLE_COMMAND_STACK_TRACES = true;
|
||||
|
||||
private final CommandExceptionType type;
|
||||
private final Map<String, Object> data;
|
||||
|
||||
public CommandException(final CommandExceptionType type, final Map<String, Object> data) {
|
||||
super(type.getTypeName(), null, ENABLE_COMMAND_STACK_TRACES, ENABLE_COMMAND_STACK_TRACES);
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@@ -64,4 +64,9 @@ public class ParameterizedCommandExceptionType implements CommandExceptionType {
|
||||
public int hashCode() {
|
||||
return getTypeName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,9 @@ public class SimpleCommandExceptionType implements CommandExceptionType {
|
||||
public int hashCode() {
|
||||
return getTypeName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user