diff --git a/src/main/java/com/erigitic/sql/SQLManager.java b/src/main/java/com/erigitic/sql/SQLManager.java index 5e989207..2977de6a 100644 --- a/src/main/java/com/erigitic/sql/SQLManager.java +++ b/src/main/java/com/erigitic/sql/SQLManager.java @@ -69,6 +69,13 @@ public DataSource getDataSource(String jdbcUrl) throws SQLException { return sql.getDataSource(jdbcUrl); } + /** + * Create a new table in the database + * + * @param tableName Name of the table to be created + * @param cols The columns that the table should have + * @return boolean Result of the query + */ public boolean createTable(String tableName, String cols) { try { Connection conn = dataSource.getConnection(); diff --git a/src/main/java/com/erigitic/sql/SQLQuery.java b/src/main/java/com/erigitic/sql/SQLQuery.java index c3ef9dc0..e42bce79 100644 --- a/src/main/java/com/erigitic/sql/SQLQuery.java +++ b/src/main/java/com/erigitic/sql/SQLQuery.java @@ -244,6 +244,11 @@ public String getString(String def) { return def; } + /** + * Get the number of rows that were affected by a query + * + * @return int Number of rows that were affected by the query + */ public int getRowsAffected() { return rowsAffected; } diff --git a/src/main/java/com/erigitic/util/MessageManager.java b/src/main/java/com/erigitic/util/MessageManager.java index 3db32075..e37392e1 100644 --- a/src/main/java/com/erigitic/util/MessageManager.java +++ b/src/main/java/com/erigitic/util/MessageManager.java @@ -41,7 +41,6 @@ import java.util.Locale; import java.util.Map; import java.util.Optional; -import java.util.ResourceBundle; public class MessageManager { @@ -54,7 +53,7 @@ public class MessageManager { /** * Grabs a message from the messages_[lang].conf file and converts it to a usable String/Text object ready for printing. Colors - * are changed, and aliases are changed to their corresponding values which are passed in. + * are changed, and value placeholders are changed to their corresponding values which are passed in. */ public MessageManager(TotalEconomy totalEconomy, Locale locale) { this.totalEconomy = totalEconomy; @@ -65,7 +64,7 @@ public MessageManager(TotalEconomy totalEconomy, Locale locale) { } /** - * Setup the config file that will contain the messages + * Setup the messages_[lang].conf file */ private void setupConfig(Locale locale) { messagesFile = new File(totalEconomy.getConfigDir(), "messages_" + locale.getLanguage() + ".conf"); @@ -85,12 +84,25 @@ private void setupConfig(Locale locale) { } } + /** + * Get a message from the messages_[lang].conf file and deserialize it for printing + * + * @param messageKey The key to grab a value from + * @return Text The deserialized message + */ public Text getMessage(String messageKey) { String message = messagesConfig.getNode(messageKey).getString(); return TextSerializers.FORMATTING_CODE.deserialize(message); } + /** + * Get a message from the messages_[lang].conf file, replace value placeholders, and deserialize it for printing + * + * @param messageKey The key to grab a value from + * @param values Map of values that will replace value placeholders (ex. {amount}, {name}) + * @return Text The deserialized message + */ public Text getMessage(String messageKey, Map values) { StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String message = sub.replace(messagesConfig.getNode(messageKey).getString());