Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
PlaidMrdeer authored Mar 10, 2023
1 parent 3d8ab2f commit 5e292d7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.plaidmrdeer</groupId>
<artifactId>SilentVoice</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>

<name>SilentVoice</name>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/plaidmrdeer/silentvoice/SilentVoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public void onLoad() {

@Override
public void onEnable() {

saveDefaultConfig();

config = getConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
Expand All @@ -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"))) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/plaidmrdeer/silentvoice/gui/MessageGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public void run() {
Map<Integer, List<String>> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/plaidmrdeer/silentvoice/sql/MySql.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void insert(String tableName, String message, String time) throws SQLExce
pstmt.close();
}

public Map<Integer, List<String>> query(String tableName) throws Exception {
public Map<Integer, List<String>> queryList(String tableName) throws Exception {
Map<Integer, List<String>> messageList = new HashMap<>();
stmt = c.createStatement();
ResultSet rs = stmt.executeQuery("SELECT 1 FROM `" + tableName + "` LIMIT 1");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/plaidmrdeer/silentvoice/sql/Sqlite.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void insert(String tableName, String message, String time) throws SQLExce
pstmt.close();
}

public Map<Integer, List<String>> query(String tableName) throws Exception {
public Map<Integer, List<String>> queryList(String tableName) throws Exception {
Map<Integer, List<String>> messageList = new HashMap<>();
stmt = c.createStatement();
ResultSet rs = stmt.executeQuery("SELECT name FROM sqlite_master WHERE type='table' AND name='" + tableName + "'" + ";");
Expand Down

0 comments on commit 5e292d7

Please sign in to comment.