mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-07-07 04:55:10 +00:00
Merge branch 'master' of github.com:essentials/Essentials
This commit is contained in:
commit
4dc92a144e
157
Essentials/src/com/earth2me/essentials/BanWorkaround.java
Normal file
157
Essentials/src/com/earth2me/essentials/BanWorkaround.java
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.server.ServerConfigurationManager;
|
||||||
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
|
||||||
|
|
||||||
|
public class BanWorkaround implements IConf
|
||||||
|
{
|
||||||
|
private transient final IEssentials ess;
|
||||||
|
private transient final ServerConfigurationManager scm;
|
||||||
|
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
|
private transient final Set<String> bans = new HashSet<String>();
|
||||||
|
private transient final Set<String> bannedIps = new HashSet<String>();
|
||||||
|
|
||||||
|
public BanWorkaround(final IEssentials ess)
|
||||||
|
{
|
||||||
|
this.ess = ess;
|
||||||
|
this.scm = ((CraftServer)ess.getServer()).getHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void banByName(final String name)
|
||||||
|
{
|
||||||
|
scm.a(name);
|
||||||
|
reloadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unbanByName(String name)
|
||||||
|
{
|
||||||
|
scm.b(name);
|
||||||
|
reloadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void banByIp(final String ip)
|
||||||
|
{
|
||||||
|
scm.c(ip);
|
||||||
|
reloadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unbanByIp(final String ip)
|
||||||
|
{
|
||||||
|
scm.d(ip);
|
||||||
|
reloadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNameBanned(final String name)
|
||||||
|
{
|
||||||
|
return bans.contains(name.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIpBanned(final String ip)
|
||||||
|
{
|
||||||
|
return bannedIps.contains(ip.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reloadConfig()
|
||||||
|
{
|
||||||
|
//I don't like this but it needs to be done until CB fixors
|
||||||
|
final File file = new File(ess.getDataFolder().getParentFile().getParentFile(), "banned-players.txt");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!file.exists())
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException(Util.i18n("bannedPlayersFileNotFound"));
|
||||||
|
}
|
||||||
|
|
||||||
|
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bans.clear();
|
||||||
|
while (bufferedReader.ready())
|
||||||
|
{
|
||||||
|
|
||||||
|
final String line = bufferedReader.readLine().trim().toLowerCase();
|
||||||
|
if (line.length() > 0 && line.charAt(0) == '#')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bans.add(line);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException 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)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
final File ipFile = new File(ess.getDataFolder().getParentFile().getParentFile(), "banned-ips.txt");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ipFile.exists())
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException(Util.i18n("bannedIpsFileNotFound"));
|
||||||
|
}
|
||||||
|
|
||||||
|
final BufferedReader bufferedReader = new BufferedReader(new FileReader(ipFile));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bannedIps.clear();
|
||||||
|
while (bufferedReader.ready())
|
||||||
|
{
|
||||||
|
|
||||||
|
final String line = bufferedReader.readLine().trim().toLowerCase();
|
||||||
|
if (line.length() > 0 && line.charAt(0) == '#')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bannedIps.add(line);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException 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)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,27 +46,24 @@ import org.bukkit.plugin.java.*;
|
||||||
public class Essentials extends JavaPlugin implements IEssentials
|
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 = 974;
|
public static final int BUKKIT_VERSION = 974;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
private Settings settings;
|
private transient Settings settings;
|
||||||
private TNTExplodeListener tntListener;
|
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
||||||
private EssentialsDependancyChecker essDep;
|
|
||||||
private static Essentials instance = null;
|
private static Essentials instance = null;
|
||||||
private Spawn spawn;
|
private transient Spawn spawn;
|
||||||
private Jail jail;
|
private transient Jail jail;
|
||||||
private Warps warps;
|
private transient Warps warps;
|
||||||
private Worth worth;
|
private transient Worth worth;
|
||||||
private List<IConf> confList;
|
private transient List<IConf> confList;
|
||||||
public ArrayList bans = new ArrayList();
|
private transient Backup backup;
|
||||||
public ArrayList bannedIps = new ArrayList();
|
private transient BanWorkaround bans;
|
||||||
private Backup backup;
|
private transient final Map<String, User> users = new HashMap<String, User>();
|
||||||
private final Map<String, User> users = new HashMap<String, User>();
|
private transient EssentialsUpdateTimer updateTimer;
|
||||||
private EssentialsUpdateTimer updateTimer;
|
private transient final Methods paymentMethod = new Methods();
|
||||||
private boolean registerFallback = true;
|
private transient final static boolean enableErrorLogging = false;
|
||||||
private final Methods paymentMethod = new Methods();
|
private transient final EssentialsErrorHandler errorHandler = new EssentialsErrorHandler();
|
||||||
private final static boolean enableErrorLogging = false;
|
private transient IPermissionsHandler permissionsHandler;
|
||||||
private final EssentialsErrorHandler errorHandler = new EssentialsErrorHandler();
|
|
||||||
private IPermissionsHandler permissionsHandler;
|
|
||||||
|
|
||||||
public static IEssentials getStatic()
|
public static IEssentials getStatic()
|
||||||
{
|
{
|
||||||
|
@ -78,13 +75,19 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupForTesting(Server server) throws IOException, InvalidDescriptionException
|
public void setupForTesting(final Server server) throws IOException, InvalidDescriptionException
|
||||||
{
|
{
|
||||||
File dataFolder = File.createTempFile("essentialstest", "");
|
final File dataFolder = File.createTempFile("essentialstest", "");
|
||||||
dataFolder.delete();
|
if (!dataFolder.delete())
|
||||||
dataFolder.mkdir();
|
{
|
||||||
logger.log(Level.INFO, Util.i18n("usingTempFolderForTesting"));
|
throw new IOException();
|
||||||
logger.log(Level.INFO, dataFolder.toString());
|
}
|
||||||
|
if (!dataFolder.mkdir())
|
||||||
|
{
|
||||||
|
throw new IOException();
|
||||||
|
}
|
||||||
|
LOGGER.log(Level.INFO, Util.i18n("usingTempFolderForTesting"));
|
||||||
|
LOGGER.log(Level.INFO, dataFolder.toString());
|
||||||
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
|
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
|
||||||
settings = new Settings(dataFolder);
|
settings = new Settings(dataFolder);
|
||||||
permissionsHandler = new ConfigPermissionsHandler(this);
|
permissionsHandler = new ConfigPermissionsHandler(this);
|
||||||
|
@ -101,11 +104,11 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
final String[] javaversion = System.getProperty("java.version").split("\\.", 3);
|
final String[] javaversion = System.getProperty("java.version").split("\\.", 3);
|
||||||
if (javaversion == null || javaversion.length < 2 || Integer.parseInt(javaversion[1]) < 6)
|
if (javaversion == null || javaversion.length < 2 || Integer.parseInt(javaversion[1]) < 6)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, "Java version not supported! Please install Java 1.6. You have " + System.getProperty("java.version"));
|
LOGGER.log(Level.SEVERE, "Java version not supported! Please install Java 1.6. You have " + System.getProperty("java.version"));
|
||||||
}
|
}
|
||||||
if (enableErrorLogging)
|
if (enableErrorLogging)
|
||||||
{
|
{
|
||||||
logger.addHandler(errorHandler);
|
LOGGER.addHandler(errorHandler);
|
||||||
}
|
}
|
||||||
setStatic();
|
setStatic();
|
||||||
EssentialsUpgrade upgrade = new EssentialsUpgrade(this.getDescription().getVersion(), this);
|
EssentialsUpgrade upgrade = new EssentialsUpgrade(this.getDescription().getVersion(), this);
|
||||||
|
@ -121,36 +124,35 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
confList.add(warps);
|
confList.add(warps);
|
||||||
worth = new Worth(this.getDataFolder());
|
worth = new Worth(this.getDataFolder());
|
||||||
confList.add(worth);
|
confList.add(worth);
|
||||||
|
bans = new BanWorkaround(this);
|
||||||
|
confList.add(bans);
|
||||||
reload();
|
reload();
|
||||||
backup = new Backup(this);
|
backup = new Backup(this);
|
||||||
essDep = new EssentialsDependancyChecker(this);
|
|
||||||
|
|
||||||
final PluginManager pm = getServer().getPluginManager();
|
final PluginManager pm = getServer().getPluginManager();
|
||||||
for (Plugin plugin : pm.getPlugins())
|
for (Plugin plugin : pm.getPlugins())
|
||||||
{
|
{
|
||||||
if (plugin.getDescription().getName().startsWith("Essentials"))
|
if (plugin.getDescription().getName().startsWith("Essentials")
|
||||||
|
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
|
||||||
{
|
{
|
||||||
if (!plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
|
LOGGER.log(Level.WARNING, Util.format("versionMismatch", plugin.getDescription().getName()));
|
||||||
{
|
|
||||||
logger.log(Level.WARNING, Util.format("versionMismatch", plugin.getDescription().getName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
||||||
if (versionMatch.matches())
|
if (versionMatch.matches())
|
||||||
{
|
{
|
||||||
int versionNumber = Integer.parseInt(versionMatch.group(4));
|
final int versionNumber = Integer.parseInt(versionMatch.group(4));
|
||||||
if (versionNumber < minBukkitBuildVersion)
|
if (versionNumber < BUKKIT_VERSION)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.i18n("notRecommendedBukkit"));
|
LOGGER.log(Level.WARNING, Util.i18n("notRecommendedBukkit"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logger.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
|
LOGGER.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin permissionsPlugin = pm.getPlugin("Permissions");
|
final Plugin permissionsPlugin = pm.getPlugin("Permissions");
|
||||||
|
|
||||||
if (permissionsPlugin != null)
|
if (permissionsPlugin != null)
|
||||||
{
|
{
|
||||||
|
@ -224,7 +226,6 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
getServer().createWorld(settings.getNetherName(), World.Environment.NETHER);
|
getServer().createWorld(settings.getNetherName(), World.Environment.NETHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
tntListener = new TNTExplodeListener(this);
|
|
||||||
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
|
pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this);
|
||||||
|
|
||||||
final EssentialsTimer timer = new EssentialsTimer(this);
|
final EssentialsTimer timer = new EssentialsTimer(this);
|
||||||
|
@ -234,20 +235,19 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
updateTimer = new EssentialsUpdateTimer(this);
|
updateTimer = new EssentialsUpdateTimer(this);
|
||||||
getScheduler().scheduleAsyncRepeatingTask(this, updateTimer, 50, 50 * 60 * (this.getDescription().getVersion().startsWith("Dev") ? 60 : 360));
|
getScheduler().scheduleAsyncRepeatingTask(this, updateTimer, 50, 50 * 60 * (this.getDescription().getVersion().startsWith("Dev") ? 60 : 360));
|
||||||
}
|
}
|
||||||
logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), AUTHORS));
|
LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), AUTHORS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
instance = null;
|
instance = null;
|
||||||
Trade.closeLog();
|
Trade.closeLog();
|
||||||
logger.removeHandler(errorHandler);
|
LOGGER.removeHandler(errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload()
|
public void reload()
|
||||||
{
|
{
|
||||||
Trade.closeLog();
|
Trade.closeLog();
|
||||||
loadBanList();
|
|
||||||
|
|
||||||
for (IConf iConf : confList)
|
for (IConf iConf : confList)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.i18n("itemsCsvNotLoaded"), ex);
|
LOGGER.log(Level.WARNING, Util.i18n("itemsCsvNotLoaded"), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
catch (Throwable ex2)
|
catch (Throwable ex2)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.format("corruptNodeInConfig", node));
|
LOGGER.log(Level.WARNING, Util.format("corruptNodeInConfig", node));
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
user = getUser(sender);
|
user = getUser(sender);
|
||||||
logger.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)));
|
LOGGER.log(Level.INFO, String.format("[PLAYER_COMMAND] %s: /%s %s ", ((Player)sender).getName(), commandLabel, EssentialsCommand.getFinalArg(args, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// New mail notification
|
// New mail notification
|
||||||
|
@ -441,14 +441,14 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("commandNotLoaded", commandLabel));
|
sender.sendMessage(Util.format("commandNotLoaded", commandLabel));
|
||||||
logger.log(Level.SEVERE, Util.format("commandNotLoaded", commandLabel), ex);
|
LOGGER.log(Level.SEVERE, Util.format("commandNotLoaded", commandLabel), ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check authorization
|
// Check authorization
|
||||||
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
|
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.format("deniedAccessCommand", user.getName()));
|
LOGGER.log(Level.WARNING, Util.format("deniedAccessCommand", user.getName()));
|
||||||
user.sendMessage(Util.i18n("noAccessCommand"));
|
user.sendMessage(Util.i18n("noAccessCommand"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.format("commandFailed", commandLabel), ex);
|
LOGGER.log(Level.SEVERE, Util.format("commandFailed", commandLabel), ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,7 +492,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
logRecord.setThrown(exception);
|
logRecord.setThrown(exception);
|
||||||
if (getSettings().isDebug())
|
if (getSettings().isDebug())
|
||||||
{
|
{
|
||||||
logger.log(logRecord);
|
LOGGER.log(logRecord);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -504,100 +504,6 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadBanList()
|
|
||||||
{
|
|
||||||
//I don't like this but it needs to be done until CB fixors
|
|
||||||
File file = new File("banned-players.txt");
|
|
||||||
File ipFile = new File("banned-ips.txt");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!file.exists())
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(Util.i18n("bannedPlayersFileNotFound"));
|
|
||||||
}
|
|
||||||
|
|
||||||
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bans.clear();
|
|
||||||
while (bufferedReader.ready())
|
|
||||||
{
|
|
||||||
|
|
||||||
final String line = bufferedReader.readLine().trim().toLowerCase();
|
|
||||||
if (line.length() > 0 && line.charAt(0) == '#')
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
bans.add(line);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException 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)
|
|
||||||
{
|
|
||||||
logger.log(Level.SEVERE, Util.i18n("bannedPlayersFileError"), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!ipFile.exists())
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException(Util.i18n("bannedIpsFileNotFound"));
|
|
||||||
}
|
|
||||||
|
|
||||||
final BufferedReader bufferedReader = new BufferedReader(new FileReader(ipFile));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bannedIps.clear();
|
|
||||||
while (bufferedReader.ready())
|
|
||||||
{
|
|
||||||
|
|
||||||
final String line = bufferedReader.readLine().trim().toLowerCase();
|
|
||||||
if (line.length() > 0 && line.charAt(0) == '#')
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
bannedIps.add(line);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException 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)
|
|
||||||
{
|
|
||||||
logger.log(Level.SEVERE, Util.i18n("bannedIpsFileError"), ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CraftScheduler getScheduler()
|
public CraftScheduler getScheduler()
|
||||||
{
|
{
|
||||||
return (CraftScheduler)this.getServer().getScheduler();
|
return (CraftScheduler)this.getServer().getScheduler();
|
||||||
|
@ -676,35 +582,20 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld(String name)
|
public World getWorld(final String name)
|
||||||
{
|
{
|
||||||
if (name.matches("[0-9]+"))
|
if (name.matches("[0-9]+"))
|
||||||
{
|
{
|
||||||
int id = Integer.parseInt(name);
|
final int id = Integer.parseInt(name);
|
||||||
if (id < getServer().getWorlds().size())
|
if (id < getServer().getWorlds().size())
|
||||||
{
|
{
|
||||||
return getServer().getWorlds().get(id);
|
return getServer().getWorlds().get(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
World w = getServer().getWorld(name);
|
return getServer().getWorld(name);
|
||||||
if (w != null)
|
|
||||||
{
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegisterFallback(boolean registerFallback)
|
public void addReloadListener(final IConf listener)
|
||||||
{
|
|
||||||
this.registerFallback = registerFallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRegisterFallbackEnabled()
|
|
||||||
{
|
|
||||||
return registerFallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addReloadListener(IConf listener)
|
|
||||||
{
|
{
|
||||||
confList.add(listener);
|
confList.add(listener);
|
||||||
}
|
}
|
||||||
|
@ -714,7 +605,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
return paymentMethod;
|
return paymentMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int broadcastMessage(String name, String message)
|
public int broadcastMessage(final String name, final String message)
|
||||||
{
|
{
|
||||||
Player[] players = getServer().getOnlinePlayers();
|
Player[] players = getServer().getOnlinePlayers();
|
||||||
|
|
||||||
|
@ -750,33 +641,23 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
return this.getScheduler().scheduleSyncDelayedTask(this, run, delay);
|
return this.getScheduler().scheduleSyncDelayedTask(this, run, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int scheduleSyncRepeatingTask(final Runnable run, long delay, long period)
|
public int scheduleSyncRepeatingTask(final Runnable run, final long delay, final long period)
|
||||||
{
|
{
|
||||||
return this.getScheduler().scheduleSyncRepeatingTask(this, run, delay, period);
|
return this.getScheduler().scheduleSyncRepeatingTask(this, run, delay, period);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getBans()
|
|
||||||
{
|
|
||||||
return bans;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getBannedIps()
|
|
||||||
{
|
|
||||||
return bannedIps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TNTExplodeListener getTNTListener()
|
public TNTExplodeListener getTNTListener()
|
||||||
{
|
{
|
||||||
return tntListener;
|
return tntListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EssentialsDependancyChecker getDependancyChecker()
|
|
||||||
{
|
|
||||||
return essDep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IPermissionsHandler getPermissionsHandler()
|
public IPermissionsHandler getPermissionsHandler()
|
||||||
{
|
{
|
||||||
return permissionsHandler;
|
return permissionsHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BanWorkaround getBans()
|
||||||
|
{
|
||||||
|
return bans;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
package com.earth2me.essentials;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
|
|
||||||
public class EssentialsDependancyChecker
|
|
||||||
{
|
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
|
||||||
final Essentials ess;
|
|
||||||
|
|
||||||
public EssentialsDependancyChecker(Essentials ess)
|
|
||||||
{
|
|
||||||
this.ess = ess;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkProtectDependancies()
|
|
||||||
{
|
|
||||||
final String dependancyLocation = "http://mirrors.ibiblio.org/pub/mirrors/maven2/c3p0/c3p0/0.9.1.2/c3p0-0.9.1.2.jar";
|
|
||||||
File dependancyFile = new File("lib/c3p0-0.9.1.2.jar");
|
|
||||||
if (!dependancyFile.exists())
|
|
||||||
{
|
|
||||||
logger.log(Level.INFO, Util.i18n("dependancyNotFound"));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
URL url = new URL(dependancyLocation);
|
|
||||||
BufferedInputStream inStream = new BufferedInputStream(url.openStream());
|
|
||||||
FileOutputStream fos = new FileOutputStream(dependancyFile);
|
|
||||||
BufferedOutputStream outStream = new BufferedOutputStream(fos, 1024);
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int len = 0;
|
|
||||||
|
|
||||||
while ((len = inStream.read(buffer)) > 0)
|
|
||||||
{
|
|
||||||
outStream.write(buffer, 0, len);
|
|
||||||
}
|
|
||||||
outStream.close();
|
|
||||||
fos.close();
|
|
||||||
inStream.close();
|
|
||||||
logger.log(Level.INFO, Util.format("dependancyDownloaded", dependancyFile.getName()));
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (MalformedURLException ex)
|
|
||||||
{
|
|
||||||
logger.log(Level.SEVERE, Util.i18n("urlMalformed"), ex);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException ex)
|
|
||||||
{
|
|
||||||
logger.log(Level.SEVERE, Util.i18n("dependancyException"), ex);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
logger.log(Level.SEVERE, Util.i18n("dependancyException"), ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -43,8 +43,7 @@ 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)ess.getServer()).getHandle().b(user.getName());
|
ess.getBans().unbanByName(user.getName());
|
||||||
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);
|
||||||
|
|
|
@ -11,71 +11,64 @@ import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
|
||||||
|
|
||||||
public interface IEssentials
|
public interface IEssentials
|
||||||
{
|
{
|
||||||
void addReloadListener(IConf listener);
|
void addReloadListener(IConf listener);
|
||||||
|
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix);
|
boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix);
|
||||||
|
|
||||||
User getUser(Object base);
|
User getUser(Object base);
|
||||||
|
|
||||||
User getOfflineUser(String name);
|
User getOfflineUser(String name);
|
||||||
|
|
||||||
World getWorld(String name);
|
World getWorld(String name);
|
||||||
|
|
||||||
int broadcastMessage(String name, String message);
|
int broadcastMessage(String name, String message);
|
||||||
|
|
||||||
Settings getSettings();
|
Settings getSettings();
|
||||||
|
|
||||||
CraftScheduler getScheduler();
|
CraftScheduler getScheduler();
|
||||||
|
|
||||||
String[] getMotd(CommandSender sender, String def);
|
String[] getMotd(CommandSender sender, String def);
|
||||||
|
|
||||||
String[] getLines(CommandSender sender, String node, String def);
|
String[] getLines(CommandSender sender, String node, String def);
|
||||||
|
|
||||||
Jail getJail();
|
Jail getJail();
|
||||||
|
|
||||||
Warps getWarps();
|
Warps getWarps();
|
||||||
|
|
||||||
Worth getWorth();
|
Worth getWorth();
|
||||||
|
|
||||||
Backup getBackup();
|
Backup getBackup();
|
||||||
|
|
||||||
Spawn getSpawn();
|
Spawn getSpawn();
|
||||||
|
|
||||||
void loadBanList();
|
Methods getPaymentMethod();
|
||||||
|
|
||||||
public boolean isRegisterFallbackEnabled();
|
|
||||||
|
|
||||||
public Methods getPaymentMethod();
|
|
||||||
|
|
||||||
Server getServer();
|
Server getServer();
|
||||||
|
|
||||||
File getDataFolder();
|
File getDataFolder();
|
||||||
|
|
||||||
PluginDescriptionFile getDescription();
|
PluginDescriptionFile getDescription();
|
||||||
|
|
||||||
int scheduleAsyncDelayedTask(Runnable run);
|
int scheduleAsyncDelayedTask(Runnable run);
|
||||||
|
|
||||||
int scheduleSyncDelayedTask(Runnable run);
|
int scheduleSyncDelayedTask(Runnable run);
|
||||||
|
|
||||||
int scheduleSyncDelayedTask(Runnable run, long delay);
|
int scheduleSyncDelayedTask(Runnable run, long delay);
|
||||||
|
|
||||||
int scheduleSyncRepeatingTask(final Runnable run, long delay, long period);
|
int scheduleSyncRepeatingTask(final Runnable run, long delay, long period);
|
||||||
|
|
||||||
List<String> getBans();
|
BanWorkaround getBans();
|
||||||
|
|
||||||
List<String> getBannedIps();
|
|
||||||
|
|
||||||
TNTExplodeListener getTNTListener();
|
TNTExplodeListener getTNTListener();
|
||||||
|
|
||||||
EssentialsDependancyChecker getDependancyChecker();
|
|
||||||
|
|
||||||
IPermissionsHandler getPermissionsHandler();
|
IPermissionsHandler getPermissionsHandler();
|
||||||
|
|
||||||
void showError(final CommandSender sender, final Throwable exception, final String commandLabel);
|
void showError(final CommandSender sender, final Throwable exception, final String commandLabel);
|
||||||
|
|
||||||
Map<String, User> getAllUsers();
|
Map<String, User> getAllUsers();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ public class PlayerExtension extends PlayerWrapper
|
||||||
|
|
||||||
public boolean isBanned()
|
public boolean isBanned()
|
||||||
{
|
{
|
||||||
return ess.getBans().contains(getName());
|
return ess.getBans().isNameBanned(this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIpBanned()
|
public boolean isIpBanned()
|
||||||
{
|
{
|
||||||
return ess.getBannedIps().contains(getAddress().getAddress().toString().replace("/", ""));
|
return ess.getBans().isIpBanned(getAddress().getAddress().getHostAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCorrectedYaw()
|
public float getCorrectedYaw()
|
||||||
|
|
|
@ -276,7 +276,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
@Override
|
@Override
|
||||||
public double getMoney()
|
public double getMoney()
|
||||||
{
|
{
|
||||||
if (ess.isRegisterFallbackEnabled() && ess.getPaymentMethod().hasMethod())
|
if (ess.getPaymentMethod().hasMethod())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -298,7 +298,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||||
@Override
|
@Override
|
||||||
public void setMoney(double value)
|
public void setMoney(double value)
|
||||||
{
|
{
|
||||||
if (ess.isRegisterFallbackEnabled() && ess.getPaymentMethod().hasMethod())
|
if (ess.getPaymentMethod().hasMethod())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
|
||||||
|
@ -15,7 +14,7 @@ public class Commandban extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@ -29,7 +28,7 @@ public class Commandban extends EssentialsCommand
|
||||||
}
|
}
|
||||||
if (server.matchPlayer(args[0]).isEmpty())
|
if (server.matchPlayer(args[0]).isEmpty())
|
||||||
{
|
{
|
||||||
((CraftServer)server).getHandle().a(args[0]);
|
ess.getBans().banByName(args[0]);
|
||||||
server.broadcastMessage(Util.format("playerBanned", args[0], Util.i18n("defaultBanReason")));
|
server.broadcastMessage(Util.format("playerBanned", args[0], Util.i18n("defaultBanReason")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -45,9 +44,8 @@ public class Commandban extends EssentialsCommand
|
||||||
banReason = Util.i18n("defaultBanReason");
|
banReason = Util.i18n("defaultBanReason");
|
||||||
}
|
}
|
||||||
player.kickPlayer(banReason);
|
player.kickPlayer(banReason);
|
||||||
((CraftServer)server).getHandle().a(player.getName());
|
ess.getBans().banByName(args[0]);
|
||||||
server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason));
|
server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason));
|
||||||
}
|
}
|
||||||
ess.loadBanList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.earth2me.essentials.commands;
|
||||||
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;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
|
|
||||||
|
|
||||||
public class Commandbanip extends EssentialsCommand
|
public class Commandbanip extends EssentialsCommand
|
||||||
|
@ -21,9 +20,7 @@ public class Commandbanip extends EssentialsCommand
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
((CraftServer)server).getHandle().c(args[0]);
|
ess.getBans().banByIp(args[0]);
|
||||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
sender.sendMessage(Util.i18n("banIpAddress"));
|
||||||
ess.loadBanList();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +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 org.bukkit.craftbukkit.CraftServer;
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -16,36 +14,22 @@ public class Commandtempban extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
User p = null;
|
final User player = getPlayer(server, args, 0, true);
|
||||||
try
|
final String time = getFinalArg(args, 1);
|
||||||
{
|
final long banTimestamp = Util.parseDateDiff(time, true);
|
||||||
p = getPlayer(server, args, 0);
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException ex)
|
|
||||||
{
|
|
||||||
p = ess.getOfflineUser(args[0]);
|
|
||||||
}
|
|
||||||
if (p == null)
|
|
||||||
{
|
|
||||||
sender.sendMessage(Util.format("playerNotFound"));
|
|
||||||
}
|
|
||||||
|
|
||||||
String time = getFinalArg(args, 1);
|
final String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp));
|
||||||
long banTimestamp = Util.parseDateDiff(time, true);
|
player.setBanReason(banReason);
|
||||||
|
player.setBanTimeout(banTimestamp);
|
||||||
String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp));
|
player.kickPlayer(banReason);
|
||||||
p.setBanReason(banReason);
|
ess.getBans().banByName(player.getName());
|
||||||
p.setBanTimeout(banTimestamp);
|
server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason));
|
||||||
p.kickPlayer(banReason);
|
|
||||||
((CraftServer)server).getHandle().a(p.getName());
|
|
||||||
server.broadcastMessage(Util.format("playerBanned", p.getName(), banReason));
|
|
||||||
Essentials.getStatic().loadBanList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.earth2me.essentials.commands;
|
||||||
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;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
|
|
||||||
|
|
||||||
public class Commandunban extends EssentialsCommand
|
public class Commandunban extends EssentialsCommand
|
||||||
|
@ -14,15 +13,14 @@ public class Commandunban extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
((CraftServer)server).getHandle().b(args[0]);
|
ess.getBans().unbanByName(args[0]);
|
||||||
sender.sendMessage(Util.i18n("unbannedPlayer"));
|
sender.sendMessage(Util.i18n("unbannedPlayer"));
|
||||||
ess.loadBanList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.earth2me.essentials.commands;
|
||||||
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;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
|
|
||||||
|
|
||||||
public class Commandunbanip extends EssentialsCommand
|
public class Commandunbanip extends EssentialsCommand
|
||||||
|
@ -14,15 +13,14 @@ public class Commandunbanip extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
((CraftServer)server).getHandle().d(args[0]);
|
ess.getBans().unbanByIp(args[0]);
|
||||||
sender.sendMessage(Util.i18n("unbannedIP"));
|
sender.sendMessage(Util.i18n("unbannedIP"));
|
||||||
ess.loadBanList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue