mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
init databackup while plugin enable...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
@@ -85,6 +85,7 @@ public class Residence extends JavaPlugin {
|
|||||||
public final static int saveVersion = 1;
|
public final static int saveVersion = 1;
|
||||||
public final static String[] validLanguages = { "English", "Chinese" };
|
public final static String[] validLanguages = { "English", "Chinese" };
|
||||||
protected static Residence instance;
|
protected static Residence instance;
|
||||||
|
protected DataBackup backup;
|
||||||
protected ResidenceBlockListener blistener;
|
protected ResidenceBlockListener blistener;
|
||||||
protected ChatManager chatmanager;
|
protected ChatManager chatmanager;
|
||||||
protected ConfigManager cmanager;
|
protected ConfigManager cmanager;
|
||||||
@@ -118,6 +119,10 @@ public class Residence extends JavaPlugin {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataBackup getBackup() {
|
||||||
|
return backup;
|
||||||
|
}
|
||||||
|
|
||||||
public ResidenceBlockListener getBlockListener() {
|
public ResidenceBlockListener getBlockListener() {
|
||||||
return blistener;
|
return blistener;
|
||||||
}
|
}
|
||||||
@@ -325,11 +330,10 @@ public class Residence extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
taskmanager.cancelall();
|
taskmanager.cancelall();
|
||||||
final DataBackup backup = new DataBackup(this);
|
if (this.init) {
|
||||||
if (init) {
|
|
||||||
try {
|
try {
|
||||||
saveYml();
|
this.saveYml();
|
||||||
backup.backup();
|
this.backup.backup();
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
this.getLogger().warning("领地数据保存错误,可能造成部分领地丢失,请尝试恢复备份文件!");
|
this.getLogger().warning("领地数据保存错误,可能造成部分领地丢失,请尝试恢复备份文件!");
|
||||||
this.getLogger().warning("错误: " + ex);
|
this.getLogger().warning("错误: " + ex);
|
||||||
@@ -341,6 +345,7 @@ public class Residence extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
try {
|
try {
|
||||||
instance = this;
|
instance = this;
|
||||||
|
this.getLogger().info("Bukkit 版本: " + this.getServer().getBukkitVersion());
|
||||||
bukkitver = Float.parseFloat(this.getServer().getBukkitVersion().substring(0, 3));
|
bukkitver = Float.parseFloat(this.getServer().getBukkitVersion().substring(0, 3));
|
||||||
init = false;
|
init = false;
|
||||||
deleteConfirm = new HashMap<String, String>();
|
deleteConfirm = new HashMap<String, String>();
|
||||||
@@ -355,7 +360,7 @@ public class Residence extends JavaPlugin {
|
|||||||
final Plugin plugin = this.getServer().getPluginManager().getPlugin(multiworld);
|
final Plugin plugin = this.getServer().getPluginManager().getPlugin(multiworld);
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
if (!plugin.isEnabled()) {
|
if (!plugin.isEnabled()) {
|
||||||
this.getLogger().info(" - 加载多世界插件: " + multiworld);
|
this.getLogger().info("加载多世界插件: " + multiworld);
|
||||||
this.getServer().getPluginManager().enablePlugin(plugin);
|
this.getServer().getPluginManager().enablePlugin(plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -391,7 +396,7 @@ public class Residence extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
economy = null;
|
economy = null;
|
||||||
if (this.getConfig().getBoolean("Global.EnableEconomy", false)) {
|
if (this.getConfig().getBoolean("Global.EnableEconomy", false)) {
|
||||||
this.getLogger().info("扫描经济系统...");
|
this.getLogger().info("启用经济系统...");
|
||||||
if (gmanager.getPermissionsPlugin() instanceof ResidenceVaultAdapter) {
|
if (gmanager.getPermissionsPlugin() instanceof ResidenceVaultAdapter) {
|
||||||
final ResidenceVaultAdapter vault = (ResidenceVaultAdapter) gmanager.getPermissionsPlugin();
|
final ResidenceVaultAdapter vault = (ResidenceVaultAdapter) gmanager.getPermissionsPlugin();
|
||||||
if (vault.economyOK()) {
|
if (vault.economyOK()) {
|
||||||
@@ -503,6 +508,7 @@ public class Residence extends JavaPlugin {
|
|||||||
this.getLogger().warning("错误: " + ex);
|
this.getLogger().warning("错误: " + ex);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
backup = new DataBackup(this);
|
||||||
new VersionChecker(this);
|
new VersionChecker(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user