Allow disabling of command exception stack trace

This commit is contained in:
Nathan Adams 2017-07-26 14:01:29 +02:00
parent d0be598676
commit dcda383dc9
3 changed files with 13 additions and 0 deletions

View file

@ -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;
}

View file

@ -64,4 +64,9 @@ public class ParameterizedCommandExceptionType implements CommandExceptionType {
public int hashCode() {
return getTypeName().hashCode();
}
@Override
public String toString() {
return message;
}
}

View file

@ -39,4 +39,9 @@ public class SimpleCommandExceptionType implements CommandExceptionType {
public int hashCode() {
return getTypeName().hashCode();
}
@Override
public String toString() {
return message;
}
}