More work on 3.0 branch

This commit is contained in:
snowleo 2012-01-24 00:01:31 +01:00
parent 01a37df700
commit 6af054631f
38 changed files with 1674 additions and 3524 deletions

3
.gitignore vendored
View File

@ -38,4 +38,5 @@
/WebPush/nbproject/private
/.idea
*.iml
/EssentialsSigns/nbproject/private/
/EssentialsSigns/nbproject/private/
/Essentials2Compat/nbproject/private/

View File

@ -16,9 +16,6 @@ import java.util.*;
*/
public final class DescParseTickFormat
{
// ============================================
// First some information vars. TODO: Should this be in a config file?
// --------------------------------------------
public static final Map<String, Integer> nameToTicks = new LinkedHashMap<String, Integer>();
public static final Set<String> resetAliases = new HashSet<String>();
public static final int ticksAtMidnight = 18000;

View File

@ -24,6 +24,7 @@ import com.earth2me.essentials.craftbukkit.ItemDupeFix;
import com.earth2me.essentials.listener.*;
import com.earth2me.essentials.perm.PermissionsHandler;
import com.earth2me.essentials.register.payment.Methods;
import com.earth2me.essentials.settings.GroupsHolder;
import com.earth2me.essentials.settings.SettingsHolder;
import com.earth2me.essentials.user.UserMap;
import java.io.File;
@ -65,6 +66,7 @@ public class Essentials extends JavaPlugin implements IEssentials
private transient List<IReload> reloadList;
private transient IBackup backup;
private transient IItemDb itemDb;
private transient IGroups groups;
private transient final Methods paymentMethod = new Methods();
private transient PermissionsHandler permissionsHandler;
private transient IUserMap userMap;
@ -141,23 +143,25 @@ public class Essentials extends JavaPlugin implements IEssentials
execTimer.mark("BukkitCheck");
try
{
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
upgrade.beforeSettings();
execTimer.mark("Upgrade");
//final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
//upgrade.beforeSettings();
//execTimer.mark("Upgrade");
reloadList = new ArrayList<IReload>();
settings = new SettingsHolder(this);
reloadList.add(settings);
execTimer.mark("Settings");
upgrade.afterSettings();
execTimer.mark("Upgrade2");
//upgrade.afterSettings();
//execTimer.mark("Upgrade2");
i18n.updateLocale(settings.getLocale());
userMap = new UserMap(this);
reloadList.add(userMap);
execTimer.mark("Init(Usermap)");
groups = new GroupsHolder(this);
reloadList.add(groups);
warps = new Warps(this);
reloadList.add(warps);
execTimer.mark("Init(Spawn/Warp)");
worth = new Worth(this.getDataFolder());
worth = new Worth(this);
reloadList.add(worth);
itemDb = new ItemDb(this);
reloadList.add(itemDb);
@ -429,13 +433,7 @@ public class Essentials extends JavaPlugin implements IEssentials
@Override
public IGroups getGroups()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IEssentialsEconomy getEconomy()
{
throw new UnsupportedOperationException("Not supported yet.");
return groups;
}
@Override

View File

@ -1,156 +0,0 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
/*@Deprecated
public interface ISettings extends com.earth2me.essentials.api.ISettings
{
boolean areSignsDisabled();
String format(String format, IUser user);
String getAnnounceNewPlayerFormat(IUser user);
boolean getAnnounceNewPlayers();
String getBackupCommand();
long getBackupInterval();
String getChatFormat(String group);
int getChatRadius();
double getCommandCost(IEssentialsCommand cmd);
double getCommandCost(String label);
String getCurrencySymbol();
int getOversizedStackSize();
int getDefaultStackSize();
double getHealCooldown();
Object getKit(String name);
Map<String, Object> getKits();
String getLocale();
String getNewbieSpawn();
String getNicknamePrefix();
ChatColor getOperatorColor() throws Exception;
boolean getPerWarpPermission();
boolean getProtectBoolean(final String configName, boolean def);
int getProtectCreeperMaxHeight();
List<Integer> getProtectList(final String configName);
boolean getProtectPreventSpawn(final String creatureName);
String getProtectString(final String configName);
boolean getRespawnAtHome();
List getMultipleHomes();
int getHomeLimit(String set);
int getHomeLimit(User user);
boolean getSortListByGroups();
int getSpawnMobLimit();
int getStartingBalance();
double getTeleportCooldown();
double getTeleportDelay();
boolean hidePermissionlessHelp();
boolean isCommandDisabled(final IEssentialsCommand cmd);
boolean isCommandDisabled(String label);
boolean isCommandOverridden(String name);
boolean isCommandRestricted(IEssentialsCommand cmd);
boolean isCommandRestricted(String label);
boolean isDebug();
boolean isEcoDisabled();
boolean isTradeInStacks(int id);
List<Integer> itemSpawnBlacklist();
boolean permissionBasedItemSpawn();
boolean showNonEssCommandsInHelp();
boolean spawnIfNoHome();
boolean warnOnBuildDisallow();
boolean warnOnSmite();
double getMaxMoney();
boolean isEcoLogEnabled();
boolean removeGodOnDisconnect();
boolean changeDisplayName();
boolean isPlayerCommand(String string);
boolean useBukkitPermissions();
boolean addPrefixSuffix();
boolean disablePrefix();
boolean disableSuffix();
long getAutoAfk();
long getAutoAfkKick();
boolean getFreezeAfkPlayers();
boolean areDeathMessagesEnabled();
public void setDebug(boolean debug);
Set<String> getNoGodWorlds();
boolean getUpdateBedAtDaytime();
boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
boolean registerBackInListener();
public boolean getDisableItemPickupWhileAfk();
public Priority getRespawnPriority();
long getTpaAcceptCancellation();
}*/

View File

@ -1,49 +0,0 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.net.InetSocketAddress;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.PlayerInventory;
/**
* @deprecated This will be moved to the api package soon
*/
/*@Deprecated
public interface IUser extends Player, com.earth2me.essentials.api.IUser
{
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();
Teleport getTeleport();
void setJail(String jail);
}*/

View File

@ -16,8 +16,6 @@ import org.bukkit.inventory.ItemStack;
public class Kits extends AsyncStorageObjectHolder<com.earth2me.essentials.settings.Kits> implements IKits
{
private static final transient Logger LOGGER = Bukkit.getLogger();
public Kits(final IEssentials ess)
{
super(ess, com.earth2me.essentials.settings.Kits.class);

View File

@ -1,833 +0,0 @@
package com.earth2me.essentials;
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
import static com.earth2me.essentials.I18n._;
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import lombok.Delegate;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.map.MapView;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
/*public class OfflinePlayer implements Player
{
private final transient IEssentials ess;
private transient Location location = new Location(null, 0, 0, 0, 0, 0);
private transient World world;
private final transient UUID uniqueId = UUID.randomUUID();
@Delegate(types = org.bukkit.OfflinePlayer.class)
private transient org.bukkit.OfflinePlayer base;
public OfflinePlayer(final String name, final IEssentials ess)
{
this.ess = ess;
this.world = ess.getServer().getWorlds().get(0);
this.base = ess.getServer().getOfflinePlayer(name);
}
@Override
public void sendMessage(final String string)
{
}
@Override
public String getDisplayName()
{
return base.getName();
}
@Override
public void setDisplayName(String string)
{
}
@Override
public void setCompassTarget(Location lctn)
{
}
@Override
public InetSocketAddress getAddress()
{
return null;
}
@Override
public void kickPlayer(String string)
{
}
@Override
public PlayerInventory getInventory()
{
return null;
}
@Override
public ItemStack getItemInHand()
{
return null;
}
@Override
public void setItemInHand(ItemStack is)
{
}
@Override
public int getHealth()
{
return 0;
}
@Override
public void setHealth(int i)
{
}
@Override
public Egg throwEgg()
{
return null;
}
@Override
public Snowball throwSnowball()
{
return null;
}
@Override
public Arrow shootArrow()
{
return null;
}
@Override
public boolean isInsideVehicle()
{
return false;
}
@Override
public boolean leaveVehicle()
{
return false;
}
@Override
public Vehicle getVehicle()
{
return null;
}
@Override
public Location getLocation()
{
return location;
}
@Override
public World getWorld()
{
return world;
}
public void setLocation(Location loc)
{
location = loc;
world = loc.getWorld();
}
public void teleportTo(Location lctn)
{
}
public void teleportTo(Entity entity)
{
}
@Override
public int getEntityId()
{
return -1;
}
@Override
public boolean performCommand(String string)
{
return false;
}
public boolean isPlayer()
{
return false;
}
@Override
public int getRemainingAir()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setRemainingAir(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getMaximumAir()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setMaximumAir(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isSneaking()
{
return false;
}
@Override
public void setSneaking(boolean bln)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void updateInventory()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void chat(String string)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public double getEyeHeight()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public double getEyeHeight(boolean bln)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Block getTargetBlock(HashSet<Byte> hs, int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getFireTicks()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getMaxFireTicks()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setFireTicks(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void remove()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Server getServer()
{
return ess == null ? null : ess.getServer();
}
public Vector getMomentum()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
public void setMomentum(Vector vector)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setVelocity(Vector vector)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Vector getVelocity()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void damage(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void damage(int i, Entity entity)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Location getEyeLocation()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void sendRawMessage(String string)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Location getCompassTarget()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getMaximumNoDamageTicks()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setMaximumNoDamageTicks(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getLastDamage()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setLastDamage(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getNoDamageTicks()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setNoDamageTicks(int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean teleport(Location lctn)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean teleport(Entity entity)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public Entity getPassenger()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean setPassenger(Entity entity)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isEmpty()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean eject()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void saveData()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void loadData()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isSleeping()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public int getSleepTicks()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public List<Entity> getNearbyEntities(double d, double d1, double d2)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isDead()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public float getFallDistance()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setFallDistance(float f)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setSleepingIgnored(boolean bln)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean isSleepingIgnored()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void awardAchievement(Achievement a)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc, int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc, Material mtrl)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void playNote(Location lctn, byte b, byte b1)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void sendBlockChange(Location lctn, Material mtrl, byte b)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void sendBlockChange(Location lctn, int i, byte b)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void setLastDamageCause(EntityDamageEvent ede)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public EntityDamageEvent getLastDamageCause()
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public void playEffect(Location lctn, Effect effect, int i)
{
throw new UnsupportedOperationException(_("notSupportedYet"));
}
@Override
public boolean sendChunkChange(Location lctn, int i, int i1, int i2, byte[] bytes)
{
return true;
}
@Override
public UUID getUniqueId()
{
return uniqueId;
}
@Override
public void playNote(Location lctn, Instrument i, Note note)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setPlayerTime(long l, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getPlayerTime()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public long getPlayerTimeOffset()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isPlayerTimeRelative()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void resetPlayerTime()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean isPermissionSet(String string)
{
return false;
}
@Override
public boolean isPermissionSet(Permission prmsn)
{
return false;
}
@Override
public boolean hasPermission(String string)
{
return false;
}
@Override
public boolean hasPermission(Permission prmsn)
{
return false;
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PermissionAttachment addAttachment(Plugin plugin)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, String string, boolean bln, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public PermissionAttachment addAttachment(Plugin plugin, int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeAttachment(PermissionAttachment pa)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void recalculatePermissions()
{
}
@Override
public Set<PermissionAttachmentInfo> getEffectivePermissions()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void sendMap(MapView mv)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public GameMode getGameMode()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setGameMode(GameMode gm)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getExperience()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setExperience(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getLevel()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setLevel(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getTotalExperience()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTotalExperience(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public float getExhaustion()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setExhaustion(float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public float getSaturation()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setSaturation(float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getFoodLevel()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setFoodLevel(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Location getBedSpawnLocation()
{
return OfflineBedLocation.getBedLocation(base.getName(), ess);
}
@Override
public boolean isSprinting()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setSprinting(boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setPlayerListName(String name)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String getPlayerListName()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getTicksLived()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setTicksLived(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getMaxHealth()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void giveExp(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public float getExp()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setExp(float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean teleport(Location lctn, TeleportCause tc)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean teleport(Entity entity, TeleportCause tc)
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Player getKiller()
{
throw new UnsupportedOperationException("Not supported yet.");
}
void setName(final String name)
{
if (!this.base.getName().equalsIgnoreCase(name)) {
this.base = ess.getServer().getOfflinePlayer(name);
}
}
}
*/

View File

@ -1,38 +0,0 @@
package com.earth2me.essentials;
import lombok.Delegate;
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;
/*public class PlayerExtension implements Player
{
@Delegate(types =
{
Player.class, Entity.class, CommandSender.class, ServerOperator.class,
HumanEntity.class, ConfigurationSerializable.class, LivingEntity.class,
Permissible.class
})
protected Player base;
public PlayerExtension(final Player base)
{
this.base = base;
}
public final Player getBase()
{
return base;
}
public final Player setBase(final Player base)
{
return this.base = base;
}
}*/

View File

@ -1,646 +0,0 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import java.io.File;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.event.Event.Priority;
import org.bukkit.inventory.ItemStack;
/*public class Settings implements ISettings
{
private final transient EssentialsConf config;
private final static Logger logger = Logger.getLogger("Minecraft");
private final transient IEssentials ess;
public Settings(IEssentials ess)
{
this.ess = ess;
config = new EssentialsConf(new File(ess.getDataFolder(), "config.yml"));
config.setTemplateName("/config.yml");
reloadConfig();
}
@Override
public boolean getRespawnAtHome()
{
return config.getBoolean("respawn-at-home", false);
}
@Override
public boolean getUpdateBedAtDaytime()
{
return config.getBoolean("update-bed-at-daytime", true);
}
@Override
public List<String> getMultipleHomes()
{
return config.getKeys("sethome-multiple");
}
@Override
public int getHomeLimit(final User user)
{
final List<String> homeList = getMultipleHomes();
if (homeList == null)
{
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
// return getHomeLimit("default");
return config.getInt("multiple-homes", 5);
}
int limit = getHomeLimit("default");
for (String set : homeList)
{
if (user.isAuthorized("essentials.sethome.multiple." + set) && (limit < getHomeLimit(set)))
{
limit = getHomeLimit(set);
}
}
return limit;
}
@Override
public int getHomeLimit(final String set)
{
return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3));
}
@Override
public int getChatRadius()
{
return config.getInt("chat.radius", config.getInt("chat-radius", 0));
}
@Override
public double getTeleportDelay()
{
return config.getDouble("teleport-delay", 0);
}
@Override
public int getOversizedStackSize()
{
return config.getInt("oversized-stacksize", 64);
}
@Override
public int getDefaultStackSize()
{
return config.getInt("default-stack-size", -1);
}
@Override
public int getStartingBalance()
{
return config.getInt("starting-balance", 0);
}
@Override
public boolean isCommandDisabled(final IEssentialsCommand cmd)
{
return isCommandDisabled(cmd.getName());
}
@Override
public boolean isCommandDisabled(String label)
{
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
{
if (!c.equalsIgnoreCase(label))
{
continue;
}
return true;
}
return config.getBoolean("disable-" + label.toLowerCase(Locale.ENGLISH), false);
}
@Override
public boolean isCommandRestricted(IEssentialsCommand cmd)
{
return isCommandRestricted(cmd.getName());
}
@Override
public boolean isCommandRestricted(String label)
{
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
{
if (!c.equalsIgnoreCase(label))
{
continue;
}
return true;
}
return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
}
@Override
public boolean isPlayerCommand(String label)
{
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
{
if (!c.equalsIgnoreCase(label))
{
continue;
}
return true;
}
return false;
}
@Override
public boolean isCommandOverridden(String name)
{
List<String> defaultList = new ArrayList<String>(1);
defaultList.add("god");
for (String c : config.getStringList("overridden-commands", defaultList))
{
if (!c.equalsIgnoreCase(name))
{
continue;
}
return true;
}
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
}
@Override
public double getCommandCost(IEssentialsCommand cmd)
{
return getCommandCost(cmd.getName());
}
@Override
public double getCommandCost(String label)
{
double cost = config.getDouble("command-costs." + label, 0.0);
if (cost == 0.0)
{
cost = config.getDouble("cost-" + label, 0.0);
}
return cost;
}
@Override
public String getNicknamePrefix()
{
return config.getString("nickname-prefix", "~");
}
@Override
public double getTeleportCooldown()
{
return config.getDouble("teleport-cooldown", 0);
}
@Override
public double getHealCooldown()
{
return config.getDouble("heal-cooldown", 0);
}
@Override
public Object getKit(String name)
{
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
for (Map.Entry<String, Object> entry : kits.entrySet())
{
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
{
return entry.getValue();
}
}
return null;
}
@Override
public Map<String, Object> getKits()
{
return (Map<String, Object>)config.getProperty("kits");
}
@Override
public ChatColor getOperatorColor() throws Exception
{
String colorName = config.getString("ops-name-color", null);
if (colorName == null)
{
return ChatColor.RED;
}
if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty())
{
throw new Exception();
}
try
{
return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH));
}
catch (IllegalArgumentException ex)
{
}
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
}
@Override
public int getSpawnMobLimit()
{
return config.getInt("spawnmob-limit", 10);
}
@Override
public boolean showNonEssCommandsInHelp()
{
return config.getBoolean("non-ess-in-help", true);
}
@Override
public boolean hidePermissionlessHelp()
{
return config.getBoolean("hide-permissionless-help", true);
}
@Override
public int getProtectCreeperMaxHeight()
{
return config.getInt("protect.creeper.max-height", -1);
}
@Override
public boolean areSignsDisabled()
{
return config.getBoolean("signs-disabled", false);
}
@Override
public long getBackupInterval()
{
return config.getInt("backup.interval", 1440); // 1440 = 24 * 60
}
@Override
public String getBackupCommand()
{
return config.getString("backup.command", null);
}
@Override
public String getChatFormat(String group)
{
return config.getString("chat.group-formats." + (group == null ? "Default" : group),
config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"));
}
@Override
public boolean getAnnounceNewPlayers()
{
return !config.getString("newbies.announce-format", "-").isEmpty();
}
@Override
public String getAnnounceNewPlayerFormat(IUser user)
{
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
}
@Override
public String format(String format, IUser user)
{
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
}
@Override
public String getNewbieSpawn()
{
return config.getString("newbies.spawnpoint", "default");
}
@Override
public boolean getPerWarpPermission()
{
return config.getBoolean("per-warp-permission", false);
}
@Override
public boolean getSortListByGroups()
{
return config.getBoolean("sort-list-by-groups", true);
}
@Override
public void reloadConfig()
{
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
}
@Override
public List<Integer> itemSpawnBlacklist()
{
final List<Integer> epItemSpwn = new ArrayList<Integer>();
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
{
itemName = itemName.trim();
if (itemName.isEmpty())
{
continue;
}
ItemStack is;
try
{
is = ess.getItemDb().get(itemName);
epItemSpwn.add(is.getTypeId());
}
catch (Exception ex)
{
logger.log(Level.SEVERE, _("unknownItemInList", itemName, "item-spawn-blacklist"));
}
}
return epItemSpwn;
}
@Override
public boolean spawnIfNoHome()
{
return config.getBoolean("spawn-if-no-home", false);
}
@Override
public boolean warnOnBuildDisallow()
{
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
}
private boolean debug = false;
@Override
public boolean isDebug()
{
return debug || config.getBoolean("debug", false);
}
@Override
public boolean warnOnSmite()
{
return config.getBoolean("warn-on-smite", true);
}
@Override
public boolean permissionBasedItemSpawn()
{
return config.getBoolean("permission-based-item-spawn", false);
}
@Override
public String getLocale()
{
return config.getString("locale", "");
}
@Override
public String getCurrencySymbol()
{
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
}
@Override
public boolean isTradeInStacks(int id)
{
return config.getBoolean("trade-in-stacks-" + id, false);
}
@Override
public boolean isEcoDisabled()
{
return config.getBoolean("disable-eco", false);
}
@Override
public boolean getProtectPreventSpawn(final String creatureName)
{
return config.getBoolean("protect.prevent.spawn." + creatureName, false);
}
@Override
public List<Integer> getProtectList(final String configName)
{
final List<Integer> list = new ArrayList<Integer>();
for (String itemName : config.getString(configName, "").split(","))
{
itemName = itemName.trim();
if (itemName.isEmpty())
{
continue;
}
ItemStack itemStack;
try
{
itemStack = ess.getItemDb().get(itemName);
list.add(itemStack.getTypeId());
}
catch (Exception ex)
{
logger.log(Level.SEVERE, _("unknownItemInList", itemName, configName));
}
}
return list;
}
@Override
public String getProtectString(final String configName)
{
return config.getString(configName, null);
}
@Override
public boolean getProtectBoolean(final String configName, boolean def)
{
return config.getBoolean(configName, def);
}
private final static double MAXMONEY = 10000000000000.0;
@Override
public double getMaxMoney()
{
double max = config.getDouble("max-money", MAXMONEY);
if (Math.abs(max) > MAXMONEY)
{
max = max < 0 ? -MAXMONEY : MAXMONEY;
}
return max;
}
@Override
public boolean isEcoLogEnabled()
{
return config.getBoolean("economy-log-enabled", false);
}
@Override
public boolean removeGodOnDisconnect()
{
return config.getBoolean("remove-god-on-disconnect", false);
}
@Override
public boolean changeDisplayName()
{
return config.getBoolean("change-displayname", true);
}
@Override
public boolean useBukkitPermissions()
{
return config.getBoolean("use-bukkit-permissions", false);
}
@Override
public boolean addPrefixSuffix()
{
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
}
@Override
public boolean disablePrefix()
{
return config.getBoolean("disablePrefix", false);
}
@Override
public boolean disableSuffix()
{
return config.getBoolean("disableSuffix", false);
}
@Override
public long getAutoAfk()
{
return config.getLong("auto-afk", 300);
}
@Override
public long getAutoAfkKick()
{
return config.getLong("auto-afk-kick", -1);
}
@Override
public boolean getFreezeAfkPlayers()
{
return config.getBoolean("freeze-afk-players", false);
}
@Override
public boolean areDeathMessagesEnabled()
{
return config.getBoolean("death-messages", true);
}
Set<String> noGodWorlds = new HashSet<String>();
@Override
public Set<String> getNoGodWorlds()
{
return noGodWorlds;
}
@Override
public void setDebug(final boolean debug)
{
this.debug = debug;
}
@Override
public boolean getRepairEnchanted()
{
return config.getBoolean("repair-enchanted", true);
}
@Override
public boolean getIsWorldTeleportPermissions()
{
return config.getBoolean("world-teleport-permissions", false);
}
@Override
public boolean registerBackInListener()
{
return config.getBoolean("register-back-in-listener", false);
}
@Override
public boolean getDisableItemPickupWhileAfk()
{
return config.getBoolean("disable-item-pickup-while-afk", true);
}
@Override
public Priority getRespawnPriority()
{
String priority = config.getString("respawn-listener-priority", "normal").toLowerCase(Locale.ENGLISH);
if ("lowest".equals(priority))
{
return Priority.Lowest;
}
if ("low".equals(priority))
{
return Priority.Low;
}
if ("normal".equals(priority))
{
return Priority.Normal;
}
if ("high".equals(priority))
{
return Priority.High;
}
if ("highest".equals(priority))
{
return Priority.Highest;
}
return Priority.Normal;
}
@Override
public long getTpaAcceptCancellation()
{
return config.getLong("tpa-accept-cancellation", 0);
}
@Override
public com.earth2me.essentials.settings.Settings getData()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void acquireReadLock()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void acquireWriteLock()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void close()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void unlock()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
*/

View File

@ -1,597 +0,0 @@
package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.register.payment.Method;
import com.earth2me.essentials.user.CooldownException;
import com.earth2me.essentials.user.UserData.TimestampType;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/*@Deprecated
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
{
private CommandSender replyTo = null;
private transient User teleportRequester;
private transient boolean teleportRequestHere;
private transient final Teleport teleport;
private transient long teleportRequestTime;
private transient long lastOnlineActivity;
private transient long lastActivity = System.currentTimeMillis();
private boolean hidden = false;
private transient Location afkPosition;
private static final Logger logger = Logger.getLogger("Minecraft");
User(final Player base, final IEssentials ess)
{
super(base, ess);
teleport = new Teleport(this, ess);
afkPosition = getLocation();
}
User update(final Player base)
{
setBase(base);
return this;
}
@Override
public boolean isAuthorized(final IEssentialsCommand cmd)
{
return isAuthorized(cmd, "essentials.");
}
@Override
public boolean isAuthorized(final IEssentialsCommand cmd, final String permissionPrefix)
{
return isAuthorized(permissionPrefix + (cmd.getName().equals("r") ? "msg" : cmd.getName()));
}
@Override
public boolean isAuthorized(final String node)
{
if (base instanceof OfflinePlayer)
{
return false;
}
if (isOp())
{
return true;
}
if (isJailed())
{
return false;
}
return ess.getPermissionsHandler().hasPermission(base, node);
}
public void healCooldown() throws Exception
{
final Calendar now = new GregorianCalendar();
if (getLastHealTimestamp() > 0)
{
final double cooldown = ess.getSettings().getHealCooldown();
final Calendar cooldownTime = new GregorianCalendar();
cooldownTime.setTimeInMillis(getLastHealTimestamp());
cooldownTime.add(Calendar.SECOND, (int)cooldown);
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
{
throw new Exception(_("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
}
}
setLastHealTimestamp(now.getTimeInMillis());
}
@Override
public void giveMoney(final double value)
{
giveMoney(value, null);
}
public void giveMoney(final double value, final CommandSender initiator)
{
if (value == 0)
{
return;
}
setMoney(getMoney() + value);
sendMessage(_("addedToAccount", Util.formatCurrency(value, ess)));
if (initiator != null)
{
initiator.sendMessage(_("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
}
}
public void payUser(final User reciever, final double value) throws Exception
{
if (value == 0)
{
return;
}
if (canAfford(value))
{
setMoney(getMoney() - value);
reciever.setMoney(reciever.getMoney() + value);
sendMessage(_("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
reciever.sendMessage(_("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
}
else
{
throw new Exception(_("notEnoughMoney"));
}
}
@Override
public void takeMoney(final double value)
{
takeMoney(value, null);
}
public void takeMoney(final double value, final CommandSender initiator)
{
if (value == 0)
{
return;
}
setMoney(getMoney() - value);
sendMessage(_("takenFromAccount", Util.formatCurrency(value, ess)));
if (initiator != null)
{
initiator.sendMessage(_("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
}
}
public boolean canAfford(final double cost)
{
final double mon = getMoney();
return mon >= cost || isAuthorized("essentials.eco.loan");
}
public void dispose()
{
this.base = new OfflinePlayer(getName(), ess);
}
@Override
public void setReplyTo(final CommandSender user)
{
replyTo = user;
}
@Override
public CommandSender getReplyTo()
{
return replyTo;
}
@Override
public int compareTo(final User other)
{
return Util.stripColor(this.getDisplayName()).compareToIgnoreCase(Util.stripColor(other.getDisplayName()));
}
@Override
public boolean equals(final Object object)
{
if (!(object instanceof User))
{
return false;
}
return this.getName().equalsIgnoreCase(((User)object).getName());
}
@Override
public int hashCode()
{
return this.getName().hashCode();
}
public Boolean canSpawnItem(final int itemId)
{
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
}
public Location getHome() throws Exception
{
return getHome(getHomes().get(0));
}
public void setHome()
{
setHome("home", getLocation());
}
public void setHome(final String name)
{
setHome(name, getLocation());
}
@Override
public void setLastLocation()
{
setLastLocation(getLocation());
}
public void requestTeleport(final User player, final boolean here)
{
teleportRequestTime = System.currentTimeMillis();
teleportRequester = player;
teleportRequestHere = here;
}
public User getTeleportRequest()
{
return teleportRequester;
}
public boolean isTeleportRequestHere()
{
return teleportRequestHere;
}
public String getNick(boolean addprefixsuffix)
{
final StringBuilder nickname = new StringBuilder();
final String nick = getNickname();
if (ess.getSettings().isCommandDisabled("nick") || nick == null || nick.isEmpty() || nick.equals(getName()))
{
nickname.append(getName());
}
else
{
nickname.append(ess.getSettings().getNicknamePrefix()).append(nick);
}
if (isOp())
{
try
{
nickname.insert(0, ess.getSettings().getOperatorColor().toString());
nickname.append("§f");
}
catch (Exception e)
{
}
}
if (addprefixsuffix && ess.getSettings().addPrefixSuffix())
{
if (!ess.getSettings().disablePrefix())
{
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
nickname.insert(0, prefix);
}
if (!ess.getSettings().disableSuffix())
{
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
nickname.append(suffix);
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
{
nickname.append("§f");
}
}
else
{
nickname.append("§f");
}
}
return nickname.toString();
}
public void setDisplayNick()
{
String name = getNick(true);
setDisplayName(name);
if (name.length() > 16)
{
name = getNick(false);
}
if (name.length() > 16)
{
name = name.substring(0, name.charAt(15) == '§' ? 15 : 16);
}
try
{
setPlayerListName(name);
}
catch (IllegalArgumentException e)
{
logger.log(Level.INFO, "Playerlist for " + name + " was not updated. Use a shorter displayname prefix.");
}
}
@Override
public String getDisplayName()
{
if (!(base instanceof OfflinePlayer) && ess.getSettings().changeDisplayName())
{
setDisplayNick();
}
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
}
public Teleport getTeleport()
{
return teleport;
}
public long getLastOnlineActivity()
{
return lastOnlineActivity;
}
public void setLastOnlineActivity(final long timestamp)
{
lastOnlineActivity = timestamp;
}
@Override
public double getMoney()
{
if (ess.getPaymentMethod().hasMethod())
{
try
{
final Method method = ess.getPaymentMethod().getMethod();
if (!method.hasAccount(this.getName()))
{
throw new Exception();
}
final Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
return account.balance();
}
catch (Throwable ex)
{
}
}
return super.getMoney();
}
@Override
public void setMoney(final double value)
{
if (ess.getPaymentMethod().hasMethod())
{
try
{
final Method method = ess.getPaymentMethod().getMethod();
if (!method.hasAccount(this.getName()))
{
throw new Exception();
}
final Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName());
account.set(value);
}
catch (Throwable ex)
{
}
}
super.setMoney(value);
}
@Override
public void setAfk(final boolean set)
{
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set);
if (set && !isAfk())
{
afkPosition = getLocation();
}
super.setAfk(set);
}
@Override
public boolean toggleAfk()
{
final boolean now = super.toggleAfk();
this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : now);
return now;
}
@Override
public boolean isHidden()
{
return hidden;
}
public void setHidden(final boolean hidden)
{
this.hidden = hidden;
}
//Returns true if status expired during this check
public boolean checkJailTimeout(final long currentTime)
{
if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed())
{
setJailTimeout(0);
setJailed(false);
sendMessage(_("haveBeenReleased"));
setJail(null);
try
{
getTeleport().back();
}
catch (Exception ex)
{
}
return true;
}
return false;
}
//Returns true if status expired during this check
public boolean checkMuteTimeout(final long currentTime)
{
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
{
setMuteTimeout(0);
sendMessage(_("canTalkAgain"));
setMuted(false);
return true;
}
return false;
}
//Returns true if status expired during this check
public boolean checkBanTimeout(final long currentTime)
{
if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned())
{
setBanTimeout(0);
setBanned(false);
return true;
}
return false;
}
public void updateActivity(final boolean broadcast)
{
if (isAfk())
{
setAfk(false);
if (broadcast && !isHidden())
{
ess.broadcastMessage(this, _("userIsNotAway", getDisplayName()));
}
}
lastActivity = System.currentTimeMillis();
}
public void checkActivity()
{
final long autoafkkick = ess.getSettings().getAutoAfkKick();
if (autoafkkick > 0 && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis()
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
{
final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0);
lastActivity = 0;
kickPlayer(kickReason);
for (Player player : ess.getServer().getOnlinePlayers())
{
final User user = ess.getUser(player);
if (user.isAuthorized("essentials.kick.notify"))
{
player.sendMessage(_("playerKicked", Console.NAME, getName(), kickReason));
}
}
}
final long autoafk = ess.getSettings().getAutoAfk();
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk"))
{
setAfk(true);
if (!isHidden())
{
ess.broadcastMessage(this, _("userIsAway", getDisplayName()));
}
}
}
public Location getAfkPosition()
{
return afkPosition;
}
@Override
public boolean toggleGodModeEnabled()
{
if (!isGodModeEnabled())
{
setFoodLevel(20);
}
return super.toggleGodModeEnabled();
}
@Override
public boolean isGodModeEnabled()
{
return (super.isGodModeEnabled() && !ess.getSettings().getNoGodWorlds().contains(getLocation().getWorld().getName()))
|| (isAfk() && ess.getSettings().getFreezeAfkPlayers());
}
public boolean isGodModeEnabledRaw()
{
return super.isGodModeEnabled();
}
public String getGroup()
{
return ess.getPermissionsHandler().getGroup(base);
}
public boolean inGroup(final String group)
{
return ess.getPermissionsHandler().inGroup(base, group);
}
public boolean canBuild()
{
return ess.getPermissionsHandler().canBuild(base, getGroup());
}
public long getTeleportRequestTime()
{
return teleportRequestTime;
}
@Override
public void onReload()
{
reloadConfig();
}
@Override
public void checkCooldown(TimestampType cooldownType, double cooldown, boolean set, String bypassPermission) throws CooldownException
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public com.earth2me.essentials.user.UserData getData()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void acquireReadLock()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void acquireWriteLock()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void close()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void unlock()
{
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void updateDisplayName()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}*/

View File

@ -1,863 +0,0 @@
package com.earth2me.essentials;
import java.io.File;
import java.util.*;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
/*@Deprecated
public abstract class UserData extends PlayerExtension implements IConf
{
protected final transient IEssentials ess;
private final EssentialsConf config;
private static final Logger logger = Logger.getLogger("Minecraft");
protected UserData(Player base, IEssentials ess)
{
super(base);
this.ess = ess;
File folder = new File(ess.getDataFolder(), "userdata");
if (!folder.exists())
{
folder.mkdirs();
}
config = new EssentialsConf(new File(folder, Util.sanitizeFileName(base.getName()) + ".yml"));
reloadConfig();
}
@Override
public final void reloadConfig()
{
config.load();
money = _getMoney();
unlimited = _getUnlimited();
powertools = _getPowertools();
homes = _getHomes();
lastLocation = _getLastLocation();
lastTeleportTimestamp = _getLastTeleportTimestamp();
lastHealTimestamp = _getLastHealTimestamp();
jail = _getJail();
mails = _getMails();
savedInventory = _getSavedInventory();
teleportEnabled = getTeleportEnabled();
ignoredPlayers = getIgnoredPlayers();
godmode = getGodModeEnabled();
muted = getMuted();
muteTimeout = _getMuteTimeout();
jailed = getJailed();
jailTimeout = _getJailTimeout();
lastLogin = _getLastLogin();
lastLogout = _getLastLogout();
lastLoginAddress = _getLastLoginAddress();
afk = getAfk();
geolocation = _getGeoLocation();
isSocialSpyEnabled = _isSocialSpyEnabled();
isNPC = _isNPC();
arePowerToolsEnabled = _arePowerToolsEnabled();
kitTimestamps = _getKitTimestamps();
}
private double money;
private double _getMoney()
{
double money = ess.getSettings().getStartingBalance();
if (config.hasProperty("money"))
{
money = config.getDouble("money", money);
}
if (Math.abs(money) > ess.getSettings().getMaxMoney())
{
money = money < 0 ? -ess.getSettings().getMaxMoney() : ess.getSettings().getMaxMoney();
}
return money;
}
public double getMoney()
{
return money;
}
public void setMoney(double value)
{
money = value;
if (Math.abs(money) > ess.getSettings().getMaxMoney())
{
money = money < 0 ? -ess.getSettings().getMaxMoney() : ess.getSettings().getMaxMoney();
}
config.setProperty("money", value);
config.save();
}
private Map<String, Object> homes;
private Map<String, Object> _getHomes()
{
Object o = config.getProperty("homes");
if (o instanceof Map)
{
return (Map<String, Object>)o;
}
else
{
return new HashMap<String, Object>();
}
}
public Location getHome(String name) throws Exception
{
Location loc = config.getLocation("homes." + name, getServer());
if (loc == null)
{
try
{
loc = config.getLocation("homes." + getHomes().get(Integer.parseInt(name) - 1), getServer());
}
catch (IndexOutOfBoundsException e)
{
return null;
}
catch (NumberFormatException e)
{
return null;
}
}
return loc;
}
public Location getHome(final Location world)
{
try
{
Location loc;
for (String home : getHomes())
{
loc = config.getLocation("homes." + home, getServer());
if (world.getWorld() == loc.getWorld())
{
return loc;
}
}
loc = config.getLocation("homes." + getHomes().get(0), getServer());
return loc;
}
catch (Exception ex)
{
return null;
}
}
public List<String> getHomes()
{
return new ArrayList(homes.keySet());
}
public void setHome(String name, Location loc)
{
//Invalid names will corrupt the yaml
name = Util.sanitizeFileName(name);
homes.put(name, loc);
config.setProperty("homes." + name, loc);
config.save();
}
public void delHome(String name) throws Exception
{
String search = name;
if (!homes.containsKey(search))
{
search = Util.sanitizeFileName(name);
}
if (homes.containsKey(search))
{
homes.remove(name);
config.removeProperty("homes." + name);
config.save();
}
else
{
//TODO: move this message to messages file
throw new Exception("Home " + name + " doesn't exist");
}
}
public boolean hasHome()
{
if (config.hasProperty("home"))
{
return true;
}
return false;
}
public String getNickname()
{
return config.getString("nickname");
}
public void setNickname(String nick)
{
config.setProperty("nickname", nick);
config.save();
}
private List<Integer> unlimited;
private List<Integer> _getUnlimited()
{
return config.getIntList("unlimited", new ArrayList<Integer>());
}
public List<Integer> getUnlimited()
{
return unlimited;
}
public boolean hasUnlimited(ItemStack stack)
{
return unlimited.contains(stack.getTypeId());
}
public void setUnlimited(ItemStack stack, boolean state)
{
if (unlimited.contains(stack.getTypeId()))
{
unlimited.remove(Integer.valueOf(stack.getTypeId()));
}
if (state)
{
unlimited.add(stack.getTypeId());
}
config.setProperty("unlimited", unlimited);
config.save();
}
private Map<Integer, Object> powertools;
@SuppressWarnings("unchecked")
private Map<Integer, Object> _getPowertools()
{
Object o = config.getProperty("powertools");
if (o instanceof Map)
{
return (Map<Integer, Object>)o;
}
else
{
return new HashMap<Integer, Object>();
}
}
public void clearAllPowertools()
{
powertools.clear();
config.setProperty("powertools", powertools);
config.save();
}
public List<String> getPowertool(ItemStack stack)
{
return (List<String>)powertools.get(stack.getTypeId());
}
public List<String> getPowertool(int id)
{
return (List<String>)powertools.get(id);
}
public void setPowertool(ItemStack stack, List<String> commandList)
{
if (commandList == null || commandList.isEmpty())
{
powertools.remove(stack.getTypeId());
}
else
{
powertools.put(stack.getTypeId(), commandList);
}
config.setProperty("powertools", powertools);
config.save();
}
public boolean hasPowerTools()
{
return !powertools.isEmpty();
}
private Location lastLocation;
private Location _getLastLocation()
{
try
{
return config.getLocation("lastlocation", getServer());
}
catch (Exception e)
{
return null;
}
}
public Location getLastLocation()
{
return lastLocation;
}
public void setLastLocation(Location loc)
{
if (loc == null || loc.getWorld() == null)
{
return;
}
lastLocation = loc;
config.setProperty("lastlocation", loc);
config.save();
}
private long lastTeleportTimestamp;
private long _getLastTeleportTimestamp()
{
return config.getLong("timestamps.lastteleport", 0);
}
public long getLastTeleportTimestamp()
{
return lastTeleportTimestamp;
}
public void setLastTeleportTimestamp(long time)
{
lastTeleportTimestamp = time;
config.setProperty("timestamps.lastteleport", time);
config.save();
}
private long lastHealTimestamp;
private long _getLastHealTimestamp()
{
return config.getLong("timestamps.lastheal", 0);
}
public long getLastHealTimestamp()
{
return lastHealTimestamp;
}
public void setLastHealTimestamp(long time)
{
lastHealTimestamp = time;
config.setProperty("timestamps.lastheal", time);
config.save();
}
private String jail;
private String _getJail()
{
return config.getString("jail");
}
public String getJail()
{
return jail;
}
public void setJail(String jail)
{
if (jail == null || jail.isEmpty())
{
this.jail = null;
config.removeProperty("jail");
}
else
{
this.jail = jail;
config.setProperty("jail", jail);
}
config.save();
}
private List<String> mails;
private List<String> _getMails()
{
return config.getStringList("mail", new ArrayList<String>());
}
public List<String> getMails()
{
return mails;
}
public void setMails(List<String> mails)
{
if (mails == null)
{
config.removeProperty("mail");
mails = _getMails();
}
else
{
config.setProperty("mail", mails);
}
this.mails = mails;
config.save();
}
public void addMail(String mail)
{
mails.add(mail);
setMails(mails);
}
private ItemStack[] savedInventory;
public ItemStack[] getSavedInventory()
{
return savedInventory;
}
private ItemStack[] _getSavedInventory()
{
int size = config.getInt("inventory.size", 0);
if (size < 1 || (getInventory() != null && size > getInventory().getSize()))
{
return null;
}
ItemStack[] is = new ItemStack[size];
for (int i = 0; i < size; i++)
{
is[i] = config.getItemStack("inventory." + i);
}
return is;
}
public void setSavedInventory(ItemStack[] is)
{
if (is == null || is.length == 0)
{
savedInventory = null;
config.removeProperty("inventory");
}
else
{
savedInventory = is;
config.setProperty("inventory.size", is.length);
for (int i = 0; i < is.length; i++)
{
if (is[i] == null || is[i].getType() == Material.AIR)
{
continue;
}
config.setProperty("inventory." + i, is[i]);
}
}
config.save();
}
private boolean teleportEnabled;
private boolean getTeleportEnabled()
{
return config.getBoolean("teleportenabled", true);
}
public boolean isTeleportEnabled()
{
return teleportEnabled;
}
public void setTeleportEnabled(boolean set)
{
teleportEnabled = set;
config.setProperty("teleportenabled", set);
config.save();
}
public boolean toggleTeleportEnabled()
{
boolean ret = !isTeleportEnabled();
setTeleportEnabled(ret);
return ret;
}
public boolean toggleSocialSpy()
{
boolean ret = !isSocialSpyEnabled();
setSocialSpyEnabled(ret);
return ret;
}
private List<String> ignoredPlayers;
public List<String> getIgnoredPlayers()
{
return config.getStringList("ignore", new ArrayList<String>());
}
public void setIgnoredPlayers(List<String> players)
{
if (players == null || players.isEmpty())
{
ignoredPlayers = new ArrayList<String>();
config.removeProperty("ignore");
}
else
{
ignoredPlayers = players;
config.setProperty("ignore", players);
}
config.save();
}
public boolean isIgnoredPlayer(String name)
{
return ignoredPlayers.contains(name.toLowerCase(Locale.ENGLISH));
}
public void setIgnoredPlayer(String name, boolean set)
{
if (set)
{
ignoredPlayers.add(name.toLowerCase(Locale.ENGLISH));
}
else
{
ignoredPlayers.remove(name.toLowerCase(Locale.ENGLISH));
}
setIgnoredPlayers(ignoredPlayers);
}
private boolean godmode;
private boolean getGodModeEnabled()
{
return config.getBoolean("godmode", false);
}
public boolean isGodModeEnabled()
{
return godmode;
}
public void setGodModeEnabled(boolean set)
{
godmode = set;
config.setProperty("godmode", set);
config.save();
}
public boolean toggleGodModeEnabled()
{
boolean ret = !isGodModeEnabled();
setGodModeEnabled(ret);
return ret;
}
private boolean muted;
private boolean getMuted()
{
return config.getBoolean("muted", false);
}
public boolean isMuted()
{
return muted;
}
public void setMuted(boolean set)
{
muted = set;
config.setProperty("muted", set);
config.save();
}
public boolean toggleMuted()
{
boolean ret = !isMuted();
setMuted(ret);
return ret;
}
private long muteTimeout;
private long _getMuteTimeout()
{
return config.getLong("timestamps.mute", 0);
}
public long getMuteTimeout()
{
return muteTimeout;
}
public void setMuteTimeout(long time)
{
muteTimeout = time;
config.setProperty("timestamps.mute", time);
config.save();
}
private boolean jailed;
private boolean getJailed()
{
return config.getBoolean("jailed", false);
}
public boolean isJailed()
{
return jailed;
}
public void setJailed(boolean set)
{
jailed = set;
config.setProperty("jailed", set);
config.save();
}
public boolean toggleJailed()
{
boolean ret = !isJailed();
setJailed(ret);
return ret;
}
private long jailTimeout;
private long _getJailTimeout()
{
return config.getLong("timestamps.jail", 0);
}
public long getJailTimeout()
{
return jailTimeout;
}
public void setJailTimeout(long time)
{
jailTimeout = time;
config.setProperty("timestamps.jail", time);
config.save();
}
public String getBanReason()
{
return config.getString("ban.reason");
}
public void setBanReason(String reason)
{
config.setProperty("ban.reason", reason);
config.save();
}
public long getBanTimeout()
{
return config.getLong("ban.timeout", 0);
}
public void setBanTimeout(long time)
{
config.setProperty("ban.timeout", time);
config.save();
}
private long lastLogin;
private long _getLastLogin()
{
return config.getLong("timestamps.login", 0);
}
public long getLastLogin()
{
return lastLogin;
}
public void setLastLogin(long time)
{
lastLogin = time;
config.setProperty("timestamps.login", time);
config.save();
}
private long lastLogout;
private long _getLastLogout()
{
return config.getLong("timestamps.logout", 0);
}
public long getLastLogout()
{
return lastLogout;
}
public void setLastLogout(long time)
{
lastLogout = time;
config.setProperty("timestamps.logout", time);
config.save();
}
private String lastLoginAddress;
private String _getLastLoginAddress()
{
return config.getString("ipAddress", "");
}
public String getLastLoginAddress()
{
return lastLoginAddress;
}
public void setLastLoginAddress(String address)
{
lastLoginAddress = address;
config.setProperty("ipAddress", address);
config.save();
}
private boolean afk;
private boolean getAfk()
{
return config.getBoolean("afk", false);
}
public boolean isAfk()
{
return afk;
}
public void setAfk(boolean set)
{
afk = set;
config.setProperty("afk", set);
config.save();
}
public boolean toggleAfk()
{
boolean ret = !isAfk();
setAfk(ret);
return ret;
}
private boolean newplayer;
private String geolocation;
private String _getGeoLocation()
{
return config.getString("geolocation");
}
public String getGeoLocation()
{
return geolocation;
}
public void setGeoLocation(String geolocation)
{
if (geolocation == null || geolocation.isEmpty())
{
this.geolocation = null;
config.removeProperty("geolocation");
}
else
{
this.geolocation = geolocation;
config.setProperty("geolocation", geolocation);
}
config.save();
}
private boolean isSocialSpyEnabled;
private boolean _isSocialSpyEnabled()
{
return config.getBoolean("socialspy", false);
}
public boolean isSocialSpyEnabled()
{
return isSocialSpyEnabled;
}
public void setSocialSpyEnabled(boolean status)
{
isSocialSpyEnabled = status;
config.setProperty("socialspy", status);
config.save();
}
private boolean isNPC;
private boolean _isNPC()
{
return config.getBoolean("npc", false);
}
public boolean isNPC()
{
return isNPC;
}
public void setNPC(boolean set)
{
isNPC = set;
config.setProperty("npc", set);
config.save();
}
private boolean arePowerToolsEnabled;
public boolean arePowerToolsEnabled()
{
return arePowerToolsEnabled;
}
public void setPowerToolsEnabled(boolean set)
{
arePowerToolsEnabled = set;
config.setProperty("powertoolsenabled", set);
config.save();
}
public boolean togglePowerToolsEnabled()
{
boolean ret = !arePowerToolsEnabled();
setPowerToolsEnabled(ret);
return ret;
}
private boolean _arePowerToolsEnabled()
{
return config.getBoolean("powertoolsenabled", true);
}
private Map<String, Object> kitTimestamps;
private Map<String, Object> _getKitTimestamps()
{
final Object map = config.getProperty("timestamps.kits");
if (map instanceof Map)
{
return (Map<String, Object>)map;
}
else
{
return new HashMap<String, Object>();
}
}
public Long getKitTimestamp(final String name)
{
final Number num = (Number)kitTimestamps.get(name.toLowerCase(Locale.ENGLISH));
return num == null ? null : num.longValue();
}
public void setKitTimestamp(final String name, final long time)
{
kitTimestamps.put(name.toLowerCase(Locale.ENGLISH), time);
config.setProperty("timestamps.kits", kitTimestamps);
config.save();
}
public void save()
{
config.save();
}
}*/

View File

@ -1,130 +0,0 @@
package com.earth2me.essentials;
import com.earth2me.essentials.api.IUserMap;
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.Set;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.ExecutionException;
import org.bukkit.entity.Player;
/*@Deprecated
public class UserMap extends CacheLoader<String, User> implements IConf, IUserMap
{
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(Util.sanitizeFileName(name));
}
}
});
}
public boolean userExists(final String name)
{
return keys.contains(Util.sanitizeFileName(name));
}
public User getUser(final String name)
{
try
{
return users.get(Util.sanitizeFileName(name));
}
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(Util.sanitizeFileName(name));
return new User(player, ess);
}
}
final File userFile = getUserFile(name);
if (userFile.exists())
{
keys.add(Util.sanitizeFileName(name));
return new User(new OfflinePlayer(name, ess), ess);
}
throw new Exception("User not found!");
}
@Override
public void reloadConfig()
{
loadAllUsersAsync(ess);
}
public void removeUser(final String name)
{
keys.remove(Util.sanitizeFileName(name));
users.invalidate(Util.sanitizeFileName(name));
}
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");
}
@Override
public void onReload()
{
loadAllUsersAsync(ess);
}
}*/

View File

@ -1,62 +1,86 @@
package com.earth2me.essentials;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IWorth;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import com.earth2me.essentials.storage.EnchantmentLevel;
import java.io.File;
import java.util.Locale;
import java.util.logging.Logger;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
public class Worth implements IWorth
public class Worth extends AsyncStorageObjectHolder<com.earth2me.essentials.settings.Worth> implements IWorth
{
private static final Logger logger = Logger.getLogger("Minecraft");
private final EssentialsConf config;
public Worth(File dataFolder)
public Worth(final IEssentials ess)
{
config = new EssentialsConf(new File(dataFolder, "worth.yml"));
config.setTemplateName("/worth.yml");
config.load();
}
public double getPrice(ItemStack itemStack)
{
String itemname = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
double result;
result = config.getDouble("worth." + itemname + "." + itemStack.getDurability(), Double.NaN);
if (Double.isNaN(result))
{
result = config.getDouble("worth." + itemname + ".0", Double.NaN);
}
if (Double.isNaN(result))
{
result = config.getDouble("worth." + itemname, Double.NaN);
}
if (Double.isNaN(result))
{
result = config.getDouble("worth-" + itemStack.getTypeId(), Double.NaN);
}
return result;
}
public void setPrice(ItemStack itemStack, double price)
{
if (itemStack.getType().getData() == null)
{
config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), price);
}
else
{
// Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0.
config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "") + "." + itemStack.getDurability(), price);
}
config.removeProperty("worth-" + itemStack.getTypeId());
config.save();
super(ess, com.earth2me.essentials.settings.Worth.class);
onReload(false);
}
@Override
public void onReload()
public double getPrice(final ItemStack itemStack)
{
config.load();
this.acquireReadLock();
try
{
final Map<MaterialData, Double> prices = this.getData().getSell();
if (prices == null || itemStack == null)
{
return Double.NaN;
}
final Double basePrice = prices.get(itemStack.getData());
if (basePrice == null || Double.isNaN(basePrice))
{
return Double.NaN;
}
double multiplier = 1.0;
if (itemStack.getType().getMaxDurability() > 0) {
multiplier *= (double)itemStack.getDurability() / (double)itemStack.getType().getMaxDurability();
}
if (itemStack.getEnchantments() != null && !itemStack.getEnchantments().isEmpty())
{
final Map<EnchantmentLevel, Double> enchantmentMultipliers = this.getData().getEnchantmentMultiplier();
if (enchantmentMultipliers != null)
{
for (Map.Entry<Enchantment, Integer> entry : itemStack.getEnchantments().entrySet())
{
final Double enchMult = enchantmentMultipliers.get(new EnchantmentLevel(entry.getKey(), entry.getValue()));
if (enchMult != null)
{
multiplier *= enchMult;
}
}
}
}
return basePrice * multiplier;
}
finally
{
this.unlock();
}
}
@Override
public void setPrice(final ItemStack itemStack, final double price)
{
acquireWriteLock();
try {
if (getData().getSell() == null) {
getData().setSell(new HashMap<MaterialData, Double>());
}
getData().getSell().put(itemStack.getData(), price);
} finally {
unlock();
}
}
@Override
public File getStorageFile() throws IOException
{
return new File(ess.getDataFolder(), "worth.yml");
}
}

