blob: c22730f3da2c420140c050f6e33b83ea06d9f475 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package com.earth2me.essentials;
import java.io.File;
import net.ess3.api.IEssentials;
import net.ess3.api.IItemDb;
import net.ess3.api.IPlugin;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class Essentials extends JavaPlugin
{
IEssentials ess;
@Override
public void onEnable()
{
Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials-3");
//TODO: Update files to new 3.0 format
//TODO: Move Eco Api here
//TODO: write update methods for itemmeta
IPlugin plugin = (IPlugin)getServer().getPluginManager().getPlugin("Essentials-3");
ess = plugin.getEssentials();
updateSettings();
updateUserfiles();
}
private void updateSettings()
{
File config = new File(getDataFolder(), "config.yml");
if (config.isFile())
{
new UpdateSettings(config, ess);
File fileNew;
do
{
fileNew = new File(getDataFolder(), "config-" + System.currentTimeMillis() + ".yml");
}
while (fileNew.exists());
config.renameTo(fileNew);
}
}
private void updateUserfiles()
{
File folder = new File(getDataFolder(), "userdata");
if (folder.isDirectory())
{
new UpdateUserFiles(folder, ess);
File folderNew;
do
{
folderNew = new File(getDataFolder(), "userdata-" + System.currentTimeMillis());
}
while (folderNew.exists());
folder.renameTo(folderNew);
}
}
public IItemDb getItemDb()
{
return ess.getItemDb();
}
}
|