summaryrefslogtreecommitdiffstats
path: root/Essentials2Compat
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-01-14 20:06:28 -0500
committerIaccidentally <coryhuckaby@gmail.com>2013-01-14 20:06:28 -0500
commit2a097530e5ea96e1329dca19b049a23ccce5d3ba (patch)
treeda72b93c02edb4182f649114fee5fad7d833601f /Essentials2Compat
parent8e54bf13b281d1299c3dc33f89940bd3a06d1a30 (diff)
downloadEssentials-2a097530e5ea96e1329dca19b049a23ccce5d3ba.tar
Essentials-2a097530e5ea96e1329dca19b049a23ccce5d3ba.tar.gz
Essentials-2a097530e5ea96e1329dca19b049a23ccce5d3ba.tar.lz
Essentials-2a097530e5ea96e1329dca19b049a23ccce5d3ba.tar.xz
Essentials-2a097530e5ea96e1329dca19b049a23ccce5d3ba.zip
Revert "Remove Transient :: Formatting Cleanup"
Diffstat (limited to 'Essentials2Compat')
-rw-r--r--Essentials2Compat/pom.xml30
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/Economy.java30
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java6
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/Settings.java74
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java1
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/UserData.java33
-rw-r--r--Essentials2Compat/src/com/earth2me/essentials/Util.java3
8 files changed, 124 insertions, 55 deletions
diff --git a/Essentials2Compat/pom.xml b/Essentials2Compat/pom.xml
index 74222b99e..81dc96ac8 100644
--- a/Essentials2Compat/pom.xml
+++ b/Essentials2Compat/pom.xml
@@ -1,20 +1,20 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.essentials3</groupId>
- <artifactId>BuildAll</artifactId>
- <version>3.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
+ <parent>
+ <groupId>net.essentials3</groupId>
+ <artifactId>BuildAll</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
- <artifactId>Essentials2Compat</artifactId>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>Essentials</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <artifactId>Essentials2Compat</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>Essentials</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git a/Essentials2Compat/src/com/earth2me/essentials/Economy.java b/Essentials2Compat/src/com/earth2me/essentials/Economy.java
index 2943fcf67..15f0045ac 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/Economy.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/Economy.java
@@ -14,6 +14,7 @@ public final class Economy
private Economy()
{
}
+
private static IEssentials ess;
private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
@@ -37,10 +38,11 @@ public final class Economy
/**
* Sets the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param balance The balance you want to set
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws net.ess3.api.NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws net.ess3.api.NoLoanPermittedException
+ * If the user is not allowed to have a negative balance
*/
public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -54,10 +56,10 @@ public final class Economy
/**
* Adds money to the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The money you want to add
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -68,10 +70,10 @@ public final class Economy
/**
* Substracts money from the balance of a user
*
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The money you want to substract
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -82,10 +84,10 @@ public final class Economy
/**
* Divides the balance of a user by a value
*
- * @param name Name of the user
+ * @param name Name of the user
* @param value The balance is divided by this value
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -96,10 +98,10 @@ public final class Economy
/**
* Multiplies the balance of a user by a value
*
- * @param name Name of the user
+ * @param name Name of the user
* @param value The balance is multiplied by this value
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -112,7 +114,7 @@ public final class Economy
*
* @param name Name of the user
* @throws UserDoesNotExistException If a user by that name does not exists
- * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
+ * @throws NoLoanPermittedException If the user is not allowed to have a negative balance
*/
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
{
@@ -124,7 +126,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more or an equal amount of money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -135,7 +137,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should have
* @return true, if the user has more money
* @throws UserDoesNotExistException If a user by that name does not exists
@@ -146,7 +148,7 @@ public final class Economy
}
/**
- * @param name Name of the user
+ * @param name Name of the user
* @param amount The amount of money the user should not have
* @return true, if the user has less money
* @throws UserDoesNotExistException If a user by that name does not exists
diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java
index a76ebbe6c..073f45bf5 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java
@@ -29,9 +29,9 @@ import net.ess3.storage.StoredLocation;
public class EssentialsConf extends YamlConfiguration
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private File configFile;
- private String templateName = null;
- private Class<?> resourceClass = EssentialsConf.class;
+ private transient File configFile;
+ private transient String templateName = null;
+ private transient Class<?> resourceClass = EssentialsConf.class;
private static final Charset UTF8 = Charset.forName("UTF-8");
public EssentialsConf(final File configFile)
diff --git a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java
index dfd68f467..93fbd20b3 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -23,6 +24,7 @@ public interface ISettings
long getBackupInterval();
//MessageFormat getChatFormat(String group);
+
int getChatRadius();
double getCommandCost(String label);
diff --git a/Essentials2Compat/src/com/earth2me/essentials/Settings.java b/Essentials2Compat/src/com/earth2me/essentials/Settings.java
index bd8671c7b..a5f454916 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/Settings.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/Settings.java
@@ -16,9 +16,9 @@ import org.bukkit.inventory.ItemStack;
public final class Settings implements ISettings
{
- private final EssentialsConf config;
+ private final transient EssentialsConf config;
private final static Logger logger = Logger.getLogger("Minecraft");
- private final IEssentials ess;
+ private final transient IEssentials ess;
private boolean metricsEnabled = true;
public Settings(IEssentials ess, File file)
@@ -52,6 +52,7 @@ public final class Settings implements ISettings
{
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
}
+
private int chatRadius = 0;
private int _getChatRadius()
@@ -88,6 +89,7 @@ public final class Settings implements ISettings
{
return config.getInt("starting-balance", 0);
}
+
private Set<String> disabledCommands = new HashSet<String>();
@Override
@@ -140,8 +142,10 @@ public final class Settings implements ISettings
}
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
}
+
private ConfigurationSection commandCosts;
+
public ConfigurationSection _getCommandCosts()
{
if (config.isConfigurationSection("command-costs"))
@@ -174,6 +178,7 @@ public final class Settings implements ISettings
}
return 0.0;
}
+
private String nicknamePrefix = "~";
private String _getNicknamePrefix()
@@ -198,6 +203,7 @@ public final class Settings implements ISettings
{
return config.getDouble("heal-cooldown", 0);
}
+
private ConfigurationSection kits;
public ConfigurationSection _getKits()
@@ -238,6 +244,7 @@ public final class Settings implements ISettings
}
return null;
}
+
private ChatColor operatorColor = null;
@Override
@@ -311,29 +318,31 @@ public final class Settings implements ISettings
{
return config.getString("backup.command", null);
}
+
private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>());
/*@Override //TODO: implement this
- public MessageFormat getChatFormat(String group)
- {
- 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}"));
- format = Util.replaceFormat(format);
- 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}");
- format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
- format = "§r".concat(format);
- mFormat = new MessageFormat(format);
- chatFormats.put(group, mFormat);
- }
- return mFormat;
- }*/
+ public MessageFormat getChatFormat(String group)
+ {
+ 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}"));
+ format = Util.replaceFormat(format);
+ 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}");
+ format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]");
+ format = "§r".concat(format);
+ mFormat = new MessageFormat(format);
+ chatFormats.put(group, mFormat);
+ }
+ return mFormat;
+ }*/
+
public String getDefaultChatformat()
{
return config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}");
@@ -375,6 +384,7 @@ public final class Settings implements ISettings
return config.getBoolean("sort-list-by-groups", true);
}
+
public void reloadConfig()
{
config.load();
@@ -405,6 +415,7 @@ public final class Settings implements ISettings
warnOnBuildDisallow = _warnOnBuildDisallow();
mailsPerMinute = _getMailsPerMinute();
}
+
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@Override
@@ -440,6 +451,7 @@ public final class Settings implements ISettings
}
return epItemSpwn;
}
+
private List<String> enabledSigns = new ArrayList<String>();
private boolean signsEnabled = false;
@@ -478,6 +490,7 @@ public final class Settings implements ISettings
}
return newSigns;
}
+
private boolean warnOnBuildDisallow;
private boolean _warnOnBuildDisallow()
@@ -490,6 +503,7 @@ public final class Settings implements ISettings
{
return warnOnBuildDisallow;
}
+
private boolean debug = false;
private boolean configDebug = false;
@@ -582,6 +596,7 @@ public final class Settings implements ISettings
{
return config.getBoolean(configName, def);
}
+
private final static double MAXMONEY = 10000000000000.0;
@Override
@@ -594,6 +609,7 @@ public final class Settings implements ISettings
}
return max;
}
+
private final static double MINMONEY = -10000000000000.0;
@Override
@@ -628,6 +644,7 @@ public final class Settings implements ISettings
{
return config.getBoolean("remove-god-on-disconnect", false);
}
+
private boolean changeDisplayName = true;
private boolean _changeDisplayName()
@@ -640,6 +657,7 @@ public final class Settings implements ISettings
{
return changeDisplayName;
}
+
private boolean changePlayerListName = false;
private boolean _changePlayerListName()
@@ -658,6 +676,7 @@ public final class Settings implements ISettings
{
return config.getBoolean("use-bukkit-permissions", false);
}
+
private boolean prefixsuffixconfigured = false;
private boolean addprefixsuffix = false;
private boolean essentialsChatActive = false;
@@ -683,6 +702,7 @@ public final class Settings implements ISettings
{
return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive;
}
+
private boolean disablePrefix = false;
private boolean _disablePrefix()
@@ -695,6 +715,7 @@ public final class Settings implements ISettings
{
return disablePrefix;
}
+
private boolean disableSuffix = false;
private boolean _disableSuffix()
@@ -719,6 +740,7 @@ public final class Settings implements ISettings
{
return config.getLong("auto-afk-kick", -1);
}
+
private boolean getFreezeAfkPlayers;
@Override
@@ -731,6 +753,7 @@ public final class Settings implements ISettings
{
return config.getBoolean("freeze-afk-players", false);
}
+
private boolean cancelAfkOnMove;
@Override
@@ -749,6 +772,7 @@ public final class Settings implements ISettings
{
return config.getBoolean("death-messages", true);
}
+
private Set<String> noGodWorlds = new HashSet<String>();
@Override
@@ -780,6 +804,7 @@ public final class Settings implements ISettings
{
return config.getBoolean("world-home-permissions", false);
}
+
private boolean registerBackInListener;
@Override
@@ -792,6 +817,7 @@ public final class Settings implements ISettings
{
return config.getBoolean("register-back-in-listener", false);
}
+
private boolean disableItemPickupWhileAfk;
@Override
@@ -849,6 +875,7 @@ public final class Settings implements ISettings
{
this.metricsEnabled = metricsEnabled;
}
+
private boolean teleportInvulnerability;
@Override
@@ -867,6 +894,7 @@ public final class Settings implements ISettings
{
return teleportInvulnerability;
}
+
private long loginAttackDelay;
private long _getLoginAttackDelay()
@@ -879,6 +907,7 @@ public final class Settings implements ISettings
{
return loginAttackDelay;
}
+
private int signUsePerSecond;
private int _getSignUsePerSecond()
@@ -908,6 +937,7 @@ public final class Settings implements ISettings
double maxSpeed = config.getDouble("max-walk-speed", 0.8);
return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed);
}
+
private int mailsPerMinute;
private int _getMailsPerMinute()
diff --git a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java
index a34734cf9..040fdd875 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java
@@ -134,6 +134,7 @@ class UpdateUserFiles
String realname = getPlayer(name);
return realname == null ? BROKENNAME : realname;
}
+
private final Map<String, String> players = new HashMap<String, String>();
private String getPlayer(String check)
diff --git a/Essentials2Compat/src/com/earth2me/essentials/UserData.java b/Essentials2Compat/src/com/earth2me/essentials/UserData.java
index 2dc8d2cec..fdd16c495 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/UserData.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/UserData.java
@@ -12,10 +12,11 @@ import org.bukkit.inventory.ItemStack;
public class UserData
{
- protected final IEssentials ess;
+ protected final transient IEssentials ess;
private EssentialsConf config;
private final File folder;
+
protected UserData(IEssentials ess, File file)
{
this.ess = ess;
@@ -58,6 +59,7 @@ public class UserData
kitTimestamps = _getKitTimestamps();
nickname = _getNickname();
}
+
private double money;
private double _getMoney()
@@ -89,6 +91,7 @@ public class UserData
config.setProperty("money", value);
config.save();
}
+
private Map<String, Object> homes;
private Map<String, Object> _getHomes()
@@ -121,6 +124,7 @@ public class UserData
return config.getLocation("homes." + search, ess.getServer());
}
+
public List<String> getHomes()
{
return new ArrayList<String>(homes.keySet());
@@ -162,6 +166,7 @@ public class UserData
}
return false;
}
+
private String nickname;
public String _getNickname()
@@ -180,6 +185,7 @@ public class UserData
config.setProperty("nickname", nick);
config.save();
}
+
private List<Integer> unlimited;
private List<Integer> _getUnlimited()
@@ -210,6 +216,7 @@ public class UserData
config.setProperty("unlimited", unlimited);
config.save();
}
+
private Map<String, Object> powertools;
private Map<String, Object> _getPowertools()
@@ -263,6 +270,7 @@ public class UserData
{
return !powertools.isEmpty();
}
+
private StoredLocation lastLocation;
private StoredLocation _getLastLocation()
@@ -281,6 +289,8 @@ public class UserData
{
return lastLocation;
}
+
+
private long lastTeleportTimestamp;
private long _getLastTeleportTimestamp()
@@ -299,6 +309,7 @@ public class UserData
config.setProperty("timestamps.lastteleport", time);
config.save();
}
+
private long lastHealTimestamp;
private long _getLastHealTimestamp()
@@ -317,6 +328,7 @@ public class UserData
config.setProperty("timestamps.lastheal", time);
config.save();
}
+
private String jail;
private String _getJail()
@@ -343,6 +355,7 @@ public class UserData
}
config.save();
}
+
private List<String> mails;
private List<String> _getMails()
@@ -375,6 +388,7 @@ public class UserData
mails.add(mail);
setMails(mails);
}
+
private boolean teleportEnabled;
private boolean getTeleportEnabled()
@@ -407,6 +421,7 @@ public class UserData
setSocialSpyEnabled(ret);
return ret;
}
+
private List<String> ignoredPlayers;
public List<String> getIgnoredPlayers()
@@ -428,6 +443,8 @@ public class UserData
}
config.save();
}
+
+
private boolean godmode;
private boolean _getGodModeEnabled()
@@ -446,6 +463,7 @@ public class UserData
config.setProperty("godmode", set);
config.save();
}
+
private boolean muted;
public boolean getMuted()
@@ -464,6 +482,7 @@ public class UserData
config.setProperty("muted", set);
config.save();
}
+
private long muteTimeout;
private long _getMuteTimeout()
@@ -482,6 +501,7 @@ public class UserData
config.setProperty("timestamps.mute", time);
config.save();
}
+
private boolean jailed;
private boolean getJailed()
@@ -507,6 +527,7 @@ public class UserData
setJailed(ret);
return ret;
}
+
private long jailTimeout;
private long _getJailTimeout()
@@ -547,6 +568,7 @@ public class UserData
config.setProperty("ban.timeout", time);
config.save();
}
+
private long lastLogin;
private long _getLastLogin()
@@ -564,6 +586,8 @@ public class UserData
lastLogin = time;
config.setProperty("timestamps.login", time);
}
+
+
private long lastLogout;
private long _getLastLogout()
@@ -582,6 +606,7 @@ public class UserData
config.setProperty("timestamps.logout", time);
config.save();
}
+
private String lastLoginAddress;
private String _getLastLoginAddress()
@@ -599,6 +624,7 @@ public class UserData
lastLoginAddress = address;
config.setProperty("ipAddress", address);
}
+
private boolean afk;
private boolean getAfk()
@@ -624,6 +650,7 @@ public class UserData
setAfk(ret);
return ret;
}
+
private boolean newplayer; //TODO: unused variable?
private String geolocation;
@@ -651,6 +678,7 @@ public class UserData
}
config.save();
}
+
private boolean isSocialSpyEnabled;
private boolean _isSocialSpyEnabled()
@@ -669,6 +697,7 @@ public class UserData
config.setProperty("socialspy", status);
config.save();
}
+
private boolean isNPC;
private boolean _isNPC()
@@ -687,6 +716,7 @@ public class UserData
config.setProperty("npc", set);
config.save();
}
+
private boolean arePowerToolsEnabled;
public boolean arePowerToolsEnabled()
@@ -712,6 +742,7 @@ public class UserData
{
return config.getBoolean("powertoolsenabled", true);
}
+
private ConfigurationSection kitTimestamps;
private ConfigurationSection _getKitTimestamps()
diff --git a/Essentials2Compat/src/com/earth2me/essentials/Util.java b/Essentials2Compat/src/com/earth2me/essentials/Util.java
index b6f051328..0500df536 100644
--- a/Essentials2Compat/src/com/earth2me/essentials/Util.java
+++ b/Essentials2Compat/src/com/earth2me/essentials/Util.java
@@ -12,6 +12,7 @@ public class Util
private Util()
{
}
+
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
@@ -32,6 +33,8 @@ public class Util
{
return INVALIDCHARS.matcher(string).replaceAll("");
}
+
+
private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
public static String formatAsCurrency(final double value)