View File

@ -37,8 +37,6 @@ public interface IEssentials extends Plugin
IUserMap getUserMap();
IBackup getBackup();
IEssentialsEconomy getEconomy();
ICommandHandler getCommandHandler();

View File

@ -1,37 +0,0 @@
package com.earth2me.essentials.api;
//TODO: Decide on this files fate
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;
}

View File

@ -0,0 +1,16 @@
package com.earth2me.essentials.settings.geoip;
import com.earth2me.essentials.storage.StorageObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class Database implements StorageObject
{
boolean showCities = false;
boolean downloadIfMissing = true;
String downloadUrlCity = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz";
String downloadUrl = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz";
}

View File

@ -0,0 +1,15 @@
package com.earth2me.essentials.settings.geoip;
import com.earth2me.essentials.storage.StorageObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
public class GeoIP implements StorageObject
{
private Database database = new Database();
boolean showOnWhois = true;
boolean showOnLogin = true;
}

View File

@ -1,5 +1,5 @@
# This determines the command prefix when there are conflicts (/name:home, /name:help, etc.)
name: Essentials
name: Essentials3
main: com.earth2me.essentials.Essentials
# Note to developers: This next line cannot change, or the automatic versioning system will break.
version: TeamCity

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Essentials2Compat" default="default" basedir=".">
<description>Builds, tests, and runs the project Essentials2Compat.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Essentials2Compat-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=cfe919e8
build.xml.script.CRC32=ec95d082
build.xml.stylesheet.CRC32=28e38971@1.50.1.46
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=cfe919e8
nbproject/build-impl.xml.script.CRC32=9b7e0383
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46

