2011-03-19 22:39:51 +00:00
|
|
|
package com.earth2me.essentials;
|
|
|
|
|
2011-04-01 22:06:00 +00:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
2011-03-19 22:39:51 +00:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
2011-06-01 10:40:12 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2011-04-01 22:06:00 +00:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
2011-03-19 22:39:51 +00:00
|
|
|
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
public class Settings implements ISettings
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
private final transient EssentialsConf config;
|
2011-04-01 22:06:00 +00:00
|
|
|
private final static Logger logger = Logger.getLogger("Minecraft");
|
2011-07-15 23:33:22 +00:00
|
|
|
private final transient IEssentials ess;
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-15 23:33:22 +00:00
|
|
|
public Settings(IEssentials ess)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
this.ess = ess;
|
|
|
|
config = new EssentialsConf(new File(ess.getDataFolder(), "config.yml"));
|
2011-03-19 22:39:51 +00:00
|
|
|
config.setTemplateName("/config.yml");
|
2011-07-16 00:38:22 +00:00
|
|
|
reloadConfig();
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean getRespawnAtHome()
|
|
|
|
{
|
|
|
|
return config.getBoolean("respawn-at-home", false);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-08-23 02:42:32 +00:00
|
|
|
@Override
|
2011-10-01 09:08:58 +00:00
|
|
|
public boolean getBedSetsHome()
|
2011-08-23 02:42:32 +00:00
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
return config.getBoolean("bed-sethome", false);
|
2011-08-23 02:42:32 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-10-01 09:08:58 +00:00
|
|
|
public List<String> getMultipleHomes()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
return config.getKeys("sethome-multiple");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getHomeLimit(final User user)
|
|
|
|
{
|
|
|
|
final List<String> homeList = getMultipleHomes();
|
|
|
|
if (homeList == null)
|
|
|
|
{
|
|
|
|
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
|
|
|
|
// return getHomeLimit("default");
|
|
|
|
return config.getInt("multiple-homes", 5);
|
|
|
|
}
|
|
|
|
int limit = getHomeLimit("default");
|
|
|
|
for (String set : homeList)
|
|
|
|
{
|
|
|
|
logger.log(Level.INFO, "Found home set: " + set);
|
|
|
|
if (user.hasPermission("essentials.sethome.multiple." + set) && limit < getHomeLimit(set))
|
|
|
|
{
|
|
|
|
limit = getHomeLimit(set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return limit;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getHomeLimit(final String set)
|
|
|
|
{
|
|
|
|
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public int getChatRadius()
|
|
|
|
{
|
|
|
|
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
public double getTeleportDelay()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return config.getDouble("teleport-delay", 0);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public int getDefaultStackSize()
|
|
|
|
{
|
|
|
|
return config.getInt("default-stack-size", 64);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public int getStartingBalance()
|
|
|
|
{
|
|
|
|
return config.getInt("starting-balance", 0);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-01 10:40:12 +00:00
|
|
|
public boolean isCommandDisabled(final IEssentialsCommand cmd)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
return isCommandDisabled(cmd.getName());
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean isCommandDisabled(String label)
|
|
|
|
{
|
|
|
|
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
|
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
if (!c.equalsIgnoreCase(label))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return config.getBoolean("disable-" + label.toLowerCase(), false);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean isCommandRestricted(IEssentialsCommand cmd)
|
|
|
|
{
|
|
|
|
return isCommandRestricted(cmd.getName());
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean isCommandRestricted(String label)
|
|
|
|
{
|
|
|
|
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
|
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
if (!c.equalsIgnoreCase(label))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return config.getBoolean("restrict-" + label.toLowerCase(), false);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 02:05:43 +00:00
|
|
|
@Override
|
|
|
|
public boolean isPlayerCommand(String label)
|
|
|
|
{
|
|
|
|
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
|
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
if (!c.equalsIgnoreCase(label))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-07-16 02:05:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-04-15 01:41:42 +00:00
|
|
|
public boolean isCommandOverridden(String name)
|
|
|
|
{
|
|
|
|
List<String> defaultList = new ArrayList<String>(1);
|
|
|
|
defaultList.add("god");
|
|
|
|
for (String c : config.getStringList("overridden-commands", defaultList))
|
|
|
|
{
|
|
|
|
if (!c.equalsIgnoreCase(name))
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2011-04-15 01:41:42 +00:00
|
|
|
continue;
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2011-04-15 01:41:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return config.getBoolean("override-" + name.toLowerCase(), false);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-23 09:55:23 +00:00
|
|
|
public double getCommandCost(IEssentialsCommand cmd)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
return getCommandCost(cmd.getName());
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-23 09:55:23 +00:00
|
|
|
public double getCommandCost(String label)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-05-23 09:55:23 +00:00
|
|
|
double cost = config.getDouble("command-costs." + label, 0.0);
|
|
|
|
if (cost == 0.0)
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2011-05-23 09:55:23 +00:00
|
|
|
cost = config.getDouble("cost-" + label, 0.0);
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
return cost;
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public String getNicknamePrefix()
|
|
|
|
{
|
2011-06-01 10:40:12 +00:00
|
|
|
return config.getString("nickname-prefix", "~");
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
public double getTeleportCooldown()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return config.getDouble("teleport-cooldown", 60);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
public double getHealCooldown()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
This is a big refactoring of the user class and more.
Many commands have been cleaned.
File changes:
- all user data has been moved from users.yml to userdata folder
- all files in userdata folder are lower case
Both changes should be done automatically.
Class changes:
- Moved all user data functions to UserData class
- Moved all user teleport functions to Teleport class
- Moved the user list to Essentials class
- Less static functions for better testing
- EssentialsCommand now has ess Property (Essentials class)
- New NotEnoughArgumentsException, that will show command description and syntax
New commands:
- /seen, shows the last login or logout
- /tempban, temporarily ban someone
- /tjail and mute, temporarily option added
Other changes:
- ban reason is saved
- don't show "You have xxx mail" on login, if user doesn't have essentials.mail permission
- time will be parsed: years, months (mo), weeks, days, hours, minutes (m), seconds, these can be shortened and combined, example: 2 days 5h 30m
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1300 e251c2fe-e539-e718-e476-b85c1f46cddb
2011-05-01 21:07:30 +00:00
|
|
|
return config.getDouble("heal-cooldown", 60);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public Object getKit(String name)
|
|
|
|
{
|
|
|
|
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
|
2011-05-14 11:20:05 +00:00
|
|
|
for (Map.Entry<String, Object> entry : kits.entrySet())
|
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
|
|
|
|
{
|
2011-05-14 11:20:05 +00:00
|
|
|
return entry.getValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-01 10:40:12 +00:00
|
|
|
public Map<String, Object> getKits()
|
|
|
|
{
|
|
|
|
return (Map<String, Object>)config.getProperty("kits");
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-10 20:40:32 +00:00
|
|
|
public ChatColor getOperatorColor() throws Exception
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
String colorName = config.getString("ops-name-color", null);
|
|
|
|
|
|
|
|
if (colorName == null)
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2011-03-19 22:39:51 +00:00
|
|
|
return ChatColor.RED;
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
|
|
|
|
{
|
2011-05-10 20:40:32 +00:00
|
|
|
throw new Exception();
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return ChatColor.valueOf(colorName.toUpperCase());
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException ex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-30 17:58:00 +00:00
|
|
|
public boolean getReclaimSetting()
|
|
|
|
{
|
|
|
|
return config.getBoolean("reclaim-onlogout", true);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public int getSpawnMobLimit()
|
|
|
|
{
|
|
|
|
return config.getInt("spawnmob-limit", 10);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean showNonEssCommandsInHelp()
|
|
|
|
{
|
|
|
|
return config.getBoolean("non-ess-in-help", true);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-10-01 09:08:58 +00:00
|
|
|
public boolean hidePermissionlessHelp()
|
2011-06-24 14:12:04 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("hide-permissionless-help", true);
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 20:29:08 +00:00
|
|
|
public int getProtectCreeperMaxHeight()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
return config.getInt("protect.creeper.max-height", -1);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean areSignsDisabled()
|
|
|
|
{
|
|
|
|
return config.getBoolean("signs-disabled", false);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public long getBackupInterval()
|
|
|
|
{
|
|
|
|
return config.getInt("backup.interval", 1440); // 1440 = 24 * 60
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public String getBackupCommand()
|
|
|
|
{
|
|
|
|
return config.getString("backup.command", null);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public String getChatFormat(String group)
|
|
|
|
{
|
|
|
|
return config.getString("chat.group-formats." + (group == null ? "Default" : group),
|
|
|
|
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean getAnnounceNewPlayers()
|
|
|
|
{
|
|
|
|
return !config.getString("newbies.announce-format", "-").isEmpty();
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-01 10:40:12 +00:00
|
|
|
public String getAnnounceNewPlayerFormat(IUser user)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-01 10:40:12 +00:00
|
|
|
public String format(String format, IUser user)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public String getNewbieSpawn()
|
|
|
|
{
|
|
|
|
return config.getString("newbies.spawnpoint", "default");
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-10-01 09:08:58 +00:00
|
|
|
public boolean getPerWarpPermission()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("per-warp-permission", false);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-03-19 22:39:51 +00:00
|
|
|
public boolean getSortListByGroups()
|
|
|
|
{
|
|
|
|
return config.getBoolean("sort-list-by-groups", true);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-10-01 09:08:58 +00:00
|
|
|
public void reloadConfig()
|
|
|
|
{
|
2011-03-19 22:39:51 +00:00
|
|
|
config.load();
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 12:04:37 +00:00
|
|
|
public List<Integer> itemSpawnBlacklist()
|
2011-04-01 22:06:00 +00:00
|
|
|
{
|
2011-06-06 12:04:37 +00:00
|
|
|
final List<Integer> epItemSpwn = new ArrayList<Integer>();
|
2011-10-01 09:08:58 +00:00
|
|
|
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
|
|
|
|
{
|
2011-04-02 09:46:13 +00:00
|
|
|
itemName = itemName.trim();
|
2011-10-01 09:08:58 +00:00
|
|
|
if (itemName.isEmpty())
|
|
|
|
{
|
2011-04-01 22:06:00 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ItemStack is;
|
2011-10-01 09:08:58 +00:00
|
|
|
try
|
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
is = ess.getItemDb().get(itemName);
|
2011-04-01 22:06:00 +00:00
|
|
|
epItemSpwn.add(is.getTypeId());
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2011-05-10 19:02:59 +00:00
|
|
|
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "item-spawn-blacklist"));
|
2011-04-01 22:06:00 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
return epItemSpwn;
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-04-15 01:41:42 +00:00
|
|
|
public boolean spawnIfNoHome()
|
2011-04-14 09:36:25 +00:00
|
|
|
{
|
2011-04-14 21:14:16 +00:00
|
|
|
return config.getBoolean("spawn-if-no-home", false);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-04-15 01:41:42 +00:00
|
|
|
public boolean warnOnBuildDisallow()
|
2011-04-14 21:14:16 +00:00
|
|
|
{
|
2011-04-15 21:18:32 +00:00
|
|
|
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
2011-04-14 09:36:25 +00:00
|
|
|
}
|
2011-04-15 23:06:29 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-04-16 23:18:00 +00:00
|
|
|
public boolean isDebug()
|
|
|
|
{
|
|
|
|
return config.getBoolean("debug", false);
|
|
|
|
}
|
2011-04-29 08:48:29 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-04-29 08:48:29 +00:00
|
|
|
public boolean warnOnSmite()
|
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
return config.getBoolean("warn-on-smite", true);
|
2011-04-29 08:48:29 +00:00
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-02 01:49:38 +00:00
|
|
|
public boolean permissionBasedItemSpawn()
|
|
|
|
{
|
|
|
|
return config.getBoolean("permission-based-item-spawn", false);
|
|
|
|
}
|
2011-05-08 00:06:28 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-09 02:42:20 +00:00
|
|
|
public String getLocale()
|
|
|
|
{
|
2011-05-09 02:47:19 +00:00
|
|
|
return config.getString("locale", "");
|
2011-05-09 02:42:20 +00:00
|
|
|
}
|
2011-05-13 16:57:45 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-13 16:57:45 +00:00
|
|
|
public String getCurrencySymbol()
|
|
|
|
{
|
|
|
|
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
|
|
|
|
}
|
2011-06-01 10:40:12 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-01 10:40:12 +00:00
|
|
|
public boolean isTradeInStacks(int id)
|
|
|
|
{
|
|
|
|
return config.getBoolean("trade-in-stacks-" + id, false);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-01 10:40:12 +00:00
|
|
|
public boolean isEcoDisabled()
|
|
|
|
{
|
|
|
|
return config.getBoolean("disable-eco", false);
|
|
|
|
}
|
2011-06-06 20:29:08 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 20:29:08 +00:00
|
|
|
public boolean getProtectPreventSpawn(final String creatureName)
|
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
return config.getBoolean("protect.prevent.spawn." + creatureName, false);
|
2011-06-06 20:29:08 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 20:29:08 +00:00
|
|
|
public List<Integer> getProtectList(final String configName)
|
|
|
|
{
|
|
|
|
final List<Integer> list = new ArrayList<Integer>();
|
2011-10-01 09:08:58 +00:00
|
|
|
for (String itemName : config.getString(configName, "").split(","))
|
|
|
|
{
|
2011-06-06 20:29:08 +00:00
|
|
|
itemName = itemName.trim();
|
2011-10-01 09:08:58 +00:00
|
|
|
if (itemName.isEmpty())
|
|
|
|
{
|
2011-06-06 20:29:08 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ItemStack itemStack;
|
2011-10-01 09:08:58 +00:00
|
|
|
try
|
|
|
|
{
|
2011-07-15 23:33:22 +00:00
|
|
|
itemStack = ess.getItemDb().get(itemName);
|
2011-06-06 20:29:08 +00:00
|
|
|
list.add(itemStack.getTypeId());
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2011-06-06 20:29:08 +00:00
|
|
|
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, configName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 20:29:08 +00:00
|
|
|
public String getProtectString(final String configName)
|
|
|
|
{
|
|
|
|
return config.getString(configName, null);
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 20:29:08 +00:00
|
|
|
public boolean getProtectBoolean(final String configName, boolean def)
|
|
|
|
{
|
|
|
|
return config.getBoolean(configName, def);
|
|
|
|
}
|
2011-07-05 21:50:31 +00:00
|
|
|
private final static double MAXMONEY = 10000000000000.0;
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
public double getMaxMoney()
|
2011-07-05 21:50:31 +00:00
|
|
|
{
|
|
|
|
double max = config.getDouble("max-money", MAXMONEY);
|
2011-10-01 09:08:58 +00:00
|
|
|
if (Math.abs(max) > MAXMONEY)
|
|
|
|
{
|
2011-07-05 21:50:31 +00:00
|
|
|
max = max < 0 ? -MAXMONEY : MAXMONEY;
|
|
|
|
}
|
|
|
|
return max;
|
|
|
|
}
|
2011-07-06 00:58:59 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
public boolean isEcoLogEnabled()
|
2011-07-06 00:58:59 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("economy-log-enabled", false);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
public boolean removeGodOnDisconnect()
|
2011-07-07 20:37:55 +00:00
|
|
|
{
|
2011-07-07 20:43:44 +00:00
|
|
|
return config.getBoolean("remove-god-on-disconnect", false);
|
2011-07-07 20:37:55 +00:00
|
|
|
}
|
2011-07-15 18:35:09 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
public boolean changeDisplayName()
|
2011-07-15 18:35:09 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("change-displayname", true);
|
|
|
|
}
|
2011-07-17 22:30:39 +00:00
|
|
|
|
|
|
|
public boolean useBukkitPermissions()
|
|
|
|
{
|
|
|
|
return config.getBoolean("use-bukkit-permissions", false);
|
|
|
|
}
|
2011-07-22 23:43:02 +00:00
|
|
|
|
|
|
|
public boolean addPrefixSuffix()
|
|
|
|
{
|
2011-07-23 22:41:54 +00:00
|
|
|
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
|
2011-07-22 23:43:02 +00:00
|
|
|
}
|
2011-08-23 00:46:19 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isUpdateEnabled()
|
|
|
|
{
|
2011-09-02 14:28:34 +00:00
|
|
|
return config.getBoolean("update-check", false);
|
2011-08-23 00:46:19 +00:00
|
|
|
}
|
2011-08-27 11:59:39 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getAutoAfk()
|
|
|
|
{
|
|
|
|
return config.getLong("auto-afk", 300);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getAutoAfkKick()
|
|
|
|
{
|
|
|
|
return config.getLong("auto-afk-kick", -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean getFreezeAfkPlayers()
|
|
|
|
{
|
|
|
|
return config.getBoolean("freeze-afk-players", false);
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|