Only print "An error occurred" if no other message

This commit is contained in:
Heliosares
2024-01-09 13:47:24 -05:00
parent bf2cd3f553
commit d40c64d6e2

View File

@@ -1,7 +1,11 @@
package dev.heliosares.auxprotect.core.commands;
import dev.heliosares.auxprotect.adapters.sender.SenderAdapter;
import dev.heliosares.auxprotect.core.*;
import dev.heliosares.auxprotect.core.APPermission;
import dev.heliosares.auxprotect.core.Command;
import dev.heliosares.auxprotect.core.IAuxProtect;
import dev.heliosares.auxprotect.core.Language;
import dev.heliosares.auxprotect.core.PlatformType;
import dev.heliosares.auxprotect.exceptions.CommandException;
import dev.heliosares.auxprotect.exceptions.NotPlayerException;
import dev.heliosares.auxprotect.exceptions.PlatformException;
@@ -9,7 +13,12 @@ import dev.heliosares.auxprotect.exceptions.SyntaxException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class APCommand extends Command {
@@ -99,9 +108,10 @@ public class APCommand extends Command {
}
}
} catch (CommandException e) {
sender.sendLang(Language.L.ERROR);
if (e.getMessage() != null) {
sender.sendMessageRaw(e.getMessage());
} else {
sender.sendLang(Language.L.ERROR);
}
} catch (Throwable t) {
sender.sendLang(Language.L.ERROR);