From efd506eb74fceca663592990d2ff3f3cf7797a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Mon, 24 Oct 2022 20:58:44 +0200 Subject: [PATCH] Fix build errors --- .../nounspicker/commands/subcommands/NounsAddSubCommand.java | 2 +- .../nounspicker/commands/subcommands/NounsSetSubCommand.java | 4 ++-- .../java/wtf/beatrice/nounspicker/utils/DatabaseManager.java | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsAddSubCommand.java b/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsAddSubCommand.java index 857e293..ada8168 100644 --- a/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsAddSubCommand.java +++ b/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsAddSubCommand.java @@ -20,7 +20,7 @@ public class NounsAddSubCommand String pronoun = args[1].toLowerCase(); - if(Cache.dbManager.getPronounId(pronoun) >= 0) + if(Cache.dbManager.isPronounValid(pronoun)) { sender.sendMessage("Pronoun already exists!"); return true; diff --git a/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsSetSubCommand.java b/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsSetSubCommand.java index 0867aea..deb0dc0 100644 --- a/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsSetSubCommand.java +++ b/src/main/java/wtf/beatrice/nounspicker/commands/subcommands/NounsSetSubCommand.java @@ -19,13 +19,13 @@ public class NounsSetSubCommand String mainPronoun = args[1].toLowerCase(); String secondaryPronoun = args[2].toLowerCase(); - if(!Cache.isPronounValid(mainPronoun)) + if(!Cache.dbManager.isPronounValid(mainPronoun)) { sender.sendMessage("Invalid main pronoun!"); return true; } - if(!Cache.isPronounValid(secondaryPronoun)) + if(!Cache.dbManager.isPronounValid(secondaryPronoun)) { sender.sendMessage("Invalid secondary pronoun!"); return true; diff --git a/src/main/java/wtf/beatrice/nounspicker/utils/DatabaseManager.java b/src/main/java/wtf/beatrice/nounspicker/utils/DatabaseManager.java index 2b61210..145f670 100644 --- a/src/main/java/wtf/beatrice/nounspicker/utils/DatabaseManager.java +++ b/src/main/java/wtf/beatrice/nounspicker/utils/DatabaseManager.java @@ -129,6 +129,10 @@ public class DatabaseManager return -1; } + public boolean isPronounValid(String pronoun) { + return getPronounId(pronoun) >= 0; + } + public boolean addNewPronoun(String pronoun, String format) { String query = "INSERT INTO pronouns " + "( pronoun, format, id) VALUES " +