Adds some missing comments

This commit is contained in:
Kristian Knarvik 2021-09-09 02:24:55 +02:00
parent 852886e818
commit 245a580a43

View File

@ -297,8 +297,12 @@ public class BooksWithoutBorders extends JavaPlugin {
}
}
/**
* Initializes the plugin, loading and fixing the config file
* @return <p>True if successful</p>
*/
private boolean initialize() {
//initializes Item Factory
//Initialize Item Factory
try {
itemFactory = this.getServer().getItemFactory();
} catch (java.lang.NoSuchMethodError nsmE) {
@ -308,7 +312,7 @@ public class BooksWithoutBorders extends JavaPlugin {
return false;
}
//Pulls config values
//Load config
if (!loadConfig()) {
return false;
}
@ -352,6 +356,9 @@ public class BooksWithoutBorders extends JavaPlugin {
return true;
}
/**
* Saves the config
*/
public void saveConfigValues() {
Configuration config = this.getConfig();
config.set("Options.Save_Books_in_Yaml_Format", useYml);
@ -390,6 +397,10 @@ public class BooksWithoutBorders extends JavaPlugin {
this.saveConfig();
}
/**
* Loads the config
* @return <p>True if the config was loaded successfully</p>
*/
public boolean loadConfig() {
this.reloadConfig();
Configuration config = this.getConfig();
@ -412,24 +423,24 @@ public class BooksWithoutBorders extends JavaPlugin {
welcomeMessage = config.getString("Options.Message_for_new_players", " ");
//Converts string into material
String sMaterial = config.getString("Options.Price_to_create_book.Item_type", " ");
if (sMaterial.equalsIgnoreCase("Economy")) {
//Convert string into material
String paymentMaterial = config.getString("Options.Price_to_create_book.Item_type", " ");
if (paymentMaterial.equalsIgnoreCase("Economy")) {
if (EconomyHelper.setupEconomy()) {
bookPriceType = Material.AIR;
} else {
sendErrorMessage(consoleSender, "BooksWithoutBorders failed to hook into Vault! Book price not set!");
bookPriceType = null;
}
} else if (!sMaterial.equalsIgnoreCase(" ")) {
for (Material m : Material.values()) {
if (m.toString().equalsIgnoreCase(sMaterial))
bookPriceType = m;
} else if (!paymentMaterial.equalsIgnoreCase(" ")) {
Material material = Material.matchMaterial(paymentMaterial);
if (material != null) {
bookPriceType = material;
}
}
bookPriceQuantity = config.getDouble("Options.Price_to_create_book.Required_quantity", 0);
//makes sure titleAuthorSeparator is a valid value
//Make sure titleAuthorSeparator is a valid value
titleAuthorSeparator = cleanString(titleAuthorSeparator);
if (titleAuthorSeparator.length() != 1) {
sendErrorMessage(consoleSender, "Title-Author_Separator is set to an invalid value!");