summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java
blob: b9cddc38c273ebae378275a81ec841e5112f3e2d (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
package com.earth2me.essentials.update;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.configuration.Configuration;


public class VersionInfo
{
	private final transient List<String> changelog;
	private final transient int minBukkit;
	private final transient int maxBukkit;
	private final transient Map<String, ModuleInfo> modules;

	public VersionInfo(final Configuration updateConfig, final String path)
	{
		changelog = updateConfig.getList(path + ".changelog", Collections.<String>emptyList());
		minBukkit = updateConfig.getInt(path + ".min-bukkit", 0);
		maxBukkit = updateConfig.getInt(path + ".max-bukkit", 0);
		modules = new HashMap<String, ModuleInfo>();
		final String modulesPath = path + ".modules";
		for (String module : updateConfig.getKeys(false))
		{
			modules.put(module, new ModuleInfo(updateConfig, modulesPath + module));
		}
	}

	public List<String> getChangelog()
	{
		return Collections.unmodifiableList(changelog);
	}

	public int getMinBukkit()
	{
		return minBukkit;
	}

	public int getMaxBukkit()
	{
		return maxBukkit;
	}

	public Map<String, ModuleInfo> getModules()
	{
		return Collections.unmodifiableMap(modules);
	}
}