summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/IConf.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/IEssentials.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/IUser.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IEssentials.java51
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java37
-rw-r--r--Essentials/src/com/earth2me/essentials/api/ISettings.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IUser.java43
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IUserMap.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IWarps.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IWorth.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Backup.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Chat.java29
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Commands.java40
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Economy.java43
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/General.java33
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/GroupOptions.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Groups.java28
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Locations.java22
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Settings.java58
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/Worth.java34
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Afk.java36
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/God.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Help.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Home.java24
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Kit.java28
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/user/Ban.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/user/IOfflineUser.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/user/Inventory.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/user/User.java220
-rw-r--r--Essentials/src/com/earth2me/essentials/user/UserBase.java117
-rw-r--r--Essentials/src/com/earth2me/essentials/user/UserData.java56
-rw-r--r--Essentials/src/com/earth2me/essentials/user/UserMap.java128
-rw-r--r--Essentials/test/com/earth2me/essentials/StorageTest.java99
39 files changed, 0 insertions, 1403 deletions
diff --git a/Essentials/src/com/earth2me/essentials/IConf.java b/Essentials/src/com/earth2me/essentials/IConf.java
index 580e6232f..a523f8638 100644
--- a/Essentials/src/com/earth2me/essentials/IConf.java
+++ b/Essentials/src/com/earth2me/essentials/IConf.java
@@ -1,9 +1,5 @@
package com.earth2me.essentials;
-/**
- * @deprecated New interface will be IReload in api package
- */
-@Deprecated
public interface IConf {
public void reloadConfig();
}
diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java
index f12798db3..9d61391d1 100644
--- a/Essentials/src/com/earth2me/essentials/IEssentials.java
+++ b/Essentials/src/com/earth2me/essentials/IEssentials.java
@@ -12,10 +12,6 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
-/**
- * @deprecated This will be moved to the api package soon
- */
-@Deprecated
public interface IEssentials extends Plugin
{
void addReloadListener(IConf listener);
diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java
index bfa9ed146..8c0d6212f 100644
--- a/Essentials/src/com/earth2me/essentials/IUser.java
+++ b/Essentials/src/com/earth2me/essentials/IUser.java
@@ -5,10 +5,6 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
-/**
- * @deprecated This will be moved to the api package soon
- */
-@Deprecated
public interface IUser extends Player
{
long getLastTeleportTimestamp();
diff --git a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java
deleted file mode 100644
index 11619bca4..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.earth2me.essentials.api;
-
-import java.util.Map;
-import org.bukkit.command.PluginCommand;
-
-
-public interface IAlternativeCommandsHandler
-{
- Map<String, String> disabledCommands();
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentials.java b/Essentials/src/com/earth2me/essentials/api/IEssentials.java
deleted file mode 100644
index c04bed0bd..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IEssentials.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.earth2me.essentials.api;
-
-import com.earth2me.essentials.perm.IPermissionsHandler;
-import com.earth2me.essentials.register.payment.Methods;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.plugin.Plugin;
-
-
-public interface IEssentials extends Plugin, IReload
-{
- void addReloadListener(IReload listener);
-
- IUser getUser(Object base);
-
- int broadcastMessage(IUser sender, String message);
-
- II18n getI18n();
-
- ISettings getSettings();
-
- IJails getJail();
-
- IWarps getWarps();
-
- IWorth getWorth();
-
- IItemDb getItemDb();
-
- IUserMap getUserMap();
-
- IEssentialsEconomy getEconomy();
-
- World getWorld(String name);
-
- Methods getPaymentMethod();
-
- int scheduleAsyncDelayedTask(Runnable run);
-
- int scheduleSyncDelayedTask(Runnable run);
-
- int scheduleSyncDelayedTask(Runnable run, long delay);
-
- int scheduleSyncRepeatingTask(Runnable run, long delay, long period);
-
- IPermissionsHandler getPermissionsHandler();
-
- IAlternativeCommandsHandler getAlternativeCommandsHandler();
-
- void showCommandError(CommandSender sender, String commandLabel, Throwable exception);
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java b/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java
deleted file mode 100644
index 72fb89d26..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.earth2me.essentials.api;
-
-
-public interface IEssentialsEconomy
-{
- double getMoney(String name) throws UserDoesNotExistException;
-
- void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException;
-
- void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException;
-
- void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException;
-
- void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException;
-
- void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException;
-
- void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException;
-
- boolean hasEnough(String name, double amount) throws UserDoesNotExistException;
-
- boolean hasMore(String name, double amount) throws UserDoesNotExistException;
-
- boolean hasLess(String name, double amount) throws UserDoesNotExistException;
-
- boolean isNegative(String name) throws UserDoesNotExistException;
-
- String format(double amount);
-
- boolean playerExists(String name);
-
- boolean isNPC(String name) throws UserDoesNotExistException;
-
- boolean createNPC(String name);
-
- void removeNPC(String name) throws UserDoesNotExistException;
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/ISettings.java b/Essentials/src/com/earth2me/essentials/api/ISettings.java
deleted file mode 100644
index eff65ad87..000000000
--- a/Essentials/src/com/earth2me/essentials/api/ISettings.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.earth2me.essentials.api;
-
-import com.earth2me.essentials.settings.Settings;
-import com.earth2me.essentials.storage.IStorageObjectHolder;
-
-
-public interface ISettings extends IStorageObjectHolder<Settings>
-{
-
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/IUser.java b/Essentials/src/com/earth2me/essentials/api/IUser.java
deleted file mode 100644
index 5d2f9d4b8..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IUser.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.earth2me.essentials.api;
-
-import com.earth2me.essentials.commands.IEssentialsCommand;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-
-
-public interface IUser extends Player, IReload
-{
- long getLastTeleportTimestamp();
-
- boolean isAuthorized(String node);
-
- boolean isAuthorized(IEssentialsCommand cmd);
-
- boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix);
-
- void setLastTeleportTimestamp(long time);
-
- Location getLastLocation();
-
- Player getBase();
-
- double getMoney();
-
- void takeMoney(double value);
-
- void giveMoney(double value);
-
- String getGroup();
-
- void setLastLocation();
-
- Location getHome(String name) throws Exception;
-
- Location getHome(Location loc) throws Exception;
-
- boolean isHidden();
-
- ITeleport getTeleport();
-
- void setJail(String jail);
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/IUserMap.java b/Essentials/src/com/earth2me/essentials/api/IUserMap.java
deleted file mode 100644
index 9e609ab37..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IUserMap.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.earth2me.essentials.api;
-
-import java.io.File;
-import java.util.Set;
-
-
-public interface IUserMap
-{
- boolean userExists(final String name);
-
- IUser getUser(final String name);
-
- void removeUser(final String name);
-
- Set<String> getAllUniqueUsers();
-
- int getUniqueUsers();
-
- File getUserFile(final String name);
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/IWarps.java b/Essentials/src/com/earth2me/essentials/api/IWarps.java
deleted file mode 100644
index 14779e327..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IWarps.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.earth2me.essentials.api;
-
-import java.util.Collection;
-import org.bukkit.Location;
-
-
-public interface IWarps extends IReload
-{
- Location getWarp(String warp) throws Exception;
-
- Collection<String> getWarps();
-
- void removeWarp(String name) throws Exception;
-
- void setWarp(String name, Location loc) throws Exception;
-}
diff --git a/Essentials/src/com/earth2me/essentials/api/IWorth.java b/Essentials/src/com/earth2me/essentials/api/IWorth.java
deleted file mode 100644
index 4add98771..000000000
--- a/Essentials/src/com/earth2me/essentials/api/IWorth.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.earth2me.essentials.api;
-
-import org.bukkit.inventory.ItemStack;
-
-
-public interface IWorth extends IReload
-{
- double getPrice(ItemStack itemStack);
-
- void setPrice(ItemStack itemStack, double price);
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Backup.java b/Essentials/src/com/earth2me/essentials/settings/Backup.java
deleted file mode 100644
index f43af47c0..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Backup.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Backup implements StorageObject
-{
- @Comment("Interval in minutes")
- private long interval = 60;
- @Comment("Add a command that backups your data, e.g. 'rdiff-backup World1 backups/World1'")
- private String command;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Chat.java b/Essentials/src/com/earth2me/essentials/settings/Chat.java
deleted file mode 100644
index 623228c4e..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Chat.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Chat implements StorageObject
-{
- @Comment("The character(s) to prefix all nicknames, so that you know they are not true usernames.")
- private String nicknamePrefix = "~";
- @Comment("Disable this if you have any other plugin, that modifies the displayname of a user.")
- private boolean changeDisplayname = true;
- private String displaynameFormat = "{PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}";
- @Comment(
- {
- "If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.",
- "Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.",
- "Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)",
- "Or with essentials.chat.question can override this by prefixing text with a question mark (?)",
- "You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
- })
- private int localRadius = 0;
- @Comment("Set the default chat format here, it will be overwritten by group specific chat formats.")
- private String defaultFormat = "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}";
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Commands.java b/Essentials/src/com/earth2me/essentials/settings/Commands.java
deleted file mode 100644
index 08efc881c..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Commands.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.settings.commands.*;
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.ListType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Commands implements StorageObject
-{
- private Afk afk = new Afk();
- private God god = new God();
- private Help help = new Help();
- private Home home = new Home();
- private Kit kit = new Kit();
- private Lightning lightning = new Lightning();
- private Spawnmob spawnmob = new Spawnmob();
- @ListType
- @Comment(
- {
- "When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take",
- "priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:",
- "usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.",
- "For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god",
- "will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",",
- "such as /egod, will always grant Essentials priority.",
- "We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.",
- "If god is set using WorldGuard, use /ungod to remove then use whichever you see fit."
- })
- private List<String> overwritten = new ArrayList<String>();
- @ListType
- @Comment("Disabled commands will be completelly unavailable on the server.")
- private List<String> disabled = new ArrayList<String>();
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Economy.java b/Essentials/src/com/earth2me/essentials/settings/Economy.java
deleted file mode 100644
index 5872dada9..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Economy.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.HashMap;
-import java.util.Map;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Economy implements StorageObject
-{
- @Comment("Defines the balance with which new players begin. Defaults to 0.")
- private double startingBalance = 0.0;
- @MapValueType(Double.class)
- @Comment("Defines the cost to use the given commands PER USE")
- private Map<String, Double> commandCosts = new HashMap<String, Double>();
- @Comment("Set this to a currency symbol you want to use.")
- private String currencySymbol = "$";
-
- public String getCurrencySymbol()
- {
- return currencySymbol == null || currencySymbol.isEmpty() ? "$" : currencySymbol.substring(0, 1);
- }
- private final transient static double MAXMONEY = 10000000000000.0;
- @Comment(
- {
- "Set the maximum amount of money a player can have",
- "The amount is always limited to 10 trillions because of the limitations of a java double"
- })
- private double maxMoney = MAXMONEY;
-
- public double getMaxMoney()
- {
- return Math.abs(maxMoney) > MAXMONEY ? MAXMONEY : Math.abs(maxMoney);
- }
- @Comment("Enable this to log all interactions with trade/buy/sell signs and sell command")
- private boolean logEnabled = false;
- private Worth worth = new Worth();
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/General.java b/Essentials/src/com/earth2me/essentials/settings/General.java
deleted file mode 100644
index a7cf537bb..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/General.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class General implements StorageObject
-{
- @Comment("Backup runs a command while saving is disabled")
- private Backup backup = new Backup();
- @Comment("You can disable the death messages of minecraft.")
- private boolean deathMessages = true;
- @Comment("Turn this on, if you want to see more error messages, if something goes wrong.")
- private boolean debug = false;
- @Comment(
- {
- "Set the locale here, if you want to change the language of Essentials.",
- "If this is not set, Essentials will use the language of your computer.",
- "Available locales: da, de, en, fr, nl"
- })
- private String locale;
- @Comment(
- {
- "Should we announce to the server when someone logs in for the first time?",
- "If so, use this format, replacing {DISPLAYNAME} with the player name.",
- "If not, set to ''"
- })
- private String newPlayerAnnouncement = "&dWelcome {DISPLAYNAME} to the server!";
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/GroupOptions.java b/Essentials/src/com/earth2me/essentials/settings/GroupOptions.java
deleted file mode 100644
index 7b16a471b..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/GroupOptions.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class GroupOptions implements StorageObject
-{
- @Comment("Message format of chat messages")
- private String messageFormat;
- @Comment("Prefix for name")
- private String prefix;
- @Comment("Suffix for name")
- private String suffix;
- @Comment("Amount of homes a player can have")
- private Integer homes;
- @Comment("Cooldown between teleports")
- private Integer teleportCooldown;
- @Comment("Delay before teleport")
- private Integer teleportDelay;
- @Comment("Cooldown between heals")
- private Integer healCooldown;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Groups.java b/Essentials/src/com/earth2me/essentials/settings/Groups.java
deleted file mode 100644
index 5e67db890..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Groups.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.LinkedHashMap;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Groups implements StorageObject
-{
- public Groups()
- {
- GroupOptions defaultOptions = new GroupOptions();
- groups.put("default", defaultOptions);
- }
- @Comment(
- {
- "The order of the groups matters, the groups are checked from top to bottom.",
- "All group names have to be lower case.",
- "The groups can be connected to users using the permission essentials.groups.groupname"
- })
- @MapValueType(GroupOptions.class)
- private LinkedHashMap<String, GroupOptions> groups = new LinkedHashMap<String, GroupOptions>();
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Locations.java b/Essentials/src/com/earth2me/essentials/settings/Locations.java
deleted file mode 100644
index 7e7f1a63d..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Locations.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.HashMap;
-import java.util.Map;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.bukkit.Location;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Locations implements StorageObject
-{
- @MapValueType(Location.class)
- Map<String, Location> jails = new HashMap<String, Location>();
- @MapValueType(Location.class)
- Map<String, Location> warps = new HashMap<String, Location>();
- @MapValueType(Location.class)
- Map<String, Location> spawns = new HashMap<String, Location>();
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Settings.java b/Essentials/src/com/earth2me/essentials/settings/Settings.java
deleted file mode 100644
index 4c2ff2dd9..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Settings.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Settings implements StorageObject
-{
- @Comment(
- {
- "##########################################################",
- "+------------------------------------------------------+ #",
- "| General Settings | #",
- "+------------------------------------------------------+ #",
- "##########################################################"
- })
- private General general = new General();
- @Comment(
- {
- "##########################################################",
- "+------------------------------------------------------+ #",
- "| Chat Settings | #",
- "+------------------------------------------------------+ #",
- "##########################################################"
- })
- private Chat chat = new Chat();
- @Comment(
- {
- "##########################################################",
- "+------------------------------------------------------+ #",
- "| Economy Settings | #",
- "+------------------------------------------------------+ #",
- "##########################################################"
- })
- private Economy economy = new Economy();
- @Comment(
- {
- "##########################################################",
- "+------------------------------------------------------+ #",
- "| Commands Settings | #",
- "+------------------------------------------------------+ #",
- "##########################################################"
- })
- private Commands commands = new Commands();
- @Comment(
- {
- "##########################################################",
- "+------------------------------------------------------+ #",
- "| Group Settings | #",
- "+------------------------------------------------------+ #",
- "##########################################################"
- })
- private Groups groups = new Groups();
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/Worth.java b/Essentials/src/com/earth2me/essentials/settings/Worth.java
deleted file mode 100644
index 707f907cf..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/Worth.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.earth2me.essentials.settings;
-
-import com.earth2me.essentials.storage.EnchantmentLevel;
-import com.earth2me.essentials.storage.MapKeyType;
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.HashMap;
-import java.util.Map;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.bukkit.Material;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.material.MaterialData;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Worth implements StorageObject
-{
- @MapKeyType(MaterialData.class)
- @MapValueType(Double.class)
- private Map<MaterialData, Double> sell = new HashMap<MaterialData, Double>();
- @MapKeyType(MaterialData.class)
- @MapValueType(Double.class)
- private Map<MaterialData, Double> buy = new HashMap<MaterialData, Double>();
- @MapKeyType(EnchantmentLevel.class)
- @MapValueType(Double.class)
- private Map<EnchantmentLevel, Double> enchantmentMultiplier = new HashMap<EnchantmentLevel, Double>();
-
- public Worth()
- {
- sell.put(new MaterialData(Material.APPLE, (byte)0), 1.0);
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Afk.java b/Essentials/src/com/earth2me/essentials/settings/commands/Afk.java
deleted file mode 100644
index 80cae7e8a..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Afk.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Afk implements StorageObject
-{
- @Comment(
- {
- "After this timeout in seconds, the user will be set as afk.",
- "Set to -1 for no timeout."
- })
- private int autoAFK = 300;
- @Comment(
- {
- "Auto-AFK Kick",
- "After this timeout in seconds, the user will be kicked from the server.",
- "Set to -1 for no timeout."
- })
- private int autoAFKKick = -1;
- @Comment(
- {
- "Set this to true, if you want to freeze the player, if he is afk.",
- "Other players or monsters can't push him out of afk mode then.",
- "This will also enable temporary god mode for the afk player.",
- "The player has to use the command /afk to leave the afk mode.",
- "You have to add a message to your welcome message or help page,",
- "since the player will not get a message, if he tries to move."
- })
- private boolean freezeAFKPlayers = false;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/God.java b/Essentials/src/com/earth2me/essentials/settings/commands/God.java
deleted file mode 100644
index a6f5dbfc3..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/God.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class God implements StorageObject
-{
- @Comment("Turn off god mode when people exit")
- private boolean removeOnDisconnect = false;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Help.java b/Essentials/src/com/earth2me/essentials/settings/commands/Help.java
deleted file mode 100644
index 0b4787471..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Help.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Help implements StorageObject
-{
- @Comment("Show other plugins commands in help")
- private boolean showNonEssCommandsInHelp = true;
- @Comment(
- {
- "Hide plugins which don't give a permission in their plugin.yml for each command.",
- "You can override a true value here for a single plugin by adding a permission to a user/group.",
- "The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.",
- "You can use negative permissions to remove access to just a single plugins help if the following is enabled."
- })
- private boolean hidePermissionlessCommands = true;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Home.java b/Essentials/src/com/earth2me/essentials/settings/commands/Home.java
deleted file mode 100644
index 8b3a0ca82..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Home.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Home implements StorageObject
-{
- @Comment("When players die, should they respawn at their homes, instead of the spawnpoint?")
- private boolean respawnAtHome = false;
- @Comment(
- {
- "When a player interacts with a bed, should their home be set to that location?",
- "If you enable this and remove default player access to the /sethome command, ",
- "you can make beds the only way for players to set their home location."
- })
- private boolean bedSetsHome = false;
- @Comment("If no home is set, should the player be send to spawn, when /home is used.")
- private boolean spawnIfNoHome = false;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java b/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java
deleted file mode 100644
index 87aa42d3c..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Kit.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.HashMap;
-import java.util.Map;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Kit implements StorageObject
-{
- public Kit()
- {
- final KitObject kit = new KitObject();
- kit.setDelay(10.0);
- kit.getItems().add(new ItemStack(Material.DIAMOND_SPADE, 1));
- kit.getItems().add(new ItemStack(Material.DIAMOND_PICKAXE, 1));
- kit.getItems().add(new ItemStack(Material.DIAMOND_AXE, 1));
- kits.put("tools", kit);
- }
- @MapValueType(KitObject.class)
- private Map<String, KitObject> kits = new HashMap<String, KitObject>();
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java b/Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java
deleted file mode 100644
index fe0353be9..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/KitObject.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.ListType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.bukkit.inventory.ItemStack;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class KitObject implements StorageObject
-{
- @ListType(ItemStack.class)
- private List<ItemStack> items = new ArrayList<ItemStack>();
- private Double delay;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java b/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java
deleted file mode 100644
index e40e645da..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Lightning.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Lightning implements StorageObject
-{
- @Comment("Shall we notify users when using /lightning")
- private boolean warnPlayer = true;
-}
diff --git a/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java b/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java
deleted file mode 100644
index 37d41c296..000000000
--- a/Essentials/src/com/earth2me/essentials/settings/commands/Spawnmob.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.earth2me.essentials.settings.commands;
-
-import com.earth2me.essentials.storage.Comment;
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Spawnmob implements StorageObject
-{
- @Comment("The maximum amount of monsters, a player can spawn with a call of /spawnmob.")
- private int limit = 10;
-}
diff --git a/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java
index f48e54002..4e860bd8c 100644
--- a/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java
+++ b/Essentials/src/com/earth2me/essentials/storage/IStorageObjectHolder.java
@@ -1,7 +1,5 @@
package com.earth2me.essentials.storage;
-import com.earth2me.essentials.user.UserData;
-
public interface IStorageObjectHolder<T extends StorageObject>
{
diff --git a/Essentials/src/com/earth2me/essentials/user/Ban.java b/Essentials/src/com/earth2me/essentials/user/Ban.java
deleted file mode 100644
index ba1c22333..000000000
--- a/Essentials/src/com/earth2me/essentials/user/Ban.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.storage.StorageObject;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Ban implements StorageObject
-{
- private String reason;
- private long timeout;
-}
diff --git a/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java b/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java
deleted file mode 100644
index 4cdee715b..000000000
--- a/Essentials/src/com/earth2me/essentials/user/IOfflinePlayer.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.earth2me.essentials.user;
-
-import org.bukkit.Location;
-
-
-public interface IOfflinePlayer
-{
- String getName();
-
- String getDisplayName();
-
- Location getBedSpawnLocation();
-
- void setBanned(boolean bln);
-} \ No newline at end of file
diff --git a/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java b/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java
deleted file mode 100644
index d6266df49..000000000
--- a/Essentials/src/com/earth2me/essentials/user/IOfflineUser.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.storage.IStorageObjectHolder;
-
-
-public interface IOfflineUser extends IStorageObjectHolder<UserData>, IOfflinePlayer
-{
-
-}
diff --git a/Essentials/src/com/earth2me/essentials/user/Inventory.java b/Essentials/src/com/earth2me/essentials/user/Inventory.java
deleted file mode 100644
index 0812f54a0..000000000
--- a/Essentials/src/com/earth2me/essentials/user/Inventory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.storage.MapKeyType;
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.HashMap;
-import java.util.Map;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class Inventory implements StorageObject
-{
- private int size;
- @MapKeyType(Integer.class)
- @MapValueType(ItemStack.class)
- private Map<Integer, ItemStack> items = new HashMap<Integer, ItemStack>();
-
- public Inventory()
- {
- items.put(1, new ItemStack(Material.APPLE, 64));
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java
deleted file mode 100644
index 589e26737..000000000
--- a/Essentials/src/com/earth2me/essentials/user/User.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.IUser;
-import com.earth2me.essentials.Teleport;
-import com.earth2me.essentials.commands.IEssentialsCommand;
-import lombok.Cleanup;
-import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.entity.Player;
-
-
-public class User extends UserBase implements IUser
-{
- public User(final Player base, final IEssentials ess)
- {
- super(base, ess);
- }
-
- public User(final OfflinePlayer offlinePlayer, final IEssentials ess)
- {
- super(offlinePlayer, ess);
- }
-
- public void example()
- {
- // Cleanup will call close at the end of the function
- @Cleanup
- final User user = this;
-
- // read lock allows to read data from the user
- user.acquireReadLock();
- final double money = user.getData().getMoney();
-
- // write lock allows only one thread to modify the data
- user.acquireWriteLock();
- user.getData().setMoney(10 + money);
- }
-
- @Override
- public void finishRead()
- {
- }
-
- @Override
- public void finishWrite()
- {
- }
-
- @Override
- public long getLastTeleportTimestamp()
- {
- acquireReadLock();
- try
- {
- return getData().getTimestamps().get("lastteleport");
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public boolean isAuthorized(String node)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean isAuthorized(IEssentialsCommand cmd)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void setLastTeleportTimestamp(long time)
- {
- acquireWriteLock();
- try
- {
- getData().getTimestamps().put("lastteleport", time);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public Location getLastLocation()
- {
- acquireReadLock();
- try
- {
- return getData().getLastLocation();
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public double getMoney()
- {
- acquireReadLock();
- try
- {
- return getData().getMoney();
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public void takeMoney(double value)
- {
- acquireWriteLock();
- try
- {
- getData().setMoney(getData().getMoney() - value);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public void giveMoney(double value)
- {
- acquireWriteLock();
- try
- {
- getData().setMoney(getData().getMoney() + value);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public String getGroup()
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void setLastLocation()
- {
- acquireWriteLock();
- try
- {
- getData().setLastLocation(base.getLocation());
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public Location getHome(String name) throws Exception
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Location getHome(Location loc) throws Exception
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public boolean isHidden()
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public Teleport getTeleport()
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void setJail(final String jail)
- {
- acquireWriteLock();
- try
- {
- getData().setJail(jail);
- }
- finally
- {
- unlock();
- }
- }
-
- @Override
- public boolean canAfford(final double cost)
- {
- final double mon = getMoney();
- if (isAuthorized("essentials.eco.loan"))
- {
- return (mon - cost) >= ess.getSettings().getMinMoney();
- }
- return cost <= mon;
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/user/UserBase.java b/Essentials/src/com/earth2me/essentials/user/UserBase.java
deleted file mode 100644
index 587ed084b..000000000
--- a/Essentials/src/com/earth2me/essentials/user/UserBase.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
-import java.io.File;
-import lombok.Delegate;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.serialization.ConfigurationSerializable;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.HumanEntity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.Permissible;
-import org.bukkit.permissions.ServerOperator;
-import org.bukkit.OfflinePlayer;
-
-
-public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implements Player, IOfflineUser
-{
-
- @Delegate(types =
- {
- Player.class, Entity.class, CommandSender.class, ServerOperator.class,
- HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class,
- Permissible.class
- },excludes=IOfflinePlayer.class)
- protected Player base;
- protected transient OfflinePlayer offlinePlayer;
-
- public UserBase(final Player base, final IEssentials ess)
- {
- super(ess, UserData.class);
- this.base = base;
- reloadConfig();
- }
-
- public UserBase(final OfflinePlayer offlinePlayer, final IEssentials ess)
- {
- super(ess, UserData.class);
- this.offlinePlayer = offlinePlayer;
- reloadConfig();
- }
-
- public final Player getBase()
- {
- return base;
- }
-
- public final Player setBase(final Player base)
- {
- return this.base = base;
- }
-
- public void update(final Player base)
- {
- setBase(base);
- }
-
- public void update(final OfflinePlayer offlinePlayer)
- {
- this.offlinePlayer = offlinePlayer;
- }
-
- public void dispose()
- {
- this.offlinePlayer = Bukkit.getOfflinePlayer(base.getName());
- this.base = null;
- }
-
- public boolean isOnlineUser() {
- return base != null;
- }
-
- @Override
- public String getName()
- {
- if (isOnlineUser()) {
- return base.getName();
- } else {
- return offlinePlayer.getName();
- }
- }
-
- @Override
- public String getDisplayName()
- {
- if (isOnlineUser()) {
- return base.getDisplayName();
- } else {
- return offlinePlayer.getName();
- }
- }
-
- @Override
- public Location getBedSpawnLocation()
- {
- return base.getBedSpawnLocation();
- }
-
- @Override
- public void setBanned(boolean bln)
- {
- if (isOnlineUser()) {
- base.setBanned(bln);
- } else {
- offlinePlayer.setBanned(bln);
- }
- }
-
- @Override
- public File getStorageFile()
- {
- return ess.getUserMap().getUserFile(getName());
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/user/UserData.java b/Essentials/src/com/earth2me/essentials/user/UserData.java
deleted file mode 100644
index 4586d0627..000000000
--- a/Essentials/src/com/earth2me/essentials/user/UserData.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.storage.ListType;
-import com.earth2me.essentials.storage.MapKeyType;
-import com.earth2me.essentials.storage.MapValueType;
-import com.earth2me.essentials.storage.StorageObject;
-import java.util.*;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.bukkit.Location;
-import org.bukkit.Material;
-
-
-@Data
-@EqualsAndHashCode(callSuper = false)
-public class UserData implements StorageObject
-{
- private String nickname;
- private double money;
- @MapValueType(Location.class)
- private Map<String, Location> homes = new HashMap<String, Location>();
- @ListType(Material.class)
- private Set<Material> unlimited = new HashSet<Material>();
- @MapValueType(List.class)
- @MapKeyType(Material.class)
- private Map<Material, List<String>> powerTools = new HashMap<Material, List<String>>();
- private Location lastLocation;
- @MapValueType(Long.class)
- private Map<String, Long> timestamps;
- private String jail;
- @ListType
- private List<String> mails;
- private Inventory inventory;
- private boolean teleportEnabled;
- @ListType
- private Set<String> ignore;
- private boolean godmode;
- private boolean muted;
- private boolean jailed;
- private Ban ban;
- private String ipAddress;
- private boolean afk;
- private boolean newplayer = true;
- private String geolocation;
- private boolean socialspy;
- private boolean npc;
- private boolean powertoolsenabled;
-
- public UserData()
- {
- unlimited.add(Material.AIR);
- unlimited.add(Material.ARROW);
- unlimited.add(Material.APPLE);
- powerTools.put(Material.DEAD_BUSH, Collections.singletonList("test"));
- }
-}
diff --git a/Essentials/src/com/earth2me/essentials/user/UserMap.java b/Essentials/src/com/earth2me/essentials/user/UserMap.java
deleted file mode 100644
index 821ee4c8f..000000000
--- a/Essentials/src/com/earth2me/essentials/user/UserMap.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package com.earth2me.essentials.user;
-
-import com.earth2me.essentials.IConf;
-import com.earth2me.essentials.IEssentials;
-import com.earth2me.essentials.Util;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.util.concurrent.UncheckedExecutionException;
-import java.io.File;
-import java.util.Collections;
-import java.util.Locale;
-import java.util.Set;
-import java.util.concurrent.ConcurrentSkipListSet;
-import java.util.concurrent.ExecutionException;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
-
-public class UserMap extends CacheLoader<String, User> implements IConf
-{
- private final transient IEssentials ess;
- private final transient Cache<String, User> users = CacheBuilder.newBuilder().softValues().build(this);
- private final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>();
-
- public UserMap(final IEssentials ess)
- {
- super();
- this.ess = ess;
- loadAllUsersAsync(ess);
- }
-
- private void loadAllUsersAsync(final IEssentials ess)
- {
- ess.scheduleAsyncDelayedTask(new Runnable()
- {
- @Override
- public void run()
- {
- final File userdir = new File(ess.getDataFolder(), "userdata");
- if (!userdir.exists())
- {
- return;
- }
- keys.clear();
- users.invalidateAll();
- for (String string : userdir.list())
- {
- if (!string.endsWith(".yml"))
- {
- continue;
- }
- final String name = string.substring(0, string.length() - 4);
- keys.add(name.toLowerCase(Locale.ENGLISH));
- }
- }
- });
- }
-
- public boolean userExists(final String name)
- {
- return keys.contains(name.toLowerCase(Locale.ENGLISH));
- }
-
- public User getUser(final String name)
- {
- try
- {
- return users.get(name.toLowerCase(Locale.ENGLISH));
- }
- catch (ExecutionException ex)
- {
- return null;
- }
- catch (UncheckedExecutionException ex)
- {
- return null;
- }
- }
-
- @Override
- public User load(final String name) throws Exception
- {
- for (Player player : ess.getServer().getOnlinePlayers())
- {
- if (player.getName().equalsIgnoreCase(name))
- {
- keys.add(name.toLowerCase(Locale.ENGLISH));
- return new User(player, ess);
- }
- }
- final File userFile = getUserFile(name);
- if (userFile.exists())
- {
- keys.add(name.toLowerCase(Locale.ENGLISH));
- return new User(Bukkit.getOfflinePlayer(name), ess);
- }
- throw new Exception("User not found!");
- }
-
- @Override
- public void reloadConfig()
- {
- loadAllUsersAsync(ess);
- }
-
- public void removeUser(final String name)
- {
- keys.remove(name.toLowerCase(Locale.ENGLISH));
- users.invalidate(name.toLowerCase(Locale.ENGLISH));
- }
-
- public Set<String> getAllUniqueUsers()
- {
- return Collections.unmodifiableSet(keys);
- }
-
- public int getUniqueUsers()
- {
- return keys.size();
- }
-
- public File getUserFile(final String name)
- {
- final File userFolder = new File(ess.getDataFolder(), "userdata");
- return new File(userFolder, Util.sanitizeFileName(name) + ".yml");
- }
-}
diff --git a/Essentials/test/com/earth2me/essentials/StorageTest.java b/Essentials/test/com/earth2me/essentials/StorageTest.java
index b7fe23433..d4ea07f46 100644
--- a/Essentials/test/com/earth2me/essentials/StorageTest.java
+++ b/Essentials/test/com/earth2me/essentials/StorageTest.java
@@ -1,10 +1,5 @@
package com.earth2me.essentials;
-import com.earth2me.essentials.settings.Settings;
-import com.earth2me.essentials.storage.ObjectLoadException;
-import com.earth2me.essentials.storage.StorageObject;
-import com.earth2me.essentials.storage.YamlStorageReader;
-import com.earth2me.essentials.storage.YamlStorageWriter;
import java.io.*;
import junit.framework.TestCase;
import org.bukkit.Location;
@@ -40,100 +35,6 @@ public class StorageTest extends TestCase
}
@Test
- public void testSettings()
- {
- try
- {
- assertTrue(StorageObject.class.isAssignableFrom(Settings.class));
- ExecuteTimer ext = new ExecuteTimer();
- ext.start();
- final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
- final Reader reader = new InputStreamReader(bais);
- final Settings settings = new YamlStorageReader(reader, null).load(Settings.class);
- ext.mark("load empty settings");
- final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]);
- final Reader reader3 = new InputStreamReader(bais3);
- final Settings settings3 = new YamlStorageReader(reader3, null).load(Settings.class);
- ext.mark("load empty settings (class cached)");
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final PrintWriter writer = new PrintWriter(baos);
- new YamlStorageWriter(writer).save(settings);
- writer.close();
- ext.mark("write settings");
- byte[] written = baos.toByteArray();
- System.out.println(new String(written));
- final ByteArrayInputStream bais2 = new ByteArrayInputStream(written);
- final Reader reader2 = new InputStreamReader(bais2);
- final Settings settings2 = new YamlStorageReader(reader2, null).load(Settings.class);
- System.out.println(settings.toString());
- System.out.println(settings2.toString());
- ext.mark("reload settings");
- System.out.println(ext.end());
- //assertEquals("Default and rewritten config should be equal", settings, settings2);
- //that assertion fails, because empty list and maps return as null
- }
- catch (ObjectLoadException ex)
- {
- fail(ex.getMessage());
- }
- }
-
- @Test
- public void testUserdata()
- {
- try
- {
- FakeServer server = new FakeServer();
- World world = server.createWorld("testWorld", Environment.NORMAL);
- ExecuteTimer ext = new ExecuteTimer();
- ext.start();
- final ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
- final Reader reader = new InputStreamReader(bais);
- final com.earth2me.essentials.user.UserData userdata = new YamlStorageReader(reader, null).load(com.earth2me.essentials.user.UserData.class);
- ext.mark("load empty user");
- final ByteArrayInputStream bais3 = new ByteArrayInputStream(new byte[0]);
- final Reader reader3 = new InputStreamReader(bais3);
- final com.earth2me.essentials.user.UserData userdata3 = new YamlStorageReader(reader3, null).load(com.earth2me.essentials.user.UserData.class);
- ext.mark("load empty user (class cached)");
-
- for (int j = 0; j < 10000; j++)
- {
- userdata.getHomes().put("home", new Location(world, j, j, j));
- }
- ext.mark("change home 10000 times");
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final PrintWriter writer = new PrintWriter(baos);
- new YamlStorageWriter(writer).save(userdata);
- writer.close();
- ext.mark("write user");
- final ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
- final PrintWriter writer2 = new PrintWriter(baos2);
- new YamlStorageWriter(writer2).save(userdata);
- writer2.close();
- ext.mark("write user (cached)");
- byte[] written = baos.toByteArray();
- System.out.println(new String(written));
- ext.mark("debug output");
- final ByteArrayInputStream bais2 = new ByteArrayInputStream(written);
- final Reader reader2 = new InputStreamReader(bais2);
- final com.earth2me.essentials.user.UserData userdata2 = new YamlStorageReader(reader2, null).load(com.earth2me.essentials.user.UserData.class);
- ext.mark("reload file");
- final ByteArrayInputStream bais4 = new ByteArrayInputStream(written);
- final Reader reader4 = new InputStreamReader(bais4);
- final com.earth2me.essentials.user.UserData userdata4 = new YamlStorageReader(reader4, null).load(com.earth2me.essentials.user.UserData.class);
- ext.mark("reload file (cached)");
- System.out.println(userdata.toString());
- System.out.println(userdata2.toString());
- System.out.println(ext.end());
- }
- catch (ObjectLoadException ex)
- {
- fail(ex.getMessage());
- }
-
- }
-
- @Test
public void testOldUserdata()
{
ExecuteTimer ext = new ExecuteTimer();