View File

@ -0,0 +1,126 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Essentials2Compat
application.vendor=
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=2
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=2
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=2
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=120
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAnnotationArgs=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineArrayInit=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineAssignment=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineBinaryOp=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineCallArgs=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineDisjunctiveCatchTypes=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineFor=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineImplements=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineMethodParams=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineParenthesized=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTernaryOp=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineThrows=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.alignMultilineTryResources=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Essentials2Compat.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.bukkit.jar=../lib/bukkit.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.bukkit.jar}:\
${reference.Essentials.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
main.class=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
project.Essentials=../Essentials
reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>Essentials2Compat</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
<definitions>../lib/nblibraries.properties</definitions>
</libraries>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>Essentials</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>

View File

@ -0,0 +1,22 @@
package com.earth2me.essentials;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class Essentials extends JavaPlugin
{
@Override
public void onEnable()
{
Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials 3");
//TODO: Update files to new 3.0 format
//TODO: Move Eco Api here
}
@Override
public void onDisable()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -18,7 +18,7 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.inventory.ItemStack;
@Deprecated
public class EssentialsUpgrade
{
private final static Logger LOGGER = Logger.getLogger("Minecraft");
@ -51,7 +51,7 @@ public class EssentialsUpgrade
}
final EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
final Worth worth = new Worth(ess.getDataFolder());
final Worth worth = new Worth(ess);
boolean found = false;
for (Material mat : Material.values())
{

View File

@ -0,0 +1,6 @@
name: Essentials
main: com.earth2me.essentials.Essentials
version: 2.9
website: http://tiny.cc/EssentialsWiki
description: Compatibility plugin for older plugins
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]

View File

@ -0,0 +1,27 @@
package com.earth2me.essentials.geoip;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.settings.geoip.GeoIP;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
import java.io.File;
import java.io.IOException;
import org.bukkit.plugin.Plugin;
public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
{
private final transient Plugin geoip;
public ConfigHolder(final IEssentials ess, final Plugin geoip)
{
super(ess, GeoIP.class);
this.geoip = geoip;
onReload();
}
@Override
public File getStorageFile() throws IOException
{
return new File(geoip.getDataFolder(), "config.yml");
}
}

View File

@ -36,8 +36,9 @@ public class EssentialsGeoIP extends JavaPlugin
this.setEnabled(false);
return;
}
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess);
final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(this, ess);
pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
ess.addReloadListener(playerListener);
logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team"));

