Allow disabling of command exception stack trace
This commit is contained in:
parent
d0be598676
commit
dcda383dc9
3 changed files with 13 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue