Feeble attempt at fixing comments not updating
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package com.drtshock.playervaults;
|
package com.drtshock.playervaults;
|
||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -18,7 +17,6 @@ import com.drtshock.playervaults.util.Lang;
|
|||||||
import com.drtshock.playervaults.util.Metrics;
|
import com.drtshock.playervaults.util.Metrics;
|
||||||
import com.drtshock.playervaults.util.Updater;
|
import com.drtshock.playervaults.util.Updater;
|
||||||
|
|
||||||
|
|
||||||
public class Main extends JavaPlugin {
|
public class Main extends JavaPlugin {
|
||||||
|
|
||||||
public static Main plugin;
|
public static Main plugin;
|
||||||
@@ -34,7 +32,6 @@ public class Main extends JavaPlugin {
|
|||||||
public static File langFile;
|
public static File langFile;
|
||||||
public static String directory = "plugins" + File.separator + "PlayerVaults" + File.separator + "vaults";
|
public static String directory = "plugins" + File.separator + "PlayerVaults" + File.separator + "vaults";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
loadLang();
|
loadLang();
|
||||||
@@ -80,11 +77,11 @@ public class Main extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupEconomy() {
|
private boolean setupEconomy() {
|
||||||
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
if(getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||||
if (rsp == null) {
|
if(rsp == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
econ = rsp.getProvider();
|
econ = rsp.getProvider();
|
||||||
@@ -109,40 +106,45 @@ public class Main extends JavaPlugin {
|
|||||||
int ecoDelete = getConfig().getInt("economy.refund-on-delete", 50);
|
int ecoDelete = getConfig().getInt("economy.refund-on-delete", 50);
|
||||||
boolean dropEnabled = getConfig().getBoolean("drop-on-death.enabled", false);
|
boolean dropEnabled = getConfig().getBoolean("drop-on-death.enabled", false);
|
||||||
int dropInvs = getConfig().getInt("drop-on-death.inventories", 50);
|
int dropInvs = getConfig().getInt("drop-on-death.inventories", 50);
|
||||||
new File("plugins" + File.separator + "PlayerVaults" + File.separator + "config.yml").delete();
|
File configFile = new File(getDataFolder(), "config.yml");
|
||||||
saveDefaultConfig();
|
configFile.delete();
|
||||||
setInConfig("check-update", checkUpdate);
|
YamlConfiguration conf = YamlConfiguration.loadConfiguration(getResource("config.yml"));
|
||||||
setInConfig("economy.enabled", ecoEnabled);
|
setInConfig("check-update", checkUpdate, conf);
|
||||||
setInConfig("economy.cost-to-create", ecoCreate);
|
setInConfig("economy.enabled", ecoEnabled, conf);
|
||||||
setInConfig("economy.cost-to-open", ecoOpen);
|
setInConfig("economy.cost-to-create", ecoCreate, conf);
|
||||||
setInConfig("economy.refund-on-delete", ecoDelete);
|
setInConfig("economy.cost-to-open", ecoOpen, conf);
|
||||||
setInConfig("drop-on-death.enabled", dropEnabled);
|
setInConfig("economy.refund-on-delete", ecoDelete, conf);
|
||||||
setInConfig("drop-on-death.inventories", dropInvs);
|
setInConfig("drop-on-death.enabled", dropEnabled, conf);
|
||||||
saveConfig();
|
setInConfig("drop-on-death.inventories", dropInvs, conf);
|
||||||
|
try {
|
||||||
|
conf.save(configFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void setInConfig(String path, T object) {
|
public <T> void setInConfig(String path, T object, YamlConfiguration conf) {
|
||||||
getConfig().set(path, object);
|
conf.set(path, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public YamlConfiguration loadLang() {
|
public YamlConfiguration loadLang() {
|
||||||
File lang = new File(getDataFolder(), "lang.yml");
|
File lang = new File(getDataFolder(), "lang.yml");
|
||||||
if(!lang.exists()) {
|
if(!lang.exists()) {
|
||||||
try{
|
try {
|
||||||
getDataFolder().mkdir();
|
getDataFolder().mkdir();
|
||||||
lang.createNewFile();
|
lang.createNewFile();
|
||||||
InputStream defConfigStream = this.getResource("lang.yml");
|
InputStream defConfigStream = this.getResource("lang.yml");
|
||||||
if (defConfigStream != null) {
|
if(defConfigStream != null) {
|
||||||
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||||
defConfig.save(lang);
|
defConfig.save(lang);
|
||||||
Lang.setFile(defConfig);
|
Lang.setFile(defConfig);
|
||||||
return defConfig;
|
return defConfig;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(); //So they notice
|
e.printStackTrace(); // So they notice
|
||||||
log.severe("[PlayerVaults] Couldn't create language file.");
|
log.severe("[PlayerVaults] Couldn't create language file.");
|
||||||
log.severe("[PlayerVaults] This is a fatal error. Now disabling");
|
log.severe("[PlayerVaults] This is a fatal error. Now disabling");
|
||||||
this.setEnabled(false); //Without it loaded, we can't send them messages
|
this.setEnabled(false); // Without it loaded, we can't send them messages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
YamlConfiguration conf = YamlConfiguration.loadConfiguration(lang);
|
YamlConfiguration conf = YamlConfiguration.loadConfiguration(lang);
|
||||||
|
|||||||
Reference in New Issue
Block a user