View File

@ -1,9 +1,8 @@
package com.earth2me.essentials.geoip;
import com.earth2me.essentials.EssentialsConf;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IReload;
import com.earth2me.essentials.api.IEssentials;
import com.earth2me.essentials.api.IReload;
import com.earth2me.essentials.api.IUser;
import com.maxmind.geoip.Location;
import com.maxmind.geoip.LookupService;
@ -19,165 +18,205 @@ import java.util.zip.GZIPInputStream;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.plugin.Plugin;
public class EssentialsGeoIPPlayerListener extends PlayerListener implements IReload
{
LookupService ls = null;
private static final Logger logger = Logger.getLogger("Minecraft");
File databaseFile;
File dataFolder;
EssentialsConf config;
private transient LookupService ls = null;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient File databaseFile;
private final transient ConfigHolder config;
private final transient IEssentials ess;
private final transient Plugin geoip;
public EssentialsGeoIPPlayerListener(File dataFolder, IEssentials ess)
public EssentialsGeoIPPlayerListener(final Plugin geoip, final IEssentials ess)
{
super();
this.ess = ess;
this.dataFolder = dataFolder;
this.config = new EssentialsConf(new File(dataFolder, "config.yml"));
config.setTemplateName("/config.yml", EssentialsGeoIP.class);
this.geoip = geoip;
this.config = new ConfigHolder(ess, geoip);
onReload();
}
@Override
public void onPlayerJoin(PlayerJoinEvent event)
public void onPlayerJoin(final PlayerJoinEvent event)
{
IUser u = ess.getUser(event.getPlayer());
final IUser u = ess.getUser(event.getPlayer());
if (u.isAuthorized("essentials.geoip.hide"))
{
return;
}
InetAddress address = event.getPlayer().getAddress().getAddress();
StringBuilder sb = new StringBuilder();
if (config.getBoolean("database.show-cities", false))
config.acquireReadLock();
try
{
Location loc = ls.getLocation(address);
if (loc == null)
final InetAddress address = event.getPlayer().getAddress().getAddress();
final StringBuilder builder = new StringBuilder();
if (config.getData().getDatabase().isShowCities())
{
return;
}
if (loc.city != null)
{
sb.append(loc.city).append(", ");
}
String region = regionName.regionNameByCode(loc.countryCode, loc.region);
if (region != null)
{
sb.append(region).append(", ");
}
sb.append(loc.countryName);
}
else
{
sb.append(ls.getCountry(address).getName());
}
if (config.getBoolean("show-on-whois", true))
{
u.acquireWriteLock();
try
{
u.getData().setGeolocation(sb.toString());
}
finally
{
u.unlock();
}
}
if (config.getBoolean("show-on-login", true) && !u.isHidden())
{
for (Player player : event.getPlayer().getServer().getOnlinePlayers())
{
IUser user = ess.getUser(player);
if (user.isAuthorized("essentials.geoip.show"))
final Location loc = ls.getLocation(address);
if (loc == null)
{
user.sendMessage(_("geoipJoinFormat", u.getDisplayName(), sb.toString()));
return;
}
if (loc.city != null)
{
builder.append(loc.city).append(", ");
}
final String region = regionName.regionNameByCode(loc.countryCode, loc.region);
if (region != null)
{
builder.append(region).append(", ");
}
builder.append(loc.countryName);
}
else
{
builder.append(ls.getCountry(address).getName());
}
if (config.getData().isShowOnWhois())
{
u.acquireWriteLock();
try
{
u.getData().setGeolocation(builder.toString());
}
finally
{
u.unlock();
}
}
if (config.getData().isShowOnLogin() && !u.isHidden())
{
for (Player player : event.getPlayer().getServer().getOnlinePlayers())
{
final IUser user = ess.getUser(player);
if (user.isAuthorized("essentials.geoip.show"))
{
user.sendMessage(_("geoipJoinFormat", user.getDisplayName(), builder.toString()));
}
}
}
}
finally
{
config.unlock();
}
}
@Override
public final void onReload()
{
config.load();
if (config.getBoolean("database.show-cities", false))
config.onReload();
config.acquireReadLock();
try
{
databaseFile = new File(dataFolder, "GeoIPCity.dat");
}
else
{
databaseFile = new File(dataFolder, "GeoIP.dat");
}
if (!databaseFile.exists())
{
if (config.getBoolean("database.download-if-missing", true))
if (config.getData().getDatabase().isShowCities())
{
downloadDatabase();
databaseFile = new File(geoip.getDataFolder(), "GeoIPCity.dat");
}
else
{
logger.log(Level.SEVERE, _("cantFindGeoIpDB"));
return;
databaseFile = new File(geoip.getDataFolder(), "GeoIP.dat");
}
if (!databaseFile.exists())
{
if (config.getData().getDatabase().isDownloadIfMissing())
{
if (config.getData().getDatabase().isShowCities())
{
downloadDatabase(config.getData().getDatabase().getDownloadUrlCity());
}
else
{
downloadDatabase(config.getData().getDatabase().getDownloadUrl());
}
}
else
{
LOGGER.log(Level.SEVERE, _("cantFindGeoIpDB"));
return;
}
}
try
{
ls = new LookupService(databaseFile);
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, _("cantReadGeoIpDB"), ex);
}
}
try
finally
{
ls = new LookupService(databaseFile);
}
catch (IOException ex)
{
logger.log(Level.SEVERE, _("cantReadGeoIpDB"), ex);
config.unlock();
}
}
private void downloadDatabase()
private void downloadDatabase(final String url)
{
if (url == null || url.isEmpty())
{
LOGGER.log(Level.SEVERE, _("geoIpUrlEmpty"));
return;
}
InputStream input = null;
OutputStream output = null;
try
{
String url;
if (config.getBoolean("database.show-cities", false))
{
url = config.getString("database.download-url-city");
}
else
{
url = config.getString("database.download-url");
}
if (url == null || url.isEmpty())
{
logger.log(Level.SEVERE, _("geoIpUrlEmpty"));
return;
}
logger.log(Level.INFO, _("downloadingGeoIp"));
URL downloadUrl = new URL(url);
URLConnection conn = downloadUrl.openConnection();
LOGGER.log(Level.INFO, _("downloadingGeoIp"));
final URL downloadUrl = new URL(url);
final URLConnection conn = downloadUrl.openConnection();
conn.setConnectTimeout(10000);
conn.connect();
InputStream input = conn.getInputStream();
input = conn.getInputStream();
if (url.endsWith(".gz"))
{
input = new GZIPInputStream(input);
}
OutputStream output = new FileOutputStream(databaseFile);
byte[] buffer = new byte[2048];
output = new FileOutputStream(databaseFile);
final byte[] buffer = new byte[2048];
int length = input.read(buffer);
while (length >= 0)
{
output.write(buffer, 0, length);
length = input.read(buffer);
}
output.close();
input.close();
output.close();
}
catch (MalformedURLException ex)
{
logger.log(Level.SEVERE, _("geoIpUrlInvalid"), ex);
return;
LOGGER.log(Level.SEVERE, _("geoIpUrlInvalid"), ex);
}
catch (IOException ex)
{
logger.log(Level.SEVERE, _("connectionFailed"), ex);
LOGGER.log(Level.SEVERE, _("connectionFailed"), ex);
}
finally
{
if (output != null)
{
try
{
output.close();
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, _("connectionFailed"), ex);
}
}
if (input != null)
{
try
{
input.close();
}
catch (IOException ex)
{
LOGGER.log(Level.SEVERE, _("connectionFailed"), ex);
}
}
}
}
}

