2011-03-19 22:39:51 +00:00
|
|
|
package com.earth2me.essentials;
|
|
|
|
|
2011-11-21 01:55:26 +00:00
|
|
|
import static com.earth2me.essentials.I18n._;
|
2011-03-19 22:39:51 +00:00
|
|
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
2012-01-29 01:12:38 +00:00
|
|
|
import com.earth2me.essentials.signs.EssentialsSign;
|
|
|
|
import com.earth2me.essentials.signs.Signs;
|
2012-02-18 21:09:18 +00:00
|
|
|
import com.earth2me.essentials.textreader.IText;
|
|
|
|
import com.earth2me.essentials.textreader.SimpleTextInput;
|
2011-03-19 22:39:51 +00:00
|
|
|
import java.io.File;
|
2012-01-19 01:03:20 +00:00
|
|
|
import java.text.MessageFormat;
|
2011-12-01 13:42:39 +00:00
|
|
|
import java.util.*;
|
2011-11-18 17:42:26 +00:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
import org.bukkit.ChatColor;
|
2012-02-22 12:32:51 +00:00
|
|
|
import org.bukkit.configuration.ConfigurationSection;
|
2012-03-03 07:03:54 +00:00
|
|
|
import org.bukkit.configuration.MemoryConfiguration;
|
2012-01-20 04:34:28 +00:00
|
|
|
import org.bukkit.event.EventPriority;
|
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;
|
2012-03-15 00:49:22 +00:00
|
|
|
private boolean metricsEnabled = true;
|
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-12-03 17:13:42 +00:00
|
|
|
|
2011-11-30 01:51:02 +00:00
|
|
|
@Override
|
|
|
|
public boolean getUpdateBedAtDaytime()
|
|
|
|
{
|
|
|
|
return config.getBoolean("update-bed-at-daytime", true);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2012-02-21 16:33:46 +00:00
|
|
|
public Set<String> getMultipleHomes()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-02-21 16:33:46 +00:00
|
|
|
return config.getConfigurationSection("sethome-multiple").getKeys(false);
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getHomeLimit(final User user)
|
|
|
|
{
|
2012-09-15 18:55:12 +00:00
|
|
|
int limit = 1;
|
|
|
|
if (user.isAuthorized("essentials.sethome.multiple"))
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2012-09-15 18:55:12 +00:00
|
|
|
limit = getHomeLimit("default");
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2012-09-15 18:55:12 +00:00
|
|
|
|
|
|
|
final Set<String> homeList = getMultipleHomes();
|
|
|
|
if (homeList != null)
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2012-09-15 18:55:12 +00:00
|
|
|
for (String set : homeList)
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2012-09-15 18:55:12 +00:00
|
|
|
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
|
|
|
|
{
|
|
|
|
limit = getHomeLimit(set);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return limit;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getHomeLimit(final String set)
|
2011-10-18 01:21:26 +00:00
|
|
|
{
|
2011-10-01 09:08:58 +00:00
|
|
|
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private int chatRadius = 0;
|
|
|
|
|
|
|
|
private int _getChatRadius()
|
|
|
|
{
|
|
|
|
return config.getInt("chat.radius", config.getInt("chat-radius", 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 getChatRadius()
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return chatRadius;
|
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 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-11-28 18:55:51 +00:00
|
|
|
public int getOversizedStackSize()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2011-11-28 18:55:51 +00:00
|
|
|
return config.getInt("oversized-stacksize", 64);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2011-12-07 14:09:22 +00:00
|
|
|
|
2011-12-04 22:21:30 +00:00
|
|
|
@Override
|
|
|
|
public int getDefaultStackSize()
|
|
|
|
{
|
|
|
|
return config.getInt("default-stack-size", -1);
|
|
|
|
}
|
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());
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private Set<String> disabledCommands = new HashSet<String>();
|
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 isCommandDisabled(String label)
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return disabledCommands.contains(label);
|
|
|
|
}
|
|
|
|
|
|
|
|
private Set<String> getDisabledCommands()
|
|
|
|
{
|
|
|
|
Set<String> disCommands = new HashSet<String>();
|
2012-02-21 16:33:46 +00:00
|
|
|
for (String c : config.getStringList("disabled-commands"))
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
disCommands.add(c.toLowerCase(Locale.ENGLISH));
|
|
|
|
}
|
|
|
|
for (String c : config.getKeys(false))
|
|
|
|
{
|
|
|
|
if (c.startsWith("disable-"))
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
disCommands.add(c.substring(8).toLowerCase(Locale.ENGLISH));
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
return disCommands;
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2011-07-16 02:05:43 +00:00
|
|
|
@Override
|
|
|
|
public boolean isPlayerCommand(String label)
|
|
|
|
{
|
2012-02-21 16:33:46 +00:00
|
|
|
for (String c : config.getStringList("player-commands"))
|
2011-07-16 02:05:43 +00:00
|
|
|
{
|
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)
|
|
|
|
{
|
2012-02-21 16:33:46 +00:00
|
|
|
for (String c : config.getStringList("overridden-commands"))
|
2011-04-15 01:41:42 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2011-11-21 01:55:26 +00:00
|
|
|
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
|
2011-04-15 01:41:42 +00:00
|
|
|
}
|
2012-08-31 16:47:35 +00:00
|
|
|
private ConfigurationSection commandCosts;
|
2011-04-15 01:41:42 +00:00
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2012-08-31 16:47:35 +00:00
|
|
|
public ConfigurationSection _getCommandCosts()
|
|
|
|
{
|
|
|
|
if (config.isConfigurationSection("command-costs"))
|
|
|
|
{
|
|
|
|
final ConfigurationSection section = config.getConfigurationSection("command-costs");
|
|
|
|
final ConfigurationSection newSection = new MemoryConfiguration();
|
|
|
|
for (String command : section.getKeys(false))
|
|
|
|
{
|
|
|
|
if (section.isDouble(command))
|
|
|
|
{
|
|
|
|
newSection.set(command.toLowerCase(Locale.ENGLISH), section.getDouble(command));
|
|
|
|
}
|
|
|
|
else if (section.isInt(command))
|
|
|
|
{
|
|
|
|
newSection.set(command.toLowerCase(Locale.ENGLISH), (double)section.getInt(command));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newSection;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2012-08-31 16:47:35 +00:00
|
|
|
public double getCommandCost(String name)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-08-31 16:47:35 +00:00
|
|
|
name = name.replace('.', '_').replace('/', '_');
|
|
|
|
if (commandCosts != null)
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2012-08-31 16:47:35 +00:00
|
|
|
return commandCosts.getDouble(name, 0.0);
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2012-08-31 16:47:35 +00:00
|
|
|
return 0.0;
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private String nicknamePrefix = "~";
|
|
|
|
|
|
|
|
private String _getNicknamePrefix()
|
|
|
|
{
|
|
|
|
return config.getString("nickname-prefix", "~");
|
|
|
|
}
|
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 String getNicknamePrefix()
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return nicknamePrefix;
|
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
|
|
|
{
|
2011-11-28 12:55:54 +00:00
|
|
|
return config.getDouble("teleport-cooldown", 0);
|
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
|
|
|
{
|
2011-11-28 12:55:54 +00:00
|
|
|
return config.getDouble("heal-cooldown", 0);
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2012-03-03 07:03:54 +00:00
|
|
|
private ConfigurationSection kits;
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2012-03-03 07:03:54 +00:00
|
|
|
public ConfigurationSection _getKits()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-02-22 12:32:51 +00:00
|
|
|
if (config.isConfigurationSection("kits"))
|
2011-05-14 11:20:05 +00:00
|
|
|
{
|
2012-03-03 07:03:54 +00:00
|
|
|
final ConfigurationSection section = config.getConfigurationSection("kits");
|
|
|
|
final ConfigurationSection newSection = new MemoryConfiguration();
|
|
|
|
for (String kitItem : section.getKeys(false))
|
2011-10-01 09:08:58 +00:00
|
|
|
{
|
2012-03-03 07:03:54 +00:00
|
|
|
if (section.isConfigurationSection(kitItem))
|
|
|
|
{
|
|
|
|
newSection.set(kitItem.toLowerCase(Locale.ENGLISH), section.getConfigurationSection(kitItem));
|
|
|
|
}
|
2012-02-26 05:06:03 +00:00
|
|
|
}
|
2012-03-03 07:03:54 +00:00
|
|
|
return newSection;
|
2011-05-14 11:20:05 +00:00
|
|
|
}
|
|
|
|
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
|
2012-02-22 12:32:51 +00:00
|
|
|
public ConfigurationSection getKits()
|
2011-06-01 10:40:12 +00:00
|
|
|
{
|
2012-03-03 07:03:54 +00:00
|
|
|
return kits;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getKit(String name)
|
|
|
|
{
|
|
|
|
name = name.replace('.', '_').replace('/', '_');
|
2012-08-31 16:47:35 +00:00
|
|
|
if (getKits() != null)
|
2012-02-22 12:32:51 +00:00
|
|
|
{
|
2012-03-03 07:03:54 +00:00
|
|
|
final ConfigurationSection kits = getKits();
|
|
|
|
if (kits.isConfigurationSection(name))
|
|
|
|
{
|
|
|
|
return kits.getConfigurationSection(name).getValues(true);
|
|
|
|
}
|
2012-02-22 12:32:51 +00:00
|
|
|
}
|
|
|
|
return null;
|
2011-06-01 10:40:12 +00:00
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private ChatColor operatorColor = null;
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2012-08-03 20:57:29 +00:00
|
|
|
public ChatColor getOperatorColor()
|
|
|
|
{
|
|
|
|
return operatorColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private ChatColor _getOperatorColor()
|
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
|
|
|
{
|
2012-09-09 15:55:19 +00:00
|
|
|
return ChatColor.DARK_RED;
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return null;
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2011-11-27 05:23:07 +00:00
|
|
|
return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
catch (IllegalArgumentException ex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-02-21 16:33:46 +00:00
|
|
|
return ChatColor.getByChar(colorName);
|
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 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()
|
|
|
|
{
|
2012-03-19 08:21:39 +00:00
|
|
|
return !signsEnabled;
|
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 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);
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
|
2011-03-19 22:39:51 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2012-01-19 01:03:20 +00:00
|
|
|
public MessageFormat getChatFormat(String group)
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-01-19 01:03:20 +00:00
|
|
|
MessageFormat mFormat = chatFormats.get(group);
|
|
|
|
if (mFormat == null)
|
|
|
|
{
|
|
|
|
String format = config.getString("chat.group-formats." + (group == null ? "Default" : group),
|
|
|
|
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
|
2012-03-22 22:07:13 +00:00
|
|
|
format = Util.replaceFormat(format);
|
2012-01-19 15:51:55 +00:00
|
|
|
format = format.replace("{DISPLAYNAME}", "%1$s");
|
|
|
|
format = format.replace("{GROUP}", "{0}");
|
|
|
|
format = format.replace("{MESSAGE}", "%2$s");
|
|
|
|
format = format.replace("{WORLDNAME}", "{1}");
|
|
|
|
format = format.replace("{SHORTWORLDNAME}", "{2}");
|
2012-03-25 13:20:26 +00:00
|
|
|
format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
|
2012-09-22 13:40:56 +00:00
|
|
|
format = "§r".concat(format);
|
2012-01-19 01:03:20 +00:00
|
|
|
mFormat = new MessageFormat(format);
|
|
|
|
chatFormats.put(group, mFormat);
|
|
|
|
}
|
|
|
|
return mFormat;
|
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 getAnnounceNewPlayers()
|
|
|
|
{
|
|
|
|
return !config.getString("newbies.announce-format", "-").isEmpty();
|
|
|
|
}
|
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2012-02-18 21:09:18 +00:00
|
|
|
public IText getAnnounceNewPlayerFormat()
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-03-22 22:07:13 +00:00
|
|
|
return new SimpleTextInput(Util.replaceFormat(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
|
2012-03-04 20:06:50 +00:00
|
|
|
@Override
|
|
|
|
public String getNewPlayerKit()
|
|
|
|
{
|
|
|
|
return config.getString("newbies.kit", "");
|
|
|
|
}
|
|
|
|
|
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();
|
2012-02-21 16:33:46 +00:00
|
|
|
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
2012-03-03 07:03:54 +00:00
|
|
|
enabledSigns = _getEnabledSigns();
|
2012-03-30 20:44:14 +00:00
|
|
|
teleportInvulnerability = _isTeleportInvulnerability();
|
2012-04-02 01:22:07 +00:00
|
|
|
disableItemPickupWhileAfk = _getDisableItemPickupWhileAfk();
|
2012-04-14 03:13:37 +00:00
|
|
|
registerBackInListener = _registerBackInListener();
|
2012-05-06 22:38:04 +00:00
|
|
|
cancelAfkOnMove = _cancelAfkOnMove();
|
|
|
|
getFreezeAfkPlayers = _getFreezeAfkPlayers();
|
2012-03-03 07:03:54 +00:00
|
|
|
itemSpawnBl = _getItemSpawnBlacklist();
|
2012-06-17 18:28:59 +00:00
|
|
|
loginAttackDelay = _getLoginAttackDelay();
|
|
|
|
signUsePerSecond = _getSignUsePerSecond();
|
2012-03-03 07:03:54 +00:00
|
|
|
kits = _getKits();
|
2012-01-19 01:03:20 +00:00
|
|
|
chatFormats.clear();
|
2012-08-03 20:57:29 +00:00
|
|
|
changeDisplayName = _changeDisplayName();
|
|
|
|
disabledCommands = getDisabledCommands();
|
|
|
|
nicknamePrefix = _getNicknamePrefix();
|
|
|
|
operatorColor = _getOperatorColor();
|
|
|
|
changePlayerListName = _changePlayerListName();
|
|
|
|
configDebug = _isDebug();
|
|
|
|
prefixsuffixconfigured = _isPrefixSuffixConfigured();
|
|
|
|
addprefixsuffix = _addPrefixSuffix();
|
|
|
|
disablePrefix = _disablePrefix();
|
|
|
|
disableSuffix = _disableSuffix();
|
|
|
|
chatRadius = _getChatRadius();
|
2012-08-31 16:47:35 +00:00
|
|
|
commandCosts = _getCommandCosts();
|
2012-08-28 00:38:16 +00:00
|
|
|
warnOnBuildDisallow = _warnOnBuildDisallow();
|
2012-10-07 20:46:15 +00:00
|
|
|
mailsPerMinute = _getMailsPerMinute();
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
2012-01-29 01:12:38 +00:00
|
|
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-06-06 12:04:37 +00:00
|
|
|
public List<Integer> itemSpawnBlacklist()
|
2012-01-29 01:12:38 +00:00
|
|
|
{
|
|
|
|
return itemSpawnBl;
|
|
|
|
}
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2012-03-03 07:03:54 +00:00
|
|
|
private List<Integer> _getItemSpawnBlacklist()
|
2011-04-01 22:06:00 +00:00
|
|
|
{
|
2011-06-06 12:04:37 +00:00
|
|
|
final List<Integer> epItemSpwn = new ArrayList<Integer>();
|
2012-02-18 21:09:18 +00:00
|
|
|
if (ess.getItemDb() == null)
|
|
|
|
{
|
2012-01-29 23:36:27 +00:00
|
|
|
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
|
|
|
|
return epItemSpwn;
|
|
|
|
}
|
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;
|
2012-02-18 21:09:18 +00:00
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
try
|
|
|
|
{
|
2012-01-29 01:12:38 +00:00
|
|
|
final ItemStack iStack = ess.getItemDb().get(itemName);
|
|
|
|
epItemSpwn.add(iStack.getTypeId());
|
2011-10-01 09:08:58 +00:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2011-11-21 01:55:26 +00:00
|
|
|
logger.log(Level.SEVERE, _("unknownItemInList", itemName, "item-spawn-blacklist"));
|
2011-04-01 22:06:00 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
return epItemSpwn;
|
|
|
|
}
|
2012-01-29 01:12:38 +00:00
|
|
|
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
2012-03-19 08:21:39 +00:00
|
|
|
private boolean signsEnabled = false;
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2012-01-29 01:12:38 +00:00
|
|
|
@Override
|
|
|
|
public List<EssentialsSign> enabledSigns()
|
|
|
|
{
|
|
|
|
return enabledSigns;
|
|
|
|
}
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2012-03-03 07:03:54 +00:00
|
|
|
private List<EssentialsSign> _getEnabledSigns()
|
2012-01-29 01:12:38 +00:00
|
|
|
{
|
|
|
|
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
|
2012-02-18 21:09:18 +00:00
|
|
|
|
2012-02-21 16:33:46 +00:00
|
|
|
for (String signName : config.getStringList("enabledSigns"))
|
2012-01-29 01:12:38 +00:00
|
|
|
{
|
2012-01-29 01:38:24 +00:00
|
|
|
signName = signName.trim().toUpperCase(Locale.ENGLISH);
|
2012-01-29 01:12:38 +00:00
|
|
|
if (signName.isEmpty())
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2012-03-19 08:21:39 +00:00
|
|
|
if (signName.equals("COLOR") || signName.equals("COLOUR"))
|
|
|
|
{
|
|
|
|
signsEnabled = true;
|
|
|
|
continue;
|
|
|
|
}
|
2012-01-29 01:12:38 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
newSigns.add(Signs.valueOf(signName).getSign());
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
|
2012-03-19 08:21:39 +00:00
|
|
|
continue;
|
2012-01-29 01:12:38 +00:00
|
|
|
}
|
2012-03-19 08:21:39 +00:00
|
|
|
signsEnabled = true;
|
2012-01-29 01:12:38 +00:00
|
|
|
}
|
|
|
|
return newSigns;
|
|
|
|
}
|
2012-08-28 00:38:16 +00:00
|
|
|
private boolean warnOnBuildDisallow;
|
2011-04-14 21:14:16 +00:00
|
|
|
|
2012-08-28 00:38:16 +00:00
|
|
|
private boolean _warnOnBuildDisallow()
|
|
|
|
{
|
|
|
|
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
|
|
|
}
|
2012-08-31 16:47:35 +00:00
|
|
|
|
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
|
|
|
{
|
2012-08-28 00:38:16 +00:00
|
|
|
return warnOnBuildDisallow;
|
2011-04-14 09:36:25 +00:00
|
|
|
}
|
2011-11-04 01:43:43 +00:00
|
|
|
private boolean debug = false;
|
2012-08-03 20:57:29 +00:00
|
|
|
private boolean configDebug = false;
|
|
|
|
|
|
|
|
private boolean _isDebug()
|
|
|
|
{
|
|
|
|
return config.getBoolean("debug", false);
|
|
|
|
}
|
2011-11-21 01:55:26 +00:00
|
|
|
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-04-16 23:18:00 +00:00
|
|
|
public boolean isDebug()
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return debug || configDebug;
|
2011-04-16 23:18:00 +00:00
|
|
|
}
|
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
|
|
|
|
2012-11-04 21:31:23 +00:00
|
|
|
//This method should always only return one character due to the implementation of the calling methods
|
|
|
|
//If you need to use a string currency, for example "coins", use the translation key 'currency'.
|
2011-07-16 00:38:22 +00:00
|
|
|
@Override
|
2011-05-13 16:57:45 +00:00
|
|
|
public String getCurrencySymbol()
|
|
|
|
{
|
2012-09-02 19:17:28 +00:00
|
|
|
return config.getString("currency-symbol", "$").concat("$").substring(0, 1).replaceAll("[0-9]", "$");
|
2011-05-13 16:57:45 +00:00
|
|
|
}
|
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-11-21 01:55:26 +00:00
|
|
|
logger.log(Level.SEVERE, _("unknownItemInList", itemName, configName));
|
2011-06-06 20:29:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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-11-18 18:07:28 +00:00
|
|
|
@Override
|
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;
|
|
|
|
}
|
2012-02-26 04:15:14 +00:00
|
|
|
private final static double MINMONEY = -10000000000000.0;
|
2012-02-26 05:06:03 +00:00
|
|
|
|
2012-02-26 04:15:14 +00:00
|
|
|
@Override
|
|
|
|
public double getMinMoney()
|
|
|
|
{
|
|
|
|
double min = config.getDouble("min-money", MINMONEY);
|
2012-02-26 05:06:03 +00:00
|
|
|
if (min > 0)
|
|
|
|
{
|
|
|
|
min = -min;
|
2012-02-26 04:15:14 +00:00
|
|
|
}
|
|
|
|
if (min < MINMONEY)
|
|
|
|
{
|
|
|
|
min = MINMONEY;
|
|
|
|
}
|
|
|
|
return min;
|
|
|
|
}
|
2011-07-06 00:58:59 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
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);
|
|
|
|
}
|
2012-03-03 07:03:54 +00:00
|
|
|
|
2012-02-27 15:31:43 +00:00
|
|
|
@Override
|
|
|
|
public boolean isEcoLogUpdateEnabled()
|
|
|
|
{
|
|
|
|
return config.getBoolean("economy-log-update-enabled", false);
|
|
|
|
}
|
2011-10-01 09:08:58 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
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
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private boolean changeDisplayName = true;
|
|
|
|
|
|
|
|
private boolean _changeDisplayName()
|
|
|
|
{
|
|
|
|
return config.getBoolean("change-displayname", true);
|
|
|
|
}
|
2011-07-15 18:35:09 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
2011-07-16 00:38:22 +00:00
|
|
|
public boolean changeDisplayName()
|
2011-07-15 18:35:09 +00:00
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return changeDisplayName;
|
|
|
|
}
|
|
|
|
private boolean changePlayerListName = false;
|
|
|
|
|
|
|
|
private boolean _changePlayerListName()
|
|
|
|
{
|
|
|
|
return config.getBoolean("change-playerlist", false);
|
2011-07-15 18:35:09 +00:00
|
|
|
}
|
2012-03-27 19:14:38 +00:00
|
|
|
|
2012-03-23 00:15:22 +00:00
|
|
|
@Override
|
|
|
|
public boolean changePlayerListName()
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return changePlayerListName;
|
2012-03-23 00:15:22 +00:00
|
|
|
}
|
2011-07-17 22:30:39 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
2011-07-17 22:30:39 +00:00
|
|
|
public boolean useBukkitPermissions()
|
|
|
|
{
|
|
|
|
return config.getBoolean("use-bukkit-permissions", false);
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
private boolean prefixsuffixconfigured = false;
|
|
|
|
private boolean addprefixsuffix = false;
|
2012-10-15 18:30:52 +00:00
|
|
|
private boolean essentialsChatActive = false;
|
2012-08-03 20:57:29 +00:00
|
|
|
|
|
|
|
private boolean _addPrefixSuffix()
|
|
|
|
{
|
|
|
|
return config.getBoolean("add-prefix-suffix", false);
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean _isPrefixSuffixConfigured()
|
|
|
|
{
|
|
|
|
return config.hasProperty("add-prefix-suffix");
|
|
|
|
}
|
2011-07-22 23:43:02 +00:00
|
|
|
|
2012-10-15 18:30:52 +00:00
|
|
|
@Override
|
|
|
|
public void setEssentialsChatActive(boolean essentialsChatActive)
|
|
|
|
{
|
|
|
|
this.essentialsChatActive = essentialsChatActive;
|
|
|
|
}
|
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
2011-07-22 23:43:02 +00:00
|
|
|
public boolean addPrefixSuffix()
|
|
|
|
{
|
2012-10-15 18:30:52 +00:00
|
|
|
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
|
2012-08-03 20:57:29 +00:00
|
|
|
}
|
|
|
|
private boolean disablePrefix = false;
|
|
|
|
|
|
|
|
private boolean _disablePrefix()
|
|
|
|
{
|
|
|
|
return config.getBoolean("disablePrefix", false);
|
2011-07-22 23:43:02 +00:00
|
|
|
}
|
2011-11-21 01:55:26 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
2011-10-27 05:17:18 +00:00
|
|
|
public boolean disablePrefix()
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return disablePrefix;
|
|
|
|
}
|
|
|
|
private boolean disableSuffix = false;
|
|
|
|
|
|
|
|
private boolean _disableSuffix()
|
|
|
|
{
|
|
|
|
return config.getBoolean("disableSuffix", false);
|
2011-10-27 05:17:18 +00:00
|
|
|
}
|
2011-11-21 01:55:26 +00:00
|
|
|
|
2011-11-18 18:07:28 +00:00
|
|
|
@Override
|
2011-10-27 05:17:18 +00:00
|
|
|
public boolean disableSuffix()
|
|
|
|
{
|
2012-08-03 20:57:29 +00:00
|
|
|
return disableSuffix;
|
2011-10-27 05:17:18 +00:00
|
|
|
}
|
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);
|
|
|
|
}
|
2012-05-06 22:38:04 +00:00
|
|
|
private boolean getFreezeAfkPlayers;
|
2011-08-27 11:59:39 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean getFreezeAfkPlayers()
|
2012-05-06 22:38:04 +00:00
|
|
|
{
|
|
|
|
return getFreezeAfkPlayers;
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean _getFreezeAfkPlayers()
|
2011-08-27 11:59:39 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("freeze-afk-players", false);
|
|
|
|
}
|
2012-05-06 22:38:04 +00:00
|
|
|
private boolean cancelAfkOnMove;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean cancelAfkOnMove()
|
|
|
|
{
|
|
|
|
return cancelAfkOnMove;
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean _cancelAfkOnMove()
|
|
|
|
{
|
|
|
|
return config.getBoolean("cancel-afk-on-move", true);
|
|
|
|
}
|
2011-10-09 18:59:06 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean areDeathMessagesEnabled()
|
|
|
|
{
|
|
|
|
return config.getBoolean("death-messages", true);
|
|
|
|
}
|
2012-01-29 01:12:38 +00:00
|
|
|
private Set<String> noGodWorlds = new HashSet<String>();
|
2011-12-03 17:13:42 +00:00
|
|
|
|
2011-11-25 06:12:21 +00:00
|
|
|
@Override
|
|
|
|
public Set<String> getNoGodWorlds()
|
|
|
|
{
|
|
|
|
return noGodWorlds;
|
|
|
|
}
|
2011-11-04 01:43:43 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setDebug(final boolean debug)
|
|
|
|
{
|
|
|
|
this.debug = debug;
|
|
|
|
}
|
2011-12-03 17:13:42 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean getRepairEnchanted()
|
|
|
|
{
|
2011-12-02 07:30:52 +00:00
|
|
|
return config.getBoolean("repair-enchanted", true);
|
|
|
|
}
|
2011-12-03 17:13:42 +00:00
|
|
|
|
|
|
|
@Override
|
2012-03-20 13:26:49 +00:00
|
|
|
public boolean isWorldTeleportPermissions()
|
2011-12-03 17:13:42 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("world-teleport-permissions", false);
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-05-22 16:54:19 +00:00
|
|
|
@Override
|
|
|
|
public boolean isWorldHomePermissions()
|
|
|
|
{
|
|
|
|
return config.getBoolean("world-home-permissions", false);
|
|
|
|
}
|
2012-04-26 08:41:24 +00:00
|
|
|
private boolean registerBackInListener;
|
2012-05-06 22:38:04 +00:00
|
|
|
|
2011-12-06 22:56:38 +00:00
|
|
|
@Override
|
|
|
|
public boolean registerBackInListener()
|
2012-04-14 03:13:37 +00:00
|
|
|
{
|
|
|
|
return registerBackInListener;
|
|
|
|
}
|
2012-05-06 22:38:04 +00:00
|
|
|
|
2012-04-14 03:13:37 +00:00
|
|
|
private boolean _registerBackInListener()
|
2011-12-06 22:56:38 +00:00
|
|
|
{
|
|
|
|
return config.getBoolean("register-back-in-listener", false);
|
|
|
|
}
|
2012-04-02 01:22:07 +00:00
|
|
|
private boolean disableItemPickupWhileAfk;
|
2011-12-07 11:10:41 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean getDisableItemPickupWhileAfk()
|
2012-04-02 01:22:07 +00:00
|
|
|
{
|
|
|
|
return disableItemPickupWhileAfk;
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean _getDisableItemPickupWhileAfk()
|
2011-12-07 11:10:41 +00:00
|
|
|
{
|
2012-04-16 23:53:57 +00:00
|
|
|
return config.getBoolean("disable-item-pickup-while-afk", false);
|
2011-12-07 11:10:41 +00:00
|
|
|
}
|
2011-12-07 14:09:22 +00:00
|
|
|
|
|
|
|
@Override
|
2012-01-20 04:34:28 +00:00
|
|
|
public EventPriority getRespawnPriority()
|
2011-12-07 14:09:22 +00:00
|
|
|
{
|
|
|
|
String priority = config.getString("respawn-listener-priority", "normal").toLowerCase(Locale.ENGLISH);
|
|
|
|
if ("lowest".equals(priority))
|
|
|
|
{
|
2012-01-20 04:34:28 +00:00
|
|
|
return EventPriority.LOWEST;
|
2011-12-07 14:09:22 +00:00
|
|
|
}
|
|
|
|
if ("low".equals(priority))
|
|
|
|
{
|
2012-01-20 04:34:28 +00:00
|
|
|
return EventPriority.LOW;
|
2011-12-07 14:09:22 +00:00
|
|
|
}
|
|
|
|
if ("normal".equals(priority))
|
|
|
|
{
|
2012-01-20 04:34:28 +00:00
|
|
|
return EventPriority.NORMAL;
|
2011-12-07 14:09:22 +00:00
|
|
|
}
|
|
|
|
if ("high".equals(priority))
|
|
|
|
{
|
2012-01-20 04:34:28 +00:00
|
|
|
return EventPriority.HIGH;
|
2011-12-07 14:09:22 +00:00
|
|
|
}
|
|
|
|
if ("highest".equals(priority))
|
|
|
|
{
|
2012-01-20 04:34:28 +00:00
|
|
|
return EventPriority.HIGHEST;
|
2011-12-07 14:09:22 +00:00
|
|
|
}
|
2012-01-20 04:34:28 +00:00
|
|
|
return EventPriority.NORMAL;
|
2011-12-07 14:09:22 +00:00
|
|
|
}
|
2012-01-19 01:03:20 +00:00
|
|
|
|
2011-12-08 23:43:09 +00:00
|
|
|
@Override
|
|
|
|
public long getTpaAcceptCancellation()
|
|
|
|
{
|
2012-01-19 01:03:20 +00:00
|
|
|
return config.getLong("tpa-accept-cancellation", 0);
|
2011-12-08 23:43:09 +00:00
|
|
|
}
|
2012-03-15 00:49:22 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isMetricsEnabled()
|
|
|
|
{
|
|
|
|
return metricsEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setMetricsEnabled(boolean metricsEnabled)
|
|
|
|
{
|
|
|
|
this.metricsEnabled = metricsEnabled;
|
|
|
|
}
|
2012-03-30 20:44:14 +00:00
|
|
|
private boolean teleportInvulnerability;
|
2012-03-27 19:14:38 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getTeleportInvulnerability()
|
|
|
|
{
|
|
|
|
return config.getLong("teleport-invulnerability", 0) * 1000;
|
|
|
|
}
|
2012-04-02 01:22:07 +00:00
|
|
|
|
2012-03-30 20:44:14 +00:00
|
|
|
private boolean _isTeleportInvulnerability()
|
|
|
|
{
|
|
|
|
return (config.getLong("teleport-invulnerability", 0) > 0);
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-03-30 20:44:14 +00:00
|
|
|
@Override
|
|
|
|
public boolean isTeleportInvulnerability()
|
|
|
|
{
|
|
|
|
return teleportInvulnerability;
|
|
|
|
}
|
2012-05-22 20:02:28 +00:00
|
|
|
private long loginAttackDelay;
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-06-17 18:28:59 +00:00
|
|
|
private long _getLoginAttackDelay()
|
2012-05-22 00:29:47 +00:00
|
|
|
{
|
|
|
|
return config.getLong("login-attack-delay", 0) * 1000;
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-05-22 00:29:47 +00:00
|
|
|
@Override
|
|
|
|
public long getLoginAttackDelay()
|
|
|
|
{
|
2012-05-22 20:02:28 +00:00
|
|
|
return loginAttackDelay;
|
2012-05-22 00:29:47 +00:00
|
|
|
}
|
2012-06-17 18:28:59 +00:00
|
|
|
private int signUsePerSecond;
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-06-17 18:28:59 +00:00
|
|
|
private int _getSignUsePerSecond()
|
|
|
|
{
|
|
|
|
final int perSec = config.getInt("sign-use-per-second", 4);
|
|
|
|
return perSec > 0 ? perSec : 1;
|
|
|
|
}
|
2012-08-03 20:57:29 +00:00
|
|
|
|
2012-06-17 18:28:59 +00:00
|
|
|
@Override
|
|
|
|
public int getSignUsePerSecond()
|
|
|
|
{
|
|
|
|
return signUsePerSecond;
|
|
|
|
}
|
2012-08-26 16:12:18 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getMaxFlySpeed()
|
|
|
|
{
|
|
|
|
double maxSpeed = config.getDouble("max-fly-speed", 1.0);
|
|
|
|
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
|
|
|
|
}
|
|
|
|
|
2012-10-06 02:31:34 +00:00
|
|
|
//This option does not exist in the config.yml because it wasn't yet implemented in bukkit
|
|
|
|
//The code was commented out in the /speed command
|
2012-08-26 16:12:18 +00:00
|
|
|
@Override
|
|
|
|
public double getMaxWalkSpeed()
|
|
|
|
{
|
|
|
|
double maxSpeed = config.getDouble("max-walk-speed", 0.8);
|
|
|
|
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
|
|
|
|
}
|
2012-10-07 20:46:15 +00:00
|
|
|
|
|
|
|
private int mailsPerMinute;
|
|
|
|
|
|
|
|
private int _getMailsPerMinute() {
|
|
|
|
return config.getInt("mails-per-minute", 1000);
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public int getMailsPerMinute()
|
|
|
|
{
|
|
|
|
return mailsPerMinute;
|
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|