Updated Essentials to work with R5

This commit is contained in:
snowleo 2012-02-21 17:33:46 +01:00
parent 3b81593ebb
commit f46948249e
22 changed files with 130 additions and 192 deletions

View file

@ -45,15 +45,15 @@ public class Settings implements ISettings
}
@Override
public List<String> getMultipleHomes()
public Set<String> getMultipleHomes()
{
return config.getKeys("sethome-multiple");
return config.getConfigurationSection("sethome-multiple").getKeys(false);
}
@Override
public int getHomeLimit(final User user)
{
final List<String> homeList = getMultipleHomes();
final Set<String> homeList = getMultipleHomes();
if (homeList == null)
{
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
@ -116,7 +116,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandDisabled(String label)
{
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("disabled-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@ -136,7 +136,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("restricted-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@ -150,7 +150,7 @@ public class Settings implements ISettings
@Override
public boolean isPlayerCommand(String label)
{
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
for (String c : config.getStringList("player-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@ -164,9 +164,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandOverridden(String name)
{
List<String> defaultList = new ArrayList<String>(1);
defaultList.add("god");
for (String c : config.getStringList("overridden-commands", defaultList))
for (String c : config.getStringList("overridden-commands"))
{
if (!c.equalsIgnoreCase(name))
{
@ -215,7 +213,7 @@ public class Settings implements ISettings
@Override
public Object getKit(String name)
{
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
Map<String, Object> kits = (Map<String, Object>)config.get("kits");
for (Map.Entry<String, Object> entry : kits.entrySet())
{
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
@ -229,7 +227,7 @@ public class Settings implements ISettings
@Override
public Map<String, Object> getKits()
{
return (Map<String, Object>)config.getProperty("kits");
return (Map<String, Object>)config.get("kits");
}
@Override
@ -254,7 +252,7 @@ public class Settings implements ISettings
{
}
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
return ChatColor.getByChar(colorName);
}
@Override
@ -355,7 +353,7 @@ public class Settings implements ISettings
public void reloadConfig()
{
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
enabledSigns = getEnabledSigns();
itemSpawnBl = getItemSpawnBlacklist();
chatFormats.clear();
@ -407,7 +405,7 @@ public class Settings implements ISettings
{
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
for (String signName : config.getStringList("enabledSigns", null))
for (String signName : config.getStringList("enabledSigns"))
{
signName = signName.trim().toUpperCase(Locale.ENGLISH);
if (signName.isEmpty())