View File

@ -610,6 +610,13 @@ is divided into following sections:
<param name="call.target" value="jar"/>
<param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
</antcall>
<antcall target="-maybe-call-dep">
<param name="call.built.properties" value="${built-jar.properties}"/>
<param location="${project.Essentials2Compat}" name="call.subproject"/>
<param location="${project.Essentials2Compat}/build.xml" name="call.script"/>
<param name="call.target" value="jar"/>
<param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
</antcall>
</target>
<target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
<target depends="init" name="-check-automatic-build">
@ -1063,6 +1070,13 @@ is divided into following sections:
<param name="call.target" value="clean"/>
<param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
</antcall>
<antcall target="-maybe-call-dep">
<param name="call.built.properties" value="${built-clean.properties}"/>
<param location="${project.Essentials2Compat}" name="call.subproject"/>
<param location="${project.Essentials2Compat}/build.xml" name="call.script"/>
<param name="call.target" value="clean"/>
<param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
</antcall>
</target>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>

View File

@ -3,6 +3,6 @@ build.xml.script.CRC32=db2fb22f
build.xml.stylesheet.CRC32=28e38971@1.42.1.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=1012a5dd
nbproject/build-impl.xml.script.CRC32=8cccbe45
nbproject/build-impl.xml.data.CRC32=6a299da6
nbproject/build-impl.xml.script.CRC32=a83e8167
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.1.46

View File

@ -72,7 +72,8 @@ jar.index=${jnlp.enabled}
javac.classpath=\
${reference.Essentials.jar}:\
${file.reference.smack-3.2.1.jar}:\
${file.reference.bukkit.jar}
${file.reference.bukkit.jar}:\
${reference.Essentials2Compat.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked
javac.deprecation=false
@ -112,7 +113,9 @@ meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=true
platform.active=default_platform
project.Essentials=../Essentials
project.Essentials2Compat=../Essentials2Compat
reference.Essentials.jar=${project.Essentials}/dist/Essentials.jar
reference.Essentials2Compat.jar=${project.Essentials2Compat}/dist/Essentials2Compat.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}

View File

@ -23,6 +23,14 @@
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
<reference>
<foreign-project>Essentials2Compat</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>

View File

@ -14,6 +14,7 @@
<ant dir="Essentials" antfile="build.xml"/>
</target>
<target name="buildRest" depends="buildEss">
<ant dir="Essentials2Compat" antfile="build.xml"/>
<ant dir="EssentialsChat" antfile="build.xml"/>
<ant dir="EssentialsSpawn" antfile="build.xml"/>
<ant dir="EssentialsProtect" antfile="build.xml"/>