From f78b422a17486ef073f46efc3820f9002b8f6a9d Mon Sep 17 00:00:00 2001
From: ChomeNS <95471003+ChomeNS@users.noreply.github.com>
Date: Mon, 24 Apr 2023 19:27:00 +0700
Subject: [PATCH] fix chomens bot crsah exploit 2023 working
---
.idea/workspace.xml | 25 ++++++++++---------
.../plugins/CommandHandlerPlugin.java | 7 +++++-
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 03f4637..49354af 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,10 @@
-
+
-
+
+
@@ -98,13 +99,6 @@
1680245437032
-
- 1681619945065
-
-
-
- 1681619945065
-
1681626702317
@@ -441,7 +435,14 @@
1682324452741
-
+
+ 1682334617794
+
+
+
+ 1682334617795
+
+
@@ -456,7 +457,6 @@
-
@@ -481,7 +481,8 @@
-
+
+
diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java
index e346406..18b0bdb 100644
--- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java
+++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CommandHandlerPlugin.java
@@ -70,7 +70,12 @@ public class CommandHandlerPlugin {
public Component executeCommand (String input, CommandContext context, boolean inGame, boolean discord, boolean console, String hash, String ownerHash, MessageReceivedEvent event) {
final String[] splitInput = input.split("\\s+");
- final String commandName = splitInput[0];
+ String commandName;
+ try {
+ commandName = splitInput[0];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return Component.text("Empty command").color(NamedTextColor.RED);
+ }
final Command command = ElementUtilities.findCommand(commands, commandName);