Added NumberFormatException check

master
Alex 2022-03-13 16:53:38 +01:00
parent d054d84339
commit 7a18172b0a
1 changed files with 29 additions and 30 deletions

View File

@ -23,6 +23,7 @@ public class SendTestMessageCommand extends Command {
// /sendTestMessage <status> <cmdID> <dest> <cmdNumber> <msg>
if (args.length == 5) {
try {
int cmdID;
byte status = Byte.parseByte(args[0]);
@ -49,18 +50,16 @@ public class SendTestMessageCommand extends Command {
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = null;
try {
kraSocketClientProtocolMessage = new KraSocketClientProtocolMessage(
status, (byte) cmdID, Integer.parseInt(args[2]),
proxiedPlayer.getUniqueId().toString(), Integer.parseInt(args[3]), args[4],
consumer);
} catch (NumberFormatException exception) {
proxiedPlayer.sendMessage(new TextComponent("§7Error: §cNumberFormatException"));
return;
}
ProxySystem.getInstance().getKraSocketClient().getSocketClient()
.SendMessage(kraSocketClientProtocolMessage);
} catch (NumberFormatException exception) {
proxiedPlayer.sendMessage(new TextComponent("§7Error: §cNumberFormatException"));
}
} else {
proxiedPlayer.sendMessage(new TextComponent(
"§cVerwendung: §7/sendTestMessage <status> <cmdID> <dest> <cmdNumber> <msg>"));