mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Several bug fixes and cleanup.
Found using PMD and FindBugs. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1553 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
2a614e53a7
commit
117d938ac5
74 changed files with 645 additions and 354 deletions
1
Essentials/nbproject/pmd.settings
Normal file
1
Essentials/nbproject/pmd.settings
Normal file
|
@ -0,0 +1 @@
|
||||||
|
DoNotUseThreads
|
|
@ -8,13 +8,15 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
|
||||||
public class Backup implements Runnable {
|
public class Backup implements Runnable {
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private CraftServer server;
|
private final CraftServer server;
|
||||||
|
private final IEssentials ess;
|
||||||
private boolean running = false;
|
private boolean running = false;
|
||||||
private int taskId = -1;
|
private int taskId = -1;
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
|
||||||
public Backup() {
|
public Backup(IEssentials ess) {
|
||||||
server = (CraftServer)Essentials.getStatic().getServer();
|
this.ess = ess;
|
||||||
|
server = (CraftServer)ess.getServer();
|
||||||
if (server.getOnlinePlayers().length > 0) {
|
if (server.getOnlinePlayers().length > 0) {
|
||||||
startTask();
|
startTask();
|
||||||
}
|
}
|
||||||
|
@ -26,11 +28,11 @@ public class Backup implements Runnable {
|
||||||
|
|
||||||
private void startTask() {
|
private void startTask() {
|
||||||
if (!running) {
|
if (!running) {
|
||||||
long interval = Essentials.getStatic().getSettings().getBackupInterval()*1200; // minutes -> ticks
|
long interval = ess.getSettings().getBackupInterval()*1200; // minutes -> ticks
|
||||||
if (interval < 1200) {
|
if (interval < 1200) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
taskId = server.getScheduler().scheduleSyncRepeatingTask(Essentials.getStatic(), this, interval, interval);
|
taskId = ess.scheduleSyncRepeatingTask(this, interval, interval);
|
||||||
running = true;
|
running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +40,7 @@ public class Backup implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (active) return;
|
if (active) return;
|
||||||
active = true;
|
active = true;
|
||||||
final String command = Essentials.getStatic().getSettings().getBackupCommand();
|
final String command = ess.getSettings().getBackupCommand();
|
||||||
if (command == null || "".equals(command)) {
|
if (command == null || "".equals(command)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +49,7 @@ public class Backup implements Runnable {
|
||||||
server.dispatchCommand(cs, "save-all");
|
server.dispatchCommand(cs, "save-all");
|
||||||
server.dispatchCommand(cs, "save-off");
|
server.dispatchCommand(cs, "save-off");
|
||||||
|
|
||||||
server.getScheduler().scheduleAsyncDelayedTask(Essentials.getStatic(),
|
ess.scheduleAsyncDelayedTask(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -59,7 +61,7 @@ public class Backup implements Runnable {
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
logger.log(Level.SEVERE, null, ex);
|
logger.log(Level.SEVERE, null, ex);
|
||||||
} finally {
|
} finally {
|
||||||
server.getScheduler().scheduleSyncDelayedTask(Essentials.getStatic(),
|
ess.scheduleSyncDelayedTask(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -1,37 +1,39 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class Charge
|
public class Charge
|
||||||
{
|
{
|
||||||
private String command = null;
|
private final String command;
|
||||||
private Double costs = null;
|
private final Double costs;
|
||||||
private ItemStack items = null;
|
private final ItemStack items;
|
||||||
private Essentials ess = Essentials.getStatic();
|
private final IEssentials ess;
|
||||||
|
|
||||||
public Charge(String command)
|
public Charge(String command, IEssentials ess)
|
||||||
|
{
|
||||||
|
this(command, null, null, ess);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Charge(double money, IEssentials ess)
|
||||||
|
{
|
||||||
|
this(null, money, null, ess);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Charge(ItemStack items, IEssentials ess)
|
||||||
|
{
|
||||||
|
this(null, null, items, ess);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Charge(String command, Double money, ItemStack item, IEssentials ess)
|
||||||
{
|
{
|
||||||
this.command = command;
|
this.command = command;
|
||||||
}
|
|
||||||
|
|
||||||
public Charge(double money)
|
|
||||||
{
|
|
||||||
this.costs = money;
|
this.costs = money;
|
||||||
|
this.items = item;
|
||||||
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Charge(ItemStack items)
|
public void isAffordableFor(IUser user) throws Exception
|
||||||
{
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Charge(EssentialsCommand command)
|
|
||||||
{
|
|
||||||
this.command = command.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void isAffordableFor(User user) throws Exception
|
|
||||||
{
|
{
|
||||||
double mon = user.getMoney();
|
double mon = user.getMoney();
|
||||||
if (costs != null)
|
if (costs != null)
|
||||||
|
@ -63,7 +65,7 @@ public class Charge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void charge(User user) throws Exception
|
public void charge(IUser user) throws Exception
|
||||||
{
|
{
|
||||||
double mon = user.getMoney();
|
double mon = user.getMoney();
|
||||||
if (costs != null)
|
if (costs != null)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
|
||||||
public class Console implements IReplyTo {
|
public final class Console implements IReplyTo {
|
||||||
private static Console instance = new Console();
|
private static Console instance = new Console();
|
||||||
private CommandSender replyTo;
|
private CommandSender replyTo;
|
||||||
public final static String NAME = "Console";
|
public final static String NAME = "Console";
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.bukkit.plugin.*;
|
||||||
import org.bukkit.plugin.java.*;
|
import org.bukkit.plugin.java.*;
|
||||||
|
|
||||||
|
|
||||||
public class Essentials extends JavaPlugin
|
public class Essentials extends JavaPlugin implements IEssentials
|
||||||
{
|
{
|
||||||
public static final String AUTHORS = "Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans and Xeology";
|
public static final String AUTHORS = "Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans and Xeology";
|
||||||
public static final int minBukkitBuildVersion = 818;
|
public static final int minBukkitBuildVersion = 818;
|
||||||
|
@ -59,19 +59,15 @@ public class Essentials extends JavaPlugin
|
||||||
public ArrayList bans = new ArrayList();
|
public ArrayList bans = new ArrayList();
|
||||||
public ArrayList bannedIps = new ArrayList();
|
public ArrayList bannedIps = new ArrayList();
|
||||||
private Backup backup;
|
private Backup backup;
|
||||||
private Map<String, User> users = new HashMap<String, User>();
|
private final Map<String, User> users = new HashMap<String, User>();
|
||||||
private EssentialsTimer timer;
|
private EssentialsTimer timer;
|
||||||
private EssentialsUpdateTimer updateTimer;
|
private EssentialsUpdateTimer updateTimer;
|
||||||
private boolean registerFallback = true;
|
private boolean registerFallback = true;
|
||||||
private Methods paymentMethod = new Methods();
|
private final Methods paymentMethod = new Methods();
|
||||||
private boolean enableErrorLogging = false;
|
private final static boolean enableErrorLogging = false;
|
||||||
private EssentialsErrorHandler errorHandler = new EssentialsErrorHandler();
|
private final EssentialsErrorHandler errorHandler = new EssentialsErrorHandler();
|
||||||
|
|
||||||
public Essentials()
|
public static IEssentials getStatic()
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Essentials getStatic()
|
|
||||||
{
|
{
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +115,7 @@ public class Essentials extends JavaPlugin
|
||||||
worth = new Worth(this.getDataFolder());
|
worth = new Worth(this.getDataFolder());
|
||||||
confList.add(worth);
|
confList.add(worth);
|
||||||
reload();
|
reload();
|
||||||
backup = new Backup();
|
backup = new Backup(this);
|
||||||
|
|
||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
for (Plugin plugin : pm.getPlugins())
|
for (Plugin plugin : pm.getPlugins())
|
||||||
|
@ -349,7 +345,7 @@ public class Essentials extends JavaPlugin
|
||||||
|
|
||||||
public boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath)
|
public boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath)
|
||||||
{
|
{
|
||||||
if ("msg".equals(commandLabel.toLowerCase()) || "r".equals(commandLabel.toLowerCase()) || "mail".equals(commandLabel.toLowerCase()) & sender instanceof CraftPlayer)
|
if ("msg".equals(commandLabel.toLowerCase()) || "r".equals(commandLabel.toLowerCase()) || "mail".equals(commandLabel.toLowerCase()) && sender instanceof CraftPlayer)
|
||||||
{
|
{
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
str.append(commandLabel).append(" ");
|
str.append(commandLabel).append(" ");
|
||||||
|
@ -408,13 +404,10 @@ public class Essentials extends JavaPlugin
|
||||||
// New mail notification
|
// New mail notification
|
||||||
if (user != null && !getSettings().isCommandDisabled("mail") && !commandLabel.equals("mail") && user.isAuthorized("essentials.mail"))
|
if (user != null && !getSettings().isCommandDisabled("mail") && !commandLabel.equals("mail") && user.isAuthorized("essentials.mail"))
|
||||||
{
|
{
|
||||||
List<String> mail = user.getMails();
|
final List<String> mail = user.getMails();
|
||||||
if (mail != null)
|
if (mail != null && !mail.isEmpty())
|
||||||
{
|
{
|
||||||
if (mail.size() > 0)
|
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
|
||||||
{
|
|
||||||
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +421,7 @@ public class Essentials extends JavaPlugin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmd = (IEssentialsCommand)classLoader.loadClass(commandPath + command.getName()).newInstance();
|
cmd = (IEssentialsCommand)classLoader.loadClass(commandPath + command.getName()).newInstance();
|
||||||
|
cmd.setEssentials(this);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -502,15 +496,15 @@ public class Essentials extends JavaPlugin
|
||||||
throw new FileNotFoundException(Util.i18n("bannedPlayersFileNotFound"));
|
throw new FileNotFoundException(Util.i18n("bannedPlayersFileNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader rx = new BufferedReader(new FileReader(file));
|
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||||
bans.clear();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int i = 0; rx.ready(); i++)
|
bans.clear();
|
||||||
|
while (bufferedReader.ready())
|
||||||
{
|
{
|
||||||
|
|
||||||
String line = rx.readLine().trim().toLowerCase();
|
final String line = bufferedReader.readLine().trim().toLowerCase();
|
||||||
if (line.startsWith("#"))
|
if (line.length() > 0 && line.charAt(0) == '#')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -522,6 +516,17 @@ public class Essentials extends JavaPlugin
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), io);
|
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), io);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bufferedReader.close();
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException ex)
|
catch (FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
|
@ -535,15 +540,15 @@ public class Essentials extends JavaPlugin
|
||||||
throw new FileNotFoundException(Util.i18n("bannedIpsFileNotFound"));
|
throw new FileNotFoundException(Util.i18n("bannedIpsFileNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader rx = new BufferedReader(new FileReader(ipFile));
|
final BufferedReader bufferedReader = new BufferedReader(new FileReader(ipFile));
|
||||||
bannedIps.clear();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int i = 0; rx.ready(); i++)
|
bannedIps.clear();
|
||||||
|
while (bufferedReader.ready())
|
||||||
{
|
{
|
||||||
|
|
||||||
String line = rx.readLine().trim().toLowerCase();
|
final String line = bufferedReader.readLine().trim().toLowerCase();
|
||||||
if (line.startsWith("#"))
|
if (line.length() > 0 && line.charAt(0) == '#')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -555,6 +560,17 @@ public class Essentials extends JavaPlugin
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), io);
|
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), io);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bufferedReader.close();
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException ex)
|
catch (FileNotFoundException ex)
|
||||||
{
|
{
|
||||||
|
@ -577,32 +593,32 @@ public class Essentials extends JavaPlugin
|
||||||
return (CraftScheduler)this.getServer().getScheduler();
|
return (CraftScheduler)this.getServer().getScheduler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Jail getJail()
|
public Jail getJail()
|
||||||
{
|
{
|
||||||
return getStatic().jail;
|
return jail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Warps getWarps()
|
public Warps getWarps()
|
||||||
{
|
{
|
||||||
return getStatic().warps;
|
return warps;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Worth getWorth()
|
public Worth getWorth()
|
||||||
{
|
{
|
||||||
return getStatic().worth;
|
return worth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Backup getBackup()
|
public Backup getBackup()
|
||||||
{
|
{
|
||||||
return getStatic().backup;
|
return backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Spawn getSpawn()
|
public Spawn getSpawn()
|
||||||
{
|
{
|
||||||
return getStatic().spawn;
|
return spawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> User getUser(T base)
|
public User getUser(Object base)
|
||||||
{
|
{
|
||||||
if (base instanceof Player)
|
if (base instanceof Player)
|
||||||
{
|
{
|
||||||
|
@ -698,9 +714,34 @@ public class Essentials extends JavaPlugin
|
||||||
|
|
||||||
return players.length;
|
return players.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<BigInteger, String> getErrors()
|
public Map<BigInteger, String> getErrors()
|
||||||
{
|
{
|
||||||
return errorHandler.errors;
|
return errorHandler.getErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int scheduleAsyncDelayedTask(final Runnable run)
|
||||||
|
{
|
||||||
|
return this.getScheduler().scheduleAsyncDelayedTask(this, run);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int scheduleSyncDelayedTask(final Runnable run)
|
||||||
|
{
|
||||||
|
return this.getScheduler().scheduleSyncDelayedTask(this, run);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int scheduleSyncRepeatingTask(final Runnable run, long delay, long period)
|
||||||
|
{
|
||||||
|
return this.getScheduler().scheduleSyncRepeatingTask(this, run, delay, period);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getBans()
|
||||||
|
{
|
||||||
|
return bans;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getBannedIps()
|
||||||
|
{
|
||||||
|
return bannedIps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.*;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.craftbukkit.block.CraftSign;
|
import org.bukkit.craftbukkit.block.CraftSign;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -12,9 +15,9 @@ import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class EssentialsBlockListener extends BlockListener
|
public class EssentialsBlockListener extends BlockListener
|
||||||
{
|
{
|
||||||
private final Essentials ess;
|
private final IEssentials ess;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
public final static ArrayList<Material> protectedBlocks = new ArrayList<Material>(4);
|
public final static List<Material> protectedBlocks = new ArrayList<Material>(4);
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
@ -24,7 +27,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||||
protectedBlocks.add(Material.DISPENSER);
|
protectedBlocks.add(Material.DISPENSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EssentialsBlockListener(Essentials ess)
|
public EssentialsBlockListener(IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +147,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||||
event.setLine(1, "§dWarp name!");
|
event.setLine(1, "§dWarp name!");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Essentials.getWarps().getWarp(event.getLine(1));
|
ess.getWarps().getWarp(event.getLine(1));
|
||||||
if (event.getLine(2).equalsIgnoreCase("Everyone")) {
|
if (event.getLine(2).equalsIgnoreCase("Everyone")) {
|
||||||
event.setLine(2, "§2Everyone");
|
event.setLine(2, "§2Everyone");
|
||||||
}
|
}
|
||||||
|
@ -243,7 +246,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||||
}
|
}
|
||||||
boolean unlimitedForUser = user.hasUnlimited(is);
|
boolean unlimitedForUser = user.hasUnlimited(is);
|
||||||
if (unlimitedForUser) {
|
if (unlimitedForUser) {
|
||||||
ess.getScheduler().scheduleSyncDelayedTask(ess,
|
ess.scheduleSyncDelayedTask(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -40,7 +40,10 @@ public class EssentialsConf extends Configuration
|
||||||
configFile = configFile.getAbsoluteFile();
|
configFile = configFile.getAbsoluteFile();
|
||||||
if (!configFile.getParentFile().exists())
|
if (!configFile.getParentFile().exists())
|
||||||
{
|
{
|
||||||
configFile.getParentFile().mkdirs();
|
if (!configFile.getParentFile().mkdirs())
|
||||||
|
{
|
||||||
|
logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!configFile.exists())
|
if (!configFile.exists())
|
||||||
{
|
{
|
||||||
|
@ -54,7 +57,10 @@ public class EssentialsConf extends Configuration
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
logger.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString()));
|
logger.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString()));
|
||||||
configFile.createNewFile();
|
if (!configFile.createNewFile())
|
||||||
|
{
|
||||||
|
logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
@ -71,10 +77,11 @@ public class EssentialsConf extends Configuration
|
||||||
|
|
||||||
private void createFromTemplate()
|
private void createFromTemplate()
|
||||||
{
|
{
|
||||||
|
InputStream istr = null;
|
||||||
OutputStream ostr = null;
|
OutputStream ostr = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
InputStream istr = resourceClass.getResourceAsStream(templateName);
|
istr = resourceClass.getResourceAsStream(templateName);
|
||||||
if (istr == null)
|
if (istr == null)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName));
|
logger.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName));
|
||||||
|
@ -89,7 +96,6 @@ public class EssentialsConf extends Configuration
|
||||||
ostr.write(buffer, 0, length);
|
ostr.write(buffer, 0, length);
|
||||||
length = istr.read(buffer);
|
length = istr.read(buffer);
|
||||||
}
|
}
|
||||||
istr.close();
|
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +104,17 @@ public class EssentialsConf extends Configuration
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (istr != null)
|
||||||
|
{
|
||||||
|
istr.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
Logger.getLogger(EssentialsConf.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (ostr != null)
|
if (ostr != null)
|
||||||
|
@ -108,7 +125,6 @@ public class EssentialsConf extends Configuration
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex);
|
logger.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class EssentialsEcoBlockListener extends BlockListener
|
public class EssentialsEcoBlockListener extends BlockListener
|
||||||
{
|
{
|
||||||
Essentials ess;
|
private final IEssentials ess;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public EssentialsEcoBlockListener(Essentials ess)
|
public EssentialsEcoBlockListener(Essentials ess)
|
||||||
|
|
|
@ -14,10 +14,10 @@ import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class EssentialsEcoPlayerListener extends PlayerListener
|
public class EssentialsEcoPlayerListener extends PlayerListener
|
||||||
{
|
{
|
||||||
Essentials ess;
|
private final IEssentials ess;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
EssentialsEcoPlayerListener(Essentials ess)
|
EssentialsEcoPlayerListener(IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class EssentialsEntityListener extends EntityListener
|
public class EssentialsEntityListener extends EntityListener
|
||||||
{
|
{
|
||||||
private final Essentials ess;
|
private final IEssentials ess;
|
||||||
|
|
||||||
public EssentialsEntityListener(Essentials parent)
|
public EssentialsEntityListener(IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = parent;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,8 @@ import java.math.BigInteger;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
|
@ -11,8 +13,8 @@ import java.util.logging.LogRecord;
|
||||||
|
|
||||||
class EssentialsErrorHandler extends Handler
|
class EssentialsErrorHandler extends Handler
|
||||||
{
|
{
|
||||||
HashMap<BigInteger, String> errors = new HashMap<BigInteger, String>();
|
private final Map<BigInteger, String> errors = new HashMap<BigInteger, String>();
|
||||||
private final LinkedList<LogRecord> records = new LinkedList<LogRecord>();
|
private final List<LogRecord> records = new LinkedList<LogRecord>();
|
||||||
|
|
||||||
public EssentialsErrorHandler()
|
public EssentialsErrorHandler()
|
||||||
{
|
{
|
||||||
|
@ -74,7 +76,7 @@ class EssentialsErrorHandler extends Handler
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (essentialsFound == false && tr.getCause() != null)
|
if (!essentialsFound && tr.getCause() != null)
|
||||||
{
|
{
|
||||||
Throwable cause = tr.getCause();
|
Throwable cause = tr.getCause();
|
||||||
StackTraceElement[] elements2 = cause.getStackTrace();
|
StackTraceElement[] elements2 = cause.getStackTrace();
|
||||||
|
@ -118,4 +120,9 @@ class EssentialsErrorHandler extends Handler
|
||||||
}
|
}
|
||||||
records.clear();
|
records.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<BigInteger, String> getErrors()
|
||||||
|
{
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,30 @@ import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import net.minecraft.server.InventoryPlayer;
|
import net.minecraft.server.InventoryPlayer;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.craftbukkit.block.CraftSign;
|
import org.bukkit.craftbukkit.block.CraftSign;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationType;
|
||||||
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerListener;
|
||||||
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +36,10 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
{
|
{
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private final Server server;
|
private final Server server;
|
||||||
private final Essentials ess;
|
private final IEssentials ess;
|
||||||
private EssentialsBlockListener essBlockListener = null;
|
private final EssentialsBlockListener essBlockListener;
|
||||||
|
|
||||||
public EssentialsPlayerListener(Essentials parent)
|
public EssentialsPlayerListener(IEssentials parent)
|
||||||
{
|
{
|
||||||
this.ess = parent;
|
this.ess = parent;
|
||||||
this.server = parent.getServer();
|
this.server = parent.getServer();
|
||||||
|
@ -40,7 +55,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) {
|
if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event.setRespawnLocation(Essentials.getJail().getJail(user.getJail()));
|
event.setRespawnLocation(ess.getJail().getJail(user.getJail()));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -162,7 +177,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
event.setTo(loc);
|
event.setTo(loc);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
user.getTeleport().now(loc, new Charge("portal"));
|
user.getTeleport().now(loc, new Charge("portal", ess));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +236,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
Essentials.getBackup().onPlayerJoin();
|
ess.getBackup().onPlayerJoin();
|
||||||
User user = ess.getUser(event.getPlayer());
|
User user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
//we do not know the ip address on playerlogin so we need to do this here.
|
//we do not know the ip address on playerlogin so we need to do this here.
|
||||||
|
@ -312,7 +327,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
event.setTo(Essentials.getJail().getJail(user.getJail()));
|
event.setTo(ess.getJail().getJail(user.getJail()));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -498,15 +513,15 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
}
|
}
|
||||||
if (m1)
|
if (m1)
|
||||||
{
|
{
|
||||||
return new Charge(q1);
|
return new Charge(q1, ess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemStack i = ItemDb.get(l1[1], (int)q1);
|
ItemStack i = ItemDb.get(l1[1], (int)q1);
|
||||||
return new Charge(i);
|
return new Charge(i, ess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Charge("warpsign");
|
return new Charge("warpsign", ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -528,8 +543,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||||
if (user.hasUnlimited(new ItemStack(event.getBucket())))
|
if (user.hasUnlimited(new ItemStack(event.getBucket())))
|
||||||
{
|
{
|
||||||
event.getItemStack().setType(event.getBucket());
|
event.getItemStack().setType(event.getBucket());
|
||||||
Essentials.getStatic().getScheduler().scheduleSyncDelayedTask(Essentials.getStatic(),
|
ess.scheduleSyncDelayedTask(new Runnable()
|
||||||
new Runnable()
|
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.bukkit.event.server.ServerListener;
|
||||||
|
|
||||||
public class EssentialsPluginListener extends ServerListener
|
public class EssentialsPluginListener extends ServerListener
|
||||||
{
|
{
|
||||||
Methods methods;
|
private final Methods methods;
|
||||||
private final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public EssentialsPluginListener(Methods methods)
|
public EssentialsPluginListener(Methods methods)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,13 +9,13 @@ import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class EssentialsTimer implements Runnable, IConf
|
public class EssentialsTimer implements Runnable, IConf
|
||||||
{
|
{
|
||||||
private Essentials parent;
|
private final IEssentials ess;
|
||||||
private Set<User> allUsers = new HashSet<User>();
|
private final Set<User> allUsers = new HashSet<User>();
|
||||||
|
|
||||||
EssentialsTimer(Essentials parent)
|
EssentialsTimer(IEssentials ess)
|
||||||
{
|
{
|
||||||
this.parent = parent;
|
this.ess = ess;
|
||||||
File userdir = new File(parent.getDataFolder(), "userdata");
|
File userdir = new File(ess.getDataFolder(), "userdata");
|
||||||
if (!userdir.exists()) {
|
if (!userdir.exists()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class EssentialsTimer implements Runnable, IConf
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String name = string.substring(0, string.length()-4);
|
String name = string.substring(0, string.length()-4);
|
||||||
User u = parent.getUser(new OfflinePlayer(name));
|
User u = ess.getUser(new OfflinePlayer(name));
|
||||||
allUsers.add(u);
|
allUsers.add(u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,9 @@ public class EssentialsTimer implements Runnable, IConf
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
for (Player player : parent.getServer().getOnlinePlayers())
|
for (Player player : ess.getServer().getOnlinePlayers())
|
||||||
{
|
{
|
||||||
User u = parent.getUser(player);
|
User u = ess.getUser(player);
|
||||||
allUsers.add(u);
|
allUsers.add(u);
|
||||||
u.setLastActivity(currentTime);
|
u.setLastActivity(currentTime);
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ public class EssentialsTimer implements Runnable, IConf
|
||||||
for (User user: allUsers) {
|
for (User user: allUsers) {
|
||||||
if (user.getBanTimeout() > 0 && user.getBanTimeout() < currentTime) {
|
if (user.getBanTimeout() > 0 && user.getBanTimeout() < currentTime) {
|
||||||
user.setBanTimeout(0);
|
user.setBanTimeout(0);
|
||||||
((CraftServer)parent.getServer()).getHandle().b(user.getName());
|
((CraftServer)ess.getServer()).getHandle().b(user.getName());
|
||||||
Essentials.getStatic().loadBanList();
|
ess.loadBanList();
|
||||||
}
|
}
|
||||||
if (user.getMuteTimeout() > 0 && user.getMuteTimeout() < currentTime && user.isMuted()) {
|
if (user.getMuteTimeout() > 0 && user.getMuteTimeout() < currentTime && user.isMuted()) {
|
||||||
user.setMuteTimeout(0);
|
user.setMuteTimeout(0);
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
||||||
class EssentialsUpdateTimer implements Runnable
|
class EssentialsUpdateTimer implements Runnable
|
||||||
{
|
{
|
||||||
private URL url;
|
private URL url;
|
||||||
private Essentials ess;
|
private final Essentials ess;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public EssentialsUpdateTimer(Essentials ess)
|
public EssentialsUpdateTimer(Essentials ess)
|
||||||
|
@ -40,7 +40,7 @@ class EssentialsUpdateTimer implements Runnable
|
||||||
sb.append("v=").append(URLEncoder.encode(ess.getDescription().getVersion(),"UTF-8"));
|
sb.append("v=").append(URLEncoder.encode(ess.getDescription().getVersion(),"UTF-8"));
|
||||||
sb.append("&b=").append(URLEncoder.encode(ess.getServer().getVersion(),"UTF-8"));
|
sb.append("&b=").append(URLEncoder.encode(ess.getServer().getVersion(),"UTF-8"));
|
||||||
sb.append("&jv=").append(URLEncoder.encode(System.getProperty("java.version"),"UTF-8"));
|
sb.append("&jv=").append(URLEncoder.encode(System.getProperty("java.version"),"UTF-8"));
|
||||||
sb.append("&l=").append(URLEncoder.encode(Util.currentLocale.toString(),"UTF-8"));
|
sb.append("&l=").append(URLEncoder.encode(Util.getCurrentLocale().toString(),"UTF-8"));
|
||||||
sb.append("&on=").append(URLEncoder.encode(System.getProperty("os.name"),"UTF-8"));
|
sb.append("&on=").append(URLEncoder.encode(System.getProperty("os.name"),"UTF-8"));
|
||||||
sb.append("&ov=").append(URLEncoder.encode(System.getProperty("os.version"),"UTF-8"));
|
sb.append("&ov=").append(URLEncoder.encode(System.getProperty("os.version"),"UTF-8"));
|
||||||
for (BigInteger bigInteger : ess.getErrors().keySet())
|
for (BigInteger bigInteger : ess.getErrors().keySet())
|
||||||
|
|
|
@ -18,16 +18,16 @@ public class EssentialsUpgrade
|
||||||
{
|
{
|
||||||
private static boolean alreadyRun = false;
|
private static boolean alreadyRun = false;
|
||||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||||
private Essentials ess;
|
private final IEssentials ess;
|
||||||
|
|
||||||
EssentialsUpgrade(String version, Essentials essentials)
|
EssentialsUpgrade(String version, IEssentials essentials)
|
||||||
{
|
{
|
||||||
if (alreadyRun == true)
|
ess = essentials;
|
||||||
|
if (alreadyRun)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
alreadyRun = true;
|
alreadyRun = true;
|
||||||
ess = essentials;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveWorthValuesToWorthYml()
|
private void moveWorthValuesToWorthYml()
|
||||||
|
@ -79,7 +79,7 @@ public class EssentialsUpgrade
|
||||||
}
|
}
|
||||||
if (line.matches(regex))
|
if (line.matches(regex))
|
||||||
{
|
{
|
||||||
if (needUpdate == false && info != null)
|
if (!needUpdate && info != null)
|
||||||
{
|
{
|
||||||
bw.write(info, 0, info.length());
|
bw.write(info, 0, info.length());
|
||||||
bw.newLine();
|
bw.newLine();
|
||||||
|
@ -246,13 +246,26 @@ public class EssentialsUpgrade
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedReader rx = new BufferedReader(new FileReader(listOfFiles[i]));
|
BufferedReader rx = new BufferedReader(new FileReader(listOfFiles[i]));
|
||||||
double x = Double.parseDouble(rx.readLine().trim());
|
double x, y, z;
|
||||||
double y = Double.parseDouble(rx.readLine().trim());
|
float yaw, pitch;
|
||||||
double z = Double.parseDouble(rx.readLine().trim());
|
String worldName;
|
||||||
float yaw = Float.parseFloat(rx.readLine().trim());
|
try
|
||||||
float pitch = Float.parseFloat(rx.readLine().trim());
|
{
|
||||||
String worldName = rx.readLine();
|
if (!rx.ready()) continue;
|
||||||
rx.close();
|
x = Double.parseDouble(rx.readLine().trim());
|
||||||
|
if (!rx.ready()) continue;
|
||||||
|
y = Double.parseDouble(rx.readLine().trim());
|
||||||
|
if (!rx.ready()) continue;
|
||||||
|
z = Double.parseDouble(rx.readLine().trim());
|
||||||
|
if (!rx.ready()) continue;
|
||||||
|
yaw = Float.parseFloat(rx.readLine().trim());
|
||||||
|
if (!rx.ready()) continue;
|
||||||
|
pitch = Float.parseFloat(rx.readLine().trim());
|
||||||
|
worldName = rx.readLine();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
rx.close();
|
||||||
|
}
|
||||||
World w = null;
|
World w = null;
|
||||||
for (World world : ess.getServer().getWorlds())
|
for (World world : ess.getServer().getWorlds())
|
||||||
{
|
{
|
||||||
|
@ -264,7 +277,7 @@ public class EssentialsUpgrade
|
||||||
}
|
}
|
||||||
if (worldName != null)
|
if (worldName != null)
|
||||||
{
|
{
|
||||||
worldName.trim();
|
worldName = worldName.trim();
|
||||||
World w1 = null;
|
World w1 = null;
|
||||||
w1 = getFakeWorld(worldName);
|
w1 = getFakeWorld(worldName);
|
||||||
if (w1 != null)
|
if (w1 != null)
|
||||||
|
@ -273,7 +286,7 @@ public class EssentialsUpgrade
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Location loc = new Location(w, x, y, z, yaw, pitch);
|
Location loc = new Location(w, x, y, z, yaw, pitch);
|
||||||
Essentials.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
|
ess.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
|
||||||
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
|
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("fileRenameError", filename));
|
throw new Exception(Util.format("fileRenameError", filename));
|
||||||
|
@ -293,6 +306,8 @@ public class EssentialsUpgrade
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BufferedReader rx = new BufferedReader(new FileReader(warpFile));
|
BufferedReader rx = new BufferedReader(new FileReader(warpFile));
|
||||||
|
try
|
||||||
|
{
|
||||||
for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":"))
|
for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":"))
|
||||||
{
|
{
|
||||||
if (parts.length < 6)
|
if (parts.length < 6)
|
||||||
|
@ -319,12 +334,17 @@ public class EssentialsUpgrade
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Location loc = new Location(w, x, y, z, yaw, pitch);
|
Location loc = new Location(w, x, y, z, yaw, pitch);
|
||||||
Essentials.getWarps().setWarp(name, loc);
|
ess.getWarps().setWarp(name, loc);
|
||||||
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
|
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("fileRenameError", "warps.txt"));
|
throw new Exception(Util.format("fileRenameError", "warps.txt"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
rx.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -381,7 +401,7 @@ public class EssentialsUpgrade
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void beforeSettings()
|
public void beforeSettings()
|
||||||
{
|
{
|
||||||
if (!ess.getDataFolder().exists())
|
if (!ess.getDataFolder().exists())
|
||||||
{
|
{
|
||||||
|
@ -390,7 +410,7 @@ public class EssentialsUpgrade
|
||||||
moveWorthValuesToWorthYml();
|
moveWorthValuesToWorthYml();
|
||||||
}
|
}
|
||||||
|
|
||||||
void afterSettings()
|
public void afterSettings()
|
||||||
{
|
{
|
||||||
sanitizeAllUserFilenames();
|
sanitizeAllUserFilenames();
|
||||||
updateUsersToNewDefaultHome();
|
updateUsersToNewDefaultHome();
|
||||||
|
|
|
@ -25,8 +25,8 @@ import org.bukkit.util.Vector;
|
||||||
public class FakeWorld implements World
|
public class FakeWorld implements World
|
||||||
{
|
{
|
||||||
|
|
||||||
private String name;
|
private final String name;
|
||||||
private Environment env;
|
private final Environment env;
|
||||||
FakeWorld(String string, Environment environment)
|
FakeWorld(String string, Environment environment)
|
||||||
{
|
{
|
||||||
this.name = string;
|
this.name = string;
|
||||||
|
|
68
Essentials/src/com/earth2me/essentials/IEssentials.java
Normal file
68
Essentials/src/com/earth2me/essentials/IEssentials.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.register.payment.Methods;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
|
||||||
|
public interface IEssentials
|
||||||
|
{
|
||||||
|
void addReloadListener(IConf listener);
|
||||||
|
|
||||||
|
void reload();
|
||||||
|
|
||||||
|
boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath);
|
||||||
|
|
||||||
|
User getUser(Object base);
|
||||||
|
|
||||||
|
User getOfflineUser(String name);
|
||||||
|
|
||||||
|
World getWorld(String name);
|
||||||
|
|
||||||
|
int broadcastMessage(String name, String message);
|
||||||
|
|
||||||
|
Settings getSettings();
|
||||||
|
|
||||||
|
CraftScheduler getScheduler();
|
||||||
|
|
||||||
|
String[] getMotd(CommandSender sender, String def);
|
||||||
|
|
||||||
|
String[] getLines(CommandSender sender, String node, String def);
|
||||||
|
|
||||||
|
Jail getJail();
|
||||||
|
|
||||||
|
Warps getWarps();
|
||||||
|
|
||||||
|
Worth getWorth();
|
||||||
|
|
||||||
|
Backup getBackup();
|
||||||
|
|
||||||
|
Spawn getSpawn();
|
||||||
|
|
||||||
|
void loadBanList();
|
||||||
|
|
||||||
|
public boolean isRegisterFallbackEnabled();
|
||||||
|
|
||||||
|
public Methods getPaymentMethod();
|
||||||
|
|
||||||
|
Server getServer();
|
||||||
|
|
||||||
|
File getDataFolder();
|
||||||
|
|
||||||
|
PluginDescriptionFile getDescription();
|
||||||
|
|
||||||
|
int scheduleAsyncDelayedTask(Runnable run);
|
||||||
|
|
||||||
|
int scheduleSyncDelayedTask(Runnable run);
|
||||||
|
|
||||||
|
int scheduleSyncRepeatingTask(final Runnable run, long delay, long period);
|
||||||
|
|
||||||
|
List<String> getBans();
|
||||||
|
|
||||||
|
List<String> getBannedIps();
|
||||||
|
}
|
51
Essentials/src/com/earth2me/essentials/IUser.java
Normal file
51
Essentials/src/com/earth2me/essentials/IUser.java
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IUser
|
||||||
|
{
|
||||||
|
int getHealth();
|
||||||
|
|
||||||
|
Location getLocation();
|
||||||
|
|
||||||
|
boolean isOnline();
|
||||||
|
|
||||||
|
void sendMessage(String string);
|
||||||
|
|
||||||
|
long getLastTeleportTimestamp();
|
||||||
|
|
||||||
|
boolean isAuthorized(String node);
|
||||||
|
|
||||||
|
boolean isAuthorized(IEssentialsCommand cmd);
|
||||||
|
|
||||||
|
void setLastTeleportTimestamp(long time);
|
||||||
|
|
||||||
|
Location getLastLocation();
|
||||||
|
|
||||||
|
Player getBase();
|
||||||
|
|
||||||
|
double getMoney();
|
||||||
|
|
||||||
|
void takeMoney(double value);
|
||||||
|
|
||||||
|
PlayerInventory getInventory();
|
||||||
|
|
||||||
|
void updateInventory();
|
||||||
|
|
||||||
|
String getGroup();
|
||||||
|
|
||||||
|
void setLastLocation();
|
||||||
|
|
||||||
|
Location getHome(Location location);
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
InetSocketAddress getAddress();
|
||||||
|
|
||||||
|
String getDisplayName();
|
||||||
|
}
|
|
@ -12,8 +12,12 @@ import org.bukkit.inventory.ItemStack;
|
||||||
* is accepted to CraftBukkit
|
* is accepted to CraftBukkit
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class InventoryWorkaround
|
public final class InventoryWorkaround
|
||||||
{
|
{
|
||||||
|
private InventoryWorkaround()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static int first(Inventory ci, ItemStack item, boolean forceDurability, boolean forceAmount)
|
public static int first(Inventory ci, ItemStack item, boolean forceDurability, boolean forceAmount)
|
||||||
{
|
{
|
||||||
return next(ci, item, 0, forceDurability, forceAmount);
|
return next(ci, item, 0, forceDurability, forceAmount);
|
||||||
|
|
|
@ -12,8 +12,12 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class ItemDb
|
public final class ItemDb
|
||||||
{
|
{
|
||||||
|
private ItemDb()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||||
private static Map<String, Integer> items = new HashMap<String, Integer>();
|
private static Map<String, Integer> items = new HashMap<String, Integer>();
|
||||||
private static Map<String, Short> durabilities = new HashMap<String, Short>();
|
private static Map<String, Short> durabilities = new HashMap<String, Short>();
|
||||||
|
@ -27,25 +31,35 @@ public class ItemDb
|
||||||
{
|
{
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
InputStream res = ItemDb.class.getResourceAsStream("/items.csv");
|
InputStream res = ItemDb.class.getResourceAsStream("/items.csv");
|
||||||
FileWriter tx = new FileWriter(file);
|
FileWriter tx = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
tx = new FileWriter(file);
|
||||||
for (int i = 0; (i = res.read()) > 0;)
|
for (int i = 0; (i = res.read()) > 0;)
|
||||||
{
|
{
|
||||||
tx.write(i);
|
tx.write(i);
|
||||||
}
|
}
|
||||||
|
tx.flush();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
tx.flush();
|
|
||||||
tx.close();
|
|
||||||
res.close();
|
res.close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tx != null)
|
||||||
|
{
|
||||||
|
tx.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
public class Jail extends BlockListener implements IConf
|
public class Jail extends BlockListener implements IConf
|
||||||
{
|
{
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private EssentialsConf config;
|
private final EssentialsConf config;
|
||||||
private Essentials ess;
|
private final IEssentials ess;
|
||||||
|
|
||||||
public Jail(Essentials ess)
|
public Jail(IEssentials ess)
|
||||||
{
|
{
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
config = new EssentialsConf(new File(ess.getDataFolder(), "jail.yml"));
|
config = new EssentialsConf(new File(ess.getDataFolder(), "jail.yml"));
|
||||||
|
@ -36,7 +36,7 @@ public class Jail extends BlockListener implements IConf
|
||||||
throw new Exception(Util.i18n("jailNotExist"));
|
throw new Exception(Util.i18n("jailNotExist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Location loc = config.getLocation(jailName.toLowerCase(), Essentials.getStatic().getServer());
|
Location loc = config.getLocation(jailName.toLowerCase(), ess.getServer());
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ import org.bukkit.event.player.PlayerListener;
|
||||||
|
|
||||||
public class JailPlayerListener extends PlayerListener
|
public class JailPlayerListener extends PlayerListener
|
||||||
{
|
{
|
||||||
private final Essentials ess;
|
private final IEssentials ess;
|
||||||
|
|
||||||
public JailPlayerListener(Essentials parent)
|
public JailPlayerListener(IEssentials parent)
|
||||||
{
|
{
|
||||||
this.ess = parent;
|
this.ess = parent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import net.minecraft.server.Entity;
|
import net.minecraft.server.Entity;
|
||||||
import net.minecraft.server.WorldServer;
|
import net.minecraft.server.WorldServer;
|
||||||
|
@ -68,7 +70,7 @@ public enum Mob
|
||||||
public Enemies type;
|
public Enemies type;
|
||||||
private String entityClass;
|
private String entityClass;
|
||||||
private String craftClass;
|
private String craftClass;
|
||||||
private static final HashMap<String, Mob> hashMap = new HashMap<String, Mob>();
|
private static final Map<String, Mob> hashMap = new HashMap<String, Mob>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
|
@ -93,9 +95,8 @@ public enum Mob
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.warning(Util.i18n("unableToSpawnMob"));
|
logger.log(Level.WARNING, Util.i18n("unableToSpawnMob"), ex);
|
||||||
ex.printStackTrace();
|
throw new MobException(ex);
|
||||||
throw new MobException();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +115,14 @@ public enum Mob
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class MobException extends Exception
|
public static class MobException extends Exception
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private MobException(Exception ex)
|
||||||
|
{
|
||||||
|
super(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Mob fromName(String n)
|
public static Mob fromName(String n)
|
||||||
|
|
|
@ -4,24 +4,27 @@ import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
import net.minecraft.server.EntityPlayer;
|
import net.minecraft.server.EntityPlayer;
|
||||||
import net.minecraft.server.IInventory;
|
import net.minecraft.server.IInventory;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class PlayerExtension extends PlayerWrapper
|
public class PlayerExtension extends PlayerWrapper
|
||||||
{
|
{
|
||||||
public PlayerExtension(Player base)
|
protected final IEssentials ess;
|
||||||
|
|
||||||
|
public PlayerExtension(Player base, IEssentials ess)
|
||||||
{
|
{
|
||||||
super(base);
|
super(base);
|
||||||
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBanned()
|
public boolean isBanned()
|
||||||
{
|
{
|
||||||
return Essentials.getStatic().bans.contains(getName());
|
return ess.getBans().contains(getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIpBanned()
|
public boolean isIpBanned()
|
||||||
{
|
{
|
||||||
return Essentials.getStatic().bannedIps.contains(getAddress().getAddress().toString().replace("/", ""));
|
return ess.getBannedIps().contains(getAddress().getAddress().toString().replace("/", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCorrectedYaw()
|
public float getCorrectedYaw()
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
public class Settings implements IConf
|
public class Settings implements IConf
|
||||||
{
|
{
|
||||||
private EssentialsConf config;
|
private final EssentialsConf config;
|
||||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public Settings(File dataFolder)
|
public Settings(File dataFolder)
|
||||||
|
@ -58,7 +60,7 @@ public class Settings implements IConf
|
||||||
return isNetherEnabled() && config.getBoolean("nether.portals-enabled", false);
|
return isNetherEnabled() && config.getBoolean("nether.portals-enabled", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCommandDisabled(IEssentialsCommand cmd)
|
public boolean isCommandDisabled(final IEssentialsCommand cmd)
|
||||||
{
|
{
|
||||||
return isCommandDisabled(cmd.getName());
|
return isCommandDisabled(cmd.getName());
|
||||||
}
|
}
|
||||||
|
@ -121,7 +123,7 @@ public class Settings implements IConf
|
||||||
|
|
||||||
public String getNicknamePrefix()
|
public String getNicknamePrefix()
|
||||||
{
|
{
|
||||||
return config.getString("nickname-prefix", "");
|
return config.getString("nickname-prefix", "~");
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getTeleportCooldown()
|
public double getTeleportCooldown()
|
||||||
|
@ -145,6 +147,11 @@ public class Settings implements IConf
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getKits()
|
||||||
|
{
|
||||||
|
return (Map<String, Object>)config.getProperty("kits");
|
||||||
|
}
|
||||||
|
|
||||||
public ChatColor getOperatorColor() throws Exception
|
public ChatColor getOperatorColor() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -191,9 +198,9 @@ public class Settings implements IConf
|
||||||
return config.getBoolean("non-ess-in-help", true);
|
return config.getBoolean("non-ess-in-help", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Boolean> getEpSettings()
|
public Map<String, Boolean> getEpSettings()
|
||||||
{
|
{
|
||||||
HashMap<String, Boolean> epSettings = new HashMap<String, Boolean>();
|
Map<String, Boolean> epSettings = new HashMap<String, Boolean>();
|
||||||
|
|
||||||
epSettings.put("protect.protect.signs", config.getBoolean("protect.protect.signs", true));
|
epSettings.put("protect.protect.signs", config.getBoolean("protect.protect.signs", true));
|
||||||
epSettings.put("protect.protect.rails", config.getBoolean("protect.protect.rails", true));
|
epSettings.put("protect.protect.rails", config.getBoolean("protect.protect.rails", true));
|
||||||
|
@ -202,9 +209,9 @@ public class Settings implements IConf
|
||||||
return epSettings;
|
return epSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, String> getEpDBSettings()
|
public Map<String, String> getEpDBSettings()
|
||||||
{
|
{
|
||||||
HashMap<String, String> epSettings = new HashMap<String, String>();
|
Map<String, String> epSettings = new HashMap<String, String>();
|
||||||
epSettings.put("protect.datatype", config.getString("protect.datatype", "sqlite"));
|
epSettings.put("protect.datatype", config.getString("protect.datatype", "sqlite"));
|
||||||
epSettings.put("protect.username", config.getString("protect.username", "root"));
|
epSettings.put("protect.username", config.getString("protect.username", "root"));
|
||||||
epSettings.put("protect.password", config.getString("protect.password", "root"));
|
epSettings.put("protect.password", config.getString("protect.password", "root"));
|
||||||
|
@ -212,9 +219,9 @@ public class Settings implements IConf
|
||||||
return epSettings;
|
return epSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> getEpAlertOnPlacement()
|
public List<Integer> getEpAlertOnPlacement()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> epAlertPlace = new ArrayList<Integer>();
|
final List<Integer> epAlertPlace = new ArrayList<Integer>();
|
||||||
for (String itemName : config.getString("protect.alert.on-placement", "").split(",")) {
|
for (String itemName : config.getString("protect.alert.on-placement", "").split(",")) {
|
||||||
itemName = itemName.trim();
|
itemName = itemName.trim();
|
||||||
if (itemName.isEmpty()) {
|
if (itemName.isEmpty()) {
|
||||||
|
@ -231,9 +238,9 @@ public class Settings implements IConf
|
||||||
return epAlertPlace;
|
return epAlertPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> getEpAlertOnUse()
|
public List<Integer> getEpAlertOnUse()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> epAlertUse = new ArrayList<Integer>();
|
final List<Integer> epAlertUse = new ArrayList<Integer>();
|
||||||
for (String itemName : config.getString("protect.alert.on-use", "").split(",")) {
|
for (String itemName : config.getString("protect.alert.on-use", "").split(",")) {
|
||||||
itemName = itemName.trim();
|
itemName = itemName.trim();
|
||||||
if (itemName.isEmpty()) {
|
if (itemName.isEmpty()) {
|
||||||
|
@ -250,9 +257,9 @@ public class Settings implements IConf
|
||||||
return epAlertUse;
|
return epAlertUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> getEpAlertOnBreak()
|
public List<Integer> getEpAlertOnBreak()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> epAlertPlace = new ArrayList<Integer>();
|
final List<Integer> epAlertPlace = new ArrayList<Integer>();
|
||||||
for (String itemName : config.getString("protect.alert.on-break", "").split(",")) {
|
for (String itemName : config.getString("protect.alert.on-break", "").split(",")) {
|
||||||
itemName = itemName.trim();
|
itemName = itemName.trim();
|
||||||
if (itemName.isEmpty()) {
|
if (itemName.isEmpty()) {
|
||||||
|
@ -269,9 +276,9 @@ public class Settings implements IConf
|
||||||
return epAlertPlace;
|
return epAlertPlace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> epBlackListPlacement()
|
public List<Integer> epBlackListPlacement()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> epBlacklistPlacement = new ArrayList<Integer>();
|
final List<Integer> epBlacklistPlacement = new ArrayList<Integer>();
|
||||||
for (String itemName : config.getString("protect.blacklist.placement", "").split(",")) {
|
for (String itemName : config.getString("protect.blacklist.placement", "").split(",")) {
|
||||||
itemName = itemName.trim();
|
itemName = itemName.trim();
|
||||||
if (itemName.isEmpty()) {
|
if (itemName.isEmpty()) {
|
||||||
|
@ -288,9 +295,9 @@ public class Settings implements IConf
|
||||||
return epBlacklistPlacement;
|
return epBlacklistPlacement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Integer> epBlackListUsage()
|
public List<Integer> epBlackListUsage()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> epBlackListUsage = new ArrayList<Integer>();
|
final List<Integer> epBlackListUsage = new ArrayList<Integer>();
|
||||||
for (String itemName : config.getString("protect.blacklist.usage", "").split(",")) {
|
for (String itemName : config.getString("protect.blacklist.usage", "").split(",")) {
|
||||||
itemName = itemName.trim();
|
itemName = itemName.trim();
|
||||||
if (itemName.isEmpty()) {
|
if (itemName.isEmpty()) {
|
||||||
|
@ -307,9 +314,9 @@ public class Settings implements IConf
|
||||||
return epBlackListUsage;
|
return epBlackListUsage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Boolean> getEpGuardSettings()
|
public Map<String, Boolean> getEpGuardSettings()
|
||||||
{
|
{
|
||||||
HashMap<String, Boolean> epSettings = new HashMap<String, Boolean>();
|
final Map<String, Boolean> epSettings = new HashMap<String, Boolean>();
|
||||||
epSettings.put("protect.prevent.lava-flow", config.getBoolean("protect.prevent.lava-flow", false));
|
epSettings.put("protect.prevent.lava-flow", config.getBoolean("protect.prevent.lava-flow", false));
|
||||||
epSettings.put("protect.prevent.water-flow", config.getBoolean("protect.prevent.water-flow", false));
|
epSettings.put("protect.prevent.water-flow", config.getBoolean("protect.prevent.water-flow", false));
|
||||||
epSettings.put("protect.prevent.water-bucket-flow", config.getBoolean("protect.prevent.water-bucket-flow", false));
|
epSettings.put("protect.prevent.water-bucket-flow", config.getBoolean("protect.prevent.water-bucket-flow", false));
|
||||||
|
@ -323,16 +330,16 @@ public class Settings implements IConf
|
||||||
epSettings.put("protect.prevent.creeper-blockdamage", config.getBoolean("protect.prevent.creeper-blockdamage", false));
|
epSettings.put("protect.prevent.creeper-blockdamage", config.getBoolean("protect.prevent.creeper-blockdamage", false));
|
||||||
epSettings.put("protect.prevent.entitytarget", config.getBoolean("protect.prevent.entitytarget", false));
|
epSettings.put("protect.prevent.entitytarget", config.getBoolean("protect.prevent.entitytarget", false));
|
||||||
for (CreatureType ct : CreatureType.values()) {
|
for (CreatureType ct : CreatureType.values()) {
|
||||||
String name = ct.toString().toLowerCase();
|
final String name = ct.toString().toLowerCase();
|
||||||
epSettings.put("protect.prevent.spawn."+name, config.getBoolean("protect.prevent.spawn."+name, false));
|
epSettings.put("protect.prevent.spawn."+name, config.getBoolean("protect.prevent.spawn."+name, false));
|
||||||
}
|
}
|
||||||
epSettings.put("protect.prevent.lightning-fire-spread", config.getBoolean("protect.prevent.lightning-fire-spread", true));
|
epSettings.put("protect.prevent.lightning-fire-spread", config.getBoolean("protect.prevent.lightning-fire-spread", true));
|
||||||
return epSettings;
|
return epSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Boolean> getEpPlayerSettings()
|
public Map<String, Boolean> getEpPlayerSettings()
|
||||||
{
|
{
|
||||||
HashMap<String, Boolean> epPlayerSettings = new HashMap<String, Boolean>();
|
final Map<String, Boolean> epPlayerSettings = new HashMap<String, Boolean>();
|
||||||
epPlayerSettings.put("protect.disable.fall", config.getBoolean("protect.disable.fall", false));
|
epPlayerSettings.put("protect.disable.fall", config.getBoolean("protect.disable.fall", false));
|
||||||
epPlayerSettings.put("protect.disable.pvp", config.getBoolean("protect.disable.pvp", false));
|
epPlayerSettings.put("protect.disable.pvp", config.getBoolean("protect.disable.pvp", false));
|
||||||
epPlayerSettings.put("protect.disable.drown", config.getBoolean("protect.disable.drown", false));
|
epPlayerSettings.put("protect.disable.drown", config.getBoolean("protect.disable.drown", false));
|
||||||
|
@ -386,12 +393,12 @@ public class Settings implements IConf
|
||||||
return !config.getString("newbies.announce-format", "-").isEmpty();
|
return !config.getString("newbies.announce-format", "-").isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAnnounceNewPlayerFormat(User user)
|
public String getAnnounceNewPlayerFormat(IUser user)
|
||||||
{
|
{
|
||||||
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
|
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String format(String format, User user)
|
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());
|
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());
|
||||||
}
|
}
|
||||||
|
@ -499,4 +506,14 @@ public class Settings implements IConf
|
||||||
{
|
{
|
||||||
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
|
return config.getString("currency-symbol", "$").substring(0, 1).replaceAll("[0-9]", "$");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTradeInStacks(int id)
|
||||||
|
{
|
||||||
|
return config.getBoolean("trade-in-stacks-" + id, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEcoDisabled()
|
||||||
|
{
|
||||||
|
return config.getBoolean("disable-eco", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.bukkit.World.Environment;
|
||||||
public class Spawn implements IConf {
|
public class Spawn implements IConf {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private EssentialsConf config;
|
private final EssentialsConf config;
|
||||||
private Server server;
|
private final Server server;
|
||||||
|
|
||||||
public Spawn(Server server, File dataFolder) {
|
public Spawn(Server server, File dataFolder) {
|
||||||
File configFile = new File(dataFolder, "spawn.yml");
|
File configFile = new File(dataFolder, "spawn.yml");
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class TargetBlock {
|
||||||
private Vector targetPos = new Vector();
|
private Vector targetPos = new Vector();
|
||||||
private Vector targetPosDouble = new Vector();
|
private Vector targetPosDouble = new Vector();
|
||||||
private Vector prevPos = new Vector();
|
private Vector prevPos = new Vector();
|
||||||
private Vector offset = new Vector();
|
private final Vector offset = new Vector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor requiring a player, uses default values
|
* Constructor requiring a player, uses default values
|
||||||
|
|
|
@ -12,17 +12,19 @@ public class Teleport implements Runnable
|
||||||
{
|
{
|
||||||
private static class Target
|
private static class Target
|
||||||
{
|
{
|
||||||
private Location location = null;
|
private final Location location;
|
||||||
private Entity entity = null;
|
private final Entity entity;
|
||||||
|
|
||||||
public Target(Location location)
|
public Target(Location location)
|
||||||
{
|
{
|
||||||
this.location = location;
|
this.location = location;
|
||||||
|
this.entity = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Target(Entity entity)
|
public Target(Entity entity)
|
||||||
{
|
{
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
|
this.location = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getLocation()
|
public Location getLocation()
|
||||||
|
@ -34,7 +36,7 @@ public class Teleport implements Runnable
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
User user;
|
private IUser user;
|
||||||
private int teleTimer = -1;
|
private int teleTimer = -1;
|
||||||
private long started; // time this task was initiated
|
private long started; // time this task was initiated
|
||||||
private long delay; // how long to delay the teleport
|
private long delay; // how long to delay the teleport
|
||||||
|
@ -47,7 +49,7 @@ public class Teleport implements Runnable
|
||||||
private long initZ;
|
private long initZ;
|
||||||
private Target teleportTarget;
|
private Target teleportTarget;
|
||||||
private Charge chargeFor;
|
private Charge chargeFor;
|
||||||
private Essentials ess;
|
private final IEssentials ess;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
private void initTimer(long delay, Target target, Charge chargeFor)
|
private void initTimer(long delay, Target target, Charge chargeFor)
|
||||||
|
@ -114,7 +116,7 @@ public class Teleport implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Teleport(User user, Essentials ess)
|
public Teleport(IUser user, IEssentials ess)
|
||||||
{
|
{
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
|
@ -127,7 +129,7 @@ public class Teleport implements Runnable
|
||||||
|
|
||||||
public void warp(String warp, Charge chargeFor) throws Exception
|
public void warp(String warp, Charge chargeFor) throws Exception
|
||||||
{
|
{
|
||||||
Location loc = Essentials.getWarps().getWarp(warp);
|
Location loc = ess.getWarps().getWarp(warp);
|
||||||
teleport(new Target(loc), chargeFor);
|
teleport(new Target(loc), chargeFor);
|
||||||
user.sendMessage(Util.format("warpingTo", warp));
|
user.sendMessage(Util.format("warpingTo", warp));
|
||||||
}
|
}
|
||||||
|
@ -162,7 +164,7 @@ public class Teleport implements Runnable
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
user.getServer().getScheduler().cancelTask(teleTimer);
|
ess.getServer().getScheduler().cancelTask(teleTimer);
|
||||||
if (notifyUser)
|
if (notifyUser)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("pendingTeleportCancelled"));
|
user.sendMessage(Util.i18n("pendingTeleportCancelled"));
|
||||||
|
@ -193,7 +195,10 @@ public class Teleport implements Runnable
|
||||||
{
|
{
|
||||||
double delay = ess.getSettings().getTeleportDelay();
|
double delay = ess.getSettings().getTeleportDelay();
|
||||||
|
|
||||||
chargeFor.isAffordableFor(user);
|
if (chargeFor != null)
|
||||||
|
{
|
||||||
|
chargeFor.isAffordableFor(user);
|
||||||
|
}
|
||||||
cooldown(true);
|
cooldown(true);
|
||||||
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
|
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
|
||||||
{
|
{
|
||||||
|
@ -213,7 +218,7 @@ public class Teleport implements Runnable
|
||||||
user.sendMessage(Util.format("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
|
user.sendMessage(Util.format("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
|
||||||
initTimer((long)(delay * 1000.0), target, chargeFor);
|
initTimer((long)(delay * 1000.0), target, chargeFor);
|
||||||
|
|
||||||
teleTimer = user.getServer().getScheduler().scheduleSyncRepeatingTask(Essentials.getStatic(), this, 10, 10);
|
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void now(Target target) throws Exception
|
private void now(Target target) throws Exception
|
||||||
|
@ -242,7 +247,7 @@ public class Teleport implements Runnable
|
||||||
now(new Target(entity));
|
now(new Target(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void back(final Charge chargeFor) throws Exception
|
public void back(Charge chargeFor) throws Exception
|
||||||
{
|
{
|
||||||
teleport(new Target(user.getLastLocation()), chargeFor);
|
teleport(new Target(user.getLastLocation()), chargeFor);
|
||||||
}
|
}
|
||||||
|
@ -257,14 +262,14 @@ public class Teleport implements Runnable
|
||||||
home(user, chargeFor);
|
home(user, chargeFor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void home(User user, Charge chargeFor) throws Exception
|
public void home(IUser user, Charge chargeFor) throws Exception
|
||||||
{
|
{
|
||||||
Location loc = user.getHome(this.user.getLocation());
|
Location loc = user.getHome(this.user.getLocation());
|
||||||
if (loc == null)
|
if (loc == null)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().spawnIfNoHome())
|
if (ess.getSettings().spawnIfNoHome())
|
||||||
{
|
{
|
||||||
respawn(Essentials.getSpawn(), chargeFor);
|
respawn(ess.getSpawn(), chargeFor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,17 +10,17 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
public class User extends UserData implements Comparable<User>, IReplyTo
|
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
{
|
{
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private boolean justPortaled = false;
|
private boolean justPortaled = false;
|
||||||
private CommandSender replyTo = null;
|
private CommandSender replyTo = null;
|
||||||
private User teleportRequester;
|
private User teleportRequester;
|
||||||
private boolean teleportRequestHere;
|
private boolean teleportRequestHere;
|
||||||
private Teleport teleport;
|
private final Teleport teleport;
|
||||||
private long lastActivity;
|
private long lastActivity;
|
||||||
|
|
||||||
User(Player base, Essentials ess)
|
User(Player base, IEssentials ess)
|
||||||
{
|
{
|
||||||
super(base, ess);
|
super(base, ess);
|
||||||
teleport = new Teleport(this, ess);
|
teleport = new Teleport(this, ess);
|
||||||
|
@ -120,14 +120,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo
|
||||||
public boolean canAfford(double cost)
|
public boolean canAfford(double cost)
|
||||||
{
|
{
|
||||||
double mon = getMoney();
|
double mon = getMoney();
|
||||||
if (mon < cost && !isAuthorized("essentials.eco.loan"))
|
return mon >= cost || isAuthorized("essentials.eco.loan");
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
|
@ -160,6 +153,23 @@ public class User extends UserData implements Comparable<User>, IReplyTo
|
||||||
return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(t.getDisplayName()));
|
return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(t.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o)
|
||||||
|
{
|
||||||
|
if (!(o instanceof User))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User) o).getDisplayName()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return ChatColor.stripColor(this.getDisplayName()).hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean canSpawnItem(int itemId)
|
public Boolean canSpawnItem(int itemId)
|
||||||
{
|
{
|
||||||
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
|
return !ess.getSettings().itemSpawnBlacklist().contains(itemId);
|
||||||
|
|
|
@ -16,14 +16,12 @@ import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public abstract class UserData extends PlayerExtension implements IConf
|
public abstract class UserData extends PlayerExtension implements IConf
|
||||||
{
|
{
|
||||||
private EssentialsConf config;
|
private final EssentialsConf config;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
protected Essentials ess;
|
|
||||||
|
|
||||||
protected UserData(Player base, Essentials ess)
|
protected UserData(Player base, IEssentials ess)
|
||||||
{
|
{
|
||||||
super(base);
|
super(base, ess);
|
||||||
this.ess = ess;
|
|
||||||
File folder = new File(ess.getDataFolder(), "userdata");
|
File folder = new File(ess.getDataFolder(), "userdata");
|
||||||
if (!folder.exists())
|
if (!folder.exists())
|
||||||
{
|
{
|
||||||
|
@ -61,7 +59,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
isNPC = _isNPC();
|
isNPC = _isNPC();
|
||||||
}
|
}
|
||||||
|
|
||||||
double money;
|
private double money;
|
||||||
|
|
||||||
private double _getMoney() {
|
private double _getMoney() {
|
||||||
if (config.hasProperty("money"))
|
if (config.hasProperty("money"))
|
||||||
|
@ -175,7 +173,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
private Map<Integer, String> getPowertools()
|
private Map<Integer, String> getPowertools()
|
||||||
{
|
{
|
||||||
Object o = config.getProperty("powertools");
|
Object o = config.getProperty("powertools");
|
||||||
if (o != null && o instanceof Map)
|
if (o instanceof Map)
|
||||||
{
|
{
|
||||||
return (Map<Integer, String>)o;
|
return (Map<Integer, String>)o;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +700,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
return isNPC;
|
return isNPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNPC(boolean set)
|
public void setNPC(boolean set)
|
||||||
{
|
{
|
||||||
isNPC = set;
|
isNPC = set;
|
||||||
config.setProperty("npc", set);
|
config.setProperty("npc", set);
|
||||||
|
|
|
@ -29,8 +29,11 @@ import org.bukkit.block.Block;
|
||||||
|
|
||||||
public class Util
|
public class Util
|
||||||
{
|
{
|
||||||
|
private Util()
|
||||||
|
{
|
||||||
|
}
|
||||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
public static String sanitizeFileName(String name)
|
public static String sanitizeFileName(String name)
|
||||||
{
|
{
|
||||||
return name.toLowerCase().replaceAll("[^a-z0-9]", "_");
|
return name.toLowerCase().replaceAll("[^a-z0-9]", "_");
|
||||||
|
@ -97,7 +100,7 @@ public class Util
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
|
private static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
|
||||||
{
|
{
|
||||||
int diff = 0;
|
int diff = 0;
|
||||||
long savedDate = fromDate.getTimeInMillis();
|
long savedDate = fromDate.getTimeInMillis();
|
||||||
while ((future && !fromDate.after(toDate)) || (!future && !fromDate.before(toDate)))
|
while ((future && !fromDate.after(toDate)) || (!future && !fromDate.before(toDate)))
|
||||||
|
@ -296,11 +299,16 @@ public class Util
|
||||||
return Math.round(d * 100.0) / 100.0;
|
return Math.round(d * 100.0) / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Locale getCurrentLocale()
|
||||||
|
{
|
||||||
|
return currentLocale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class ConfigClassLoader extends ClassLoader
|
private static class ConfigClassLoader extends ClassLoader
|
||||||
{
|
{
|
||||||
private File dataFolder;
|
private final File dataFolder;
|
||||||
private ClassLoader cl;
|
private final ClassLoader cl;
|
||||||
|
|
||||||
public ConfigClassLoader(File dataFolder, ClassLoader cl)
|
public ConfigClassLoader(File dataFolder, ClassLoader cl)
|
||||||
{
|
{
|
||||||
|
@ -389,16 +397,17 @@ public class Util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static final Locale defaultLocale = Locale.getDefault();
|
private static final Locale defaultLocale = Locale.getDefault();
|
||||||
public static Locale currentLocale = defaultLocale;
|
private static Locale currentLocale = defaultLocale;
|
||||||
private static ResourceBundle bundle = ResourceBundle.getBundle("messages", defaultLocale);
|
private static ResourceBundle bundle = ResourceBundle.getBundle("messages", defaultLocale);
|
||||||
private static ResourceBundle defaultBundle = ResourceBundle.getBundle("messages", Locale.US);
|
private static ResourceBundle defaultBundle = ResourceBundle.getBundle("messages", Locale.US);
|
||||||
|
|
||||||
public static String i18n(String string)
|
public static String i18n(String string)
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
return bundle.getString(string);
|
return bundle.getString(string);
|
||||||
}
|
}
|
||||||
catch (MissingResourceException ex)
|
catch (MissingResourceException ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), bundle.getLocale().toString()), ex);
|
logger.log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), bundle.getLocale().toString()), ex);
|
||||||
return defaultBundle.getString(string);
|
return defaultBundle.getString(string);
|
||||||
|
@ -432,7 +441,8 @@ public class Util
|
||||||
}
|
}
|
||||||
logger.log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
|
logger.log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
|
||||||
bundle = ResourceBundle.getBundle("messages", currentLocale, new ConfigClassLoader(dataFolder, Util.class.getClassLoader()));
|
bundle = ResourceBundle.getBundle("messages", currentLocale, new ConfigClassLoader(dataFolder, Util.class.getClassLoader()));
|
||||||
if (!bundle.keySet().containsAll(defaultBundle.keySet())) {
|
if (!bundle.keySet().containsAll(defaultBundle.keySet()))
|
||||||
|
{
|
||||||
logger.log(Level.WARNING, String.format("Translation file %s does not contain all translation keys.", currentLocale.toString()));
|
logger.log(Level.WARNING, String.format("Translation file %s does not contain all translation keys.", currentLocale.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ import org.bukkit.Server;
|
||||||
public class Warps implements IConf
|
public class Warps implements IConf
|
||||||
{
|
{
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
Map<StringIgnoreCase, EssentialsConf> warpPoints = new HashMap<StringIgnoreCase, EssentialsConf>();
|
private final Map<StringIgnoreCase, EssentialsConf> warpPoints = new HashMap<StringIgnoreCase, EssentialsConf>();
|
||||||
File warpsFolder;
|
private final File warpsFolder;
|
||||||
Server server;
|
private final Server server;
|
||||||
|
|
||||||
public Warps(Server server, File dataFolder)
|
public Warps(Server server, File dataFolder)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ public class Warps implements IConf
|
||||||
List<String> keys = new ArrayList<String>();
|
List<String> keys = new ArrayList<String>();
|
||||||
for (StringIgnoreCase stringIgnoreCase : warpPoints.keySet())
|
for (StringIgnoreCase stringIgnoreCase : warpPoints.keySet())
|
||||||
{
|
{
|
||||||
keys.add(stringIgnoreCase.string);
|
keys.add(stringIgnoreCase.getString());
|
||||||
}
|
}
|
||||||
Collections.sort(keys, String.CASE_INSENSITIVE_ORDER);
|
Collections.sort(keys, String.CASE_INSENSITIVE_ORDER);
|
||||||
return keys;
|
return keys;
|
||||||
|
@ -120,9 +120,9 @@ public class Warps implements IConf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class StringIgnoreCase
|
private static class StringIgnoreCase
|
||||||
{
|
{
|
||||||
String string;
|
private final String string;
|
||||||
|
|
||||||
public StringIgnoreCase(String string)
|
public StringIgnoreCase(String string)
|
||||||
{
|
{
|
||||||
|
@ -132,21 +132,22 @@ public class Warps implements IConf
|
||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
return string.toLowerCase().hashCode();
|
return getString().toLowerCase().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o)
|
public boolean equals(Object o)
|
||||||
{
|
{
|
||||||
if (o instanceof String)
|
|
||||||
{
|
|
||||||
return string.equalsIgnoreCase((String)o);
|
|
||||||
}
|
|
||||||
if (o instanceof StringIgnoreCase)
|
if (o instanceof StringIgnoreCase)
|
||||||
{
|
{
|
||||||
return string.equalsIgnoreCase(((StringIgnoreCase)o).string);
|
return getString().equalsIgnoreCase(((StringIgnoreCase)o).getString());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getString()
|
||||||
|
{
|
||||||
|
return string;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack;
|
||||||
public class Worth implements IConf
|
public class Worth implements IConf
|
||||||
{
|
{
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private EssentialsConf config;
|
private final EssentialsConf config;
|
||||||
|
|
||||||
public Worth(File dataFolder)
|
public Worth(File dataFolder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,11 @@ import org.bukkit.entity.Player;
|
||||||
* Instead of using this api directly, we recommend to use the register plugin:
|
* Instead of using this api directly, we recommend to use the register plugin:
|
||||||
* http://bit.ly/RegisterMethod
|
* http://bit.ly/RegisterMethod
|
||||||
*/
|
*/
|
||||||
public class Economy
|
public final class Economy
|
||||||
{
|
{
|
||||||
|
private Economy()
|
||||||
|
{
|
||||||
|
}
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
private static void createNPCFile(String name)
|
private static void createNPCFile(String name)
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class Commandback extends EssentialsCommand
|
||||||
@Override
|
@Override
|
||||||
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.sendMessage(Util.i18n("backUsageMsg"));
|
user.sendMessage(Util.i18n("backUsageMsg"));
|
||||||
user.getTeleport().back(charge);
|
user.getTeleport().back(charge);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Backup;
|
import com.earth2me.essentials.Backup;
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -17,7 +16,7 @@ public class Commandbackup extends EssentialsCommand
|
||||||
@Override
|
@Override
|
||||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
Backup backup = Essentials.getBackup();
|
Backup backup = ess.getBackup();
|
||||||
if (backup == null)
|
if (backup == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class Commandbigtree extends EssentialsCommand
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
Object tree = new Object();
|
TreeType tree = TreeType.TREE;
|
||||||
if (args.length > 0 && args[0].equalsIgnoreCase("redwood"))
|
if (args.length > 0 && args[0].equalsIgnoreCase("redwood"))
|
||||||
{
|
{
|
||||||
tree = TreeType.TALL_REDWOOD;
|
tree = TreeType.TALL_REDWOOD;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -18,7 +17,7 @@ public class Commanddeljail extends EssentialsCommand {
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
charge(sender);
|
charge(sender);
|
||||||
Essentials.getJail().delJail(args[0]);
|
ess.getJail().delJail(args[0]);
|
||||||
sender.sendMessage(Util.format("deleteJail", args[0]));
|
sender.sendMessage(Util.format("deleteJail", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ public class Commanddelwarp extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
charge(sender);
|
charge(sender);
|
||||||
Essentials.getWarps().delWarp(args[0]);
|
ess.getWarps().delWarp(args[0]);
|
||||||
sender.sendMessage(Util.format("deleteWarp", args[0]));
|
sender.sendMessage(Util.format("deleteWarp", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class Commandeco extends EssentialsCommand
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[1].contentEquals("*"))
|
if (args[1].contentEquals("*"))
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,10 +72,18 @@ public class Commandhelp extends EssentialsCommand
|
||||||
}
|
}
|
||||||
if (helpFile.exists())
|
if (helpFile.exists())
|
||||||
{
|
{
|
||||||
BufferedReader rx = new BufferedReader(new FileReader(helpFile));
|
final BufferedReader bufferedReader = new BufferedReader(new FileReader(helpFile));
|
||||||
for (String l = null; rx.ready() && (l = rx.readLine()) != null;)
|
try {
|
||||||
|
|
||||||
|
while (bufferedReader.ready())
|
||||||
|
{
|
||||||
|
final String line = bufferedReader.readLine();
|
||||||
|
retval.add(line.replace('&', '§'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
{
|
{
|
||||||
retval.add(l.replace('&', '§'));
|
bufferedReader.close();
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -85,17 +94,16 @@ public class Commandhelp extends EssentialsCommand
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PluginDescriptionFile desc = p.getDescription();
|
final PluginDescriptionFile desc = p.getDescription();
|
||||||
HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands();
|
final HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands();
|
||||||
for (String k : cmds.keySet())
|
for (Entry<String, HashMap<String, String>> k : cmds.entrySet())
|
||||||
{
|
{
|
||||||
if (p.getDescription().getName().toLowerCase().contains("essentials"))
|
if (p.getDescription().getName().toLowerCase().contains("essentials"))
|
||||||
{
|
{
|
||||||
String node = "essentials." + k;
|
final String node = "essentials." + k.getKey();
|
||||||
if (!ess.getSettings().isCommandDisabled(k) && user.isAuthorized(node))
|
if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node))
|
||||||
{
|
{
|
||||||
HashMap<String, String> v = cmds.get(k);
|
retval.add("§c" + k.getKey() + "§7: " + k.getValue().get("description"));
|
||||||
retval.add("§c" + k + "§7: " + v.get("description"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -103,17 +111,17 @@ public class Commandhelp extends EssentialsCommand
|
||||||
if (ess.getSettings().showNonEssCommandsInHelp())
|
if (ess.getSettings().showNonEssCommandsInHelp())
|
||||||
{
|
{
|
||||||
pluginName = p.getDescription().getName();
|
pluginName = p.getDescription().getName();
|
||||||
HashMap<String, String> v = cmds.get(k);
|
final HashMap<String, String> value = k.getValue();
|
||||||
if (v.containsKey("permission") && v.get("permission") != null && !(v.get("permission").equals("")))
|
if (value.containsKey("permission") && value.get("permission") != null && !(value.get("permission").equals("")))
|
||||||
{
|
{
|
||||||
if (user.isAuthorized(v.get("permission")))
|
if (user.isAuthorized(value.get("permission")))
|
||||||
{
|
{
|
||||||
retval.add("§c" + k + "§7: " + v.get("description"));
|
retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retval.add("§c" + k + "§7: " + v.get("description"));
|
retval.add("§c" + k.getKey() + "§7: " + value.get("description"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,10 +136,7 @@ public class Commandhelp extends EssentialsCommand
|
||||||
{
|
{
|
||||||
if (!reported)
|
if (!reported)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, "Error getting help for:" + pluginName);
|
logger.log(Level.WARNING, "Error getting help for:" + pluginName, ex);
|
||||||
ex.printStackTrace();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
reported = true;
|
reported = true;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class Commandhome extends EssentialsCommand
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
if(args.length > 0 && user.isAuthorized("essentials.home.others"))
|
if(args.length > 0 && user.isAuthorized("essentials.home.others"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,16 +45,25 @@ public class Commandinfo extends EssentialsCommand
|
||||||
}
|
}
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
BufferedReader rx = new BufferedReader(new FileReader(file));
|
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||||
int i = 0;
|
try
|
||||||
for (String l = null; rx.ready() && (l = rx.readLine()) != null; i++)
|
|
||||||
{
|
{
|
||||||
if (l.startsWith("#"))
|
int lineNumber = 0;
|
||||||
|
while (bufferedReader.ready())
|
||||||
{
|
{
|
||||||
bookmarks.put(l.substring(1).toLowerCase().replaceAll("&[0-9a-f]", ""), i);
|
final String line = bufferedReader.readLine();
|
||||||
chapters.add(l.substring(1).replace('&', '§'));
|
if (line.length() > 0 && line.charAt(0) == '#')
|
||||||
|
{
|
||||||
|
bookmarks.put(line.substring(1).toLowerCase().replaceAll("&[0-9a-f]", ""), lineNumber);
|
||||||
|
chapters.add(line.substring(1).replace('&', '§'));
|
||||||
|
}
|
||||||
|
lines.add(line.replace('&', '§'));
|
||||||
|
lineNumber++;
|
||||||
}
|
}
|
||||||
lines.add(l.replace('&', '§'));
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
bufferedReader.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ public class Commandjails extends EssentialsCommand
|
||||||
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
StringBuilder jailList = new StringBuilder();
|
StringBuilder jailList = new StringBuilder();
|
||||||
for (String j : Essentials.getJail().getJails())
|
for (String j : ess.getJail().getJails())
|
||||||
{
|
{
|
||||||
jailList.append(j);
|
jailList.append(j);
|
||||||
jailList.append(' ');
|
jailList.append(' ');
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class Commandjump extends EssentialsCommand
|
||||||
throw new Exception(Util.i18n("jumpError"), ex);
|
throw new Exception(Util.i18n("jumpError"), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getTeleport().teleport(loc, charge);
|
user.getTeleport().teleport(loc, charge);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,13 @@ public class Commandkit extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Map<String, Object> kits = (Map<String, Object>)ess.getConfiguration().getProperty("kits");
|
Map<String, Object> kits = ess.getSettings().getKits();
|
||||||
StringBuilder list = new StringBuilder();
|
StringBuilder list = new StringBuilder();
|
||||||
for (String k : kits.keySet())
|
for (String k : kits.keySet())
|
||||||
{
|
{
|
||||||
|
@ -110,7 +109,7 @@ public class Commandkit extends EssentialsCommand
|
||||||
items = (List<String>)kit;
|
items = (List<String>)kit;
|
||||||
}
|
}
|
||||||
|
|
||||||
Charge charge = new Charge("kit-" + kitName);
|
Charge charge = new Charge("kit-" + kitName, ess);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class Commandnick extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
charge(user);
|
charge(user);
|
||||||
user.setDisplayName(ess.getConfiguration().getString("nickname-prefix", "~") + nick);
|
user.setDisplayName(ess.getSettings().getNicknamePrefix() + nick);
|
||||||
user.setNickname(nick);
|
user.setNickname(nick);
|
||||||
user.sendMessage(Util.format("nickSet", user.getDisplayName() + "§7."));
|
user.sendMessage(Util.format("nickSet", user.getDisplayName() + "§7."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class Commandpowertool extends EssentialsCommand
|
||||||
if (is == null || is.getType() == Material.AIR)
|
if (is == null || is.getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("powerToolAir"));
|
user.sendMessage(Util.i18n("powerToolAir"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
String command = getFinalArg(args, 0);
|
String command = getFinalArg(args, 0);
|
||||||
if (command != null && !command.isEmpty())
|
if (command != null && !command.isEmpty())
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,9 @@ public class Commandsell extends EssentialsCommand
|
||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double worth = Essentials.getWorth().getPrice(is);
|
double worth = ess.getWorth().getPrice(is);
|
||||||
boolean stack = args.length > 1 && args[1].endsWith("s");
|
boolean stack = args.length > 1 && args[1].endsWith("s");
|
||||||
boolean requireStack = ess.getConfiguration().getBoolean("trade-in-stacks-" + id, false);
|
boolean requireStack = ess.getSettings().isTradeInStacks(id);
|
||||||
|
|
||||||
if (Double.isNaN(worth))
|
if (Double.isNaN(worth))
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class Commandsetjail extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
charge(user);
|
charge(user);
|
||||||
Essentials.getJail().setJail(user.getLocation(), args[0]);
|
ess.getJail().setJail(user.getLocation(), args[0]);
|
||||||
user.sendMessage(Util.format("jailSet",args[0]));
|
user.sendMessage(Util.format("jailSet",args[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class Commandsetwarp extends EssentialsCommand
|
||||||
|
|
||||||
charge(user);
|
charge(user);
|
||||||
Location loc = user.getLocation();
|
Location loc = user.getLocation();
|
||||||
Essentials.getWarps().setWarp(args[0], loc);
|
ess.getWarps().setWarp(args[0], loc);
|
||||||
user.sendMessage(Util.format("warpSet", args[0]));
|
user.sendMessage(Util.format("warpSet", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class Commandsetworth extends EssentialsCommand
|
||||||
|
|
||||||
ItemStack stack = ItemDb.get(args[0]);
|
ItemStack stack = ItemDb.get(args[0]);
|
||||||
charge(user);
|
charge(user);
|
||||||
Essentials.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
||||||
user.sendMessage(Util.i18n("worthSet"));
|
user.sendMessage(Util.i18n("worthSet"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class Commandspawner extends EssentialsCommand
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("mobSpawnError"));
|
throw new Exception(Util.i18n("mobSpawnError"), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,15 +173,15 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
}
|
}
|
||||||
catch (MobException e1)
|
catch (MobException e1)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(Util.i18n("unableToSpawnMob"), e1);
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e2)
|
catch (NumberFormatException e2)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("numberRequired"));
|
throw new Exception(Util.i18n("numberRequired"), e2);
|
||||||
}
|
}
|
||||||
catch (NullPointerException np)
|
catch (NullPointerException np)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("soloMob"));
|
throw new Exception(Util.i18n("soloMob"), np);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -205,7 +205,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("slimeMalformedSize"));
|
throw new Exception(Util.i18n("slimeMalformedSize"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("Sheep".equalsIgnoreCase(type))
|
if ("Sheep".equalsIgnoreCase(type))
|
||||||
|
@ -216,7 +216,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("sheepMalformedColor"));
|
throw new Exception(Util.i18n("sheepMalformedColor"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
|
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class Commandtogglejail extends EssentialsCommand
|
||||||
p.setJailed(true);
|
p.setJailed(true);
|
||||||
p.sendMessage(Util.i18n("userJailed"));
|
p.sendMessage(Util.i18n("userJailed"));
|
||||||
p.setJail(null);
|
p.setJail(null);
|
||||||
Essentials.getJail().sendToJail(p, args[1]);
|
ess.getJail().sendToJail(p, args[1]);
|
||||||
p.setJail(args[1]);
|
p.setJail(args[1]);
|
||||||
long timeDiff = 0;
|
long timeDiff = 0;
|
||||||
if (args.length > 2)
|
if (args.length > 2)
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class Commandtop extends EssentialsCommand
|
||||||
int topZ = user.getLocation().getBlockZ();
|
int topZ = user.getLocation().getBlockZ();
|
||||||
int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
|
int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
|
||||||
charge(user);
|
charge(user);
|
||||||
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Charge(this));
|
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Charge(this.getName(), ess));
|
||||||
user.sendMessage(Util.i18n("teleportTop"));
|
user.sendMessage(Util.i18n("teleportTop"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class Commandtp extends EssentialsCommand
|
||||||
throw new Exception(Util.format("teleportDisabled", p.getDisplayName()));
|
throw new Exception(Util.format("teleportDisabled", p.getDisplayName()));
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getTeleport().teleport(p, charge);
|
user.getTeleport().teleport(p, charge);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class Commandtpaccept extends EssentialsCommand
|
||||||
throw new Exception(Util.i18n("noPendingRequest"));
|
throw new Exception(Util.i18n("noPendingRequest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
if (user.isTeleportRequestHere())
|
if (user.isTeleportRequestHere())
|
||||||
{
|
{
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class Commandtphere extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("teleportDisabled", p.getDisplayName()));
|
throw new Exception(Util.format("teleportDisabled", p.getDisplayName()));
|
||||||
}
|
}
|
||||||
p.getTeleport().teleport(user, new Charge(this));
|
p.getTeleport().teleport(user, new Charge(this.getName(), ess));
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
p.sendMessage(Util.i18n("teleporting"));
|
p.sendMessage(Util.i18n("teleporting"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class Commandtppos extends EssentialsCommand
|
||||||
int y = Integer.parseInt(args[1]);
|
int y = Integer.parseInt(args[1]);
|
||||||
int z = Integer.parseInt(args[2]);
|
int z = Integer.parseInt(args[2]);
|
||||||
Location l = new Location(user.getWorld(), x, y, z);
|
Location l = new Location(user.getWorld(), x, y, z);
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(Util.i18n("teleporting"));
|
||||||
user.getTeleport().teleport(l, charge);
|
user.getTeleport().teleport(l, charge);
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Charge;
|
import com.earth2me.essentials.Charge;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import com.earth2me.essentials.Warps;
|
import com.earth2me.essentials.Warps;
|
||||||
|
@ -27,7 +26,7 @@ public class Commandwarp extends EssentialsCommand
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Warps warps = Essentials.getWarps();
|
Warps warps = ess.getWarps();
|
||||||
if (warps.isEmpty())
|
if (warps.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("noWarpsDefined"));
|
throw new Exception(Util.i18n("noWarpsDefined"));
|
||||||
|
@ -74,7 +73,7 @@ public class Commandwarp extends EssentialsCommand
|
||||||
|
|
||||||
private void warpUser(User user, String name) throws Exception
|
private void warpUser(User user, String name) throws Exception
|
||||||
{
|
{
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
if (ess.getSettings().getPerWarpPermission())
|
if (ess.getSettings().getPerWarpPermission())
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class Commandwhois extends EssentialsCommand
|
||||||
sender.sendMessage(Util.format("whoisIs", u.getDisplayName(), u.getName()));
|
sender.sendMessage(Util.format("whoisIs", u.getDisplayName(), u.getName()));
|
||||||
sender.sendMessage(Util.format("whoisHealth", u.getHealth()));
|
sender.sendMessage(Util.format("whoisHealth", u.getHealth()));
|
||||||
sender.sendMessage(Util.format("whoisLocation", u.getLocation().getWorld().getName(), u.getLocation().getBlockX(), u.getLocation().getBlockY(), u.getLocation().getBlockZ()));
|
sender.sendMessage(Util.format("whoisLocation", u.getLocation().getWorld().getName(), u.getLocation().getBlockX(), u.getLocation().getBlockY(), u.getLocation().getBlockZ()));
|
||||||
if (!ess.getConfiguration().getBoolean("disable-eco", false))
|
if (!ess.getSettings().isEcoDisabled())
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("whoisMoney", Util.formatCurrency(u.getMoney())));
|
sender.sendMessage(Util.format("whoisMoney", Util.formatCurrency(u.getMoney())));
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@ public class Commandwhois extends EssentialsCommand
|
||||||
? Util.i18n("whoisStatusAway")
|
? Util.i18n("whoisStatusAway")
|
||||||
: Util.i18n("whoisStatusAvailable"));
|
: Util.i18n("whoisStatusAvailable"));
|
||||||
sender.sendMessage(Util.format("whoisIPAddress", u.getAddress().getAddress().toString()));
|
sender.sendMessage(Util.format("whoisIPAddress", u.getAddress().getAddress().toString()));
|
||||||
String location = u.getGeoLocation();
|
final String location = u.getGeoLocation();
|
||||||
if (location != null
|
if (location != null
|
||||||
&& (sender instanceof Player ? ess.getUser(sender).isAuthorized("essentials.geoip.show") : true))
|
&& (sender instanceof Player ? ess.getUser(sender).isAuthorized("essentials.geoip.show") : true))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("whoisGeoLocation", location.toString()));
|
sender.sendMessage(Util.format("whoisGeoLocation", location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
|
||||||
|
@ -69,7 +68,7 @@ public class Commandworld extends EssentialsCommand
|
||||||
Location loc = user.getLocation();
|
Location loc = user.getLocation();
|
||||||
loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);
|
loc = new Location(world, loc.getBlockX() * factor + .5, loc.getBlockY(), loc.getBlockZ() * factor + .5);
|
||||||
|
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getTeleport().teleport(loc, charge);
|
user.getTeleport().teleport(loc, charge);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.ItemDb;
|
import com.earth2me.essentials.ItemDb;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
@ -39,7 +38,7 @@ public class Commandworth extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
is.setAmount(amount);
|
is.setAmount(amount);
|
||||||
double worth = Essentials.getWorth().getPrice(is);
|
double worth = ess.getWorth().getPrice(is);
|
||||||
if (Double.isNaN(worth))
|
if (Double.isNaN(worth))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("itemCannotBeSold"));
|
throw new Exception(Util.i18n("itemCannotBeSold"));
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.bukkit.Server;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import com.earth2me.essentials.Essentials;
|
import com.earth2me.essentials.Essentials;
|
||||||
|
import com.earth2me.essentials.IEssentials;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
@ -15,13 +16,17 @@ import java.util.logging.Logger;
|
||||||
public abstract class EssentialsCommand implements IEssentialsCommand
|
public abstract class EssentialsCommand implements IEssentialsCommand
|
||||||
{
|
{
|
||||||
private final String name;
|
private final String name;
|
||||||
protected Essentials ess;
|
protected IEssentials ess;
|
||||||
protected final static Logger logger = Logger.getLogger("Minecraft");
|
protected final static Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
protected EssentialsCommand(String name)
|
protected EssentialsCommand(String name)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.ess = Essentials.getStatic();
|
}
|
||||||
|
|
||||||
|
public void setEssentials(IEssentials ess)
|
||||||
|
{
|
||||||
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
|
@ -84,7 +89,7 @@ public abstract class EssentialsCommand implements IEssentialsCommand
|
||||||
{
|
{
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
Charge charge = new Charge(this);
|
Charge charge = new Charge(this.getName(), ess);
|
||||||
charge.charge(ess.getUser((Player)sender));
|
charge.charge(ess.getUser((Player)sender));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import com.earth2me.essentials.IEssentials;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import com.earth2me.essentials.*;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
public interface IEssentialsCommand
|
public interface IEssentialsCommand
|
||||||
|
@ -15,4 +16,6 @@ public interface IEssentialsCommand
|
||||||
|
|
||||||
void run(Server server, CommandSender sender, String commandLabel, Command cmd, String[] args)
|
void run(Server server, CommandSender sender, String commandLabel, Command cmd, String[] args)
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
|
void setEssentials(IEssentials ess);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,4 +2,14 @@ package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
public class NotEnoughArgumentsException extends Exception {
|
public class NotEnoughArgumentsException extends Exception {
|
||||||
|
|
||||||
|
public NotEnoughArgumentsException()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotEnoughArgumentsException(final Throwable ex)
|
||||||
|
{
|
||||||
|
super(ex);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.bukkit.plugin.InvalidDescriptionException;
|
||||||
|
|
||||||
public class EconomyTest extends TestCase
|
public class EconomyTest extends TestCase
|
||||||
{
|
{
|
||||||
private OfflinePlayer base1;
|
private final OfflinePlayer base1;
|
||||||
private Essentials ess;
|
private final Essentials ess;
|
||||||
|
|
||||||
public EconomyTest(String testName)
|
public EconomyTest(String testName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,18 +15,6 @@ public class EssentialsTest extends TestCase
|
||||||
System.out.println("Essentials should " + what);
|
System.out.println("Essentials should " + what);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setUp() throws Exception
|
|
||||||
{
|
|
||||||
super.setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown() throws Exception
|
|
||||||
{
|
|
||||||
super.tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testLoadClasses()
|
public void testLoadClasses()
|
||||||
{
|
{
|
||||||
should("make all classes accessible");
|
should("make all classes accessible");
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.bukkit.scheduler.BukkitScheduler;
|
||||||
public class FakeServer implements Server
|
public class FakeServer implements Server
|
||||||
{
|
{
|
||||||
private List<Player> players = new ArrayList<Player>();
|
private List<Player> players = new ArrayList<Player>();
|
||||||
private List<World> worlds = new ArrayList<World>();
|
private final List<World> worlds = new ArrayList<World>();
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
|
@ -186,12 +186,12 @@ public class FakeServer implements Server
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPlayer(Player base1)
|
public void addPlayer(Player base1)
|
||||||
{
|
{
|
||||||
players.add(base1);
|
players.add(base1);
|
||||||
}
|
}
|
||||||
|
|
||||||
OfflinePlayer createPlayer(String name)
|
public OfflinePlayer createPlayer(String name)
|
||||||
{
|
{
|
||||||
OfflinePlayer player = new OfflinePlayer(name);
|
OfflinePlayer player = new OfflinePlayer(name);
|
||||||
player.setLocation(new Location(worlds.get(0), 0, 0, 0, 0, 0));
|
player.setLocation(new Location(worlds.get(0), 0, 0, 0, 0, 0));
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.earth2me.essentials;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
|
|
||||||
public class PermissionsTest extends TestCase
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void setUp() throws Exception
|
|
||||||
{
|
|
||||||
super.setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,9 +10,9 @@ import org.bukkit.plugin.InvalidDescriptionException;
|
||||||
|
|
||||||
public class UserTest extends TestCase
|
public class UserTest extends TestCase
|
||||||
{
|
{
|
||||||
private OfflinePlayer base1;
|
private final OfflinePlayer base1;
|
||||||
private Essentials ess;
|
private final Essentials ess;
|
||||||
private FakeServer server;
|
private final FakeServer server;
|
||||||
|
|
||||||
public UserTest(String testName)
|
public UserTest(String testName)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue