From 5e292d78ce2d21b5083316e10bcf962c47cb6e17 Mon Sep 17 00:00:00 2001 From: plaidmrdeer <98594477+plaidmrdeer@users.noreply.github.com> Date: Fri, 10 Mar 2023 13:33:18 +0800 Subject: [PATCH] Add files via upload --- pom.xml | 2 +- src/main/java/com/plaidmrdeer/silentvoice/SilentVoice.java | 1 + .../silentvoice/commands/SilentVoiceCommand.java | 7 +++---- .../java/com/plaidmrdeer/silentvoice/gui/MessageGui.java | 4 ++-- src/main/java/com/plaidmrdeer/silentvoice/sql/MySql.java | 2 +- src/main/java/com/plaidmrdeer/silentvoice/sql/Sqlite.java | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index a1c3bfe..e35eff7 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.plaidmrdeer SilentVoice - 1.0.0 + 1.0.1 jar SilentVoice diff --git a/src/main/java/com/plaidmrdeer/silentvoice/SilentVoice.java b/src/main/java/com/plaidmrdeer/silentvoice/SilentVoice.java index fcf75c9..5408268 100644 --- a/src/main/java/com/plaidmrdeer/silentvoice/SilentVoice.java +++ b/src/main/java/com/plaidmrdeer/silentvoice/SilentVoice.java @@ -126,6 +126,7 @@ public void onLoad() { @Override public void onEnable() { + saveDefaultConfig(); config = getConfig(); diff --git a/src/main/java/com/plaidmrdeer/silentvoice/commands/SilentVoiceCommand.java b/src/main/java/com/plaidmrdeer/silentvoice/commands/SilentVoiceCommand.java index b7e9e4c..94828af 100644 --- a/src/main/java/com/plaidmrdeer/silentvoice/commands/SilentVoiceCommand.java +++ b/src/main/java/com/plaidmrdeer/silentvoice/commands/SilentVoiceCommand.java @@ -25,11 +25,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull String label, @NotNull String[] args) { - String silentVoicePermissions = "SilentVoice.command.silentvoicereload"; + String silentVoicePermissions = "SilentVoice.command.silentvoice"; String silentVoiceViewPermissions = "SilentVoice.command.silentvoice.view"; String silentVoiceWritePermissions = "SilentVoice.command.silentvoice.write"; String noPermissionPath = "no_permissions"; - String commandErrorPath = "command_error"; int subLength = 2; if (!sender.hasPermission(silentVoicePermissions)) { @@ -43,7 +42,7 @@ public boolean onCommand(@NotNull CommandSender sender, } try { - if (args.length > subLength) { + if (args.length >= subLength) { if (!sender.hasPermission(silentVoiceWritePermissions)) { instance.sendMessage (sender, noPermissionPath); return true; @@ -58,7 +57,7 @@ public void run() { try { StringBuilder sb = new StringBuilder(); for (int i = 1; i <= args.length - 1; i++) { - sb.append(args[i] + " "); + sb.append(args[i]).append(" "); } String message = sb.toString().trim(); if ("sqlite".equals (instance.config.getString("sql.type"))) { diff --git a/src/main/java/com/plaidmrdeer/silentvoice/gui/MessageGui.java b/src/main/java/com/plaidmrdeer/silentvoice/gui/MessageGui.java index 55564cb..49cddf1 100644 --- a/src/main/java/com/plaidmrdeer/silentvoice/gui/MessageGui.java +++ b/src/main/java/com/plaidmrdeer/silentvoice/gui/MessageGui.java @@ -41,9 +41,9 @@ public void run() { Map> message; try { if ("sqlite".equals (instance.config.getString("sql.type"))) { - message = instance.getSqlite().query(name); + message = instance.getSqlite().queryList(name); } else { - message = instance.getMySql().query(name); + message = instance.getMySql().queryList(name); } } catch (Exception e) { throw new RuntimeException(e); diff --git a/src/main/java/com/plaidmrdeer/silentvoice/sql/MySql.java b/src/main/java/com/plaidmrdeer/silentvoice/sql/MySql.java index 1207e16..4a05f6a 100644 --- a/src/main/java/com/plaidmrdeer/silentvoice/sql/MySql.java +++ b/src/main/java/com/plaidmrdeer/silentvoice/sql/MySql.java @@ -43,7 +43,7 @@ public void insert(String tableName, String message, String time) throws SQLExce pstmt.close(); } - public Map> query(String tableName) throws Exception { + public Map> queryList(String tableName) throws Exception { Map> messageList = new HashMap<>(); stmt = c.createStatement(); ResultSet rs = stmt.executeQuery("SELECT 1 FROM `" + tableName + "` LIMIT 1"); diff --git a/src/main/java/com/plaidmrdeer/silentvoice/sql/Sqlite.java b/src/main/java/com/plaidmrdeer/silentvoice/sql/Sqlite.java index fe3e6e7..867d6bc 100644 --- a/src/main/java/com/plaidmrdeer/silentvoice/sql/Sqlite.java +++ b/src/main/java/com/plaidmrdeer/silentvoice/sql/Sqlite.java @@ -44,7 +44,7 @@ public void insert(String tableName, String message, String time) throws SQLExce pstmt.close(); } - public Map> query(String tableName) throws Exception { + public Map> queryList(String tableName) throws Exception { Map> messageList = new HashMap<>(); stmt = c.createStatement(); ResultSet rs = stmt.executeQuery("SELECT name FROM sqlite_master WHERE type='table' AND name='" + tableName + "'" + ";");