diff options
171 files changed, 4224 insertions, 1769 deletions
diff --git a/.gitignore b/.gitignore index 7152ec996..4d5963e6b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,8 @@ /EssentialsPermissionsCommands/dist/ /Essentials/nbproject/private/ /Essentials/dist/ -/Essentials/build/
\ No newline at end of file +/Essentials/build/ +/YamlAnnotations/ +/EssentialsUpdate/nbproject/private/ +/EssentialsRelease/ +/EssentialsUpdate/
\ No newline at end of file diff --git a/BuildAll/nbproject/build-impl.xml b/BuildAll/nbproject/build-impl.xml index 824338a6a..34bc10d88 100644 --- a/BuildAll/nbproject/build-impl.xml +++ b/BuildAll/nbproject/build-impl.xml @@ -638,13 +638,6 @@ is divided into following sections: </antcall> <antcall target="-maybe-call-dep"> <param name="call.built.properties" value="${built-jar.properties}"/> - <param location="${project.EssentialsPermissionsCommands}" name="call.subproject"/> - <param location="${project.EssentialsPermissionsCommands}/build.xml" name="call.script"/> - <param name="call.target" value="jar"/> - <param name="transfer.built-jar.properties" value="${built-jar.properties}"/> - </antcall> - <antcall target="-maybe-call-dep"> - <param name="call.built.properties" value="${built-jar.properties}"/> <param location="${project.EssentialsProtect}" name="call.subproject"/> <param location="${project.EssentialsProtect}/build.xml" name="call.script"/> <param name="call.target" value="jar"/> @@ -1138,13 +1131,6 @@ is divided into following sections: </antcall> <antcall target="-maybe-call-dep"> <param name="call.built.properties" value="${built-clean.properties}"/> - <param location="${project.EssentialsPermissionsCommands}" name="call.subproject"/> - <param location="${project.EssentialsPermissionsCommands}/build.xml" name="call.script"/> - <param name="call.target" value="clean"/> - <param name="transfer.built-clean.properties" value="${built-clean.properties}"/> - </antcall> - <antcall target="-maybe-call-dep"> - <param name="call.built.properties" value="${built-clean.properties}"/> <param location="${project.EssentialsProtect}" name="call.subproject"/> <param location="${project.EssentialsProtect}/build.xml" name="call.script"/> <param name="call.target" value="clean"/> diff --git a/BuildAll/nbproject/genfiles.properties b/BuildAll/nbproject/genfiles.properties index 6288dcb14..d832e2cec 100644 --- a/BuildAll/nbproject/genfiles.properties +++ b/BuildAll/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=2bd2dd75 +build.xml.data.CRC32=51b33957 build.xml.script.CRC32=7a797370 -build.xml.stylesheet.CRC32=28e38971@1.43.1.45 +build.xml.stylesheet.CRC32=28e38971@1.44.1.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=2bd2dd75 -nbproject/build-impl.xml.script.CRC32=89fb91fc +nbproject/build-impl.xml.data.CRC32=51b33957 +nbproject/build-impl.xml.script.CRC32=66b89647 nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45 diff --git a/BuildAll/nbproject/project.properties b/BuildAll/nbproject/project.properties index 78667df7f..dd9ceab91 100644 --- a/BuildAll/nbproject/project.properties +++ b/BuildAll/nbproject/project.properties @@ -67,7 +67,6 @@ javac.classpath=\ ${reference.Essentials.jar}:\ ${reference.EssentialsChat.jar}:\ ${reference.EssentialsProtect.jar}:\ - ${reference.EssentialsPermissionsCommands.jar}:\ ${reference.EssentialsSpawn.jar}:\ ${reference.EssentialsGeoIP.jar}:\ ${reference.EssentialsGroupBridge.jar}:\ @@ -106,7 +105,6 @@ project.EssentialsChat=../EssentialsChat project.EssentialsGeoIP=../EssentialsGeoIP project.EssentialsGroupBridge=../EssentialsGroupBridge project.EssentialsGroupManager=../EssentialsGroupManager -project.EssentialsPermissionsCommands=../EssentialsPermissionsCommands project.EssentialsProtect=../EssentialsProtect project.EssentialsSpawn=../EssentialsSpawn project.EssentialsXMPP=../EssentialsXMPP @@ -115,7 +113,6 @@ reference.EssentialsChat.jar=${project.EssentialsChat}/dist/EssentialsChat.jar reference.EssentialsGeoIP.jar=${project.EssentialsGeoIP}/dist/EssentialsGeoIP.jar reference.EssentialsGroupBridge.jar=${project.EssentialsGroupBridge}/dist/EssentialsGroupBridge.jar reference.EssentialsGroupManager.jar=${project.EssentialsGroupManager}/dist/EssentialsGroupManager.jar -reference.EssentialsPermissionsCommands.jar=${project.EssentialsPermissionsCommands}/dist/EssentialsPermissionsCommands.jar reference.EssentialsProtect.jar=${project.EssentialsProtect}/dist/EssentialsProtect.jar reference.EssentialsSpawn.jar=${project.EssentialsSpawn}/dist/EssentialsSpawn.jar reference.EssentialsXMPP.jar=${project.EssentialsXMPP}/dist/EssentialsXMPP.jar diff --git a/BuildAll/nbproject/project.xml b/BuildAll/nbproject/project.xml index cda8261b6..420233ac9 100644 --- a/BuildAll/nbproject/project.xml +++ b/BuildAll/nbproject/project.xml @@ -56,14 +56,6 @@ <id>jar</id> </reference> <reference> - <foreign-project>EssentialsPermissionsCommands</foreign-project> - <artifact-type>jar</artifact-type> - <script>build.xml</script> - <target>jar</target> - <clean-target>clean</clean-target> - <id>jar</id> - </reference> - <reference> <foreign-project>EssentialsProtect</foreign-project> <artifact-type>jar</artifact-type> <script>build.xml</script> diff --git a/Essentials/nbproject/pmd.settings b/Essentials/nbproject/pmd.settings index 6a34e356c..824aa3ac9 100644 --- a/Essentials/nbproject/pmd.settings +++ b/Essentials/nbproject/pmd.settings @@ -1 +1,2 @@ DoNotUseThreads +SignatureDeclareThrowsException diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties index 8df8ef4d2..db78855e6 100644 --- a/Essentials/nbproject/project.properties +++ b/Essentials/nbproject/project.properties @@ -62,6 +62,7 @@ dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar +file.reference.bPermissions.jar=../lib/bPermissions.jar file.reference.craftbukkit-0.0.1-SNAPSHOT.jar=..\\lib\\craftbukkit-0.0.1-SNAPSHOT.jar file.reference.iCo4.jar=../lib/iCo4.jar file.reference.iCo5.jar=../lib/iCo5.jar @@ -69,6 +70,7 @@ file.reference.iCo6.jar=../lib/iCo6.jar file.reference.junit-4.5.jar=..\\lib\\junit_4\\junit-4.5.jar file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar file.reference.Permissions3.jar=../lib/Permissions3.jar +file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar includes=** jar.archive.disabled=${jnlp.enabled} @@ -82,7 +84,9 @@ javac.classpath=\ ${file.reference.iCo6.jar}:\ ${file.reference.MultiCurrency.jar}:\ ${file.reference.BOSEconomy7.jar}:\ - ${file.reference.PermissionsEx.jar} + ${file.reference.PermissionsEx.jar}:\ + ${file.reference.bPermissions.jar}:\ + ${file.reference.PermissionsBukkit-1.2.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/Essentials/src/com/earth2me/essentials/Backup.java b/Essentials/src/com/earth2me/essentials/Backup.java index 6b88eaef9..b7b441b1e 100644 --- a/Essentials/src/com/earth2me/essentials/Backup.java +++ b/Essentials/src/com/earth2me/essentials/Backup.java @@ -1,35 +1,45 @@ package com.earth2me.essentials; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; -public class Backup implements Runnable { - private static final Logger logger = Logger.getLogger("Minecraft"); - private final CraftServer server; - private final IEssentials ess; - private boolean running = false; - private int taskId = -1; - private boolean active = false; - public Backup(IEssentials ess) { +public class Backup implements Runnable +{ + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private transient final CraftServer server; + private transient final IEssentials ess; + private transient boolean running = false; + private transient int taskId = -1; + private transient boolean active = false; + + public Backup(final IEssentials ess) + { this.ess = ess; server = (CraftServer)ess.getServer(); - if (server.getOnlinePlayers().length > 0) { + if (server.getOnlinePlayers().length > 0) + { startTask(); } - } + } - void onPlayerJoin() { + void onPlayerJoin() + { startTask(); } - - private void startTask() { - if (!running) { - long interval = ess.getSettings().getBackupInterval()*1200; // minutes -> ticks - if (interval < 1200) { + + private void startTask() + { + if (!running) + { + final long interval = ess.getSettings().getBackupInterval() * 1200; // minutes -> ticks + if (interval < 1200) + { return; } taskId = ess.scheduleSyncRepeatingTask(this, interval, interval); @@ -37,48 +47,84 @@ public class Backup implements Runnable { } } - public void run() { - if (active) return; + public void run() + { + if (active) + { + return; + } active = true; final String command = ess.getSettings().getBackupCommand(); - if (command == null || "".equals(command)) { + if (command == null || "".equals(command)) + { return; } - logger.log(Level.INFO, Util.i18n("backupStarted")); + LOGGER.log(Level.INFO, Util.i18n("backupStarted")); final CommandSender cs = server.getServer().console; server.dispatchCommand(cs, "save-all"); server.dispatchCommand(cs, "save-off"); - - ess.scheduleAsyncDelayedTask( - new Runnable() { - - public void run() { - try { - Process child = Runtime.getRuntime().exec(command); - child.waitFor(); - } catch (InterruptedException ex) { - logger.log(Level.SEVERE, null, ex); - } catch (IOException ex) { - logger.log(Level.SEVERE, null, ex); - } finally { - ess.scheduleSyncDelayedTask( - new Runnable() { - public void run() { - server.dispatchCommand(cs, "save-on"); - if (server.getOnlinePlayers().length == 0) { - running = false; - if (taskId != -1) { - server.getScheduler().cancelTask(taskId); + ess.scheduleAsyncDelayedTask( + new Runnable() + { + public void run() + { + try + { + final ProcessBuilder childBuilder = new ProcessBuilder(command); + childBuilder.redirectErrorStream(true); + childBuilder.directory(ess.getDataFolder().getParentFile().getParentFile()); + final Process child = childBuilder.start(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream())); + try + { + child.waitFor(); + String line; + do + { + line = reader.readLine(); + if (line != null) + { + LOGGER.log(Level.INFO, line); + } } + while (line != null); + } + finally + { + reader.close(); } - active = false; - logger.log(Level.INFO, Util.i18n("backupFinished")); } - }); - } - } - }); + catch (InterruptedException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + catch (IOException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + finally + { + ess.scheduleSyncDelayedTask( + new Runnable() + { + public void run() + { + server.dispatchCommand(cs, "save-on"); + if (server.getOnlinePlayers().length == 0) + { + running = false; + if (taskId != -1) + { + server.getScheduler().cancelTask(taskId); + } + } + active = false; + LOGGER.log(Level.INFO, Util.i18n("backupFinished")); + } + }); + } + } + }); } - } diff --git a/Essentials/src/com/earth2me/essentials/BanWorkaround.java b/Essentials/src/com/earth2me/essentials/BanWorkaround.java deleted file mode 100644 index bf9c47899..000000000 --- a/Essentials/src/com/earth2me/essentials/BanWorkaround.java +++ /dev/null @@ -1,157 +0,0 @@ -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); - } - } -} diff --git a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java deleted file mode 100644 index aee9ef0b4..000000000 --- a/Essentials/src/com/earth2me/essentials/BukkitPermissionsHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.earth2me.essentials; - -import org.bukkit.entity.Player; - - -public class BukkitPermissionsHandler implements IPermissionsHandler -{ - public String getGroup(Player base) - { - return "default"; - } - - public boolean canBuild(Player base, String group) - { - return true; - } - - public boolean inGroup(Player base, String group) - { - return false; - } - - public boolean hasPermission(Player base, String node) - { - if (base.hasPermission("-" + node)) - { - return false; - } - final String[] parts = node.split("\\."); - final StringBuilder sb = new StringBuilder(); - for (String part : parts) - { - if (base.hasPermission(sb.toString() + "*")) - { - return true; - } - sb.append(part).append("."); - } - return base.hasPermission(node); - } - - public String getPrefix(Player base) - { - return ""; - } - - public String getSuffix(Player base) - { - return ""; - } -} diff --git a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java index 21ca8feff..0fd2e9047 100755 --- a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java +++ b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java @@ -35,7 +35,6 @@ public final class DescParseTickFormat SDFTwelve.setTimeZone(TimeZone.getTimeZone("GMT")); nameToTicks.put("sunrise", 23000); - nameToTicks.put("rise", 23000); nameToTicks.put("dawn", 23000); nameToTicks.put("daystart", 0); @@ -49,7 +48,6 @@ public final class DescParseTickFormat nameToTicks.put("afternoon", 9000); nameToTicks.put("sunset", 12000); - nameToTicks.put("set", 12000); nameToTicks.put("dusk", 12000); nameToTicks.put("sundown", 12000); nameToTicks.put("nightfall", 12000); @@ -157,10 +155,6 @@ public final class DescParseTickFormat int hours = 0; int minutes = 0; - if (desc.endsWith("pm")) - { - hours += 12; - } desc = desc.toLowerCase().replaceAll("[^0-9]", ""); @@ -191,6 +185,16 @@ public final class DescParseTickFormat { throw new NumberFormatException(); } + + if (desc.endsWith("pm") && hours != 12) + { + hours += 12; + } + + if (desc.endsWith("am") && hours == 12) + { + hours -= 12; + } return hoursMinutesToTicks(hours, minutes); } @@ -227,18 +231,7 @@ public final class DescParseTickFormat // -------------------------------------------- public static String format(final long ticks) { - final StringBuilder msg = new StringBuilder(); - msg.append(Commandtime.colorHighlight1); - msg.append(format24(ticks)); - msg.append(Commandtime.colorDefault); - msg.append(" or "); - msg.append(Commandtime.colorHighlight1); - msg.append(format12(ticks)); - msg.append(Commandtime.colorDefault); - msg.append(" or "); - msg.append(Commandtime.colorHighlight1); - msg.append(formatTicks(ticks)); - return msg.toString(); + return Util.format("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks)); } public static String formatTicks(final long ticks) diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index a3457df12..7e6aed108 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -26,7 +26,9 @@ import org.bukkit.*; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import com.earth2me.essentials.commands.IEssentialsCommand; +import com.earth2me.essentials.commands.NoChargeException; import com.earth2me.essentials.commands.NotEnoughArgumentsException; +import com.earth2me.essentials.perm.PermissionsHandler; import com.earth2me.essentials.register.payment.Methods; import com.earth2me.essentials.signs.SignBlockListener; import com.earth2me.essentials.signs.SignEntityListener; @@ -38,7 +40,6 @@ import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Type; -import org.bukkit.event.server.ServerListener; import org.bukkit.plugin.*; import org.bukkit.plugin.java.*; import org.bukkit.scheduler.BukkitScheduler; @@ -46,7 +47,7 @@ import org.bukkit.scheduler.BukkitScheduler; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1000; + public static final int BUKKIT_VERSION = 1060; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); @@ -56,14 +57,12 @@ public class Essentials extends JavaPlugin implements IEssentials private transient Worth worth; private transient List<IConf> confList; private transient Backup backup; - private transient BanWorkaround bans; private transient ItemDb itemDb; - private transient final Map<String, User> users = new HashMap<String, User>(); private transient EssentialsUpdateTimer updateTimer; private transient final Methods paymentMethod = new Methods(); private transient final static boolean enableErrorLogging = false; private transient final EssentialsErrorHandler errorHandler = new EssentialsErrorHandler(); - private transient IPermissionsHandler permissionsHandler; + private transient PermissionsHandler permissionsHandler; private transient UserMap userMap; @Override @@ -88,7 +87,7 @@ public class Essentials extends JavaPlugin implements IEssentials this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null); settings = new Settings(this); userMap = new UserMap(this); - permissionsHandler = new ConfigPermissionsHandler(this); + permissionsHandler = new PermissionsHandler(this, false); Economy.setEss(this); } @@ -119,8 +118,6 @@ public class Essentials extends JavaPlugin implements IEssentials confList.add(warps); worth = new Worth(this.getDataFolder()); confList.add(worth); - bans = new BanWorkaround(this); - confList.add(bans); itemDb = new ItemDb(this); confList.add(itemDb); reload(); @@ -149,9 +146,11 @@ public class Essentials extends JavaPlugin implements IEssentials LOGGER.log(Level.INFO, Util.i18n("bukkitFormatChanged")); } - final ServerListener serverListener = new EssentialsPluginListener(this); + permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions()); + final EssentialsPluginListener serverListener = new EssentialsPluginListener(this); pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Low, this); pm.registerEvent(Type.PLUGIN_DISABLE, serverListener, Priority.Low, this); + confList.add(serverListener); final EssentialsPlayerListener playerListener = new EssentialsPlayerListener(this); pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); @@ -208,12 +207,12 @@ public class Essentials extends JavaPlugin implements IEssentials pm.registerEvent(Type.ENTITY_EXPLODE, tntListener, Priority.High, this); final EssentialsTimer timer = new EssentialsTimer(this); - getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 50); + getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100); Economy.setEss(this); - if (enableErrorLogging) + if (getSettings().isUpdateEnabled()) { updateTimer = new EssentialsUpdateTimer(this); - getScheduler().scheduleAsyncRepeatingTask(this, updateTimer, 50, 50 * 60 * (this.getDescription().getVersion().startsWith("Dev") ? 60 : 360)); + getScheduler().scheduleAsyncRepeatingTask(this, updateTimer, 20 * 60 * 10, 20 * 3600 * 6); } LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors()))); } @@ -237,11 +236,6 @@ public class Essentials extends JavaPlugin implements IEssentials Util.updateLocale(settings.getLocale(), this); - for (User user : users.values()) - { - user.reloadConfig(); - } - // for motd getConfiguration().load(); } @@ -314,7 +308,7 @@ public class Essentials extends JavaPlugin implements IEssentials } } m = m.replace("{ONLINE}", Integer.toString(getServer().getOnlinePlayers().length - playerHidden)); - m = m.replace("{UNIQUE}", Integer.toString(users.size())); + m = m.replace("{UNIQUE}", Integer.toString(userMap.getUniqueUsers())); if (m.matches(".*\\{PLAYERLIST\\}.*")) { @@ -454,6 +448,10 @@ public class Essentials extends JavaPlugin implements IEssentials } return true; } + catch (NoChargeException ex) + { + return true; + } catch (NotEnoughArgumentsException ex) { sender.sendMessage(command.getDescription()); @@ -567,7 +565,7 @@ public class Essentials extends JavaPlugin implements IEssentials } catch (NullPointerException ex) { - return null; + return new User(base, this); } } @@ -611,14 +609,20 @@ public class Essentials extends JavaPlugin implements IEssentials } @Override - public int broadcastMessage(final String name, final String message) + public int broadcastMessage(final IUser sender, final String message) { + if (sender == null) { + return getServer().broadcastMessage(message); + } + if (sender.isHidden()) { + return 0; + } final Player[] players = getServer().getOnlinePlayers(); for (Player player : players) { final User user = getUser(player); - if (!user.isIgnoredPlayer(name)) + if (!user.isIgnoredPlayer(sender.getName())) { player.sendMessage(message); } @@ -663,24 +667,12 @@ public class Essentials extends JavaPlugin implements IEssentials } @Override - public IPermissionsHandler getPermissionsHandler() + public PermissionsHandler getPermissionsHandler() { return permissionsHandler; } @Override - public void setPermissionsHandler(final IPermissionsHandler handler) - { - this.permissionsHandler = handler; - } - - @Override - public BanWorkaround getBans() - { - return bans; - } - - @Override public ItemDb getItemDb() { return itemDb; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index eaf23b773..c48f9f987 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -1,6 +1,8 @@ package com.earth2me.essentials; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -19,12 +21,12 @@ import org.bukkit.util.config.Configuration; public class EssentialsConf extends Configuration { - private static final Logger logger = Logger.getLogger("Minecraft"); - private File configFile; - private String templateName = null; - private Class<?> resourceClass = EssentialsConf.class; + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private transient File configFile; + private transient String templateName = null; + private transient Class<?> resourceClass = EssentialsConf.class; - public EssentialsConf(File configFile) + public EssentialsConf(final File configFile) { super(configFile); this.configFile = configFile; @@ -42,33 +44,79 @@ public class EssentialsConf extends Configuration { if (!configFile.getParentFile().mkdirs()) { - logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString())); + LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString())); } } + // This will delete files where the first character is 0. In most cases they are broken. + if (configFile.exists() && configFile.length() != 0) + { + try + { + final InputStream input = new FileInputStream(configFile); + try + { + if (input.read() == 0) + { + input.close(); + configFile.delete(); + } + } + catch (IOException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + finally + { + try + { + input.close(); + } + catch (IOException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + } + } + catch (FileNotFoundException ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + } + if (!configFile.exists()) { if (templateName != null) { - logger.log(Level.INFO, Util.format("creatingConfigFromTemplate", configFile.toString())); + LOGGER.log(Level.INFO, Util.format("creatingConfigFromTemplate", configFile.toString())); createFromTemplate(); } else { try { - logger.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString())); + LOGGER.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString())); if (!configFile.createNewFile()) { - logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString())); + LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString())); } } catch (IOException ex) { - logger.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()), ex); + LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()), ex); } } } - super.load(); + + try + { + super.load(); + } + catch (RuntimeException e) + { + LOGGER.log(Level.INFO, "File: " + configFile.toString()); + throw e; + } + if (this.root == null) { this.root = new HashMap<String, Object>(); @@ -84,7 +132,7 @@ public class EssentialsConf extends Configuration istr = resourceClass.getResourceAsStream(templateName); if (istr == null) { - logger.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName)); + LOGGER.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName)); return; } ostr = new FileOutputStream(configFile); @@ -99,7 +147,7 @@ public class EssentialsConf extends Configuration } catch (IOException ex) { - logger.log(Level.SEVERE, Util.format("failedToWriteConfig", configFile.toString()), ex); + LOGGER.log(Level.SEVERE, Util.format("failedToWriteConfig", configFile.toString()), ex); return; } finally @@ -124,12 +172,12 @@ public class EssentialsConf extends Configuration } catch (IOException ex) { - logger.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex); + LOGGER.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex); } } } - public void setTemplateName(String templateName) + public void setTemplateName(final String templateName) { this.templateName = templateName; } @@ -139,48 +187,48 @@ public class EssentialsConf extends Configuration return configFile; } - public void setTemplateName(String templateName, Class<?> resClass) + public void setTemplateName(final String templateName, final Class<?> resClass) { this.templateName = templateName; this.resourceClass = resClass; } - public boolean hasProperty(String path) + public boolean hasProperty(final String path) { return getProperty(path) != null; } - public Location getLocation(String path, Server server) + public Location getLocation(final String path, final Server server) throws Exception { - String worldName = getString((path != null ? path + "." : "") + "world"); + final String worldName = getString((path == null ? "" : path + ".") + "world"); if (worldName == null || worldName.isEmpty()) { return null; } - World world = server.getWorld(worldName); + final World world = server.getWorld(worldName); if (world == null) { - return null; + throw new Exception(Util.i18n("invalidWorld")); } return new Location(world, - getDouble((path != null ? path + "." : "") + "x", 0), - getDouble((path != null ? path + "." : "") + "y", 0), - getDouble((path != null ? path + "." : "") + "z", 0), - (float)getDouble((path != null ? path + "." : "") + "yaw", 0), - (float)getDouble((path != null ? path + "." : "") + "pitch", 0)); + getDouble((path == null ? "" : path + ".") + "x", 0), + getDouble((path == null ? "" : path + ".") + "y", 0), + getDouble((path == null ? "" : path + ".") + "z", 0), + (float)getDouble((path == null ? "" : path + ".") + "yaw", 0), + (float)getDouble((path == null ? "" : path + ".") + "pitch", 0)); } - public void setProperty(String path, Location loc) + public void setProperty(final String path, final Location loc) { - setProperty((path != null ? path + "." : "") + "world", loc.getWorld().getName()); - setProperty((path != null ? path + "." : "") + "x", loc.getX()); - setProperty((path != null ? path + "." : "") + "y", loc.getY()); - setProperty((path != null ? path + "." : "") + "z", loc.getZ()); - setProperty((path != null ? path + "." : "") + "yaw", loc.getYaw()); - setProperty((path != null ? path + "." : "") + "pitch", loc.getPitch()); + setProperty((path == null ? "" : path + ".") + "world", loc.getWorld().getName()); + setProperty((path == null ? "" : path + ".") + "x", loc.getX()); + setProperty((path == null ? "" : path + ".") + "y", loc.getY()); + setProperty((path == null ? "" : path + ".") + "z", loc.getZ()); + setProperty((path == null ? "" : path + ".") + "yaw", loc.getYaw()); + setProperty((path == null ? "" : path + ".") + "pitch", loc.getPitch()); } - public ItemStack getItemStack(String path) + public ItemStack getItemStack(final String path) { return new ItemStack( Material.valueOf(getString(path + ".type", "AIR")), @@ -189,9 +237,9 @@ public class EssentialsConf extends Configuration (byte)getInt(path + ".data", 0)*/); } - public void setProperty(String path, ItemStack stack) + public void setProperty(final String path, final ItemStack stack) { - Map<String, Object> map = new HashMap<String, Object>(); + final Map<String, Object> map = new HashMap<String, Object>(); map.put("type", stack.getType().toString()); map.put("amount", stack.getAmount()); map.put("damage", stack.getDurability()); @@ -200,40 +248,30 @@ public class EssentialsConf extends Configuration setProperty(path, map); } - public long getLong(String path, long def) + public long getLong(final String path, final long def) { - Number num; try { - num = (Number)getProperty(path); + final Number num = (Number)getProperty(path); + return num == null ? def : num.longValue(); } - catch(ClassCastException ex) + catch (ClassCastException ex) { return def; } - if (num == null) - { - return def; - } - return num.longValue(); } @Override - public double getDouble(String path, double def) + public double getDouble(final String path, final double def) { - Number num; try { - num = (Number)getProperty(path); - } - catch(ClassCastException ex) - { - return def; + Number num = (Number)getProperty(path); + return num == null ? def : num.doubleValue(); } - if (num == null) + catch (ClassCastException ex) { return def; } - return num.doubleValue(); } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 0d4759c64..ce97726dc 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -1,12 +1,10 @@ package com.earth2me.essentials; -import org.bukkit.craftbukkit.entity.CraftPlayer; +import java.util.List; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityCombustEvent; -import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityListener; @@ -35,25 +33,28 @@ public class EssentialsEntityListener extends EntityListener User defender = ess.getUser(eDefend); User attacker = ess.getUser(eAttack); ItemStack is = attacker.getItemInHand(); - String command = attacker.getPowertool(is); - if (command != null && !command.isEmpty()) + List<String> commandList = attacker.getPowertool(is); + if (commandList != null && !commandList.isEmpty()) { - attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName())); - event.setCancelled(true); - return; + for (String command : commandList) + { + + if (command != null && !command.isEmpty()) + { + attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName())); + event.setCancelled(true); + return; + } + } } } } - if (event instanceof EntityDamageEvent || event instanceof EntityDamageByBlockEvent || event instanceof EntityDamageByProjectileEvent) + if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) { - - if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) - { - CraftPlayer player = (CraftPlayer)event.getEntity(); - player.getHandle().fireTicks = 0; - player.setRemainingAir(player.getMaximumAir()); - event.setCancelled(true); - } + final Player player = (Player)event.getEntity(); + player.setFireTicks(0); + player.setRemainingAir(player.getMaximumAir()); + event.setCancelled(true); } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index ff32a9636..9ba02b5c3 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -73,11 +73,7 @@ public class EssentialsPlayerListener extends PlayerListener it.remove(); } } - if (user.isAfk()) - { - user.setAfk(false); - ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName())); - } + user.updateActivity(true); if (ess.getSettings().changeDisplayName()) { user.setDisplayName(user.getNick()); @@ -93,10 +89,27 @@ public class EssentialsPlayerListener extends PlayerListener } final User user = ess.getUser(event.getPlayer()); - if (user.isAfk()) + if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers()) { - user.setAfk(false); - ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName())); + final Location from = event.getFrom(); + final Location to = event.getTo().clone(); + to.setX(from.getX()); + to.setY(from.getY()); + to.setZ(from.getZ()); + try + { + event.setTo(Util.getSafeDestination(to)); + } + catch (Exception ex) + { + event.setTo(to); + } + return; + } + + Location afk = user.getAfkPosition(); + if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9) { + user.updateActivity(true); } if (!ess.getSettings().getNetherPortalsEnabled()) @@ -216,6 +229,7 @@ public class EssentialsPlayerListener extends PlayerListener user.getInventory().setContents(user.getSavedInventory()); user.setSavedInventory(null); } + user.updateActivity(false); user.dispose(); if (!ess.getSettings().getReclaimSetting()) { @@ -252,19 +266,11 @@ public class EssentialsPlayerListener extends PlayerListener ess.getBackup().onPlayerJoin(); final User user = ess.getUser(event.getPlayer()); - //we do not know the ip address on playerlogin so we need to do this here. - if (user.isIpBanned()) - { - final String banReason = user.getBanReason(); - user.kickPlayer(banReason != null && !banReason.isEmpty() ? banReason : Util.i18n("defaultBanReason")); - return; - } - if (ess.getSettings().changeDisplayName()) { user.setDisplayName(user.getNick()); } - user.setAfk(false); + user.updateActivity(false); if (user.isAuthorized("essentials.sleepingignored")) { user.setSleepingIgnored(true); @@ -299,14 +305,11 @@ public class EssentialsPlayerListener extends PlayerListener @Override public void onPlayerLogin(final PlayerLoginEvent event) { - if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL) + if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED) { return; } User user = ess.getUser(event.getPlayer()); - if (user == null) { - user = new User(event.getPlayer(), ess); - } user.setNPC(false); final long currentTime = System.currentTimeMillis(); @@ -326,6 +329,7 @@ public class EssentialsPlayerListener extends PlayerListener event.disallow(Result.KICK_FULL, Util.i18n("serverFull")); return; } + event.allow(); user.setLastLogin(System.currentTimeMillis()); updateCompass(user); @@ -426,30 +430,35 @@ public class EssentialsPlayerListener extends PlayerListener } final User user = ess.getUser(event.getPlayer()); final ItemStack is = user.getItemInHand(); - if (is == null || is.getType() == Material.AIR) - { - return; - } - final String command = user.getPowertool(is); - if (command == null || command.isEmpty()) + if (is == null || is.getType() == Material.AIR || !user.arePowerToolsEnabled()) { return; } - if (command.matches(".*\\{player\\}.*")) + final List<String> commandList = user.getPowertool(is); + if (commandList == null || commandList.isEmpty()) { - //user.sendMessage("Click a player to use this command"); return; } - if (command.startsWith("c:")) + + // We need to loop through each command and execute + for (String command : commandList) { - for (Player p : server.getOnlinePlayers()) + if (command.matches(".*\\{player\\}.*")) { - p.sendMessage(user.getDisplayName() + ":" + command.substring(2)); + //user.sendMessage("Click a player to use this command"); + continue; + } + else if (command.startsWith("c:")) + { + for (Player p : server.getOnlinePlayers()) + { + p.sendMessage(user.getDisplayName() + ":" + command.substring(2)); + } + } + else + { + user.getServer().dispatchCommand(event.getPlayer(), command); } - } - else - { - user.getServer().dispatchCommand(user, command); } } @@ -467,16 +476,16 @@ public class EssentialsPlayerListener extends PlayerListener { for (Player player : ess.getServer().getOnlinePlayers()) { - if (ess.getUser(player).isSocialSpyEnabled()) + User spyer = ess.getUser(player); + if (spyer.isSocialSpyEnabled() && !user.equals(spyer)) { player.sendMessage(user.getDisplayName() + " : " + event.getMessage()); } } } - if (user.isAfk()) + if (!cmd.equalsIgnoreCase("afk")) { - user.setAfk(false); - ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName())); + user.updateActivity(true); } } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java index 34632dd40..e64496171 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java @@ -1,16 +1,13 @@ package com.earth2me.essentials; -import com.earth2me.essentials.register.payment.Methods; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.ServerListener; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; -public class EssentialsPluginListener extends ServerListener +public class EssentialsPluginListener extends ServerListener implements IConf { private final transient IEssentials ess; private static final Logger LOGGER = Logger.getLogger("Minecraft"); @@ -23,7 +20,7 @@ public class EssentialsPluginListener extends ServerListener @Override public void onPluginEnable(final PluginEnableEvent event) { - checkPermissions(); + ess.getPermissionsHandler().checkPermissions(); if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(event.getPlugin())) { LOGGER.log(Level.INFO, "[Essentials] Payment method found (" + ess.getPaymentMethod().getMethod().getName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")"); @@ -32,50 +29,20 @@ public class EssentialsPluginListener extends ServerListener } @Override - public void onPluginDisable(PluginDisableEvent event) + public void onPluginDisable(final PluginDisableEvent event) { - checkPermissions(); + ess.getPermissionsHandler().checkPermissions(); // Check to see if the plugin thats being disabled is the one we are using if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin())) { LOGGER.log(Level.INFO, "[Essentials] Payment method was disabled. No longer accepting payments."); } } - - private void checkPermissions() - { - final PluginManager pm = ess.getServer().getPluginManager(); - final Plugin permissionsExPlugin = pm.getPlugin("PermissionsEx"); - if (permissionsExPlugin == null || !permissionsExPlugin.isEnabled()) - { - final Plugin permissionsPlugin = pm.getPlugin("Permissions"); - if (permissionsPlugin == null || !permissionsPlugin.isEnabled()) - { - if (ess.getSettings().useBukkitPermissions()) - { - ess.setPermissionsHandler(new BukkitPermissionsHandler()); - } - else - { - ess.setPermissionsHandler(new ConfigPermissionsHandler(ess)); - } - } - else - { - if (permissionsPlugin.getDescription().getVersion().charAt(0) == '3') - { - ess.setPermissionsHandler(new Permissions3Handler(permissionsPlugin)); - } - else - { - ess.setPermissionsHandler(new Permissions2Handler(permissionsPlugin)); - } - } - } - else - { - ess.setPermissionsHandler(new PermissionsExHandler()); - } + @Override + public void reloadConfig() + { + ess.getPermissionsHandler().setUseSuperperms(ess.getSettings().useBukkitPermissions()); + ess.getPermissionsHandler().checkPermissions(); } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java index 639802776..f3b447dae 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java @@ -24,16 +24,17 @@ public class EssentialsTimer implements Runnable { final User user = ess.getUser(player); onlineUsers.add(user); - user.setLastActivity(currentTime); + user.setLastOnlineActivity(currentTime); + user.checkActivity(); } final Iterator<User> iterator = onlineUsers.iterator(); while (iterator.hasNext()) { final User user = iterator.next(); - if (user.getLastActivity() < currentTime && user.getLastActivity() > user.getLastLogout()) + if (user.getLastOnlineActivity() < currentTime && user.getLastOnlineActivity() > user.getLastLogout()) { - user.setLastLogout(user.getLastActivity()); + user.setLastLogout(user.getLastOnlineActivity()); iterator.remove(); continue; } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpdateTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsUpdateTimer.java index f00f644cd..6f7579d4e 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpdateTimer.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpdateTimer.java @@ -4,65 +4,81 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.logging.Level; import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.bukkit.entity.Player; class EssentialsUpdateTimer implements Runnable { - private URL url; - private final Essentials ess; - private static final Logger logger = Logger.getLogger("Minecraft"); - - public EssentialsUpdateTimer(Essentials ess) + private transient URL url; + private final transient IEssentials ess; + private static final Logger LOGGER = Logger.getLogger("Minecraft"); + private final transient Pattern pattern = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*"); + + public EssentialsUpdateTimer(final IEssentials ess) { this.ess = ess; try { - url = new URL("http://127.0.0.1:8080/check"); + url = new URL("http://essentialsupdate.appspot.com/check"); } catch (MalformedURLException ex) { - logger.log(Level.SEVERE, "Invalid url!", ex); + LOGGER.log(Level.SEVERE, "Invalid url!", ex); } } + @Override public void run() { try { - StringBuilder sb = new StringBuilder(); - sb.append("v=").append(URLEncoder.encode(ess.getDescription().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("&l=").append(URLEncoder.encode(Util.getCurrentLocale().toString(),"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")); - for (BigInteger bigInteger : ess.getErrors().keySet()) + final StringBuilder builder = new StringBuilder(); + String bukkitVersion = ess.getServer().getVersion(); + final Matcher versionMatch = pattern.matcher(bukkitVersion); + if (versionMatch.matches()) { - sb.append("&e[]=").append(bigInteger.toString(36)); + bukkitVersion = versionMatch.group(4); } - URLConnection conn = url.openConnection(); + builder.append("v=").append(URLEncoder.encode(ess.getDescription().getVersion(), "UTF-8")); + builder.append("&b=").append(URLEncoder.encode(bukkitVersion, "UTF-8")); + final URLConnection conn = url.openConnection(); conn.setConnectTimeout(10000); conn.setDoOutput(true); conn.connect(); - OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); - wr.write(sb.toString()); - wr.flush(); - BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String ret = br.readLine(); - wr.close(); - br.close(); - logger.log(Level.INFO, ret); + final OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); + writer.write(builder.toString()); + writer.flush(); + final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); + final String ret = reader.readLine(); + writer.close(); + reader.close(); + if (!ret.isEmpty() && !ret.equalsIgnoreCase("OK")) + { + LOGGER.log(Level.INFO, "Essentials Update-Check: " + ret); + if (ret.startsWith("New Version")) + { + for (Player player : ess.getServer().getOnlinePlayers()) + { + final User user = ess.getUser(player); + if (user.isAuthorized("essentials.admin.notices.update")) + { + user.sendMessage(ret); + } + } + } + } } catch (IOException ex) { - logger.log(Level.SEVERE, "Failed to open connection", ex); + LOGGER.log(Level.SEVERE, "Failed to open connection", ex); } - } + } } diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java index c6c7effd8..409250a00 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -1,13 +1,24 @@ package com.earth2me.essentials; +import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; +import java.io.FileInputStream; import java.io.FileReader; import java.io.FileWriter; +import java.io.IOException; +import java.math.BigInteger; +import java.security.DigestInputStream; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -197,6 +208,133 @@ public class EssentialsUpgrade doneFile.save(); } + private void updateUsersPowerToolsFormat() + { + if (doneFile.getBoolean("updateUsersPowerToolsFormat", false)) + { + return; + } + final File userdataFolder = new File(ess.getDataFolder(), "userdata"); + if (!userdataFolder.exists() || !userdataFolder.isDirectory()) + { + return; + } + final File[] userFiles = userdataFolder.listFiles(); + + for (File file : userFiles) + { + if (!file.isFile() || !file.getName().endsWith(".yml")) + { + continue; + } + final EssentialsConf config = new EssentialsConf(file); + try + { + config.load(); + if (config.hasProperty("powertools")) + { + @SuppressWarnings("unchecked") + final Map<Integer, Object> powertools = (Map<Integer, Object>)config.getProperty("powertools"); + if (powertools == null) + { + continue; + } + for (Map.Entry<Integer, Object> entry : powertools.entrySet()) + { + if (entry.getValue() instanceof String) + { + List<String> temp = new ArrayList<String>(); + temp.add((String)entry.getValue()); + ((Map<Integer, Object>)powertools).put(entry.getKey(), temp); + } + } + config.save(); + } + } + catch (RuntimeException ex) + { + LOGGER.log(Level.INFO, "File: " + file.toString()); + throw ex; + } + } + doneFile.setProperty("updateUsersPowerToolsFormat", true); + doneFile.save(); + } + + private void updateUsersHomesFormat() + { + if (doneFile.getBoolean("updateUsersHomesFormat", false)) + { + return; + } + final File userdataFolder = new File(ess.getDataFolder(), "userdata"); + if (!userdataFolder.exists() || !userdataFolder.isDirectory()) + { + return; + } + final File[] userFiles = userdataFolder.listFiles(); + + for (File file : userFiles) + { + if (!file.isFile() || !file.getName().endsWith(".yml")) + { + continue; + } + final EssentialsConf config = new EssentialsConf(file); + try + { + + config.load(); + if (config.hasProperty("home") && config.hasProperty("home.default")) + { + @SuppressWarnings("unchecked") + final String defworld = (String)config.getProperty("home.default"); + final Location defloc = getFakeLocation(config, "home.worlds." + defworld); + if (defloc != null) + { + config.setProperty("homes.home", defloc); + } + + List<String> worlds = config.getKeys("home.worlds"); + Location loc; + String worldName; + + if (worlds == null) + { + continue; + } + for (String world : worlds) + { + if (defworld.equalsIgnoreCase(world)) + { + continue; + } + loc = getFakeLocation(config, "home.worlds." + world); + if (loc == null) + { + continue; + } + worldName = loc.getWorld().getName().toLowerCase(); + if (worldName != null && !worldName.isEmpty()) + { + config.setProperty("homes." + worldName, loc); + } + } + config.removeProperty("home"); + config.save(); + } + + } + catch (RuntimeException ex) + { + LOGGER.log(Level.INFO, "File: " + file.toString()); + throw ex; + } + } + doneFile.setProperty("updateUsersHomesFormat", true); + doneFile.save(); + } + private void moveUsersDataToUserdataFolder() { final File usersFile = new File(ess.getDataFolder(), "users.yml"); @@ -232,12 +370,12 @@ public class EssentialsUpgrade } if (world != null) { - user.setHome(new Location(world, - ((Number)vals.get(0)).doubleValue(), - ((Number)vals.get(1)).doubleValue(), - ((Number)vals.get(2)).doubleValue(), - ((Number)vals.get(3)).floatValue(), - ((Number)vals.get(4)).floatValue()), true); + user.setHome("home", new Location(world, + ((Number)vals.get(0)).doubleValue(), + ((Number)vals.get(1)).doubleValue(), + ((Number)vals.get(2)).doubleValue(), + ((Number)vals.get(3)).floatValue(), + ((Number)vals.get(4)).floatValue())); } } } @@ -442,6 +580,73 @@ public class EssentialsUpgrade return null; } + public Location getFakeLocation(EssentialsConf config, String path) + { + String worldName = config.getString((path != null ? path + "." : "") + "world"); + if (worldName == null || worldName.isEmpty()) + { + return null; + } + World world = getFakeWorld(worldName); + if (world == null) + { + return null; + } + return new Location(world, + config.getDouble((path != null ? path + "." : "") + "x", 0), + config.getDouble((path != null ? path + "." : "") + "y", 0), + config.getDouble((path != null ? path + "." : "") + "z", 0), + (float)config.getDouble((path != null ? path + "." : "") + "yaw", 0), + (float)config.getDouble((path != null ? path + "." : "") + "pitch", 0)); + } + + private void deleteOldItemsCsv() + { + if (doneFile.getBoolean("deleteOldItemsCsv", false)) + { + return; + } + final File file = new File(ess.getDataFolder(), "items.csv"); + if (file.exists()) + { + try + { + final Set<BigInteger> oldconfigs = new HashSet<BigInteger>(); + oldconfigs.add(new BigInteger("66ec40b09ac167079f558d1099e39f10", 16)); // sep 1 + oldconfigs.add(new BigInteger("34284de1ead43b0bee2aae85e75c041d", 16)); // crlf + oldconfigs.add(new BigInteger("c33bc9b8ee003861611bbc2f48eb6f4f", 16)); // jul 24 + oldconfigs.add(new BigInteger("6ff17925430735129fc2a02f830c1daa", 16)); // crlf + + MessageDigest digest = ManagedFile.getDigest(); + final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); + final DigestInputStream dis = new DigestInputStream(bis, digest); + final byte[] buffer = new byte[1024]; + try + { + while (dis.read(buffer) != -1) + { + } + } + finally + { + dis.close(); + } + + BigInteger hash = new BigInteger(1, digest.digest()); + if (oldconfigs.contains(hash) && !file.delete()) + { + throw new IOException("Could not delete file " + file.toString()); + } + doneFile.setProperty("deleteOldItemsCsv", true); + doneFile.save(); + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + } + } + public void beforeSettings() { if (!ess.getDataFolder().exists()) @@ -457,5 +662,8 @@ public class EssentialsUpgrade updateUsersToNewDefaultHome(); moveUsersDataToUserdataFolder(); convertWarps(); + updateUsersPowerToolsFormat(); + updateUsersHomesFormat(); + deleteOldItemsCsv(); } } diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/FakeWorld.java index d39df60e4..8894e8df1 100644 --- a/Essentials/src/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/FakeWorld.java @@ -12,16 +12,12 @@ import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.entity.Arrow; -import org.bukkit.entity.Boat; import org.bukkit.entity.CreatureType; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.LightningStrike; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Minecart; import org.bukkit.entity.Player; -import org.bukkit.entity.PoweredMinecart; -import org.bukkit.entity.StorageMinecart; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; import org.bukkit.inventory.ItemStack; @@ -404,5 +400,41 @@ public class FakeWorld implements World { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public boolean unloadChunk(Chunk chunk) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMaxHeight() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getKeepSpawnInMemory() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setKeepSpawnInMemory(boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isAutoSave() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAutoSave(boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java index 9f427b220..9dca96e81 100644 --- a/Essentials/src/com/earth2me/essentials/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/IEssentials.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.perm.PermissionsHandler; import com.earth2me.essentials.register.payment.Methods; import org.bukkit.World; import org.bukkit.command.Command; @@ -22,7 +23,7 @@ public interface IEssentials extends Plugin World getWorld(String name); - int broadcastMessage(String name, String message); + int broadcastMessage(IUser sender, String message); ISettings getSettings(); @@ -52,13 +53,9 @@ public interface IEssentials extends Plugin int scheduleSyncRepeatingTask(final Runnable run, long delay, long period); - BanWorkaround getBans(); - TNTExplodeListener getTNTListener(); - IPermissionsHandler getPermissionsHandler(); - - void setPermissionsHandler(IPermissionsHandler handler); + PermissionsHandler getPermissionsHandler(); void showError(final CommandSender sender, final Throwable exception, final String commandLabel); diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 13717f469..82c057648 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -72,6 +72,8 @@ public interface ISettings extends IConf boolean getReclaimSetting(); boolean getRespawnAtHome(); + + int getMultipleHomes(); boolean getSortListByGroups(); @@ -107,8 +109,6 @@ public interface ISettings extends IConf boolean permissionBasedItemSpawn(); - void reloadConfig(); - boolean showNonEssCommandsInHelp(); boolean spawnIfNoHome(); @@ -129,7 +129,15 @@ public interface ISettings extends IConf boolean isPlayerCommand(String string); - public boolean useBukkitPermissions(); + boolean useBukkitPermissions(); + + boolean addPrefixSuffix(); + + boolean isUpdateEnabled(); + + long getAutoAfk(); + + long getAutoAfkKick(); - public boolean addPrefixSuffix(); + boolean getFreezeAfkPlayers(); } diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index 5b2e7075e..27f95430c 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -22,7 +22,7 @@ public interface IUser boolean isAuthorized(String node); boolean isAuthorized(IEssentialsCommand cmd); - + boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix); void setLastTeleportTimestamp(long time); @@ -45,11 +45,15 @@ public interface IUser void setLastLocation(); - Location getHome(Location location); + Location getHome(String name) throws Exception; + + Location getHome(Location loc) throws Exception; String getName(); InetSocketAddress getAddress(); String getDisplayName(); + + boolean isHidden(); } diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java index 9aee4033c..3f0f89af2 100644 --- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java @@ -3,7 +3,6 @@ package com.earth2me.essentials; import java.util.HashMap; import java.util.Map; import org.bukkit.Location; -import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.entity.Item; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -130,7 +129,7 @@ public final class InventoryWorkaround // More than a single stack! if (item.getAmount() > item.getType().getMaxStackSize()) { - cinventory.setItem(firstFree, new CraftItemStack(item.getTypeId(), item.getType().getMaxStackSize(), item.getDurability())); + cinventory.setItem(firstFree, new ItemStack(item.getTypeId(), item.getType().getMaxStackSize(), item.getDurability())); item.setAmount(item.getAmount() - item.getType().getMaxStackSize()); } else diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 8e05b17fb..e978a312d 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -1,14 +1,8 @@ package com.earth2me.essentials; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -17,108 +11,45 @@ public class ItemDb implements IConf { private final transient IEssentials ess; - public ItemDb(IEssentials ess) + public ItemDb(final IEssentials ess) { this.ess = ess; + file = new ManagedFile("items.csv", ess); } - private final static Logger LOGGER = Logger.getLogger("Minecraft"); private final transient Map<String, Integer> items = new HashMap<String, Integer>(); private final transient Map<String, Short> durabilities = new HashMap<String, Short>(); + private final transient ManagedFile file; + @Override public void reloadConfig() { - final File file = new File(ess.getDataFolder(), "items.csv"); + final List<String> lines = file.getLines(); + + if (lines.isEmpty()) { + return; + } + + durabilities.clear(); + items.clear(); - if (!file.exists()) + for (String line : lines) { - final InputStream res = ItemDb.class.getResourceAsStream("/items.csv"); - FileWriter tx = null; - try + line = line.trim().toLowerCase(); + if (line.length() > 0 && line.charAt(0) == '#') { - tx = new FileWriter(file); - for (int i = 0; (i = res.read()) > 0;) - { - tx.write(i); - } - tx.flush(); - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, Util.i18n("itemsCsvNotLoaded"), ex); - return; - } - finally - { - try - { - res.close(); - } - catch (Exception ex) - { - } - try - { - if (tx != null) - { - tx.close(); - } - } - catch (Exception ex) - { - } + continue; } - } - BufferedReader rx = null; - try - { - rx = new BufferedReader(new FileReader(file)); - durabilities.clear(); - items.clear(); - - for (int i = 0; rx.ready(); i++) + final String[] parts = line.split("[^a-z0-9]"); + if (parts.length < 2) { - try - { - final String line = rx.readLine().trim().toLowerCase(); - if (line.startsWith("#")) - { - continue; - } - - final String[] parts = line.split("[^a-z0-9]"); - if (parts.length < 2) - { - continue; - } + continue; + } - final int numeric = Integer.parseInt(parts[1]); + final int numeric = Integer.parseInt(parts[1]); - durabilities.put(parts[0].toLowerCase(), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0); - items.put(parts[0].toLowerCase(), numeric); - } - catch (Exception ex) - { - LOGGER.warning(Util.format("parseError", "items.csv", i)); - } - } - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, Util.i18n("itemsCsvNotLoaded"), ex); - } - finally - { - if (rx != null) { - try - { - rx.close(); - } - catch (IOException ex) - { - LOGGER.log(Level.SEVERE, ex.getMessage(), ex); - } - } + durabilities.put(parts[0].toLowerCase(), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0); + items.put(parts[0].toLowerCase(), numeric); } } @@ -163,7 +94,7 @@ public class ItemDb implements IConf metaData = durabilities.get(itemname); } } - else if(Material.getMaterial(itemname) != null) + else if (Material.getMaterial(itemname) != null) { itemid = Material.getMaterial(itemname).getId(); metaData = 0; diff --git a/Essentials/src/com/earth2me/essentials/ManagedFile.java b/Essentials/src/com/earth2me/essentials/ManagedFile.java new file mode 100644 index 000000000..759261e02 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/ManagedFile.java @@ -0,0 +1,235 @@ +package com.earth2me.essentials; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.math.BigInteger; +import java.security.DigestInputStream; +import java.security.DigestOutputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import org.bukkit.Bukkit; + + +public class ManagedFile +{ + private final static int BUFFERSIZE = 1024 * 8; + private final transient File file; + + public ManagedFile(final String filename, final IEssentials ess) + { + file = new File(ess.getDataFolder(), filename); + + if (file.exists()) + { + try + { + if (checkForVersion(file, ess.getDescription().getVersion()) && !file.delete()) + { + throw new IOException("Could not delete file " + file.toString()); + } + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + } + + if (!file.exists()) + { + try + { + copyResourceAscii("/" + filename, file); + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.SEVERE, Util.i18n("itemsCsvNotLoaded"), ex); + } + } + } + + public static void copyResourceAscii(final String resourceName, final File file) throws IOException + { + final InputStreamReader reader = new InputStreamReader(ManagedFile.class.getResourceAsStream(resourceName)); + try + { + final MessageDigest digest = getDigest(); + final DigestOutputStream digestStream = new DigestOutputStream(new FileOutputStream(file), digest); + try + { + final OutputStreamWriter writer = new OutputStreamWriter(digestStream); + try + { + final char[] buffer = new char[BUFFERSIZE]; + do + { + final int length = reader.read(buffer); + if (length >= 0) + { + writer.write(buffer, 0, length); + } + else + { + break; + } + } + while (true); + writer.write("\n"); + writer.flush(); + final BigInteger hashInt = new BigInteger(1, digest.digest()); + digestStream.on(false); + digestStream.write('#'); + digestStream.write(hashInt.toString(16).getBytes()); + } + finally + { + writer.close(); + } + } + finally + { + digestStream.close(); + } + } + finally + { + reader.close(); + } + } + + public static boolean checkForVersion(final File file, final String version) throws IOException + { + if (file.length() < 33) + { + return false; + } + final BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); + try + { + final byte[] buffer = new byte[(int)file.length()]; + int position = 0; + do + { + final int length = bis.read(buffer, position, Math.min((int)file.length() - position, BUFFERSIZE)); + if (length < 0) + { + break; + } + position += length; + } + while (position < file.length()); + final ByteArrayInputStream bais = new ByteArrayInputStream(buffer); + if (bais.skip(file.length() - 33) != file.length() - 33) + { + return false; + } + final BufferedReader reader = new BufferedReader(new InputStreamReader(bais)); + try + { + String hash = reader.readLine(); + if (hash.matches("#[a-f0-9]{32}")) + { + hash = hash.substring(1); + bais.reset(); + final String versionline = reader.readLine(); + if (versionline.matches("#version: .+")) + { + final String versioncheck = versionline.substring(10); + if (!versioncheck.equalsIgnoreCase(version)) + { + bais.reset(); + final MessageDigest digest = getDigest(); + final DigestInputStream digestStream = new DigestInputStream(bais, digest); + try + { + final byte[] bytes = new byte[(int)file.length() - 33]; + digestStream.read(bytes); + final BigInteger correct = new BigInteger(hash, 16); + final BigInteger test = new BigInteger(1, digest.digest()); + if (correct.equals(test)) + { + return true; + } + else + { + Bukkit.getLogger().warning("File " + file.toString() + " has been modified by user and file version differs, please update the file manually."); + } + } + finally + { + digestStream.close(); + } + } + } + } + } + finally + { + reader.close(); + } + } + finally + { + bis.close(); + } + return false; + } + + public static MessageDigest getDigest() throws IOException + { + try + { + return MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException ex) + { + throw new IOException(ex); + } + } + + public List<String> getLines() + { + try + { + final BufferedReader reader = new BufferedReader(new FileReader(file)); + try + { + final List<String> lines = new ArrayList<String>(); + do + { + final String line = reader.readLine(); + if (line == null) + { + break; + } + else + { + lines.add(line); + } + } + while (true); + return lines; + } + finally + { + reader.close(); + } + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + return Collections.emptyList(); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/Mob.java b/Essentials/src/com/earth2me/essentials/Mob.java index f5e1aea3d..df4a5b72f 100644 --- a/Essentials/src/com/earth2me/essentials/Mob.java +++ b/Essentials/src/com/earth2me/essentials/Mob.java @@ -27,7 +27,10 @@ public enum Mob SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID), ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE), MONSTER("Monster", Enemies.ENEMY, CreatureType.MONSTER), - WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF); + WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF), + CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER), + ENDERMAN("Enderman", Enemies.ENEMY, CreatureType.ENDERMAN), + SILVERFISH("Silverfish", Enemies.ENEMY, CreatureType.SILVERFISH); public static final Logger logger = Logger.getLogger("Minecraft"); @@ -86,6 +89,9 @@ public enum Mob final protected String type; } + public CreatureType getType () { + return bukkitType; + } public static class MobException extends Exception { diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index 895e2c4d5..0d019848e 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -7,6 +7,7 @@ import java.util.Set; import java.util.UUID; import org.bukkit.Achievement; import org.bukkit.Effect; +import org.bukkit.GameMode; import org.bukkit.Instrument; import org.bukkit.Location; import org.bukkit.Material; @@ -24,6 +25,7 @@ import org.bukkit.entity.Vehicle; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; +import org.bukkit.map.MapView; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; @@ -38,22 +40,24 @@ public class OfflinePlayer implements Player private Location location = new Location(null, 0, 0, 0, 0, 0); private World world; private UUID uniqueId = UUID.randomUUID(); + private org.bukkit.OfflinePlayer base; public OfflinePlayer(String name, IEssentials ess) { this.name = name; this.ess = ess; this.world = ess.getServer().getWorlds().get(0); + this.base = ess.getServer().getOfflinePlayer(name); } public boolean isOnline() { - return false; + return base.isOnline(); } public boolean isOp() { - return false; + return base.isOp(); } public void sendMessage(String string) @@ -575,5 +579,120 @@ public class OfflinePlayer implements Player public void setOp(boolean bln) { + base.setOp(bln); + } + + @Override + public void sendMap(MapView mv) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isBanned() + { + return base.isBanned(); + } + + @Override + public void setBanned(boolean bln) + { + base.setBanned(bln); + } + + @Override + public boolean isWhitelisted() + { + return base.isWhitelisted(); + } + + @Override + public void setWhitelisted(boolean bln) + { + base.setWhitelisted(bln); + } + + @Override + public GameMode getGameMode() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setGameMode(GameMode gm) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getExperience() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setExperience(int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getLevel() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setLevel(int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getTotalExperience() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setTotalExperience(int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getExhaustion() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setExhaustion(float f) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public float getSaturation() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setSaturation(float f) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getFoodLevel() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setFoodLevel(int i) + { + throw new UnsupportedOperationException("Not supported yet."); } } diff --git a/Essentials/src/com/earth2me/essentials/PlayerExtension.java b/Essentials/src/com/earth2me/essentials/PlayerExtension.java index e72cf25f4..ef63dacc3 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerExtension.java +++ b/Essentials/src/com/earth2me/essentials/PlayerExtension.java @@ -17,16 +17,6 @@ public class PlayerExtension extends PlayerWrapper this.ess = ess; } - public boolean isBanned() - { - return ess.getBans().isNameBanned(this.getName()); - } - - public boolean isIpBanned() - { - return ess.getBans().isIpBanned(getAddress().getAddress().getHostAddress()); - } - public float getCorrectedYaw() { float angle = (getLocation().getYaw() - 90.0f) % 360.0f; diff --git a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java index 8acd7fed6..6fde72e71 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java +++ b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java @@ -7,6 +7,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.*; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.inventory.*; +import org.bukkit.map.MapView; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; @@ -405,20 +406,6 @@ public class PlayerWrapper implements Player return base.eject(); } - @Override - @Deprecated - public void teleportTo(Location lctn) - { - base.teleportTo(lctn); - } - - @Override - @Deprecated - public void teleportTo(Entity entity) - { - base.teleportTo(entity); - } - public void saveData() { base.saveData(); @@ -624,4 +611,118 @@ public class PlayerWrapper implements Player { base.setOp(bln); } + + @Override + public void sendMap(MapView mv) + { + base.sendMap(mv); + } + + @Override + public boolean isBanned() + { + return base.isBanned(); + } + + @Override + public void setBanned(boolean bln) + { + base.setBanned(bln); + } + + @Override + public boolean isWhitelisted() + { + return base.isWhitelisted(); + } + + @Override + public void setWhitelisted(boolean bln) + { + base.setWhitelisted(bln); + } + + @Override + public GameMode getGameMode() + { + return base.getGameMode(); + } + + @Override + public void setGameMode(GameMode gm) + { + base.setGameMode(gm); + } + + @Override + public int getExperience() + { + return base.getExperience(); + } + + @Override + public void setExperience(int i) + { + base.setExperience(i); + } + + @Override + public int getLevel() + { + return base.getLevel(); + } + + @Override + public void setLevel(int i) + { + base.setLevel(i); + } + + @Override + public int getTotalExperience() + { + return base.getTotalExperience(); + } + + @Override + public void setTotalExperience(int i) + { + base.setTotalExperience(i); + } + + @Override + public float getExhaustion() + { + return base.getExhaustion(); + } + + @Override + public void setExhaustion(float f) + { + base.setExhaustion(f); + } + + @Override + public float getSaturation() + { + return base.getSaturation(); + } + + @Override + public void setSaturation(float f) + { + base.setSaturation(f); + } + + @Override + public int getFoodLevel() + { + return base.getFoodLevel(); + } + + @Override + public void setFoodLevel(int i) + { + base.setFoodLevel(i); + } } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 1700dec3a..665da17a6 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -30,6 +30,12 @@ public class Settings implements ISettings { return config.getBoolean("respawn-at-home", false); } + + @Override + public int getMultipleHomes() + { + return config.getInt("multiple-homes", 5); + } @Override public boolean getBedSetsHome() @@ -473,4 +479,28 @@ public class Settings implements ISettings { return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat")); } + + @Override + public boolean isUpdateEnabled() + { + return config.getBoolean("update-check", false); + } + + @Override + public long getAutoAfk() + { + return config.getLong("auto-afk", 300); + } + + @Override + public long getAutoAfkKick() + { + return config.getLong("auto-afk-kick", -1); + } + + @Override + public boolean getFreezeAfkPlayers() + { + return config.getBoolean("freeze-afk-players", false); + } } diff --git a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java index bdd453266..90c66aa35 100644 --- a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java +++ b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import net.minecraft.server.ChunkPosition; import net.minecraft.server.Packet60Explosion; import org.bukkit.Location; @@ -52,6 +54,7 @@ public class TNTExplodeListener extends EntityListener implements Runnable { return; } + try { final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size()); final Player[] players = ess.getServer().getOnlinePlayers(); final List<ChunkPosition> blocksUnderPlayers = new ArrayList<ChunkPosition>(players.length); @@ -72,6 +75,9 @@ public class TNTExplodeListener extends EntityListener implements Runnable } } ((CraftServer)ess.getServer()).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0F, set)); + } catch (Throwable ex) { + Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); + } event.setCancelled(true); } diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 9fb9b7433..608663561 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import com.earth2me.essentials.commands.NotEnoughArgumentsException; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.logging.Logger; @@ -10,6 +11,8 @@ import org.bukkit.entity.Entity; public class Teleport implements Runnable { private static final double MOVE_CONSTANT = 0.3; + + private static class Target { private final Location location; @@ -57,9 +60,9 @@ public class Teleport implements Runnable this.started = System.currentTimeMillis(); this.delay = delay; this.health = user.getHealth(); - this.initX = Math.round(user.getLocation().getX()*MOVE_CONSTANT); - this.initY = Math.round(user.getLocation().getY()*MOVE_CONSTANT); - this.initZ = Math.round(user.getLocation().getZ()*MOVE_CONSTANT); + this.initX = Math.round(user.getLocation().getX() * MOVE_CONSTANT); + this.initY = Math.round(user.getLocation().getY() * MOVE_CONSTANT); + this.initZ = Math.round(user.getLocation().getZ() * MOVE_CONSTANT); this.teleportTarget = target; this.chargeFor = chargeFor; } @@ -72,9 +75,9 @@ public class Teleport implements Runnable cancel(); return; } - if (Math.round(user.getLocation().getX()*MOVE_CONSTANT) != initX - || Math.round(user.getLocation().getY()*MOVE_CONSTANT) != initY - || Math.round(user.getLocation().getZ()*MOVE_CONSTANT) != initZ + if (Math.round(user.getLocation().getX() * MOVE_CONSTANT) != initX + || Math.round(user.getLocation().getY() * MOVE_CONSTANT) != initY + || Math.round(user.getLocation().getZ() * MOVE_CONSTANT) != initZ || user.getHealth() < health) { // user moved, cancel teleport cancel(true); @@ -92,7 +95,7 @@ public class Teleport implements Runnable user.sendMessage(Util.i18n("teleportationCommencing")); try { - + now(teleportTarget); if (chargeFor != null) { @@ -229,7 +232,7 @@ public class Teleport implements Runnable cooldown(false); now(new Target(loc)); } - + public void now(Location loc, Trade chargeFor) throws Exception { cooldown(false); @@ -256,24 +259,12 @@ public class Teleport implements Runnable back(null); } - public void home(Trade chargeFor) throws Exception + public void home(IUser user, String home, Trade chargeFor) throws Exception { - home(user, chargeFor); - } - - public void home(IUser user, Trade chargeFor) throws Exception - { - Location loc = user.getHome(this.user.getLocation()); + final Location loc = user.getHome(home); if (loc == null) { - if (ess.getSettings().spawnIfNoHome()) - { - respawn(ess.getSpawn(), chargeFor); - } - else - { - throw new Exception(user == this.user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer")); - } + throw new NotEnoughArgumentsException(); } teleport(new Target(loc), chargeFor); } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 6c18c03ae..2f4fc2951 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -4,67 +4,79 @@ import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.register.payment.Method; import java.util.Calendar; import java.util.GregorianCalendar; -import java.util.logging.Logger; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class User extends UserData implements Comparable<User>, IReplyTo, IUser { - private static final Logger logger = Logger.getLogger("Minecraft"); private boolean justPortaled = false; private CommandSender replyTo = null; - private User teleportRequester; - private boolean teleportRequestHere; - private final Teleport teleport; - private long lastActivity; + private transient User teleportRequester; + private transient boolean teleportRequestHere; + private transient final Teleport teleport; + private transient long lastOnlineActivity; + private transient long lastActivity = System.currentTimeMillis(); private boolean hidden = false; - - User(Player base, IEssentials ess) + private transient boolean godStateBeforeAfk; + private transient Location afkPosition; + + User(final Player base, final IEssentials ess) { super(base, ess); teleport = new Teleport(this, ess); + godStateBeforeAfk = isGodModeEnabled(); + afkPosition = getLocation(); } - - User update(Player base) + + User update(final Player base) { setBase(base); return this; } - - public boolean isAuthorized(IEssentialsCommand cmd) + + @Override + public boolean isAuthorized(final IEssentialsCommand cmd) { return isAuthorized(cmd, "essentials."); } - - public boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix) + + @Override + public boolean isAuthorized(final IEssentialsCommand cmd, final String permissionPrefix) { return isAuthorized(permissionPrefix + (cmd.getName().equals("r") ? "msg" : cmd.getName())); } - - public boolean isAuthorized(String node) + + @Override + public boolean isAuthorized(final String node) { + if (base instanceof OfflinePlayer) + { + return false; + } + if (isOp()) { return true; } - + if (isJailed()) { return false; } - - return ess.getPermissionsHandler().hasPermission(this, node); + + return ess.getPermissionsHandler().hasPermission(base, node); } - + public void healCooldown() throws Exception { - Calendar now = new GregorianCalendar(); + final Calendar now = new GregorianCalendar(); if (getLastHealTimestamp() > 0) { - double cooldown = ess.getSettings().getHealCooldown(); - Calendar cooldownTime = new GregorianCalendar(); + final double cooldown = ess.getSettings().getHealCooldown(); + final Calendar cooldownTime = new GregorianCalendar(); cooldownTime.setTimeInMillis(getLastHealTimestamp()); cooldownTime.add(Calendar.SECOND, (int)cooldown); cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0)); @@ -75,13 +87,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser } setLastHealTimestamp(now.getTimeInMillis()); } - - public void giveMoney(double value) + + @Override + public void giveMoney(final double value) { giveMoney(value, null); } - - public void giveMoney(double value, CommandSender initiator) + + public void giveMoney(final double value, final CommandSender initiator) { if (value == 0) { @@ -91,35 +104,36 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser sendMessage(Util.format("addedToAccount", Util.formatCurrency(value, ess))); if (initiator != null) { - initiator.sendMessage((Util.format("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()))); + initiator.sendMessage(Util.format("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName())); } } - - public void payUser(User reciever, double value) throws Exception + + public void payUser(final User reciever, final double value) throws Exception { if (value == 0) { return; } - if (!canAfford(value)) - { - throw new Exception(Util.i18n("notEnoughMoney")); - } - else + if (canAfford(value)) { setMoney(getMoney() - value); reciever.setMoney(reciever.getMoney() + value); sendMessage(Util.format("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName())); reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName())); } + else + { + throw new Exception(Util.i18n("notEnoughMoney")); + } } - - public void takeMoney(double value) + + @Override + public void takeMoney(final double value) { takeMoney(value, null); } - - public void takeMoney(double value, CommandSender initiator) + + public void takeMoney(final double value, final CommandSender initiator) { if (value == 0) { @@ -129,99 +143,108 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value, ess))); if (initiator != null) { - initiator.sendMessage((Util.format("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()))); + initiator.sendMessage(Util.format("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName())); } } - - public boolean canAfford(double cost) + + public boolean canAfford(final double cost) { - double mon = getMoney(); + final double mon = getMoney(); return mon >= cost || isAuthorized("essentials.eco.loan"); } - + public void dispose() { this.base = new OfflinePlayer(getName(), ess); } - + public boolean getJustPortaled() { return justPortaled; } - - public void setJustPortaled(boolean value) + + public void setJustPortaled(final boolean value) { justPortaled = value; } - - public void setReplyTo(CommandSender user) + + @Override + public void setReplyTo(final CommandSender user) { replyTo = user; } - + + @Override public CommandSender getReplyTo() { return replyTo; } - - public int compareTo(User t) + + @Override + public int compareTo(final User other) { - return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(t.getDisplayName())); + return ChatColor.stripColor(this.getDisplayName()).compareToIgnoreCase(ChatColor.stripColor(other.getDisplayName())); } - + @Override - public boolean equals(Object o) + public boolean equals(final Object object) { - if (!(o instanceof User)) + if (!(object instanceof User)) { return false; } - return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)o).getDisplayName())); - + return ChatColor.stripColor(this.getDisplayName()).equalsIgnoreCase(ChatColor.stripColor(((User)object).getDisplayName())); + } - + @Override public int hashCode() { return ChatColor.stripColor(this.getDisplayName()).hashCode(); } - - public Boolean canSpawnItem(int itemId) + + public Boolean canSpawnItem(final int itemId) { return !ess.getSettings().itemSpawnBlacklist().contains(itemId); } - + + public Location getHome() throws Exception + { + return getHome(getHomes().get(0)); + } + public void setHome() { - setHome(getLocation(), true); + setHome("home", getLocation()); } - - public void setHome(boolean defaultHome) + + public void setHome(final String name) { - setHome(getLocation(), defaultHome); + setHome(name, getLocation()); } - + + @Override public void setLastLocation() { setLastLocation(getLocation()); } - - public void requestTeleport(User player, boolean here) + + public void requestTeleport(final User player, final boolean here) { teleportRequester = player; teleportRequestHere = here; } - + public User getTeleportRequest() { return teleportRequester; } - + public boolean isTeleportRequestHere() { return teleportRequestHere; } - + public String getNick() { final StringBuilder nickname = new StringBuilder(); @@ -245,12 +268,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { } } - + if (ess.getSettings().addPrefixSuffix()) { - final String prefix = ess.getPermissionsHandler().getPrefix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); - final String suffix = ess.getPermissionsHandler().getSuffix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); - + final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); + final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName()); + nickname.insert(0, prefix); nickname.append(suffix); if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§")) @@ -258,25 +281,25 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser nickname.append("§f"); } } - + return nickname.toString(); } - + public Teleport getTeleport() { return teleport; } - - public long getLastActivity() + + public long getLastOnlineActivity() { - return lastActivity; + return lastOnlineActivity; } - - public void setLastActivity(long timestamp) + + public void setLastOnlineActivity(final long timestamp) { - lastActivity = timestamp; + lastOnlineActivity = timestamp; } - + @Override public double getMoney() { @@ -284,12 +307,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser { try { - Method method = ess.getPaymentMethod().getMethod(); + final Method method = ess.getPaymentMethod().getMethod(); if (!method.hasAccount(this.getName())) { throw new Exception(); } - Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); + final Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); return account.balance(); } catch (Throwable ex) @@ -298,20 +321,20 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser } return super.getMoney(); } - + @Override - public void setMoney(double value) + public void setMoney(final double value) { if (ess.getPaymentMethod().hasMethod()) { try { - Method method = ess.getPaymentMethod().getMethod(); + final Method method = ess.getPaymentMethod().getMethod(); if (!method.hasAccount(this.getName())) { throw new Exception(); } - Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); + final Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); account.set(value); } catch (Throwable ex) @@ -320,32 +343,44 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser } super.setMoney(value); } - + @Override - public void setAfk(boolean set) + public void setAfk(final boolean set) { this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : set); + if (set && !isAfk() && ess.getSettings().getFreezeAfkPlayers()) + { + godStateBeforeAfk = isGodModeEnabled(); + setGodModeEnabled(true); + } + if (!set && isAfk() && ess.getSettings().getFreezeAfkPlayers()) + { + setGodModeEnabled(godStateBeforeAfk); + } + if (set && !isAfk()) { + afkPosition = getLocation(); + } super.setAfk(set); } - + @Override public boolean toggleAfk() { - boolean now = super.toggleAfk(); + final boolean now = super.toggleAfk(); this.setSleepingIgnored(this.isAuthorized("essentials.sleepingignored") ? true : now); return now; } - + public boolean isHidden() { return hidden; } - - public void setHidden(boolean hidden) + + public void setHidden(final boolean hidden) { this.hidden = hidden; } - + public void checkJailTimeout(final long currentTime) { if (getJailTimeout() > 0 && getJailTimeout() < currentTime && isJailed()) @@ -363,7 +398,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser } } } - + public void checkMuteTimeout(final long currentTime) { if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted()) @@ -373,13 +408,60 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser setMuted(false); } } - + public void checkBanTimeout(final long currentTime) { - if (getBanTimeout() > 0 && getBanTimeout() < currentTime && ess.getBans().isNameBanned(getName())) + if (getBanTimeout() > 0 && getBanTimeout() < currentTime && isBanned()) { setBanTimeout(0); - ess.getBans().unbanByName(getName()); + setBanned(false); } } + + public void updateActivity(final boolean broadcast) + { + if (isAfk()) + { + setAfk(false); + if (broadcast && !isHidden()) + { + ess.broadcastMessage(this, Util.format("userIsNotAway", getDisplayName())); + } + } + lastActivity = System.currentTimeMillis(); + } + + public void checkActivity() + { + final long autoafkkick = ess.getSettings().getAutoAfkKick(); + if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis() + && !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt")) + { + final String kickReason = Util.format("autoAfkKickReason", autoafkkick / 60.0); + kickPlayer(kickReason); + + + for (Player player : ess.getServer().getOnlinePlayers()) + { + final User user = ess.getUser(player); + if (user.isAuthorized("essentials.kick.notify")) + { + player.sendMessage(Util.format("playerKicked", Console.NAME, getName(), kickReason)); + } + } + } + final long autoafk = ess.getSettings().getAutoAfk(); + if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis()) + { + setAfk(true); + if (!isHidden()) { + ess.broadcastMessage(this, Util.format("userIsAway", getDisplayName())); + } + } + } + + public Location getAfkPosition() + { + return afkPosition; + } } diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 896339642..75d126c3e 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -1,15 +1,14 @@ package com.earth2me.essentials; +import com.earth2me.essentials.commands.NotEnoughArgumentsException; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -36,7 +35,8 @@ public abstract class UserData extends PlayerExtension implements IConf config.load(); money = _getMoney(); unlimited = _getUnlimited(); - powertools = getPowertools(); + powertools = _getPowertools(); + homes = _getHomes(); lastLocation = _getLastLocation(); lastTeleportTimestamp = _getLastTeleportTimestamp(); lastHealTimestamp = _getLastHealTimestamp(); @@ -57,6 +57,7 @@ public abstract class UserData extends PlayerExtension implements IConf geolocation = _getGeoLocation(); isSocialSpyEnabled = _isSocialSpyEnabled(); isNPC = _isNPC(); + arePowerToolsEnabled = _arePowerToolsEnabled(); } private double money; @@ -89,48 +90,97 @@ public abstract class UserData extends PlayerExtension implements IConf config.setProperty("money", value); config.save(); } + private Map<String, Object> homes; - public boolean hasHome() + private Map<String, Object> _getHomes() { - if (config.hasProperty("home")) + Object o = config.getProperty("homes"); + + if (o instanceof Map) { - return true; + return (Map<String, Object>)o; } - return false; + else + { + return new HashMap<String, Object>(); + } + } - public Location getHome(Location location) + public Location getHome(String name) throws Exception { - if (!hasHome()) + Location loc = config.getLocation("homes." + name, getServer()); + if (loc == null) { - return null; + try + { + loc = config.getLocation("homes." + getHomes().get(Integer.parseInt(name) - 1), getServer()); + } + catch (IndexOutOfBoundsException e) + { + return null; + } + catch (NumberFormatException e) + { + return null; + } } - World world = location.getWorld(); - String worldHome = "home.worlds." + world.getName().toLowerCase(); - if (!config.hasProperty(worldHome)) + + return loc; + } + + public Location getHome(Location world) throws Exception + { + Location loc; + for (String home : getHomes()) { - String defaultWorld = config.getString("home.default"); - worldHome = "home.worlds." + defaultWorld; + loc = config.getLocation("homes." + home, getServer()); + if (world.getWorld() == loc.getWorld()) + { + return loc; + } + } - Location loc = config.getLocation(worldHome, getServer()); + loc = config.getLocation("homes." + getHomes().get(0), getServer()); return loc; } - public void setHome(Location loc, boolean b) + public List<String> getHomes() + { + List<String> list = new ArrayList(homes.keySet()); + return list; + + } + + public void setHome(String name, Location loc) + { + homes.put(name, loc); + config.setProperty("homes." + name, loc); + config.save(); + } + + public void delHome(String name) throws Exception { - String worldName = loc.getWorld().getName().toLowerCase(); - if (worldName == null || worldName.isEmpty()) + if (getHome(name) != null) { - logger.log(Level.WARNING, Util.i18n("emptyWorldName")); - return; + homes.remove(name); + config.removeProperty("homes." + name); + config.save(); } - if (b || !config.hasProperty("home.default")) + else { - config.setProperty("home.default", worldName); + //TODO: move this message to messages file + throw new Exception("Home " + name + " doesn't exist"); } + } - config.setProperty("home.worlds." + worldName, loc); - config.save(); + public boolean hasHome() + { + if (config.hasProperty("home")) + { + return true; + } + return false; } public String getNickname() @@ -173,46 +223,66 @@ public abstract class UserData extends PlayerExtension implements IConf config.setProperty("unlimited", unlimited); config.save(); } - private Map<Integer, String> powertools; + private Map<Integer, Object> powertools; @SuppressWarnings("unchecked") - private Map<Integer, String> getPowertools() + private Map<Integer, Object> _getPowertools() { Object o = config.getProperty("powertools"); + if (o instanceof Map) { - return (Map<Integer, String>)o; + return (Map<Integer, Object>)o; } else { - return new HashMap<Integer, String>(); + return new HashMap<Integer, Object>(); } } - public String getPowertool(ItemStack stack) + public void clearAllPowertools() { + powertools.clear(); + config.setProperty("powertools", powertools); + config.save(); + } + + public List<String> getPowertool(ItemStack stack) { - return powertools.get(stack.getTypeId()); + return (List<String>)powertools.get(stack.getTypeId()); } - public void setPowertool(ItemStack stack, String command) + public void setPowertool(ItemStack stack, List<String> commandList) { - if (command == null || command.isEmpty()) + if (commandList == null || commandList.isEmpty()) { powertools.remove(stack.getTypeId()); } else { - powertools.put(stack.getTypeId(), command); + powertools.put(stack.getTypeId(), commandList); } config.setProperty("powertools", powertools); config.save(); } + + public boolean hasPowerTools() + { + return powertools.size() > 0; + } + private Location lastLocation; private Location _getLastLocation() { - return config.getLocation("lastlocation", getServer()); + try + { + return config.getLocation("lastlocation", getServer()); + } + catch (Exception e) + { + return null; + } } public Location getLastLocation() @@ -709,4 +779,31 @@ public abstract class UserData extends PlayerExtension implements IConf config.setProperty("npc", set); config.save(); } + + private boolean arePowerToolsEnabled; + + public boolean arePowerToolsEnabled() + { + return arePowerToolsEnabled; + } + + public void setPowerToolsEnabled(boolean set) + { + arePowerToolsEnabled = set; + config.setProperty("powertoolsenabled", set); + config.save(); + } + + public boolean togglePowerToolsEnabled() + { + boolean ret = !arePowerToolsEnabled(); + setPowerToolsEnabled(ret); + return ret; + } + + private boolean _arePowerToolsEnabled() + { + return config.getBoolean("powertoolsenabled", true); + } + } diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java index 7a7fdb4af..69ddb5354 100644 --- a/Essentials/src/com/earth2me/essentials/UserMap.java +++ b/Essentials/src/com/earth2me/essentials/UserMap.java @@ -1,11 +1,14 @@ package com.earth2me.essentials; import com.google.common.base.Function; +import com.google.common.collect.ComputationException; import com.google.common.collect.MapMaker; import java.io.File; import java.util.HashSet; import java.util.Set; import java.util.concurrent.ConcurrentMap; +import java.util.logging.Level; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -47,6 +50,10 @@ public class UserMap implements Function<String, User>, IConf { // Ignore these } + catch (ComputationException ex) + { + Bukkit.getLogger().log(Level.INFO, "Failed to preload user "+name, ex); + } } } }); @@ -104,4 +111,9 @@ public class UserMap implements Function<String, User>, IConf } return userSet; } + + public int getUniqueUsers() + { + return users.size(); + } } diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java index 614e9b2b9..7d0093680 100644 --- a/Essentials/src/com/earth2me/essentials/Util.java +++ b/Essentials/src/com/earth2me/essentials/Util.java @@ -14,9 +14,12 @@ import java.text.MessageFormat; import java.util.Calendar; import java.util.Enumeration; import java.util.GregorianCalendar; +import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; @@ -216,6 +219,40 @@ public class Util return c.getTimeInMillis(); } + // The player can stand inside these materials + private static final Set<Integer> AIR_MATERIALS = new HashSet<Integer>(); + + static { + AIR_MATERIALS.add(Material.AIR.getId()); + AIR_MATERIALS.add(Material.SAPLING.getId()); + AIR_MATERIALS.add(Material.POWERED_RAIL.getId()); + AIR_MATERIALS.add(Material.DETECTOR_RAIL.getId()); + AIR_MATERIALS.add(Material.DEAD_BUSH.getId()); + AIR_MATERIALS.add(Material.RAILS.getId()); + AIR_MATERIALS.add(Material.YELLOW_FLOWER.getId()); + AIR_MATERIALS.add(Material.RED_ROSE.getId()); + AIR_MATERIALS.add(Material.RED_MUSHROOM.getId()); + AIR_MATERIALS.add(Material.BROWN_MUSHROOM.getId()); + AIR_MATERIALS.add(Material.SEEDS.getId()); + AIR_MATERIALS.add(Material.SIGN_POST.getId()); + AIR_MATERIALS.add(Material.WALL_SIGN.getId()); + AIR_MATERIALS.add(Material.LADDER.getId()); + AIR_MATERIALS.add(Material.SUGAR_CANE_BLOCK.getId()); + AIR_MATERIALS.add(Material.REDSTONE_WIRE.getId()); + AIR_MATERIALS.add(Material.REDSTONE_TORCH_OFF.getId()); + AIR_MATERIALS.add(Material.REDSTONE_TORCH_ON.getId()); + AIR_MATERIALS.add(Material.TORCH.getId()); + AIR_MATERIALS.add(Material.SOIL.getId()); + AIR_MATERIALS.add(Material.DIODE_BLOCK_OFF.getId()); + AIR_MATERIALS.add(Material.DIODE_BLOCK_ON.getId()); + AIR_MATERIALS.add(Material.TRAP_DOOR.getId()); + AIR_MATERIALS.add(Material.STONE_BUTTON.getId()); + AIR_MATERIALS.add(Material.STONE_PLATE.getId()); + AIR_MATERIALS.add(Material.WOOD_PLATE.getId()); + AIR_MATERIALS.add(Material.IRON_DOOR_BLOCK.getId()); + AIR_MATERIALS.add(Material.WOODEN_DOOR.getId()); + } + public static Location getSafeDestination(final Location loc) throws Exception { if (loc == null || loc.getWorld() == null) @@ -223,9 +260,9 @@ public class Util throw new Exception(Util.i18n("destinationNotSet")); } final World world = loc.getWorld(); - int x = loc.getBlockX(); - int y = loc.getBlockY(); - int z = loc.getBlockZ(); + int x = (int)Math.round(loc.getX()); + int y = (int)Math.round(loc.getY()); + int z = (int)Math.round(loc.getZ()); while (isBlockAboveAir(world, x, y, z)) { @@ -263,7 +300,7 @@ public class Util private static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) { - return world.getBlockAt(x, y - 1, z).getType() == Material.AIR; + return AIR_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType().getId()); } public static boolean isBlockUnsafe(final World world, final int x, final int y, final int z) @@ -279,8 +316,8 @@ public class Util return true; } - if ((world.getBlockAt(x, y, z).getType() != Material.AIR) - || (world.getBlockAt(x, y + 1, z).getType() != Material.AIR)) + if ((!AIR_MATERIALS.contains(world.getBlockAt(x, y, z).getType().getId())) + || (!AIR_MATERIALS.contains(world.getBlockAt(x, y + 1, z).getType().getId()))) { return true; } @@ -469,18 +506,40 @@ public class Util public static String joinList(Object... list) { - final StringBuilder buf = new StringBuilder(); - boolean first = true; + return joinList(", ", list); + } + + public static String joinList(String seperator, Object... list) + { + StringBuilder buf = new StringBuilder(); for (Object each : list) { - if (!first) + if (buf.length() > 0) { - buf.append(", "); - + buf.append(seperator); + } + + if(each instanceof List) + { + buf.append(joinList(seperator, ((List)each).toArray())); + } + else + { + try + { + buf.append(each.toString()); + } + catch (Exception e) + { + buf.append(each.toString()); + } } - first = false; - buf.append(each); } return buf.toString(); } + + public static String capitalCase(String s) + { + return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1); + } } diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java index b1d27e0b2..adf665f2a 100644 --- a/Essentials/src/com/earth2me/essentials/Warps.java +++ b/Essentials/src/com/earth2me/essentials/Warps.java @@ -2,6 +2,7 @@ package com.earth2me.essentials; import java.io.File; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,9 +36,9 @@ public class Warps implements IConf return warpPoints.isEmpty(); } - public Iterable<String> getWarpNames() + public Collection<String> getWarpNames() { - List<String> keys = new ArrayList<String>(); + final List<String> keys = new ArrayList<String>(); for (StringIgnoreCase stringIgnoreCase : warpPoints.keySet()) { keys.add(stringIgnoreCase.getString()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java index 03950966c..8bf70873d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandafk.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandafk.java @@ -15,8 +15,6 @@ public class Commandafk extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); - if (args.length > 0 && user.isAuthorized("essentials.afk.others")) { User afkUser = ess.getUser(ess.getServer().matchPlayer(args[0])); @@ -35,13 +33,20 @@ public class Commandafk extends EssentialsCommand { if (!user.toggleAfk()) { - user.sendMessage(Util.i18n("markedAsNotAway")); - ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName())); + //user.sendMessage(Util.i18n("markedAsNotAway")); + if (!user.isHidden()) + { + ess.broadcastMessage(user, Util.format("userIsNotAway", user.getDisplayName())); + } + user.updateActivity(false); } else { - user.sendMessage(Util.i18n("markedAsAway")); - ess.broadcastMessage(user.getName(), Util.format("userIsAway", user.getDisplayName())); + //user.sendMessage(Util.i18n("markedAsAway")); + if (!user.isHidden()) + { + ess.broadcastMessage(user, Util.format("userIsAway", user.getDisplayName())); + } } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java b/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java index 4dd3042d0..5bfdd3835 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java @@ -17,9 +17,8 @@ public class Commandantioch extends EssentialsCommand @Override public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - charge(user); - ess.broadcastMessage(user.getName(), "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,"); - ess.broadcastMessage(user.getName(), "who being naughty in My sight, shall snuff it."); + ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,"); + ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it."); final Location loc = new TargetBlock(user).getTargetBlock().getLocation(); loc.getWorld().spawn(loc, TNTPrimed.class); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java index 8f6e8e8bf..6bbf8361c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbackup.java @@ -19,9 +19,8 @@ public class Commandbackup extends EssentialsCommand Backup backup = ess.getBackup(); if (backup == null) { - return; + throw new Exception(); } - charge(sender); backup.run(); sender.sendMessage(Util.i18n("backupStarted")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java index 7dd1fb449..d26df68cb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java @@ -26,7 +26,6 @@ public class Commandbalance extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); double bal = (args.length < 1 || !(user.isAuthorized("essentials.balance.others") || user.isAuthorized("essentials.balance.other")) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 628058c6e..d6387c074 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -52,8 +52,8 @@ public class Commandban extends EssentialsCommand { banReason = Util.i18n("defaultBanReason"); } + player.setBanned(true); player.kickPlayer(banReason); - ess.getBans().banByName(player.getName()); String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; for(Player p : server.getOnlinePlayers()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java index 77c268988..3301afc87 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java @@ -20,7 +20,7 @@ public class Commandbanip extends EssentialsCommand throw new NotEnoughArgumentsException(); } - ess.getBans().banByIp(args[0]); + ess.getServer().banIP(args[0]); sender.sendMessage(Util.i18n("banIpAddress")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java index f02b99b15..ded3ffdaf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.TargetBlock; import org.bukkit.Server; import org.bukkit.TreeType; import com.earth2me.essentials.User; @@ -31,39 +32,20 @@ public class Commandbigtree extends EssentialsCommand throw new NotEnoughArgumentsException(); } - double x = user.getLocation().getX(); - double y = user.getLocation().getY(); - double z = user.getLocation().getZ(); - - // offset tree in direction player is facing - final int r = (int)user.getCorrectedYaw(); - if (r < 68 || r > 292) // north - { - x -= 3.0D; - } - else if (r > 112 && r < 248) // south - { - x += 3.0D; - } - if (r > 22 && r < 158) // east + final int[] ignore = { - z -= 3.0D; - } - else if (r > 202 && r < 338) // west - { - z += 3.0D; - } - - final Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z)); + 8, 9 + }; + final Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation(); + final Location safeLocation = Util.getSafeDestination(loc); final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree); if (success) { - charge(user); user.sendMessage(Util.i18n("bigTreeSuccess")); } else { - user.sendMessage(Util.i18n("bigTreeFailure")); + throw new Exception(Util.i18n("bigTreeFailure")); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java index 3ca9d3fd0..9b92434a4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java @@ -1,6 +1,5 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.Console; import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -15,15 +14,14 @@ public class Commandbroadcast extends EssentialsCommand } @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) { throw new NotEnoughArgumentsException(); } - charge(sender); - ess.broadcastMessage(sender instanceof Player ? ((Player)sender).getName() : Console.NAME, + ess.broadcastMessage(null, Util.format("broadcast", getFinalArg(args, 0))); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java index e63331203..5df3cb5d8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandburn.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandburn.java @@ -21,7 +21,6 @@ public class Commandburn extends EssentialsCommand throw new NotEnoughArgumentsException(); } - charge(sender); for (Player p : server.matchPlayer(args[0])) { p.setFireTicks(Integer.parseInt(args[1]) * 20); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java index 09496c7a2..447689691 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java @@ -27,7 +27,6 @@ public class Commandclearinventory extends EssentialsCommand if (!online.isEmpty()) { - charge(user); for (Player p : online) { p.getInventory().clear(); @@ -42,7 +41,6 @@ public class Commandclearinventory extends EssentialsCommand Player p = server.getPlayer(args[0]); if (p != null) { - charge(user); p.getInventory().clear(); user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName())); } @@ -54,7 +52,6 @@ public class Commandclearinventory extends EssentialsCommand } else { - charge(user); user.getInventory().clear(); user.sendMessage(Util.i18n("inventoryCleared")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java index 0386485f4..bd07c2b9b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java @@ -15,7 +15,6 @@ public class Commandcompass extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); int r = (int)user.getCorrectedYaw(); String dir; if (r < 23) dir = "N"; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java new file mode 100644 index 000000000..aa60c9168 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelhome.java @@ -0,0 +1,48 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.User; +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import com.earth2me.essentials.Util; + + +public class Commanddelhome extends EssentialsCommand +{ + public Commanddelhome() + { + super("delhome"); + } + + @Override + public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + //Allowing both formats /delhome khobbits house | /delhome khobbits:house + final String[] nameParts = args[0].split(":"); + if (nameParts[0].length() != args[0].length()) + { + args = nameParts; + } + + User user = ess.getUser(sender); + String name; + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + else if (args.length > 1 && (user == null || user.isAuthorized("essentials.delhome.others"))) + { + user = getPlayer(server, args, 0); + name = args[1]; + } + else + { + if (user == null) + { + throw new NotEnoughArgumentsException(); + } + name = args[0]; + } + user.delHome(name.toLowerCase()); + sender.sendMessage(Util.format("deleteHome", name)); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java index 7fb6f816c..23ec04c4e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddeljail.java @@ -16,7 +16,6 @@ public class Commanddeljail extends EssentialsCommand { { throw new NotEnoughArgumentsException(); } - charge(sender); ess.getJail().delJail(args[0]); sender.sendMessage(Util.format("deleteJail", args[0])); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java index 42a68dda8..7c2795dda 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddelwarp.java @@ -19,7 +19,6 @@ public class Commanddelwarp extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - charge(sender); ess.getWarps().delWarp(args[0]); sender.sendMessage(Util.format("deleteWarp", args[0])); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java b/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java index 9a719335e..5ceb62591 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanddepth.java @@ -15,7 +15,6 @@ public class Commanddepth extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); int y = user.getLocation().getBlockY() - 63; if (y > 0) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index bf0226138..fda7061d5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -102,7 +102,6 @@ public class Commandessentials extends EssentialsCommand return; } ess.reload(); - charge(sender); sender.sendMessage(Util.format("essentialsReload", ess.getDescription().getVersion())); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandext.java b/Essentials/src/com/earth2me/essentials/commands/Commandext.java index 339351ef1..afb9fa3a6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandext.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandext.java @@ -30,7 +30,6 @@ public class Commandext extends EssentialsCommand { if (args.length < 1) { - charge(user); user.setFireTicks(0); user.sendMessage(Util.i18n("extinguish")); return; @@ -43,7 +42,6 @@ public class Commandext extends EssentialsCommand { for (Player p : server.matchPlayer(name)) { - charge(sender); p.setFireTicks(0); sender.sendMessage(Util.format("extinguishOthers", p.getDisplayName())); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java index 73c314935..19e7eddf1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfireball.java @@ -17,7 +17,6 @@ public class Commandfireball extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - charge(user); final Vector direction = user.getEyeLocation().getDirection().multiply(2); user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), Fireball.class); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java index dd3cf35f4..28164bd78 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java @@ -16,7 +16,6 @@ public class Commandgc extends EssentialsCommand @Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - charge(sender); sender.sendMessage(Util.format("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024))); sender.sendMessage(Util.format("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024))); sender.sendMessage(Util.format("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024))); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java index 517ef0c9a..bf5cff75d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java @@ -15,7 +15,6 @@ public class Commandgetpos extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); Location coords = user.getLocation(); user.sendMessage("§7X: " + coords.getBlockX() + " (-North <-> +South)"); user.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)"); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index 21eea2c70..065b76d03 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -16,6 +16,7 @@ public class Commandgive extends EssentialsCommand super("give"); } + //TODO: move these messages to message file @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { @@ -35,8 +36,7 @@ public class Commandgive extends EssentialsCommand : (!ess.getUser(sender).isAuthorized("essentials.itemspawn.exempt") && !ess.getUser(sender).canSpawnItem(stack.getTypeId())))) { - sender.sendMessage(ChatColor.RED + "You are not allowed to spawn the item " + itemname); - return; + throw new Exception(ChatColor.RED + "You are not allowed to spawn the item " + itemname); } if (args.length > 2 && Integer.parseInt(args[2]) > 0) { @@ -45,13 +45,11 @@ public class Commandgive extends EssentialsCommand if (stack.getType() == Material.AIR) { - sender.sendMessage(ChatColor.RED + "You can't give air."); - return; + throw new Exception(ChatColor.RED + "You can't give air."); } User giveTo = getPlayer(server, args, 0); String itemName = stack.getType().toString().toLowerCase().replace('_', ' '); - charge(sender); sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + "."); giveTo.getInventory().addItem(stack); giveTo.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java index 6bb9f1390..d4c35e113 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgod.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgod.java @@ -28,7 +28,6 @@ public class Commandgod extends EssentialsCommand @Override protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); if (args.length > 0 && user.isAuthorized("essentials.god.others")) { godOtherPlayers(server, user, args[0]); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java index effe64604..d60fc09fe 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandheal.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandheal.java @@ -25,7 +25,6 @@ public class Commandheal extends EssentialsCommand { user.healCooldown(); } - charge(user); healOtherPlayers(server, user, args[0]); return; } @@ -34,7 +33,6 @@ public class Commandheal extends EssentialsCommand { user.healCooldown(); } - charge(user); user.setHealth(20); user.sendMessage(Util.i18n("heal")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 53ed22a23..8e99dc1ed 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -20,6 +20,9 @@ import java.util.logging.Level; public class Commandhelp extends EssentialsCommand { + private static final String DESCRIPTION = "description"; + private static final String PERMISSION = "permission"; + private static final String PERMISSIONS = "permissions"; public final Yaml yaml = new Yaml(new SafeConstructor()); public Commandhelp() @@ -28,7 +31,7 @@ public class Commandhelp extends EssentialsCommand } @Override - protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { int page = 1; String match = ""; @@ -53,34 +56,32 @@ public class Commandhelp extends EssentialsCommand } } - List<String> lines = getHelpLines(user, match); - if (lines.size() > 0) + final List<String> lines = getHelpLines(user, match); + if (lines.isEmpty()) { - int start = (page - 1) * 9; - int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); - - user.sendMessage(Util.format("helpPages", page, pages)); - for (int i = start; i < lines.size() && i < start + 9; i++) - { - user.sendMessage(lines.get(i)); - } + throw new Exception(Util.i18n("noHelpFound")); } - else + + final int start = (page - 1) * 9; + final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); + + user.sendMessage(Util.format("helpPages", page, pages)); + for (int i = start; i < lines.size() && i < start + 9; i++) { - user.sendMessage(Util.i18n("noHelpFound")); + user.sendMessage(lines.get(i)); } } @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { sender.sendMessage(Util.i18n("helpConsole")); } @SuppressWarnings("CallToThreadDumpStack") - private List<String> getHelpLines(User user, String match) throws Exception + private List<String> getHelpLines(final User user, final String match) throws Exception { - List<String> retval = new ArrayList<String>(); + final List<String> retval = new ArrayList<String>(); File helpFile = new File(ess.getDataFolder(), "help_" + Util.sanitizeFileName(user.getName()) + ".txt"); if (!helpFile.exists()) { @@ -116,15 +117,16 @@ public class Commandhelp extends EssentialsCommand try { final PluginDescriptionFile desc = p.getDescription(); - final HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands(); + final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands(); pluginName = p.getDescription().getName().toLowerCase(); - for (Entry<String, HashMap<String, String>> k : cmds.entrySet()) + for (Entry<String, HashMap<String, Object>> k : cmds.entrySet()) { try { if ((!match.equalsIgnoreCase("")) && (!k.getKey().toLowerCase().contains(match)) - && (!k.getValue().get("description").toLowerCase().contains(match)) + && (!(k.getValue().get(DESCRIPTION) instanceof String + && ((String)k.getValue().get(DESCRIPTION)).toLowerCase().contains(match))) && (!pluginName.contains(match))) { continue; @@ -135,37 +137,69 @@ public class Commandhelp extends EssentialsCommand final String node = "essentials." + k.getKey(); if (!ess.getSettings().isCommandDisabled(k.getKey()) && user.isAuthorized(node)) { - retval.add("§c" + k.getKey() + "§7: " + k.getValue().get("description")); + retval.add("§c" + k.getKey() + "§7: " + k.getValue().get(DESCRIPTION)); } } else { if (ess.getSettings().showNonEssCommandsInHelp()) { - final HashMap<String, String> value = k.getValue(); - if (value.containsKey("permission") && value.get("permission") != null && !(value.get("permission").equals(""))) + final HashMap<String, Object> value = k.getValue(); + if (value.containsKey(PERMISSION) && value.get(PERMISSION) instanceof String && !(value.get(PERMISSION).equals(""))) { - if (user.isAuthorized(value.get("permission"))) + if (user.isAuthorized((String)value.get(PERMISSION))) { - retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + retval.add("§c" + k.getKey() + "§7: " + value.get(DESCRIPTION)); } } - else if (value.containsKey("permissions") && value.get("permissions") != null && !(value.get("permissions").equals(""))) + else if (value.containsKey(PERMISSION) && value.get(PERMISSION) instanceof List && !((List<Object>)value.get(PERMISSION)).isEmpty()) { - if (user.isAuthorized(value.get("permissions"))) + boolean enabled = false; + for (Object o : (List<Object>)value.get(PERMISSION)) + { + if (o instanceof String && user.isAuthorized((String)o)) + { + enabled = true; + break; + } + } + if (enabled) + { + retval.add("§c" + k.getKey() + "§7: " + value.get(DESCRIPTION)); + } + } + else if (value.containsKey(PERMISSIONS) && value.get(PERMISSIONS) instanceof String && !(value.get(PERMISSIONS).equals(""))) + { + if (user.isAuthorized((String)value.get(PERMISSIONS))) + { + retval.add("§c" + k.getKey() + "§7: " + value.get(DESCRIPTION)); + } + } + else if (value.containsKey(PERMISSIONS) && value.get(PERMISSIONS) instanceof List && !((List<Object>)value.get(PERMISSIONS)).isEmpty()) + { + boolean enabled = false; + for (Object o : (List<Object>)value.get(PERMISSIONS)) + { + if (o instanceof String && user.isAuthorized((String)o)) + { + enabled = true; + break; + } + } + if (enabled) { - retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + retval.add("§c" + k.getKey() + "§7: " + value.get(DESCRIPTION)); } } else if (user.isAuthorized("essentials.help." + pluginName)) { - retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + retval.add("§c" + k.getKey() + "§7: " + value.get(DESCRIPTION)); } else { if (!ess.getSettings().hidePermissionlessHelp()) { - retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + retval.add("§c" + k.getKey() + "§7: " + value.get(DESCRIPTION)); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index 261cad062..158b0d40b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -22,7 +22,6 @@ public class Commandhelpop extends EssentialsCommand throw new NotEnoughArgumentsException(); } - charge(user); final String message = Util.format("helpOp", user.getDisplayName(), getFinalArg(args, 0)); logger.log(Level.INFO, message); for (Player p : server.getOnlinePlayers()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java index 2649a9cb0..2ee2661e6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.Trade; import org.bukkit.Server; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.util.List; public class Commandhome extends EssentialsCommand @@ -18,24 +19,49 @@ public class Commandhome extends EssentialsCommand { Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); - if(args.length > 0 && user.isAuthorized("essentials.home.others")) + User u = user; + String homeName = ""; + String[] nameParts; + if (args.length > 0) { - User u; - try + nameParts = args[0].split(":"); + if (nameParts[0].length() == args[0].length() || !user.isAuthorized("essentials.home.others")) { - u = getPlayer(server, args, 0); + homeName = nameParts[0]; } - catch(NoSuchFieldException ex) + else { - u = ess.getOfflineUser(args[0]); + u = getPlayer(server, nameParts[0].split(" "), 0, true); + if (nameParts.length > 1) + { + homeName = nameParts[1]; + } } - if (u == null) + } + try + { + user.getTeleport().home(u, homeName.toLowerCase(), charge); + } + catch (NotEnoughArgumentsException e) + { + List<String> homes = u.getHomes(); + if (homes.isEmpty()) + { + throw new Exception(u == user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer")); + } + else if ((homes.size() == 1) && u == user) + { + user.getTeleport().home(u, homes.get(0), charge); + } + else if (ess.getSettings().spawnIfNoHome()) + { + user.getTeleport().respawn(ess.getSpawn(), charge); + } + else { - throw new Exception(Util.i18n("playerNotFound")); + user.sendMessage(Util.format("homes", Util.joinList(homes))); } - user.getTeleport().home(u, charge); - return; } - user.getTeleport().home(charge); + throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java index 4db469b58..97dd71d35 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinfo.java @@ -68,9 +68,8 @@ public class Commandinfo extends EssentialsCommand } else { - sender.sendMessage(Util.i18n("infoFileDoesNotExist")); file.createNewFile(); - return; + throw new Exception(Util.i18n("infoFileDoesNotExist")); } if (bookmarks.isEmpty()) @@ -88,7 +87,6 @@ public class Commandinfo extends EssentialsCommand int start = (page - 1) * 9; int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); - charge(sender); sender.sendMessage(Util.format("infoPages", page, pages )); for (int i = start; i < lines.size() && i < start + 9; i++) { @@ -140,7 +138,6 @@ public class Commandinfo extends EssentialsCommand } int pages = end / 9 + (end % 9 > 0 ? 1 : 0); - charge(sender); sender.sendMessage(Util.format("infoPages", page, pages )); for (int i = start; i < end && i < start + 9; i++) { @@ -182,7 +179,6 @@ public class Commandinfo extends EssentialsCommand int page = chapterpage + 1; int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0); - charge(sender); sender.sendMessage(Util.format("infoChapterPages", pageStr, page , pages)); for (int i = start; i < chapterend && i < start + 9; i++) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java index e5877fe40..8b6dc8182 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java @@ -31,11 +31,9 @@ public class Commandinvsee extends EssentialsCommand { invUser.getInventory().setContents(user.getSavedInventory()); user.setSavedInventory(null); - user.sendMessage(Util.i18n("invRestored")); - return; + throw new Exception(Util.i18n("invRestored")); } - charge(user); if (user.getSavedInventory() == null) { user.setSavedInventory(user.getInventory().getContents()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 79e8344f1..352ce18eb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -31,8 +31,7 @@ public class Commanditem extends EssentialsCommand : (!user.isAuthorized("essentials.itemspawn.exempt") && !user.canSpawnItem(stack.getTypeId()))) { - user.sendMessage(Util.format("cantSpawnItem", itemname)); - return; + throw new Exception(Util.format("cantSpawnItem", itemname)); } if (args.length > 1 && Integer.parseInt(args[1]) > 0) @@ -42,12 +41,10 @@ public class Commanditem extends EssentialsCommand if (stack.getType() == Material.AIR) { - user.sendMessage(Util.format("cantSpawnItem", "Air")); - return; + throw new Exception(Util.format("cantSpawnItem", "Air")); } String itemName = stack.getType().toString().toLowerCase().replace('_', ' '); - charge(user); user.sendMessage(Util.format("itemSpawn", stack.getAmount(), itemName)); user.getInventory().addItem(stack); user.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjails.java b/Essentials/src/com/earth2me/essentials/commands/Commandjails.java index b91a1c985..36eb633fc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjails.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjails.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Util; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -14,12 +15,6 @@ public class Commandjails extends EssentialsCommand @Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - StringBuilder jailList = new StringBuilder(); - for (String j : ess.getJail().getJails()) - { - jailList.append(j); - jailList.append(' '); - } - sender.sendMessage("§7" + jailList); + sender.sendMessage("§7" + Util.joinList(" ", ess.getJail().getJails())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index e9b3720fe..fd0d4a8e0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -26,10 +26,8 @@ public class Commandkick extends EssentialsCommand User player = getPlayer(server, args, 0); if (player.isAuthorized("essentials.kick.exempt")) { - sender.sendMessage(Util.i18n("kickExempt")); - return; + throw new Exception(Util.i18n("kickExempt")); } - charge(sender); final String kickReason = args.length > 1 ? getFinalArg(args, 1) : Util.i18n("kickDefault"); player.kickPlayer(kickReason); String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index c52dc8d14..8d36f50d5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -16,8 +16,6 @@ public class Commandkickall extends EssentialsCommand @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - charge(sender); - for (Player p : server.getOnlinePlayers()) { if (sender instanceof Player && p.getName().equalsIgnoreCase(((Player)sender).getName())) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java index c849463b7..03afeadc4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java @@ -21,7 +21,6 @@ public class Commandkill extends EssentialsCommand throw new NotEnoughArgumentsException(); } - charge(sender); for (Player p : server.matchPlayer(args[0])) { p.setHealth(0); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java index 849ec2398..75cc83887 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkit.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkit.java @@ -9,6 +9,7 @@ import org.bukkit.Server; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import java.util.GregorianCalendar; +import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -124,7 +125,7 @@ public class Commandkit extends EssentialsCommand for (String d : items) { String[] parts = d.split("[^0-9]+", 3); - int id = Integer.parseInt(parts[0]); + int id = Material.getMaterial(Integer.parseInt(parts[0])).getId(); int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1; short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0; HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data)); @@ -140,7 +141,6 @@ public class Commandkit extends EssentialsCommand } try { - charge(user); charge.charge(user); } catch (Exception ex) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index c9135d61e..dc4387833 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -26,20 +26,14 @@ public class Commandlightning extends EssentialsCommand if (args.length < 1 & user != null) { user.getWorld().strikeLightning(user.getTargetBlock(null, 600).getLocation()); - charge(user); return; } if (server.matchPlayer(args[0]).isEmpty()) { - sender.sendMessage(Util.i18n("playerNotFound")); - return; + throw new Exception(Util.i18n("playerNotFound")); } - if (user != null) - { - charge(user); - } for (Player p : server.matchPlayer(args[0])) { sender.sendMessage(Util.format("lightningUse", p.getDisplayName())); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index d5f946bf9..98066d7e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -44,7 +44,7 @@ public class Commandlist extends EssentialsCommand playerHidden++; } } - charge(sender); + //TODO: move these to messages file StringBuilder online = new StringBuilder(); online.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().length - playerHidden); if (showhidden && playerHidden > 0) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index b54b88a12..a98fabbd2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -23,22 +23,19 @@ public class Commandmail extends EssentialsCommand List<String> mail = user.getMails(); if (mail.isEmpty()) { - user.sendMessage(Util.i18n("noMail")); - return; + throw new Exception(Util.i18n("noMail")); } for (String s : mail) { user.sendMessage(s); } - user.sendMessage(Util.i18n("mailClear")); - return; + throw new Exception(Util.i18n("mailClear")); } if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { if (!user.isAuthorized("essentials.mail.send")) { - user.sendMessage(Util.i18n("noMailSendPerm")); - return; + throw new Exception(Util.i18n("noMailSendPerm")); } Player player = server.getPlayer(args[1]); @@ -53,10 +50,8 @@ public class Commandmail extends EssentialsCommand } if (u == null) { - user.sendMessage(Util.format("playerNeverOnServer", args[1])); - return; + throw new Exception(Util.format("playerNeverOnServer", args[1])); } - charge(user); if (!u.isIgnoredPlayer(user.getName())) { u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2)); @@ -67,8 +62,7 @@ public class Commandmail extends EssentialsCommand if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { user.setMails(null); - user.sendMessage(Util.i18n("mailCleared")); - return; + throw new Exception(Util.i18n("mailCleared")); } throw new NotEnoughArgumentsException(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java index 098558f11..02bcecdc2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java @@ -17,21 +17,22 @@ public class Commandme extends EssentialsCommand { if (user.isMuted()) { - user.sendMessage(Util.i18n("voiceSilenced")); - return; + throw new Exception(Util.i18n("voiceSilenced")); } if (args.length < 1) { throw new NotEnoughArgumentsException(); } - StringBuilder message = new StringBuilder(); + final StringBuilder message = new StringBuilder(); + message.append("* "); + message.append(user.getDisplayName()); + message.append(' '); for (int i = 0; i < args.length; i++) { message.append(args[i]); message.append(' '); } - charge(user); - ess.broadcastMessage(user.getName(), "* " + user.getDisplayName() + " " + message); + ess.broadcastMessage(user, message.toString()); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java index 4712c331b..c695338f6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmotd.java @@ -15,7 +15,6 @@ public class Commandmotd extends EssentialsCommand @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - charge(sender); for (String m : ess.getMotd(sender, Util.i18n("noMotd"))) { sender.sendMessage(m); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index 42f17bed2..f14935648 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -30,8 +30,7 @@ public class Commandmsg extends EssentialsCommand User user = ess.getUser(sender); if (user.isMuted()) { - user.sendMessage(Util.i18n("voiceSilenced")); - return; + throw new Exception(Util.i18n("voiceSilenced")); } } @@ -55,8 +54,7 @@ public class Commandmsg extends EssentialsCommand if (matches.isEmpty()) { - sender.sendMessage(Util.i18n("playerNotFound")); - return; + throw new Exception(Util.i18n("playerNotFound")); } int i = 0; @@ -70,11 +68,9 @@ public class Commandmsg extends EssentialsCommand } if (i == matches.size()) { - sender.sendMessage(Util.i18n("playerNotFound")); - return; + throw new Exception(Util.i18n("playerNotFound")); } - charge(sender); for (Player p : matches) { sender.sendMessage(Util.format("msgFormat", translatedMe, p.getDisplayName(), message)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index e56ddc42c..1777c5b48 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -24,8 +24,7 @@ public class Commandmute extends EssentialsCommand User p = getPlayer(server, args, 0, true); if (!p.isMuted() && p.isAuthorized("essentials.mute.exempt")) { - sender.sendMessage(Util.i18n("muteExempt")); - return; + throw new Exception(Util.i18n("muteExempt")); } long muteTimestamp = 0; if (args.length > 1) @@ -34,7 +33,6 @@ public class Commandmute extends EssentialsCommand muteTimestamp = Util.parseDateDiff(time, true); } p.setMuteTimeout(muteTimestamp); - charge(sender); boolean muted = p.toggleMuted(); sender.sendMessage( muted diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index 3731b24c5..253ec7646 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -21,13 +21,16 @@ public class Commandnick extends EssentialsCommand { throw new NotEnoughArgumentsException(); } + + if (!ess.getSettings().changeDisplayName()) { + throw new Exception(Util.i18n("nickDisplayName")); + } if (args.length > 1) { if (!user.isAuthorized("essentials.nick.others")) { - user.sendMessage(Util.i18n("nickOthersPermission")); - return; + throw new Exception(Util.i18n("nickOthersPermission")); } setOthersNickname(server, user, args); @@ -46,8 +49,7 @@ public class Commandnick extends EssentialsCommand if (nick.matches("[^a-zA-Z_0-9]")) { - user.sendMessage(Util.i18n("nickNamesAlpha")); - return; + throw new Exception(Util.i18n("nickNamesAlpha")); } for (Player p : server.getOnlinePlayers()) @@ -61,12 +63,10 @@ public class Commandnick extends EssentialsCommand String nk = nick.toLowerCase(); if (nk.equals(dn) || nk.equals(n)) { - user.sendMessage(Util.i18n("nickInUse")); - return; + throw new Exception(Util.i18n("nickInUse")); } } - charge(user); user.setDisplayName(ess.getSettings().getNicknamePrefix() + nick); user.setNickname(nick); user.sendMessage(Util.format("nickSet", user.getDisplayName() + "§7.")); @@ -80,6 +80,11 @@ public class Commandnick extends EssentialsCommand throw new NotEnoughArgumentsException(); } + if (!ess.getSettings().changeDisplayName()) { + sender.sendMessage(Util.i18n("nickDisplayName")); + return; + } + setOthersNickname(server, sender, args); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandplugin.java b/Essentials/src/com/earth2me/essentials/commands/Commandplugin.java deleted file mode 100644 index 9e7939d57..000000000 --- a/Essentials/src/com/earth2me/essentials/commands/Commandplugin.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.earth2me.essentials.commands; - -import java.io.File; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginManager; - - -public class Commandplugin extends EssentialsCommand -{ - private Server server; - - public Commandplugin() - { - super("plugin"); - } - - @Override - public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { - this.server = server; - - PluginCommands sub = null; - try - { - sub = PluginCommands.valueOf(args[0].toUpperCase()); - } - catch (Exception ex) - { - sender.sendMessage("§cUsage: /plugin [load|reload|enable|disable|list] [PluginName]"); - return; - } - - switch (sub) - { - case LOAD: // All disable functions are broken until - // http://leaky.bukkit.org/issues/641 is fixed. - sender.sendMessage("This function is broken. Performing /reload now."); - server.reload(); - /*if (args.length < 2) return; - User.charge(sender, this); - loadPlugin(args[1], sender);*/ - return; - - case RELOAD: - sender.sendMessage("This function is broken. Performing /reload now."); - server.reload(); - /*if (args.length < 2) return; - User.charge(sender, this); - reloadPlugin(args[1], sender);*/ - return; - - case ENABLE: - sender.sendMessage("This function is broken. Performing /reload now."); - server.reload(); - /*if (args.length < 2) return; - User.charge(sender, this); - enablePlugin(args[1], sender);*/ - return; - - case DISABLE: - sender.sendMessage("This function is broken."); - /*if (args.length < 2) return; - User.charge(sender, this); - disablePlugin(args[1], sender);*/ - return; - - case LIST: - charge(sender); - listPlugins(sender); - return; - } - } - - private void listPlugins(CommandSender player) - { - StringBuilder plugins = new StringBuilder(); - for (Plugin p : server.getPluginManager().getPlugins()) - { - plugins.append(p.isEnabled() ? " §a" : " §c"); - plugins.append(p.getDescription().getName()); - } - - plugins.insert(0, "§7Plugins:§f"); - player.sendMessage(plugins.toString()); - } - - private boolean reloadPlugin(String name, CommandSender player) - { - return disablePlugin(name, player) && enablePlugin(name, player); - } - - private boolean loadPlugin(String name, CommandSender sender) - { - try - { - PluginManager pm = server.getPluginManager(); - pm.loadPlugin(new File("plugins", name + ".jar")); - sender.sendMessage("§7Plugin loaded."); - return enablePlugin(name, sender); - } - catch (Throwable ex) - { - sender.sendMessage("§cCould not load plugin. Is the file named properly?"); - return false; - } - } - - private boolean enablePlugin(String name, CommandSender sender) - { - try - { - final PluginManager pm = server.getPluginManager(); - final Plugin plugin = pm.getPlugin(name); - if (!plugin.isEnabled()) - { - new Thread(new Runnable() - { - public void run() - { - synchronized (pm) - { - pm.enablePlugin(plugin); - } - } - }).start(); - } - sender.sendMessage("§7Plugin enabled."); - return true; - } - catch (Throwable ex) - { - listPlugins(sender); - return false; - } - } - - private boolean disablePlugin(String name, CommandSender sender) - { - try - { - final PluginManager pm = server.getPluginManager(); - final Plugin plugin = pm.getPlugin(name); - if (plugin.isEnabled()) - { - new Thread(new Runnable() - { - public void run() - { - synchronized (pm) - { - pm.disablePlugin(plugin); - } - } - }).start(); - } - sender.sendMessage("§7Plugin disabled."); - return true; - } - catch (Throwable ex) - { - listPlugins(sender); - return false; - } - } - - - private enum PluginCommands - { - LOAD, RELOAD, LIST, ENABLE, DISABLE - } -} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java index c7bd34705..c9e8dea58 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertool.java @@ -2,6 +2,8 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.util.ArrayList; +import java.util.List; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.inventory.ItemStack; @@ -15,25 +17,92 @@ public class Commandpowertool extends EssentialsCommand } @Override - protected void run(Server server, User user, String commandLabel, String[] args) throws Exception + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { + String command = getFinalArg(args, 0); - ItemStack is = user.getItemInHand(); - if (is == null || is.getType() == Material.AIR) + // check to see if this is a clear all command + if(command != null && command.equalsIgnoreCase("clearall")) { - user.sendMessage(Util.i18n("powerToolAir")); + user.clearAllPowertools(); + user.sendMessage(Util.i18n("powerToolClearAll")); return; } - String command = getFinalArg(args, 0); + + final ItemStack itemStack = user.getItemInHand(); + if (itemStack == null || itemStack.getType() == Material.AIR) + { + throw new Exception(Util.i18n("powerToolAir")); + } + + final String itemName = itemStack.getType().toString().toLowerCase().replaceAll("_", " "); + List<String> powertools = user.getPowertool(itemStack); if (command != null && !command.isEmpty()) { - user.sendMessage(Util.format("powerToolAttach",is.getType().toString().toLowerCase().replaceAll("_", " "))); + if (command.equalsIgnoreCase("l:")) + { + if (powertools == null || powertools.isEmpty()) + { + throw new Exception(Util.format("powerToolListEmpty", itemName)); + } + else + { + user.sendMessage(Util.format("powerToolList", Util.joinList(powertools), itemName)); + } + return; + } + if (command.startsWith("r:")) + { + try + { + command = command.substring(2); + if (!powertools.contains(command)) + { + throw new Exception(Util.format("powerToolNoSuchCommandAssigned", command, itemName)); + } + + powertools.remove(command); + user.sendMessage(Util.format("powerToolRemove", command, itemName)); + } + catch (Exception e) + { + user.sendMessage(e.getMessage()); + return; + } + } + else + { + if (command.startsWith("a:")) + { + command = command.substring(2); + if (powertools.contains(command)) + { + throw new Exception(Util.format("powerToolAlreadySet", command, itemName)); + } + } + else if (powertools != null && !powertools.isEmpty()) + { + // Replace all commands with this one + powertools.clear(); + } + else + { + powertools = new ArrayList<String>(); + } + + powertools.add(command); + user.sendMessage(Util.format("powerToolAttach", Util.joinList(powertools), itemName)); + } } else { - user.sendMessage(Util.format("powerToolRemove", is.getType().toString().toLowerCase().replaceAll("_", " "))); + if (powertools != null) + { + powertools.clear(); + } + user.sendMessage(Util.format("powerToolRemoveAll", itemName)); } - charge(user); - user.setPowertool(is, command); + + user.setPowertool(itemStack, powertools); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java new file mode 100644 index 000000000..af51f2628 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java @@ -0,0 +1,29 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; +import org.bukkit.Server; + + +public class Commandpowertooltoggle extends EssentialsCommand +{ + public Commandpowertooltoggle() + { + super("powertooltoggle"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if(!user.hasPowerTools()) + { + user.sendMessage(Util.i18n("noPowerTools")); + return; + } + user.sendMessage(user.togglePowerToolsEnabled() + ? Util.i18n("powerToolsEnabled") + : Util.i18n("powerToolsDisabled")); + } + + +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java index bbf1dfdcc..2eb580ea4 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandptime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandptime.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.DescParseTickFormat; import org.bukkit.Server; import org.bukkit.command.CommandSender; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.Collection; import java.util.Comparator; import java.util.HashSet; @@ -17,12 +18,6 @@ import org.bukkit.entity.Player; public class Commandptime extends EssentialsCommand { - // TODO: I suggest that the chat colors be centralized in the config file. - public static final ChatColor colorDefault = ChatColor.YELLOW; - public static final ChatColor colorChrome = ChatColor.GOLD; - public static final ChatColor colorLogo = ChatColor.GREEN; - public static final ChatColor colorHighlight1 = ChatColor.AQUA; - public static final ChatColor colorBad = ChatColor.RED; public static final Set<String> getAliases = new HashSet<String>(); static @@ -57,10 +52,10 @@ public class Commandptime extends EssentialsCommand } User user = ess.getUser(sender); - if (user != null && !user.isAuthorized("essentials.ptime.others")) + if ((!users.contains(user) || users.size() > 1) && user != null && !user.isAuthorized("essentials.ptime.others")) { - // TODO should not be hardcoded !! - throw new Exception(colorBad + "You are not authorized to set others PlayerTime"); + user.sendMessage(Util.i18n("pTimeOthersPermission")); + return; } Long ticks; @@ -102,41 +97,29 @@ public class Commandptime extends EssentialsCommand */ private void getUsersTime(final CommandSender sender, final Collection<User> users) { - if (users.size() == 1) + if (users.size() > 1) { - final User user = users.iterator().next(); - - if (user.getPlayerTimeOffset() == 0) - { - sender.sendMessage(colorDefault + user.getName() + "'s time is normal. Time is the same as on the server."); - } - else - { - String time = DescParseTickFormat.format(user.getPlayerTime()); - if (!user.isPlayerTimeRelative()) - { - time = "fixed to " + time; - } - sender.sendMessage(colorDefault + user.getName() + "'s time is " + time); - } - return; + sender.sendMessage(Util.format("pTimePlayers")); } - - sender.sendMessage(colorDefault + "These players have their own time:"); - - for (User user : users) + + for (User user : users) { - //if (!user.isPlayerTimeRelative()) - if (user.getPlayerTimeOffset() != 0) + if(user.getPlayerTimeOffset() == 0) { + sender.sendMessage(Util.format("pTimeNormal", user.getName())); + } + else { String time = DescParseTickFormat.format(user.getPlayerTime()); - if (!user.isPlayerTimeRelative()) + if(!user.isPlayerTimeRelative()) { - time = "fixed to " + time; + sender.sendMessage(Util.format("pTimeCurrentFixed", user.getName(), time)); + } + else { + sender.sendMessage(Util.format("pTimeCurrent", user.getName(), time)); } - sender.sendMessage(colorDefault + user.getName() + "'s time is " + time); } } + return; } @@ -171,44 +154,33 @@ public class Commandptime extends EssentialsCommand } } + final StringBuilder msg = new StringBuilder(); + for (User user : users) + { + if (msg.length() > 0) + { + msg.append(", "); + } + + msg.append(user.getName()); + } // Inform the sender of the change - sender.sendMessage(""); - final StringBuilder msg = new StringBuilder(); if (ticks == null) { - sender.sendMessage(colorDefault + "The players time was reset for:"); + sender.sendMessage(Util.format("pTimeReset", msg.toString())); } else { String time = DescParseTickFormat.format(ticks); if (!relative) { - time = "fixed to " + time; + sender.sendMessage(Util.format("pTimeSetFixed", time, msg.toString())); } - sender.sendMessage(colorDefault + "The players time is " + time); - msg.append(colorDefault); - msg.append("For: "); - } - - boolean first = true; - for (User user : users) - { - if (!first) - { - msg.append(colorDefault); - msg.append(", "); + else { + sender.sendMessage(Util.format("pTimeSet", time, msg.toString())); } - else - { - first = false; - } - - msg.append(colorHighlight1); - msg.append(user.getName()); } - - sender.sendMessage(msg.toString()); } /** @@ -258,7 +230,7 @@ public class Commandptime extends EssentialsCommand // We failed to understand the world target... else { - throw new Exception("Could not find the player(s) \"" + selector + "\""); + throw new Exception(Util.i18n("playerNotFound")); } return users; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index d89947500..daf83034a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -32,11 +32,9 @@ public class Commandr extends EssentialsCommand if (target == null) { - sender.sendMessage(Util.i18n("foreverAlone")); - return; + throw new Exception(Util.i18n("foreverAlone")); } - charge(sender); sender.sendMessage(Util.format("msgFormat", Util.i18n("me"), targetName, message)); if (target instanceof Player) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index e16d59198..5e12c535d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -22,7 +22,6 @@ public class Commandrealname extends EssentialsCommand throw new NotEnoughArgumentsException(); } final String whois = args[0].toLowerCase(); - charge(user); for (Player p : server.getOnlinePlayers()) { final User u = ess.getUser(p); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandreloadall.java b/Essentials/src/com/earth2me/essentials/commands/Commandreloadall.java index eeee08e11..bd4f59dcc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandreloadall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandreloadall.java @@ -15,7 +15,6 @@ public class Commandreloadall extends EssentialsCommand @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - charge(sender); server.reload(); sender.sendMessage(Util.i18n("reloadAllPlugins")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java new file mode 100644 index 000000000..029901867 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -0,0 +1,118 @@ +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.ChargeException; +import com.earth2me.essentials.IUser; +import com.earth2me.essentials.Trade; +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; +import java.util.ArrayList; +import java.util.List; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.inventory.ItemStack; + + +public class Commandrepair extends EssentialsCommand +{ + public Commandrepair() + { + super("repair"); + } + + @Override + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + + if (args[0].equalsIgnoreCase("hand")) + { + final ItemStack item = user.getItemInHand(); + final String itemName = item.getType().toString().toLowerCase(); + final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); + + charge.isAffordableFor(user); + + repairItem(item); + + charge.charge(user); + + user.sendMessage(Util.format("repair", itemName.replace('_', ' '))); + } + else if (args[0].equalsIgnoreCase("all")) + { + final List<String> repaired = new ArrayList<String>(); + repairItems(user.getInventory().getContents(), user, repaired); + + repairItems(user.getInventory().getArmorContents(), user, repaired); + + if (repaired.isEmpty()) + { + throw new Exception(Util.format("repairNone")); + } + else + { + user.sendMessage(Util.format("repair", Util.joinList(repaired))); + } + + } + else + { + throw new NotEnoughArgumentsException(); + } + } + + private void repairItem(final ItemStack item) throws Exception + { + final Material material = Material.getMaterial(item.getTypeId()); + if (material.isBlock() || material.getMaxDurability() < 0) + { + throw new Exception(Util.i18n("repairInvalidType")); + } + + if (item.getDurability() == 0) + { + throw new Exception(Util.i18n("repairAlreadyFixed")); + } + + item.setDurability((short)0); + } + + private void repairItems(final ItemStack[] items, final IUser user, final List<String> repaired) + { + for (ItemStack item : items) + { + final String itemName = item.getType().toString().toLowerCase(); + final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); + try + { + charge.isAffordableFor(user); + } + catch (ChargeException ex) + { + user.sendMessage(ex.getMessage()); + continue; + } + + try + { + repairItem(item); + } + catch (Exception e) + { + continue; + } + try + { + charge.charge(user); + } + catch (ChargeException ex) + { + user.sendMessage(ex.getMessage()); + } + repaired.add(itemName.replace('_', ' ')); + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java index 1b00bea47..39f7de68e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrules.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrules.java @@ -15,7 +15,6 @@ public class Commandrules extends EssentialsCommand @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { - charge(sender); for (String m : ess.getLines(sender, "rules", Util.i18n("noRules"))) { sender.sendMessage(m); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index 56f6cb2fc..658782b9a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -29,7 +29,7 @@ public class Commandsell extends EssentialsCommand { is = user.getItemInHand(); } - if (args[0].equalsIgnoreCase("inventory")) + else if (args[0].equalsIgnoreCase("inventory")) { for (ItemStack stack : user.getInventory().getContents()) { @@ -47,7 +47,7 @@ public class Commandsell extends EssentialsCommand } return; } - if (args[0].equalsIgnoreCase("blocks")) + else if (args[0].equalsIgnoreCase("blocks")) { for (ItemStack stack : user.getInventory().getContents()) { @@ -145,11 +145,9 @@ public class Commandsell extends EssentialsCommand { user.sendMessage(Util.i18n("itemNotEnough1")); user.sendMessage(Util.i18n("itemNotEnough2")); - user.sendMessage(Util.i18n("itemNotEnough3")); - return; + throw new Exception(Util.i18n("itemNotEnough3")); } - charge(user); final ItemStack ris = new ItemStack(is.getType(), amount, is.getDurability()); InventoryWorkaround.removeItem(user.getInventory(), true, ris); user.updateInventory(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 154017d43..82d66a71c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -17,16 +17,38 @@ public class Commandsethome extends EssentialsCommand { if (args.length > 0) { + //Allowing both formats /sethome khobbits house | /sethome khobbits:house + final String[] nameParts = args[0].split(":"); + if (nameParts[0].length() != args[0].length()) + { + args = nameParts; + } + if (args.length < 2) { - user.setHome(args[0].equalsIgnoreCase("default")); + if (user.isAuthorized("essentials.sethome.multiple")) + { + if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getMultipleHomes()) + || (user.getHomes().contains(args[0].toLowerCase()))) + { + user.setHome(args[0].toLowerCase()); + } + else + { + throw new Exception(Util.format("maxHomes", ess.getSettings().getMultipleHomes())); + } + + } + else { + throw new Exception(Util.format("maxHomes", 1)); + } } else { if (user.isAuthorized("essentials.sethome.others")) { User usersHome = ess.getUser(ess.getServer().getPlayer(args[0])); - if(usersHome == null) + if (usersHome == null) { usersHome = ess.getOfflineUser(args[0]); } @@ -34,15 +56,19 @@ public class Commandsethome extends EssentialsCommand { throw new Exception(Util.i18n("playerNotFound")); } - usersHome.setHome(user.getLocation(), args[1].equalsIgnoreCase("default")); + String name = args[1].toLowerCase(); + if (!user.isAuthorized("essentials.sethome.multiple")) + { + name = "home"; + } + usersHome.setHome(name, user.getLocation()); } } } else { - user.setHome(false); + user.setHome(); } - charge(user); user.sendMessage(Util.i18n("homeSet")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java index 76fe766c3..d9b0eac4d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetjail.java @@ -15,12 +15,10 @@ public class Commandsetjail extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - if (args.length < 1) { throw new NotEnoughArgumentsException(); } - charge(user); ess.getJail().setJail(user.getLocation(), args[0]); user.sendMessage(Util.format("jailSet",args[0])); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 4e799d6c0..ccdacab57 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -21,7 +21,6 @@ public class Commandsetwarp extends EssentialsCommand throw new NotEnoughArgumentsException(); } - charge(user); Location loc = user.getLocation(); ess.getWarps().setWarp(args[0], loc); user.sendMessage(Util.format("warpSet", args[0])); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java index e6b741c43..086b1549d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetworth.java @@ -22,7 +22,6 @@ public class Commandsetworth extends EssentialsCommand } ItemStack stack = ess.getItemDb().get(args[0]); - charge(user); ess.getWorth().setPrice(stack, Double.parseDouble(args[1])); user.sendMessage(Util.i18n("worthSet")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java index 33efffeef..8e95e8237 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsocialspy.java @@ -15,9 +15,6 @@ public class Commandsocialspy extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - - charge(user); user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? Util.i18n("enabled") : Util.i18n("disabled"))); - } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java index ae92670ca..18e4fb349 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java @@ -1,12 +1,12 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Mob; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.block.CraftCreatureSpawner; -import org.bukkit.entity.CreatureType; +import org.bukkit.block.CreatureSpawner; public class Commandspawner extends EssentialsCommand @@ -22,6 +22,7 @@ public class Commandspawner extends EssentialsCommand if (args.length < 1 || args[0].length() < 2) { throw new NotEnoughArgumentsException(); + //TODO: user.sendMessage("§7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf"); } final Block target = user.getTarget().getTargetBlock(); @@ -30,14 +31,20 @@ public class Commandspawner extends EssentialsCommand throw new Exception(Util.i18n("mobSpawnTarget")); } - charge(user); try { - String name = args[0].substring(0, 1).toUpperCase() + args[0].substring(1).toLowerCase(); - if (name.equalsIgnoreCase("Pigzombie")) { - name = "PigZombie"; - } - new CraftCreatureSpawner(target).setCreatureType(CreatureType.fromName(name)); + String name = args[0]; + name = name.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : name.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(name); + + Mob mob = null; + mob = Mob.fromName(name); + if (mob == null) + { + user.sendMessage(Util.i18n("invalidMob")); + return; + } + ((CreatureSpawner)target.getState()).setCreatureType(mob.getType()); + user.sendMessage(Util.format("setSpawner", mob.name)); } catch (Throwable ex) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java index 86d2beac4..f46264582 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java @@ -8,16 +8,13 @@ import com.earth2me.essentials.Mob.MobException; import com.earth2me.essentials.TargetBlock; import com.earth2me.essentials.Util; import java.util.Random; -import net.minecraft.server.EntityWolf; -import net.minecraft.server.PathEntity; import org.bukkit.DyeColor; -import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.entity.CraftCreeper; -import org.bukkit.craftbukkit.entity.CraftSheep; -import org.bukkit.craftbukkit.entity.CraftSlime; -import org.bukkit.craftbukkit.entity.CraftWolf; +import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; +import org.bukkit.entity.Sheep; +import org.bukkit.entity.Slime; +import org.bukkit.entity.Wolf; public class Commandspawnmob extends EssentialsCommand @@ -40,7 +37,7 @@ public class Commandspawnmob extends EssentialsCommand String[] mountparts = args[0].split(","); String[] parts = mountparts[0].split(":"); String mobType = parts[0]; - mobType = mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : capitalCase(mobType); + mobType = mobType.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : mobType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mobType); String mobData = null; if (parts.length == 2) { @@ -52,7 +49,7 @@ public class Commandspawnmob extends EssentialsCommand { parts = mountparts[1].split(":"); mountType = parts[0]; - mountType = mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : capitalCase(mountType); + mountType = mountType.equalsIgnoreCase("CaveSpider") ? "CaveSpider" : mountType.equalsIgnoreCase("PigZombie") ? "PigZombie" : Util.capitalCase(mountType); if (parts.length == 2) { mountData = parts[1]; @@ -62,8 +59,7 @@ public class Commandspawnmob extends EssentialsCommand if (ess.getSettings().getProtectPreventSpawn(mobType.toLowerCase()) || (mountType != null && ess.getSettings().getProtectPreventSpawn(mountType.toLowerCase()))) { - user.sendMessage(Util.i18n("unableToSpawnMob")); - return; + throw new Exception(Util.i18n("unableToSpawnMob")); } Entity spawnedMob = null; @@ -74,26 +70,23 @@ public class Commandspawnmob extends EssentialsCommand mob = Mob.fromName(mobType); if (mob == null) { - user.sendMessage(Util.i18n("invalidMob")); - return; + throw new Exception(Util.i18n("invalidMob")); } - charge(user); int[] ignore = { 8, 9 }; - Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation(); - - Block block = user.getWorld().getBlockAt(loc); - while (!(block.getType() == Material.AIR || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)) + Block block = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock(); + if (block == null) { - loc.setY(loc.getY() + 1); - block = user.getWorld().getBlockAt(loc); + user.sendMessage(Util.i18n("unableToSpawnMob")); + return; } - + Location loc = block.getLocation(); + Location sloc = Util.getSafeDestination(loc); try { - spawnedMob = mob.spawn(user, server, loc); + spawnedMob = mob.spawn(user, server, sloc); } catch (MobException e) { @@ -186,18 +179,13 @@ public class Commandspawnmob extends EssentialsCommand } } - private String capitalCase(String s) - { - return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1); - } - private void changeMobData(String type, Entity spawned, String data, User user) throws Exception { if ("Slime".equalsIgnoreCase(type)) { try { - ((CraftSlime)spawned).setSize(Integer.parseInt(data)); + ((Slime)spawned).setSize(Integer.parseInt(data)); } catch (Exception e) { @@ -210,12 +198,12 @@ public class Commandspawnmob extends EssentialsCommand { if (data.equalsIgnoreCase("random")) { - Random rand = new Random(); - ((CraftSheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); + Random rand = new Random(); + ((Sheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); } - else - { - ((CraftSheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase())); + else + { + ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase())); } } catch (Exception e) @@ -225,21 +213,18 @@ public class Commandspawnmob extends EssentialsCommand } if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed")) { - EntityWolf wolf = ((CraftWolf)spawned).getHandle(); + Wolf wolf = ((Wolf)spawned); wolf.setTamed(true); - wolf.setPathEntity((PathEntity)null); + wolf.setOwner(user); wolf.setSitting(true); - wolf.health = 20; - wolf.setOwnerName(user.getName()); - wolf.world.a(wolf, (byte)7); } if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("angry")) { - ((CraftWolf)spawned).setAngry(true); + ((Wolf)spawned).setAngry(true); } if ("Creeper".equalsIgnoreCase(type) && data.equalsIgnoreCase("powered")) { - ((CraftCreeper)spawned).setPowered(true); + ((Creeper)spawned).setPowered(true); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java index 57e5e3fd5..ca9fee47b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java @@ -15,10 +15,9 @@ public class Commandsuicide extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); user.setHealth(0); user.sendMessage(Util.i18n("suicideMessage")); - ess.broadcastMessage(user.getName(), + ess.broadcastMessage(user, Util.format("suicideSuccess",user.getDisplayName())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index a20ad067f..bc8442da4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -47,8 +47,8 @@ public class Commandtempban extends EssentialsCommand final String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp)); player.setBanReason(banReason); player.setBanTimeout(banTimestamp); + player.setBanned(true); player.kickPlayer(banReason); - ess.getBans().banByName(player.getName()); String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; for(Player p : server.getOnlinePlayers()) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java b/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java index b1ffd3f7f..34f5c3fed 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandthunder.java @@ -16,13 +16,11 @@ public class Commandthunder extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - if (args.length < 1) { throw new NotEnoughArgumentsException(); } - charge(user); World world = user.getWorld(); boolean setThunder = args[0].equalsIgnoreCase("true"); if (args.length > 1) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index 23f9138a9..72bb2b65f 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -5,19 +5,12 @@ import org.bukkit.Server; import org.bukkit.World; import org.bukkit.command.CommandSender; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.*; -import org.bukkit.ChatColor; public class Commandtime extends EssentialsCommand { - // TODO: I suggest that the chat colors be centralized in the config file. - public static final ChatColor colorDefault = ChatColor.YELLOW; - public static final ChatColor colorChrome = ChatColor.GOLD; - public static final ChatColor colorLogo = ChatColor.GREEN; - public static final ChatColor colorHighlight1 = ChatColor.AQUA; - public static final ChatColor colorBad = ChatColor.RED; - public Commandtime() { super("time"); @@ -44,8 +37,8 @@ public class Commandtime extends EssentialsCommand User user = ess.getUser(sender); if (user != null && !user.isAuthorized("essentials.time.set")) { - // TODO should not be hardcoded !! - throw new Exception(colorBad + "You are not authorized to set the time"); + user.sendMessage(Util.i18n("timeSetPermission")); + return; } // Parse the target time int ticks from args[0] @@ -67,7 +60,6 @@ public class Commandtime extends EssentialsCommand */ private void getWorldsTime(CommandSender sender, Collection<World> worlds) { - // TODO do we need to check for the essentials.time permission? Or is that tested for us already. if (worlds.size() == 1) { Iterator<World> iter = worlds.iterator(); @@ -77,7 +69,7 @@ public class Commandtime extends EssentialsCommand for (World world : worlds) { - sender.sendMessage(colorDefault + world.getName() + ": " + DescParseTickFormat.format(world.getTime())); + sender.sendMessage(Util.format("timeCurrentWorld", world.getName(), DescParseTickFormat.format(world.getTime()))); } return; } @@ -96,31 +88,21 @@ public class Commandtime extends EssentialsCommand } // Inform the sender of the change - sender.sendMessage(""); - sender.sendMessage(colorDefault + "The time was set to"); - sender.sendMessage(DescParseTickFormat.format(ticks)); + //sender.sendMessage(""); StringBuilder msg = new StringBuilder(); - msg.append(colorDefault); - msg.append("In "); boolean first = true; for (World world : worlds) { - if (!first) + if (msg.length() > 0) { - msg.append(colorDefault); msg.append(", "); } - else - { - first = false; - } - msg.append(colorHighlight1); msg.append(world.getName()); } - sender.sendMessage(msg.toString()); + sender.sendMessage(Util.format("timeWorldSet", DescParseTickFormat.format(ticks), msg.toString())); } /** @@ -159,7 +141,7 @@ public class Commandtime extends EssentialsCommand // We failed to understand the world target... else { - throw new Exception("Could not find the world(s) \"" + selector + "\""); + throw new Exception(Util.i18n("invalidWorld")); } return worlds; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index 5fafe3374..625a375d8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -44,10 +44,6 @@ public class Commandtogglejail extends EssentialsCommand return; } } - charge(sender); - p.setJailed(true); - p.sendMessage(Util.i18n("userJailed")); - p.setJail(null); if (!(p.getBase() instanceof OfflinePlayer)) { ess.getJail().sendToJail(p, args[1]); @@ -57,6 +53,9 @@ public class Commandtogglejail extends EssentialsCommand // Check if jail exists ess.getJail().getJail(args[1]); } + p.setJailed(true); + p.sendMessage(Util.i18n("userJailed")); + p.setJail(null); p.setJail(args[1]); long timeDiff = 0; if (args.length > 2) @@ -73,7 +72,7 @@ public class Commandtogglejail extends EssentialsCommand if (args.length >= 2 && p.isJailed() && !args[1].equalsIgnoreCase(p.getJail())) { - sender.sendMessage("§cPerson is already in jail " + p.getJail()); + sender.sendMessage(Util.format("jailAlreadyIncarcerated", p.getJail())); return; } @@ -82,7 +81,7 @@ public class Commandtogglejail extends EssentialsCommand String time = getFinalArg(args, 2); long timeDiff = Util.parseDateDiff(time, true); p.setJailTimeout(timeDiff); - sender.sendMessage("Jail time extend to " + Util.formatDateDiff(timeDiff)); + sender.sendMessage(Util.format("jailSentenceExtended", Util.formatDateDiff(timeDiff))); return; } @@ -94,13 +93,13 @@ public class Commandtogglejail extends EssentialsCommand } p.setJailed(false); p.setJailTimeout(0); - p.sendMessage("§7You have been released"); + p.sendMessage(Util.format("jailReleasedPlayerNotify")); p.setJail(null); if (!(p.getBase() instanceof OfflinePlayer)) { p.getTeleport().back(); } - sender.sendMessage("§7Player " + p.getName() + " unjailed."); + sender.sendMessage(Util.format("jailReleased", p.getName())); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java index 8c0c687d0..ee5bfbe45 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtop.java @@ -20,7 +20,6 @@ public class Commandtop extends EssentialsCommand int topX = user.getLocation().getBlockX(); int topZ = user.getLocation().getBlockZ(); int topY = user.getWorld().getHighestBlockYAt(topX, topZ); - charge(user); user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess)); user.sendMessage(Util.i18n("teleportTop")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java index c147c5d25..480fb6153 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java @@ -33,7 +33,7 @@ public class Commandtp extends EssentialsCommand Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); user.getTeleport().teleport(p, charge); - break; + throw new NoChargeException(); case 2: if (!user.isAuthorized("essentials.tpohere")) @@ -41,13 +41,12 @@ public class Commandtp extends EssentialsCommand throw new Exception("You need access to /tpohere to teleport other players."); } user.sendMessage(Util.i18n("teleporting")); - charge(user); User target = getPlayer(server, args, 0); User toPlayer = getPlayer(server, args, 1); target.getTeleport().now(toPlayer, false); target.sendMessage(Util.format("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); break; - } + } } @Override @@ -63,5 +62,6 @@ public class Commandtp extends EssentialsCommand User toPlayer = getPlayer(server, args, 1); target.getTeleport().now(toPlayer, false); target.sendMessage(Util.format("teleportAtoB", Console.NAME, toPlayer.getDisplayName())); + return; } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java index f3b7ae505..32cbe3bd9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java @@ -25,7 +25,6 @@ public class Commandtpa extends EssentialsCommand { throw new Exception(Util.format("teleportDisabled", p.getDisplayName())); } - charge(user); if (!p.isIgnoredPlayer(user.getName())) { p.requestTeleport(user, false); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java new file mode 100644 index 000000000..97897852f --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java @@ -0,0 +1,60 @@ +package com.earth2me.essentials.commands; + +import org.bukkit.Server; +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public class Commandtpaall extends EssentialsCommand +{ + public Commandtpaall() + { + super("tpaall"); + } + + @Override + public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + if (sender instanceof Player) + { + teleportAAllPlayers(server, sender, ess.getUser(sender)); + return; + } + throw new NotEnoughArgumentsException(); + } + + User p = getPlayer(server, args, 0); + teleportAAllPlayers(server, sender, p); + } + + private void teleportAAllPlayers(Server server, CommandSender sender, User p) + { + sender.sendMessage(Util.i18n("teleportAAll")); + for (Player player : server.getOnlinePlayers()) + { + User u = ess.getUser(player); + if (p == u) + { + continue; + } + if (!u.isTeleportEnabled()) + { + continue; + } + try + { + u.requestTeleport(p, true); + u.sendMessage(Util.format("teleportHereRequest", p.getDisplayName())); + u.sendMessage(Util.i18n("typeTpaccept")); + } + catch (Exception ex) + { + ess.showError(sender, ex, getName()); + } + } + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 0cba80020..043f23172 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -33,7 +33,7 @@ public class Commandtpaccept extends EssentialsCommand charge.isAffordableFor(p); } user.sendMessage(Util.i18n("requestAccepted")); - p.sendMessage(Util.i18n("requestAccepted")); + p.sendMessage(Util.format("requestAcceptedFrom", user.getDisplayName())); if (user.isTeleportRequestHere()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java index 2003bbf73..935721345 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java @@ -25,7 +25,6 @@ public class Commandtpahere extends EssentialsCommand { throw new Exception(Util.format("teleportDisabled", p.getDisplayName())); } - charge(user); p.requestTeleport(user, true); p.sendMessage(Util.format("teleportHereRequest", user.getDisplayName())); p.sendMessage(Util.i18n("typeTpaccept")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java index cc58944d7..1cb6321ea 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java @@ -21,7 +21,6 @@ public class Commandtpall extends EssentialsCommand { if (sender instanceof Player) { - charge(sender); teleportAllPlayers(server, sender, ess.getUser(sender)); return; } @@ -29,7 +28,6 @@ public class Commandtpall extends EssentialsCommand } User p = getPlayer(server, args, 0); - charge(sender); teleportAllPlayers(server, sender, p); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java index 097ea1fdd..5d7764ae6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java @@ -21,9 +21,8 @@ public class Commandtpdeny extends EssentialsCommand throw new Exception(Util.i18n("noPendingRequest")); } - charge(user); user.sendMessage(Util.i18n("requestDenied")); - p.sendMessage(Util.i18n("requestDenied")); + p.sendMessage(Util.format("requestDeniedFrom", user.getDisplayName())); user.requestTeleport(null, false); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java index 036c4be27..bba8d8743 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java @@ -24,5 +24,6 @@ public class Commandtphere extends EssentialsCommand p.getTeleport().teleport(user, new Trade(this.getName(), ess)); user.sendMessage(Util.i18n("teleporting")); p.sendMessage(Util.i18n("teleporting")); + throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java index 18d818ea1..5a4e082e0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java @@ -32,7 +32,6 @@ public class Commandtpo extends EssentialsCommand // Verify permission if (!p.isHidden() || user.isAuthorized("essentials.teleport.hidden")) { - charge(user); user.getTeleport().now(p, false); user.sendMessage(Util.i18n("teleporting")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java index 186476a50..7af39854f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java @@ -33,7 +33,6 @@ public class Commandtpohere extends EssentialsCommand // Verify permission if (!p.isHidden() || user.isAuthorized("essentials.teleport.hidden")) { - charge(user); p.getTeleport().now(user, false); user.sendMessage(Util.i18n("teleporting")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java index 805aefaca..ce7c369e4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java @@ -26,9 +26,16 @@ public class Commandtppos extends EssentialsCommand int y = Integer.parseInt(args[1]); int z = Integer.parseInt(args[2]); Location l = new Location(user.getWorld(), x, y, z); + if (args.length > 3) { + l.setYaw(Float.parseFloat(args[3])); + } + if (args.length > 4) { + l.setPitch(Float.parseFloat(args[4])); + } Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); user.sendMessage(Util.i18n("teleporting")); user.getTeleport().teleport(l, charge); + throw new NoChargeException(); } }
\ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java index 38236d475..f880c5d34 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java @@ -15,7 +15,6 @@ public class Commandtptoggle extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); user.sendMessage(user.toggleTeleportEnabled() ? Util.i18n("teleportationEnabled") : Util.i18n("teleportationDisabled")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java index 8e3b567b4..8013453ab 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java @@ -1,10 +1,13 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.TargetBlock; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.TreeType; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import org.bukkit.Material; +import org.bukkit.block.Block; public class Commandtree extends EssentialsCommand @@ -38,35 +41,16 @@ public class Commandtree extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - - double x = user.getLocation().getX(); - double y = user.getLocation().getY(); - double z = user.getLocation().getZ(); - - // offset tree in direction player is facing - int r = (int)user.getCorrectedYaw(); - if (r < 68 || r > 292) // north - { - x -= 3.0D; - } - else if (r > 112 && r < 248) // south - { - x += 3.0D; - } - if (r > 22 && r < 158) // east - { - z -= 3.0D; - } - else if (r > 202 && r < 338) // west + + final int[] ignore = { - z += 3.0D; - } - - Location safeLocation = Util.getSafeDestination(new Location(user.getWorld(), x, y, z)); - boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree); + 8, 9 + }; + final Location loc = (new TargetBlock(user, 300, 0.2, ignore)).getTargetBlock().getLocation(); + final Location safeLocation = Util.getSafeDestination(loc); + final boolean success = user.getWorld().generateTree(safeLocation, (TreeType)tree); if (success) { - charge(user); user.sendMessage(Util.i18n("treeSpawned")); } else diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index 2cf4e78d0..8bc921d64 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -26,12 +26,12 @@ public class Commandunban extends EssentialsCommand { User u = getPlayer(server, args, 0, true); name = u.getName(); + u.setBanned(false); + sender.sendMessage(Util.i18n("unbannedPlayer")); } catch (NoSuchFieldException e) { - name = args[0]; + sender.sendMessage(Util.i18n("playerNotFound")); } - ess.getBans().unbanByName(name); - sender.sendMessage(Util.i18n("unbannedPlayer")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index aa6327f49..ea2c88f78 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -20,7 +20,7 @@ public class Commandunbanip extends EssentialsCommand throw new NotEnoughArgumentsException(); } - ess.getBans().unbanByIp(args[0]); + ess.getServer().unbanIP(args[0]); sender.sendMessage(Util.i18n("unbannedIP")); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java index 122891e02..cebbcaf8c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunlimited.java @@ -93,8 +93,7 @@ public class Commandunlimited extends EssentialsCommand && !((stack.getType() == Material.WATER_BUCKET || stack.getType() == Material.LAVA_BUCKET) && user.isAuthorized("essentials.unlimited.item-bucket")))) { - user.sendMessage(Util.format("unlimitedItemPermission", itemname)); - return false; + throw new Exception(Util.format("unlimitedItemPermission", itemname)); } String message = "disableUnlimited"; @@ -103,7 +102,6 @@ public class Commandunlimited extends EssentialsCommand { message = "enableUnlimited"; enableUnlimited = true; - charge(user); if (!InventoryWorkaround.containsItem(target.getInventory(), true, stack)) { target.getInventory().addItem(stack); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 50a8ff0cf..36d1d0df0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -5,10 +5,15 @@ import org.bukkit.Server; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import com.earth2me.essentials.Warps; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; public class Commandwarp extends EssentialsCommand { + private final static int WARPS_PER_PAGE = 20; + public Commandwarp() { super("warp"); @@ -17,13 +22,11 @@ public class Commandwarp extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - - if (args.length == 0) + if (args.length == 0 || args[0].matches("[0-9]+")) { if (!user.isAuthorized("essentials.warp.list")) { - user.sendMessage(Util.i18n("warpListPermission")); - return; + throw new Exception(Util.i18n("warpListPermission")); } Warps warps = ess.getWarps(); @@ -31,27 +34,28 @@ public class Commandwarp extends EssentialsCommand { throw new Exception(Util.i18n("noWarpsDefined")); } - StringBuilder sb = new StringBuilder(); - int i = 0; - for (String warpName : warps.getWarpNames()) + final List<String> warpNameList = new ArrayList<String>(warps.getWarpNames()); + final Iterator<String> iterator = warpNameList.iterator(); + while (iterator.hasNext()) { - if (ess.getSettings().getPerWarpPermission()) + final String warpName = iterator.next(); + if (ess.getSettings().getPerWarpPermission() && !user.isAuthorized("essentials.warp." + warpName)) { - if (user.isAuthorized("essentials.warp." + warpName)) - { - if (i++ > 0) sb.append(", "); - sb.append(warpName); - } + iterator.remove(); } - else - { - if (i++ > 0) sb.append(", "); - sb.append(warpName); - } - } - user.sendMessage(sb.toString()); - return; + int page = 1; + if (args.length > 0) + { + page = Integer.parseInt(args[0]); + } + if (warpNameList.size() > WARPS_PER_PAGE) + { + user.sendMessage(Util.format("warpsCount", warpNameList.size(), page, (int)Math.ceil(warpNameList.size() / (double)WARPS_PER_PAGE))); + } + final int warpPage = (page - 1) * WARPS_PER_PAGE; + user.sendMessage(Util.joinList(warpNameList.subList(warpPage, warpPage+Math.min(warpNameList.size() - warpPage, WARPS_PER_PAGE)))); + throw new NoChargeException(); } if (args.length > 0) { @@ -59,15 +63,15 @@ public class Commandwarp extends EssentialsCommand if (args.length == 2 && user.isAuthorized("essentials.warp.otherplayers")) { otherUser = ess.getUser(server.getPlayer(args[1])); - if(otherUser == null) + if (otherUser == null) { - user.sendMessage(Util.i18n("playerNotFound")); - return; + throw new Exception(Util.i18n("playerNotFound")); } warpUser(otherUser, args[0]); - return; + throw new NoChargeException(); } warpUser(user, args[0]); + throw new NoChargeException(); } } @@ -82,8 +86,7 @@ public class Commandwarp extends EssentialsCommand user.getTeleport().warp(name, charge); return; } - user.sendMessage(Util.i18n("warpUsePermission")); - return; + throw new Exception(Util.i18n("warpUsePermission")); } user.getTeleport().warp(name, charge); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java index eec1d9575..45c62d787 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java @@ -23,7 +23,6 @@ public class Commandweather extends EssentialsCommand boolean isStorm = args[0].equalsIgnoreCase("storm"); World world = user.getWorld(); - charge(user); if (args.length > 1) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index ef815dd87..1769202f5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -35,7 +35,6 @@ public class Commandwhois extends EssentialsCommand showhidden = true; } String whois = args[0].toLowerCase(); - charge(sender); int prefixLength = ChatColor.stripColor(ess.getSettings().getNicknamePrefix()).length(); for (Player p : server.getOnlinePlayers()) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java index 0a315b1d4..77db8e5e3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java @@ -47,7 +47,7 @@ public class Commandworld extends EssentialsCommand user.sendMessage(Util.i18n("invalidWorld")); user.sendMessage(Util.format("possibleWorlds", server.getWorlds().size() - 1)); user.sendMessage(Util.i18n("typeWorldName")); - return; + throw new NoChargeException(); } } @@ -71,5 +71,6 @@ public class Commandworld extends EssentialsCommand Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); user.getTeleport().teleport(loc, charge); + throw new NoChargeException(); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java index f2d6ed954..b59070320 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java @@ -43,7 +43,6 @@ public class Commandworth extends EssentialsCommand throw new Exception(Util.i18n("itemCannotBeSold")); } - charge(user); user.sendMessage(is.getDurability() != 0 ? Util.format("worthMeta", is.getType().toString().toLowerCase().replace("_", ""), diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index c99cdfdc9..58da18c21 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -79,7 +79,10 @@ public abstract class EssentialsCommand implements IEssentialsCommand @Override public final void run(final Server server, final User user, final String commandLabel, final Command cmd, final String[] args) throws Exception { + final Trade charge = new Trade(this.getName(), ess); + charge.isAffordableFor(user); run(server, user, commandLabel, args); + charge.charge(user); } protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception @@ -111,13 +114,4 @@ public abstract class EssentialsCommand implements IEssentialsCommand } return bldr.toString(); } - - protected void charge(final CommandSender sender) throws ChargeException - { - if (sender instanceof Player) - { - final Trade charge = new Trade(this.getName(), ess); - charge.charge(ess.getUser((Player)sender)); - } - } } diff --git a/Essentials/src/com/earth2me/essentials/commands/NoChargeException.java b/Essentials/src/com/earth2me/essentials/commands/NoChargeException.java new file mode 100644 index 000000000..bb0088792 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/NoChargeException.java @@ -0,0 +1,10 @@ +package com.earth2me.essentials.commands; + + +public class NoChargeException extends Exception +{ + public NoChargeException() + { + super("Will charge later"); + } +} diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java new file mode 100644 index 000000000..90b905113 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/perm/BPermissionsHandler.java @@ -0,0 +1,51 @@ +package com.earth2me.essentials.perm; + +import de.bananaco.permissions.Permissions; +import de.bananaco.permissions.interfaces.PermissionSet; +import de.bananaco.permissions.worlds.WorldPermissionsManager; +import java.util.List; +import org.bukkit.entity.Player; + + +public class BPermissionsHandler extends SuperpermsHandler +{ + private final transient WorldPermissionsManager wpm; + + public BPermissionsHandler() + { + wpm = Permissions.getWorldPermissionsManager(); + } + + @Override + public String getGroup(final Player base) + { + final List<String> groups = getGroups(base); + if (groups == null || groups.isEmpty()) + { + return null; + } + return groups.get(0); + } + + @Override + public List<String> getGroups(final Player base) + { + final PermissionSet pset = wpm.getPermissionSet(base.getWorld()); + if (pset == null) + { + return null; + } + return pset.getGroups(base); + } + + @Override + public boolean inGroup(final Player base, final String group) + { + final List<String> groups = getGroups(base); + if (groups == null || groups.isEmpty()) + { + return false; + } + return groups.contains(group); + } +} diff --git a/Essentials/src/com/earth2me/essentials/ConfigPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java index 200aa34f8..fad479444 100644 --- a/Essentials/src/com/earth2me/essentials/ConfigPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java @@ -1,46 +1,61 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.perm; +import com.earth2me.essentials.IEssentials; +import java.util.List; import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; public class ConfigPermissionsHandler implements IPermissionsHandler { private final transient IEssentials ess; - public ConfigPermissionsHandler(final IEssentials ess) + public ConfigPermissionsHandler(final Plugin ess) { - this.ess = ess; + this.ess = (IEssentials)ess; } + @Override public String getGroup(final Player base) { - return "default"; + return null; } + @Override + public List<String> getGroups(final Player base) + { + return null; + } + + @Override public boolean canBuild(final Player base, final String group) { return true; } + @Override public boolean inGroup(final Player base, final String group) { return false; } + @Override public boolean hasPermission(final Player base, final String node) { final String[] cmds = node.split("\\.", 2); - return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1]) - && ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]); + return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1]) + && ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]); } + @Override public String getPrefix(final Player base) { - return ""; + return null; } + @Override public String getSuffix(final Player base) { - return ""; + return null; } } diff --git a/Essentials/src/com/earth2me/essentials/IPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/IPermissionsHandler.java index a7bcc80b7..27af48e8c 100644 --- a/Essentials/src/com/earth2me/essentials/IPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/IPermissionsHandler.java @@ -1,13 +1,15 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.perm; +import java.util.List; import org.bukkit.entity.Player; public interface IPermissionsHandler { - String getGroup(Player base); + List<String> getGroups(Player base); + boolean canBuild(Player base, String group); boolean inGroup(Player base, String group); @@ -17,5 +19,4 @@ public interface IPermissionsHandler String getPrefix(Player base); String getSuffix(Player base); - } diff --git a/Essentials/src/com/earth2me/essentials/perm/NullPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/NullPermissionsHandler.java new file mode 100644 index 000000000..b51aeb055 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/perm/NullPermissionsHandler.java @@ -0,0 +1,51 @@ +package com.earth2me.essentials.perm; + +import java.util.Collections; +import java.util.List; +import org.bukkit.entity.Player; + + +public class NullPermissionsHandler implements IPermissionsHandler +{ + @Override + public String getGroup(final Player base) + { + return null; + } + + @Override + public List<String> getGroups(final Player base) + { + return Collections.emptyList(); + } + + @Override + public boolean canBuild(final Player base, final String group) + { + return false; + } + + @Override + public boolean inGroup(final Player base, final String group) + { + return false; + } + + @Override + public boolean hasPermission(final Player base, final String node) + { + return false; + } + + @Override + public String getPrefix(final Player base) + { + return null; + } + + @Override + public String getSuffix(final Player base) + { + return null; + } +} diff --git a/Essentials/src/com/earth2me/essentials/Permissions2Handler.java b/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java index 71d7da58b..6b5ff5b73 100644 --- a/Essentials/src/com/earth2me/essentials/Permissions2Handler.java +++ b/Essentials/src/com/earth2me/essentials/perm/Permissions2Handler.java @@ -1,7 +1,9 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.perm; import com.nijiko.permissions.PermissionHandler; import com.nijikokun.bukkit.Permissions.Permissions; +import java.util.Arrays; +import java.util.List; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -10,41 +12,50 @@ public class Permissions2Handler implements IPermissionsHandler { private final transient PermissionHandler permissionHandler; - Permissions2Handler(final Plugin permissionsPlugin) + public Permissions2Handler(final Plugin permissionsPlugin) { permissionHandler = ((Permissions)permissionsPlugin).getHandler(); } + @Override public String getGroup(final Player base) { - final String group = permissionHandler.getGroup(base.getWorld().getName(), base.getName()); - return group == null ? "default" : group; + return permissionHandler.getGroup(base.getWorld().getName(), base.getName()); } + @Override + public List<String> getGroups(final Player base) + { + return Arrays.asList(permissionHandler.getGroups(base.getWorld().getName(), base.getName())); + } + + @Override public boolean canBuild(final Player base, final String group) { return permissionHandler.canGroupBuild(base.getWorld().getName(), getGroup(base)); } + @Override public boolean inGroup(final Player base, final String group) { return permissionHandler.inGroup(base.getWorld().getName(), base.getName(), group); } + @Override public boolean hasPermission(final Player base, final String node) { return permissionHandler.permission(base, node); } + @Override public String getPrefix(final Player base) { - final String prefix = permissionHandler.getGroupPrefix(base.getWorld().getName(), getGroup(base)); - return prefix == null ? "" : prefix; + return permissionHandler.getGroupPrefix(base.getWorld().getName(), getGroup(base)); } + @Override public String getSuffix(final Player base) { - final String suffix = permissionHandler.getGroupSuffix(base.getWorld().getName(), getGroup(base)); - return suffix == null ? "" : suffix; + return permissionHandler.getGroupSuffix(base.getWorld().getName(), getGroup(base)); } } diff --git a/Essentials/src/com/earth2me/essentials/Permissions3Handler.java b/Essentials/src/com/earth2me/essentials/perm/Permissions3Handler.java index 99c95da0a..190d5b8c5 100644 --- a/Essentials/src/com/earth2me/essentials/Permissions3Handler.java +++ b/Essentials/src/com/earth2me/essentials/perm/Permissions3Handler.java @@ -1,7 +1,9 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.perm; import com.nijiko.permissions.PermissionHandler; import com.nijikokun.bukkit.Permissions.Permissions; +import java.util.Arrays; +import java.util.List; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -9,40 +11,51 @@ import org.bukkit.plugin.Plugin; public class Permissions3Handler implements IPermissionsHandler { private final transient PermissionHandler permissionHandler; - - Permissions3Handler(final Plugin permissionsPlugin) + + public Permissions3Handler(final Plugin permissionsPlugin) { permissionHandler = ((Permissions)permissionsPlugin).getHandler(); } + @Override public String getGroup(final Player base) { return permissionHandler.getPrimaryGroup(base.getWorld().getName(), base.getName()); } + @Override + public List<String> getGroups(final Player base) + { + return Arrays.asList(permissionHandler.getGroups(base.getWorld().getName(), base.getName())); + } + + @Override public boolean canBuild(final Player base, final String group) { return permissionHandler.canUserBuild(base.getWorld().getName(), base.getName()); } + @Override public boolean inGroup(final Player base, final String group) { return permissionHandler.inGroup(base.getWorld().getName(), base.getName(), group); } + @Override public boolean hasPermission(final Player base, final String node) { return permissionHandler.has(base, node); } + @Override public String getPrefix(final Player base) { return permissionHandler.getUserPrefix(base.getWorld().getName(), base.getName()); } + @Override public String getSuffix(final Player base) { return permissionHandler.getUserSuffix(base.getWorld().getName(), base.getName()); } - } diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java new file mode 100644 index 000000000..d47c3c8a4 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsBukkitHandler.java @@ -0,0 +1,77 @@ +package com.earth2me.essentials.perm; + +import com.platymuus.bukkit.permissions.Group; +import com.platymuus.bukkit.permissions.PermissionInfo; +import com.platymuus.bukkit.permissions.PermissionsPlugin; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + + +public class PermissionsBukkitHandler extends SuperpermsHandler +{ + private final transient PermissionsPlugin plugin; + + public PermissionsBukkitHandler(final Plugin plugin) + { + this.plugin = (PermissionsPlugin)plugin; + } + + @Override + public String getGroup(final Player base) + { + final List<Group> groups = getPBGroups(base); + if (groups == null || groups.isEmpty()) + { + return null; + } + return groups.get(0).getName(); + } + + @Override + public List<String> getGroups(final Player base) + { + final List<Group> groups = getPBGroups(base); + if (groups.size() == 1) + { + return Collections.singletonList(groups.get(0).getName()); + } + final List<String> groupNames = new ArrayList<String>(groups.size()); + for (Group group : groups) + { + groupNames.add(group.getName()); + } + return groupNames; + } + + private List<Group> getPBGroups(final Player base) + { + final PermissionInfo info = plugin.getPlayerInfo(base.getName()); + if (info == null) + { + return Collections.emptyList(); + } + final List<Group> groups = info.getGroups(); + if (groups == null || groups.isEmpty()) + { + return Collections.emptyList(); + } + return groups; + } + + @Override + public boolean inGroup(final Player base, final String group) + { + final List<Group> groups = getPBGroups(base); + for (Group group1 : groups) + { + if (group1.getName().equalsIgnoreCase(group)) + { + return true; + } + } + return false; + } +} diff --git a/Essentials/src/com/earth2me/essentials/PermissionsExHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java index f9151c77e..5b7bb7b81 100644 --- a/Essentials/src/com/earth2me/essentials/PermissionsExHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsExHandler.java @@ -1,12 +1,14 @@ -package com.earth2me.essentials; +package com.earth2me.essentials.perm; +import java.util.Arrays; +import java.util.List; import org.bukkit.entity.Player; import ru.tehkode.permissions.PermissionManager; import ru.tehkode.permissions.PermissionUser; import ru.tehkode.permissions.bukkit.PermissionsEx; -class PermissionsExHandler implements IPermissionsHandler +public class PermissionsExHandler implements IPermissionsHandler { private final transient PermissionManager manager; @@ -15,17 +17,30 @@ class PermissionsExHandler implements IPermissionsHandler manager = PermissionsEx.getPermissionManager(); } - public String getGroup(Player base) + @Override + public String getGroup(final Player base) { final PermissionUser user = manager.getUser(base.getName()); if (user == null) { - return "default"; + return null; } return user.getGroupsNames()[0]; } - public boolean canBuild(Player base, String group) + @Override + public List<String> getGroups(final Player base) + { + final PermissionUser user = manager.getUser(base.getName()); + if (user == null) + { + return null; + } + return Arrays.asList(user.getGroupsNames()); + } + + @Override + public boolean canBuild(final Player base, final String group) { final PermissionUser user = manager.getUser(base.getName()); if (user == null) @@ -36,7 +51,8 @@ class PermissionsExHandler implements IPermissionsHandler return user.getOptionBoolean("build", base.getWorld().getName(), true); } - public boolean inGroup(Player base, String group) + @Override + public boolean inGroup(final Player base, final String group) { final PermissionUser user = manager.getUser(base.getName()); if (user == null) @@ -47,27 +63,30 @@ class PermissionsExHandler implements IPermissionsHandler return user.inGroup(group); } - public boolean hasPermission(Player base, String node) + @Override + public boolean hasPermission(final Player base, final String node) { return manager.has(base.getName(), node, base.getWorld().getName()); } - public String getPrefix(Player base) + @Override + public String getPrefix(final Player base) { final PermissionUser user = manager.getUser(base.getName()); if (user == null) { - return ""; + return null; } return user.getPrefix(); } - public String getSuffix(Player base) + @Override + public String getSuffix(final Player base) { final PermissionUser user = manager.getUser(base.getName()); if (user == null) { - return ""; + return null; } return user.getSuffix(); } diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java new file mode 100644 index 000000000..8adff346a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java @@ -0,0 +1,180 @@ +package com.earth2me.essentials.perm; + +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; + + +public class PermissionsHandler implements IPermissionsHandler +{ + private transient IPermissionsHandler handler = new NullPermissionsHandler(); + private transient String defaultGroup = "default"; + private final transient Plugin plugin; + private final static Logger LOGGER = Logger.getLogger("Minecraft"); + private transient boolean useSuperperms = false; + + public PermissionsHandler(final Plugin plugin) + { + this.plugin = plugin; + } + + public PermissionsHandler(final Plugin plugin, final boolean useSuperperms) + { + this.plugin = plugin; + this.useSuperperms = useSuperperms; + } + + public PermissionsHandler(final Plugin plugin, final String defaultGroup) + { + this.plugin = plugin; + this.defaultGroup = defaultGroup; + } + + @Override + public String getGroup(final Player base) + { + String group = handler.getGroup(base); + if (group == null) + { + group = defaultGroup; + } + return group; + } + + @Override + public List<String> getGroups(final Player base) + { + List<String> groups = handler.getGroups(base); + if (groups == null || groups.isEmpty()) + { + groups = Collections.singletonList(defaultGroup); + } + return Collections.unmodifiableList(groups); + } + + @Override + public boolean canBuild(final Player base, final String group) + { + return handler.canBuild(base, group); + } + + @Override + public boolean inGroup(final Player base, final String group) + { + return handler.inGroup(base, group); + } + + @Override + public boolean hasPermission(final Player base, final String node) + { + return handler.hasPermission(base, node); + } + + @Override + public String getPrefix(final Player base) + { + String prefix = handler.getPrefix(base); + if (prefix == null) + { + prefix = ""; + } + return prefix; + } + + @Override + public String getSuffix(final Player base) + { + String suffix = handler.getSuffix(base); + if (suffix == null) + { + suffix = ""; + } + return suffix; + } + + public void checkPermissions() + { + final PluginManager pluginManager = plugin.getServer().getPluginManager(); + + final Plugin permExPlugin = pluginManager.getPlugin("PermissionsEx"); + if (permExPlugin != null && permExPlugin.isEnabled()) + { + if (!(handler instanceof PermissionsExHandler)) + { + LOGGER.log(Level.INFO, "Essentials: Using PermissionsEx based permissions."); + handler = new PermissionsExHandler(); + } + return; + } + + final Plugin permBukkitPlugin = pluginManager.getPlugin("PermissionsBukkit"); + if (permBukkitPlugin != null && permBukkitPlugin.isEnabled()) + { + if (!(handler instanceof PermissionsBukkitHandler)) + { + LOGGER.log(Level.INFO, "Essentials: Using PermissionsBukkit based permissions."); + handler = new PermissionsBukkitHandler(permBukkitPlugin); + } + return; + } + + final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions"); + if (bPermPlugin != null && bPermPlugin.isEnabled()) + { + if (!(handler instanceof BPermissionsHandler)) + { + LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions."); + handler = new BPermissionsHandler(); + } + return; + } + + final Plugin permPlugin = pluginManager.getPlugin("Permissions"); + if (permPlugin != null && permPlugin.isEnabled()) + { + if (permPlugin.getDescription().getVersion().charAt(0) == '3') + { + if (!(handler instanceof Permissions3Handler)) + { + LOGGER.log(Level.INFO, "Essentials: Using Permissions 3 based permissions."); + handler = new Permissions3Handler(permPlugin); + } + } + else + { + if (!(handler instanceof Permissions2Handler)) + { + LOGGER.log(Level.INFO, "Essentials: Using Permissions 2 based permissions."); + handler = new Permissions2Handler(permPlugin); + } + } + return; + } + + if (useSuperperms) + { + if (!(handler instanceof SuperpermsHandler)) + { + LOGGER.log(Level.INFO, "Essentials: Using superperms based permissions."); + handler = new SuperpermsHandler(); + } + } + else + { + if (!(handler instanceof ConfigPermissionsHandler)) + { + LOGGER.log(Level.INFO, "Essentials: Using config based permissions. Enable superperms in config."); + handler = new ConfigPermissionsHandler(plugin); + } + } + } + + public void setUseSuperperms(final boolean useSuperperms) + { + this.useSuperperms = useSuperperms; + } +} diff --git a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java new file mode 100644 index 000000000..70a118bcf --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java @@ -0,0 +1,66 @@ +package com.earth2me.essentials.perm; + +import java.util.List; +import org.bukkit.entity.Player; + + +public class SuperpermsHandler implements IPermissionsHandler +{ + @Override + public String getGroup(final Player base) + { + return null; + } + + @Override + public List<String> getGroups(final Player base) + { + return null; + } + + @Override + public boolean canBuild(final Player base, final String group) + { + return hasPermission(base, "essentials.build"); + } + + @Override + public boolean inGroup(final Player base, final String group) + { + return false; + } + + @Override + public boolean hasPermission(final Player base, final String node) + { + if (base.hasPermission("-" + node)) + { + return false; + } + final String[] parts = node.split("\\."); + final StringBuilder builder = new StringBuilder(node.length()); + for (String part : parts) + { + builder.append('*'); + if (base.hasPermission(builder.toString())) + { + return true; + } + builder.deleteCharAt(builder.length() - 1); + builder.append(part).append('.'); + } + return base.hasPermission(node); + } + + @Override + public String getPrefix(final Player base) + { + return null; + } + + @Override + public String getSuffix(final Player base) + { + return null; + } +} diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index fc5dd8553..17d7a5993 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -11,7 +11,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; -import org.bukkit.craftbukkit.block.CraftSign; import org.bukkit.entity.Player; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.inventory.ItemStack; @@ -21,9 +20,6 @@ public class EssentialsSign { private static final Set<Material> EMPTY_SET = new HashSet<Material>(); protected transient final String signName; - private static final String FORMAT_SUCCESS = "§1[%s]"; - private static final String FORMAT_TEMPLATE = "[%s]"; - private static final String FORMAT_FAIL = "§4[%s]"; public EssentialsSign(final String signName) { @@ -41,7 +37,7 @@ public class EssentialsSign // they won't change it to §1[Signname] return true; } - sign.setLine(0, String.format(FORMAT_FAIL, this.signName)); + sign.setLine(0, Util.format("signFormatFail", this.signName)); try { final boolean ret = onSignCreate(sign, user, getUsername(user), ess); @@ -65,12 +61,12 @@ public class EssentialsSign public String getSuccessName() { - return String.format(FORMAT_SUCCESS, this.signName); + return Util.format("signFormatSuccess", this.signName); } public String getTemplateName() { - return String.format(FORMAT_TEMPLATE, this.signName); + return Util.format("signFormatTemplate", this.signName); } private String getUsername(final User user) @@ -191,8 +187,13 @@ public class EssentialsSign { return true; } + + public boolean onBlockIgnite(final Block block, final IEssentials ess) + { + return true; + } - public boolean onBlockPush(Block block, IEssentials ess) + public boolean onBlockPush(final Block block, final IEssentials ess) { return true; } @@ -450,7 +451,7 @@ public class EssentialsSign public BlockSign(final Block block) { this.block = block; - this.sign = new CraftSign(block); + this.sign = (Sign)block.getState(); } public final String getLine(final int index) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java index 6f07b67b2..7320f27a4 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -7,7 +7,6 @@ import java.util.logging.Logger; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.Sign; -import org.bukkit.craftbukkit.block.CraftSign; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBurnEvent; @@ -48,7 +47,7 @@ public class SignBlockListener extends BlockListener final int mat = block.getTypeId(); if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId()) { - final Sign csign = new CraftSign(block); + final Sign csign = (Sign)block.getState(); for (Signs signs : Signs.values()) { final EssentialsSign sign = signs.getSign(); @@ -184,9 +183,24 @@ public class SignBlockListener extends BlockListener return; } - if (protectSignsAndBlocks(event.getBlock(), event.getPlayer())) + final Block block = event.getBlock(); + if (((block.getType() == Material.WALL_SIGN + || block.getType() == Material.SIGN_POST) + && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) + || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); + return; + } + for (Signs signs : Signs.values()) + { + final EssentialsSign sign = signs.getSign(); + if (sign.getBlocks().contains(block.getType()) + && !sign.onBlockIgnite(block, ess)) + { + event.setCancelled(true); + return; + } } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java index a97c234fa..5d7900508 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.IEssentials; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.Sign; -import org.bukkit.craftbukkit.block.CraftSign; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerListener; @@ -39,7 +38,7 @@ public class SignPlayerListener extends PlayerListener { return; } - final Sign csign = new CraftSign(block); + final Sign csign = (Sign)block.getState(); for (Signs signs : Signs.values()) { final EssentialsSign sign = signs.getSign(); diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java index 43bb964b0..1db607606 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java @@ -15,7 +15,6 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; -import org.bukkit.craftbukkit.block.CraftSign; import org.bukkit.inventory.ItemStack; @@ -41,7 +40,7 @@ public class SignProtection extends EssentialsSign sign.setLine(3, "§1" + username); return true; } - player.sendMessage("§4You are not allowed to create sign here."); + player.sendMessage(Util.i18n("signProtectInvalidLocation")); return false; } @@ -146,6 +145,10 @@ public class SignProtection extends EssentialsSign { return SignProtectionState.OWNER; } + if (ChatColor.stripColor(sign.getLine(3)).equalsIgnoreCase(username)) + { + return SignProtectionState.OWNER; + } for (int i = 1; i <= 2; i++) { final String line = sign.getLine(i); @@ -158,10 +161,6 @@ public class SignProtection extends EssentialsSign return SignProtectionState.ALLOWED; } } - if (ChatColor.stripColor(sign.getLine(3)).equalsIgnoreCase(username)) - { - return SignProtectionState.OWNER; - } return SignProtectionState.NOT_ALLOWED; } @@ -203,7 +202,7 @@ public class SignProtection extends EssentialsSign { if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) { - final Sign sign = new CraftSign(b); + final Sign sign = (Sign)b.getState(); if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) { return true; @@ -217,7 +216,7 @@ public class SignProtection extends EssentialsSign { if (a.getType() == Material.SIGN_POST || a.getType() == Material.WALL_SIGN) { - final Sign sign = new CraftSign(a); + final Sign sign = (Sign)a.getState(); if (sign.getLine(0).equalsIgnoreCase("§1[Protection]")) { return true; @@ -312,6 +311,14 @@ public class SignProtection extends EssentialsSign return state == SignProtectionState.NOSIGN; } + + @Override + public boolean onBlockIgnite(final Block block, final IEssentials ess) + { + final SignProtectionState state = isBlockProtected(block, null, null, false); + + return state == SignProtectionState.NOSIGN; + } @Override public boolean onBlockPush(final Block block, final IEssentials ess) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 37f56d9fb..bf85d827c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -10,6 +10,7 @@ import org.bukkit.inventory.ItemStack; public class SignTrade extends EssentialsSign { + public SignTrade() { super("Trade"); @@ -33,10 +34,17 @@ public class SignTrade extends EssentialsSign { if (sign.getLine(3).substring(2).equalsIgnoreCase(username)) { - final Trade stored = getTrade(sign, 1, true, true, ess); - substractAmount(sign, 1, stored, ess); - stored.pay(player); - Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess); + try + { + final Trade stored = getTrade(sign, 1, true, true, ess); + substractAmount(sign, 1, stored, ess); + stored.pay(player); + Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess); + } + catch (SignException e) + { + throw new SignException(Util.i18n("tradeSignEmptyOwner")); + } } else { @@ -141,7 +149,7 @@ public class SignTrade extends EssentialsSign sign.setLine(index, stackamount + " " + split[1] + ":" + amount); return; } - throw new SignException(Util.format("invalidSignLine", index+1)); + throw new SignException(Util.format("invalidSignLine", index + 1)); } protected final Trade getTrade(final ISign sign, final int index, final boolean fullAmount, final boolean notEmpty, final IEssentials ess) throws SignException @@ -155,11 +163,18 @@ public class SignTrade extends EssentialsSign if (split.length == 2) { - final Double money = getMoney(split[0]); - final Double amount = notEmpty ? getDoublePositive(split[1]) : getDouble(split[1]); - if (money != null && amount != null) + try { - return new Trade(fullAmount ? amount : money, ess); + final Double money = getMoney(split[0]); + final Double amount = notEmpty ? getDoublePositive(split[1]) : getDouble(split[1]); + if (money != null && amount != null) + { + return new Trade(fullAmount ? amount : money, ess); + } + } + catch (SignException e) + { + throw new SignException(Util.i18n("tradeSignEmpty")); } } @@ -171,12 +186,12 @@ public class SignTrade extends EssentialsSign amount -= amount % stackamount; if (notEmpty && (amount < 1 || stackamount < 1 || item.getTypeId() == 0)) { - throw new SignException(Util.i18n("moreThanZero")); + throw new SignException(Util.i18n("tradeSignEmpty")); } item.setAmount(fullAmount ? amount : stackamount); return new Trade(item, ess); } - throw new SignException(Util.format("invalidSignLine", index+1)); + throw new SignException(Util.format("invalidSignLine", index + 1)); } protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException @@ -235,6 +250,6 @@ public class SignTrade extends EssentialsSign sign.setLine(index, stackamount + " " + split[1] + ":" + (amount + Math.round(value))); return; } - throw new SignException(Util.format("invalidSignLine", index+1)); + throw new SignException(Util.format("invalidSignLine", index + 1)); } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index d369a704d..d2c12be0e 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -40,7 +40,9 @@ change-displayname: true # Adds the prefix and suffix to the displayname of the player, so it will be displayed in messages and lists. # The prefix/suffix can be set using Permissions, Group Manager or PermissionsEx. # The value of change-displayname (above) has to be true. -add-prefix-suffix: false +# If you don't set this, it will default to true if essentials chat is installed. +# Don't forget to remove the # infront of the line +#add-prefix-suffix: false # The delay, in seconds, required between /home, /tp, etc. teleport-cooldown: 0 @@ -89,7 +91,7 @@ nether: # Mob limit on spawnmob spawnmob-limit: 10 -#Shall we notify users when using /lightning +# Shall we notify users when using /lightning warn-on-smite: true # The message of the day, displayed on connect and by typing /motd. @@ -205,7 +207,7 @@ backup: # Interval in minutes interval: 60 # Add a command that backups your data, e.g. - # command: 'rdiff-backup World1 backups/World1' + #command: 'rdiff-backup World1 backups/World1' # Set this true to enable permission per warp. per-warp-permission: false @@ -221,13 +223,29 @@ debug: false # Don't forget to remove the # infront of the line #locale: de_DE -#turn off god mode when people exit +# Turn off god mode when people exit remove-god-on-disconnect: false # Use the permission system of bukkit # This only works if no other permission plugins are installed use-bukkit-permissions: false +# Auto-AFK +# After this timeout in seconds, the user will be set as afk. +# Set to -1 for no timeout. +auto-afk: 300 + +# Auto-AFK Kick +# After this timeout in seconds, the user will be kicked from the server. +# Set to -1 for no timeout. +auto-afk-kick: -1 + +# Set this to true, if you want to freeze the player, if he is afk. +# Other players or monsters can't push him out of afk mode then. +# This will also enable temporary god mode for the afk player. +# The player has to use the command /afk to leave the afk mode. +freeze-afk-players: false + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # @@ -241,9 +259,13 @@ respawn-at-home: false # If you enable this and remove default user access to the /sethome command, you can make beds the only way for players to set their home location. bed-sethome: false -#if no home is set send you to spawn when /home is used +# If no home is set send you to spawn when /home is used spawn-if-no-home: false +# If users have essentials.sethome.multiple how many homes can they have +# People with essentials.sethome.multiple.unlimited are not limited by this number +multiple-homes: 5 + ############################################################ # +------------------------------------------------------+ # @@ -280,13 +302,13 @@ economy-log-enabled: false # +------------------------------------------------------+ # ############################################################ -#Show other plugins commands in help +# Show other plugins commands in help non-ess-in-help: true -#Hide plugins which dont give a permission -#You can override a true value here for a single plugin by adding a permission to a user/group. -#The indervidual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless. -#You can use negitive permissions to remove access to just a single plugins help if the following is enabled. +# Hide plugins which dont give a permission +# You can override a true value here for a single plugin by adding a permission to a user/group. +# The indervidual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless. +# You can use negitive permissions to remove access to just a single plugins help if the following is enabled. hide-permissionless-help: true ############################################################ @@ -299,6 +321,7 @@ hide-permissionless-help: true # Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting. # Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!) # Or with essentials.chat.question can override this by prefixing text with a question mark (?) +# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section." chat: radius: 0 @@ -417,10 +440,10 @@ protect: # This only has an effect if "rails" or "signs" is also enabled. block-below: true - # Prevent placing blocks above protected rails, this is to stop a potential griefing + # Prevent placing blocks above protected rails, this is to stop a potential griefing prevent-block-on-rails: false - #Store blocks / signs in memory before writing + # Store blocks / signs in memory before writing memstore: false # Disable various default physics and behaviors @@ -460,11 +483,11 @@ protect: # Set true to disable useing for those people use: true - #Should we tell people they are not allowed to build + # Should we tell people they are not allowed to build warn-on-build-disallow: false - #disable weather options + # Disable weather options weather: storm: false thunder: false diff --git a/Essentials/src/examples/bpermissions.yml b/Essentials/src/examples/bpermissions.yml new file mode 100644 index 000000000..9ba493fae --- /dev/null +++ b/Essentials/src/examples/bpermissions.yml @@ -0,0 +1,120 @@ +default: Default +groups: + Default: + - essentials.spawn + - essentials.rules + - essentials.motd + - essentials.list + - essentials.helpop + - essentials.help + Builder: + - essentials.build + - essentials.afk + - essentials.back + - essentials.back.ondeath + - essentials.balance + - essentials.balance.others + - essentials.balancetop + - essentials.chat.color + - essentials.chat.shout + - essentials.chat.question + - essentials.compass + - essentials.depth + - essentials.home + - essentials.ignore + - essentials.kit + - essentials.kit.tools + - essentials.mail + - essentials.mail.send + - essentials.me + - essentials.msg + - essentials.nick + - essentials.pay + - essentials.ping + - essentials.portal + - essentials.powertool + - essentials.protect + - essentials.sethome + - essentials.signs.use.* + - essentials.signs.create.disposal + - essentials.signs.create.mail + - essentials.signs.create.protection + - essentials.signs.create.trade + - essentials.signs.break.disposal + - essentials.signs.break.mail + - essentials.signs.break.protection + - essentials.signs.break.trade + - essentials.suicide + - essentials.time + - essentials.tpa + - essentials.tpaccept + - essentials.tpahere + - essentials.tpdeny + - essentials.warp + - essentials.warp.list + - essentials.worth + Moderator: + - essentials.build + - essentials.ban + - essentials.ban.notify + - essentials.banip + - essentials.broadcast + - essentials.clearinventory + - essentials.delwarp + - essentials.eco.loan + - essentials.ext + - essentials.getpos + - essentials.helpop.recieve + - essentials.home.others + - essentials.invsee + - essentials.jails + - essentials.jump + - essentials.kick + - essentials.kick.notify + - essentials.kill + - essentials.mute + - essentials.nick.others + - essentials.realname + - essentials.setwarp + - essentials.signs.create.* + - essentials.signs.break.* + - essentials.spawner + - essentials.thunder + - essentials.time + - essentials.time.set + - essentials.protect.alerts + - essentials.protect.admin + - essentials.protect.ownerinfo + - essentials.ptime + - essentials.ptime.others + - essentials.togglejail + - essentials.top + - essentials.tp + - essentials.tphere + - essentials.tppos + - essentials.tptoggle + - essentials.unban + - essentials.unbanip + - essentials.weather + - essentials.whois + - essentials.world + Admin: + # Since we use essentials.* permission here, we can still disable commands like this + # This is only available for essentials permissions + - -essentials.backup + - -essentials.essentials + - -essentials.setspawn + - -essentials.reloadall + - essentials.* + Owner: + - essentials.* +players: + notch: + - Default + snowleo: + - Admin + - Moderator + - Builder + - Default + KHobbits: + - Owner diff --git a/Essentials/src/examples/permissionsbukkit.yml b/Essentials/src/examples/permissionsbukkit.yml new file mode 100644 index 000000000..243752232 --- /dev/null +++ b/Essentials/src/examples/permissionsbukkit.yml @@ -0,0 +1,135 @@ +users: + snowleo: + groups: + - Admin +groups: + Default: + permissions: + permissions.build: true + essentials.build: false + essentials.spawn: true + essentials.rules: true + essentials.motd: true + essentials.list: true + essentials.helpop: true + essentials.help: true + Builder: + permissions: + permissions.build: true + essentials.build: true + essentials.afk: true + essentials.back: true + essentials.back.ondeath: true + essentials.balance: true + essentials.balance.others: true + essentials.balancetop: true + essentials.chat.color: true + essentials.chat.shout: true + essentials.chat.question: true + essentials.compass: true + essentials.depth: true + essentials.home: true + essentials.ignore: true + essentials.kit: true + essentials.kit.tools: true + essentials.mail: true + essentials.mail.send: true + essentials.me: true + essentials.msg: true + essentials.nick: true + essentials.pay: true + essentials.ping: true + essentials.portal: true + essentials.powertool: true + essentials.protect: true + essentials.sethome: true + essentials.signs.use.*: true + essentials.signs.create.disposal: true + essentials.signs.create.mail: true + essentials.signs.create.protection: true + essentials.signs.create.trade: true + essentials.signs.break.disposal: true + essentials.signs.break.mail: true + essentials.signs.break.protection: true + essentials.signs.break.trade: true + essentials.suicide: true + essentials.time: true + essentials.tpa: true + essentials.tpaccept: true + essentials.tpahere: true + essentials.tpdeny: true + essentials.warp: true + essentials.warp.list: true + essentials.worth: true + inheritance: + - Default + Moderator: + permissions: + essentials.ban: true + essentials.ban.notify: true + essentials.banip: true + essentials.broadcast: true + essentials.clearinventory: true + essentials.delwarp: true + essentials.eco.loan: true + essentials.ext: true + essentials.getpos: true + essentials.helpop.recieve: true + essentials.home.others: true + essentials.invsee: true + essentials.jails: true + essentials.jump: true + essentials.kick: true + essentials.kick.notify: true + essentials.kill: true + essentials.mute: true + essentials.nick.others: true + essentials.realname: true + essentials.setwarp: true + essentials.signs.create.*: true + essentials.signs.break.*: true + essentials.spawner: true + essentials.thunder: true + essentials.time: true + essentials.time.set: true + essentials.protect.alerts: true + essentials.protect.admin: true + essentials.protect.ownerinfo: true + essentials.ptime: true + essentials.ptime.others: true + essentials.togglejail: true + essentials.top: true + essentials.tp: true + essentials.tphere: true + essentials.tppos: true + essentials.tptoggle: true + essentials.unban: true + essentials.unbanip: true + essentials.weather: true + essentials.whois: true + essentials.world: true + inheritance: + - Builder + Admin: + permissions: + permissions.*: true + # Since we use essentials.* permission here, we can still disable commands like this + # This is only available for essentials permissions + -essentials.backup: true + -essentials.essentials: true + -essentials.setspawn: true + -essentials.reloadall: true + essentials.*: true + inheritance: + - Moderator + Owner: + permissions: + # Double negation + -essentials.backup: false + -essentials.essentials: false + -essentials.setspawn: false + -essentials.reloadall: false + inheritance: + - Admin +messages: + build: '&cYou do not have permission to build here.' diff --git a/Essentials/src/examples/permissionsex.yml b/Essentials/src/examples/permissionsex.yml new file mode 100644 index 000000000..47407cd62 --- /dev/null +++ b/Essentials/src/examples/permissionsex.yml @@ -0,0 +1,150 @@ +groups: + Default: + default: true + permissions: + - essentials.spawn + - essentials.rules + - essentials.motd + - essentials.list + - essentials.helpop + - essentials.help + - modifyworld.* + prefix: '&e' + options: + build: false + rank: '1000' + Builder: + permissions: + - essentials.afk + - essentials.back + - essentials.back.ondeath + - essentials.balance + - essentials.balance.others + - essentials.balancetop + - essentials.chat.color + - essentials.chat.shout + - essentials.chat.question + - essentials.compass + - essentials.depth + - essentials.home + - essentials.ignore + - essentials.kit + - essentials.kit.tools + - essentials.mail + - essentials.mail.send + - essentials.me + - essentials.msg + - essentials.nick + - essentials.pay + - essentials.ping + - essentials.portal + - essentials.powertool + - essentials.protect + - essentials.sethome + - essentials.signs.use.* + - essentials.signs.create.disposal + - essentials.signs.create.mail + - essentials.signs.create.protection + - essentials.signs.create.trade + - essentials.signs.break.disposal + - essentials.signs.break.mail + - essentials.signs.break.protection + - essentials.signs.break.trade + - essentials.suicide + - essentials.time + - essentials.tpa + - essentials.tpaccept + - essentials.tpahere + - essentials.tpdeny + - essentials.warp + - essentials.warp.list + - essentials.worth + inheritance: + - default + prefix: '&2' + options: + build: true + rank: '500' + Moderator: + permissions: + - essentials.ban + - essentials.ban.notify + - essentials.banip + - essentials.broadcast + - essentials.clearinventory + - essentials.delwarp + - essentials.eco.loan + - essentials.ext + - essentials.getpos + - essentials.helpop.recieve + - essentials.home.others + - essentials.invsee + - essentials.jails + - essentials.jump + - essentials.kick + - essentials.kick.notify + - essentials.kill + - essentials.mute + - essentials.nick.others + - essentials.realname + - essentials.setwarp + - essentials.signs.create.* + - essentials.signs.break.* + - essentials.spawner + - essentials.thunder + - essentials.time + - essentials.time.set + - essentials.protect.alerts + - essentials.protect.admin + - essentials.protect.ownerinfo + - essentials.ptime + - essentials.ptime.others + - essentials.togglejail + - essentials.top + - essentials.tp + - essentials.tphere + - essentials.tppos + - essentials.tptoggle + - essentials.unban + - essentials.unbanip + - essentials.weather + - essentials.whois + - essentials.world + - permissions.user.promote.default + - permissions.user.demote.default + - permissions.manage.membership + inheritance: + - builder + prefix: '&5' + options: + build: true + rank: '200' + Admin: + permissions: + - -essentials.backup + - -essentials.essentials + - -essentials.setspawn + - -essentials.reloadall + - essentials.* + - permissions.manage.users + - permissions.manage.users.permissions + - permissions.manage.users.permissions.timed + inheritance: + - moderator + prefix: '&c' + options: + build: true + rank: '100' + Owner: + permissions: + - '*' + inheritance: + - admin + prefix: '&4' + options: + build: true + rank: '0' +users: + snowleo: + group: + - Builder diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 579042e18..53fe31d6c 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1,4 +1,5 @@ -#Last updated on 7/9/2011 21:37 (gmt +3) for minecraft version 1.7.3 +#version: TeamCity +# If you change this file, it will not be automatically updated after the next release. #item,id,metadata stone,1,0 sstone,1,0 @@ -401,6 +402,58 @@ ntreeleaf,18,0 nlogleaf,18,0 ntrunkleaf,18,0 nwoodleaf,18,0 +pineleaves,18,1 +pineleaf,18,1 +pinetreeleaves,18,1 +pinelogleaves,18,1 +pinetrunkleaves,18,1 +pinewoodleaves,18,1 +ptreeleaves,18,1 +plogleaves,18,1 +ptrunkleaves,18,1 +pwoodleaves,18,1 +pitreeleaves,18,1 +pilogleaves,18,1 +pitrunkleaves,18,1 +piwoodleaves,18,1 +pinetreeleaf,18,1 +pinelogleaf,18,1 +pinetrunkleaf,18,1 +pinewoodleaf,18,1 +ptreeleaf,18,1 +plogleaf,18,1 +ptrunkleaf,18,1 +pwoodleaf,18,1 +pitreeleaf,18,1 +pilogleaf,18,1 +pitrunkleaf,18,1 +piwoodleaf,18,1 +birchleaves,18,2 +birchleaf,18,2 +birchtreeleaves,18,2 +birchlogleaves,18,2 +birchtrunkleaves,18,2 +birchwoodleaves,18,2 +btreeleaves,18,2 +blogleaves,18,2 +btrunkleaves,18,2 +bwoodleaves,18,2 +bitreeleaves,18,2 +bilogleaves,18,2 +bitrunkleaves,18,2 +biwoodleaves,18,2 +birchtreeleaf,18,2 +birchlogleaf,18,2 +birchtrunkleaf,18,2 +birchwoodleaf,18,2 +btreeleaf,18,2 +blogleaf,18,2 +btrunkleaf,18,2 +bwoodleaf,18,2 +bitreeleaf,18,2 +bilogleaf,18,2 +bitrunkleaf,18,2 +biwoodleaf,18,2 sponge,19,0 glass,20,0 lapislazuliore,21,0 @@ -1199,6 +1252,92 @@ tdoor,96,0 doort,96,0 trapd,96,0 dtrap,96,0 +silverstone,97,0 +silverfishstone,97,0 +silverfishs,97,0 +sfstone,97,0 +stonesilverfish,97,0 +fishstone,97,0 +trapstone,97,0 +stonebrick,98,0 +stonebricks,98,0 +stonebrickblock,98,0 +stonebb,98,0 +mossystonebrick,98,1 +mossystonebricks,98,1 +mossystonebrickblock,98,1 +mossystonebb,98,1 +crackedstonebrick,98,1 +crackedstonebricks,98,1 +crackedstonebrickblock,98,1 +crackedstonebb,98,1 +hugeredmushroom,99,0 +bigredmushroom,99,0 +brmushroom,99,0 +giantredmushroom,99,0 +grmushroom,99,0 +hugebrownmushroom,100,0 +bigbrownmushroom,100,0 +bbmushroom,100,0 +giantbrownmushroom,100,0 +gbmushroom,100,0 +ironbars,101,0 +ironbarsb,101,0 +ironbarsblock,101,0 +metalbarsblock,101,0 +metalbarsb,101,0 +metalbars,101,0 +jailbarsblock,101,0 +jailbarsb,101,0 +jailbars,101,0 +glasspane,102,0 +flatglass,102,0 +skinnyglass,102,0 +glassflat,102,0 +melon,103,0 +watermelon,103,0 +greenmelon,103,0 +melongreen,103,0 +melonblock,103,0 +watermelonblock,103,0 +greenmelonblock,103,0 +pumpkinstem,104,0 +stempumpkin,104,0 +pumpstem,104,0 +stempump,104,0 +melonstem,105,0 +watermelonstem,105,0 +greenmelonstem,105,0 +stemmelon,105,0 +stemwatermelon,105,0 +stemgreenmelon,105,0 +vines,106,0 +vine,106,0 +greenvines,106,0 +gardenvines,106,0 +vinesgreen,106,0 +fencegate,107,0 +woodenfence,107,0 +woodenfencegate,107,0 +gatefence,107,0 +woodengate,107,0 +woodgate,107,0 +gardengate,107,0 +brickstairs,108,0 +redbrickstairs,108,0 +bstairs,108,0 +stairsbrick,108,0 +brickstair,108,0 +redstairs,108,0 +stonebrickstairs,109,0 +stonebstairs,109,0 +sbstairs,109,0 +stairsstonebrick,109,0 +cementbrickstairs,109,0 +cementstairs,109,0 +cementbstairs,109,0 +greybrickstairs,109,0 +greybstairs,109,0 ironshovel,256,0 ironspade,256,0 ishovel,256,0 @@ -1745,6 +1884,7 @@ gfish,350,0 roastedfish,350,0 roastfish,350,0 rofish,350,0 +dye,351,0 inksack,351,0 inksac,351,0 isack,351,0 @@ -2014,6 +2154,60 @@ cookie,357,0 map,358,0 chart,358,0 shears,359,0 +shear,359,0 +sheers,359,0 +sheer,359,0 +melonslice,360,0 +mslice,360,0 +slicemelon,360,0 +watermelonslice,360,0 +greenmelonslice,360,0 +melongreenslice,360,0 +pumpkinseeds,361,0 +pseeds,361,0 +seedsp,361,0 +seedspumpkin,361,0 +pumpseeds,361,0 +seedspump,361,0 +melonseeds,362,0 +mseeds,362,0 +watermelonseeds,362,0 +greenmelonseeds,362,0 +gmelonseeds,362,0 +seedsmelon,362,0 +seedswatermelon,362,0 +rawbeef,363,0 +rawsteak,363,0 +uncookedbeef,363,0 +uncookedsteak,363,0 +cowmeat,363,0 +plainbeef,363,0 +cookedbeef,364,0 +grilledbeef,364,0 +cookedsteak,364,0 +grilledsteak,364,0 +cookedcowmeat,364,0 +rawchicken,365,0 +uncookedchicken,365,0 +plainchicken,365,0 +chickenplain,365,0 +chickenuncooked,365,0 +chickenraw,365,0 +cookedchicken,366,0 +grilledchicken,366,0 +toastedchicken,366,0 +rottenflesh,367,0 +zombieflesh,367,0 +rottenmeat,367,0 +zombiemeat,367,0 +badflesh,367,0 +poisenflesh,367,0 +zombieremains,367,0 +enderpearl,368,0 +pearl,368,0 +epearl,368,0 +bluepearl,368,0 +endergem,368,0 goldmusicrecord,2256,0 goldmusicdisk,2256,0 goldmusiccd,2256,0 diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index bdb2d45a8..d90d788eb 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -1,12 +1,14 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here +# by: addedToAccount = \u00a7a{0} has been added to your account. addedToOthersAccount = \u00a7a{0} has been added to {1} account. alertBroke = broke: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} alertPlaced = placed: alertUsed = used: +autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath = \u00a77Use the /back command to return to your death point. backUsageMsg = \u00a77Returning to previous location. backupFinished = Backup finished @@ -47,6 +49,7 @@ day = day days = days defaultBanReason = The Ban Hammer has spoken! deleteFileError = Could not delete file: {0} +deleteHome = \u00a77Home {0} has been removed. deleteJail = \u00a77Jail {0} has been removed. deleteWarp = \u00a77Warp {0} has been removed. deniedAccessCommand = {0} was denied access to command. @@ -62,7 +65,6 @@ disabled = disabled dontMoveMessage = \u00a77Teleportation will commence in {0}. Don''t move. downloadingGeoIp = Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) duplicatedUserdata = Duplicated userdata: {0} and {1} -emptyWorldName = Set Home: World name is null or empty. enableUnlimited = \u00a77Giving unlimited amount of {0} to {1}. enabled = enabled errorCallingCommand = Error calling command /{0} @@ -97,6 +99,7 @@ helpPages = Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: holeInFloor = Hole in floor homeSet = \u00a77Home set. homeSetToBed = \u00a77Your home is now set to this bed. +homes = Homes: {0} hour = hour hours = hours ignorePlayer = You ignore player {0} from now on. @@ -128,8 +131,12 @@ itemSold = \u00a77Sold for \u00a7c {0} \u00a77 ({1} items at {2} each) itemSoldConsole = {0} sold {1} for \u00a77 {2} \u00a77 ({3} items at {4} each) itemSpawn = \u00a77Giving {0} of {1} itemsCsvNotLoaded = Could not load items.csv. +jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0} jailMessage = \u00a7cYou do the crime, you do the time. jailNotExist = That jail does not exist. +jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed. +jailReleasedPlayerNotify = \u00a77You have been released! +jailSentenceExtended = Jail time extend to: {0) jailSet = \u00a77Jail {0} has been set jumpError = That would hurt your computer''s brain. kickDefault = Kicked from server @@ -145,7 +152,7 @@ kits = \u00a77Kits: {0} lightningSmited = \u00a77You have just been smited lightningUse = \u00a77Smiting {0} loadWarpError = Failed to load warp {0} -loadinfo = Loaded {0} build {1} by {2} +loadinfo = Loaded {0} build {1} by: {2} localFormat = Local: <{0}> {1} mailClear = \u00a7cTo mark your mail as read, type /mail clear mailCleared = \u00a77Mail Cleared! @@ -153,12 +160,14 @@ mailSent = \u00a77Mail sent! markMailAsRead = \u00a7cTo mark your mail as read, type /mail clear markedAsAway = \u00a77You are now marked as away. markedAsNotAway = \u00a77You are no longer marked as away. +maxHomes=You cannot set more than {0} homes. mayNotJail = \u00a7cYou may not jail that person me = me minute = minute minutes = minutes missingItems = You do not have {0}x {1}. missingPrefixSuffix = Missing a prefix or suffix for {0} +mobsAvailable = \u00a77Mobs: {0} mobSpawnError = Error while changing mob spawner. mobSpawnLimit = Mob quantity limited to server limit mobSpawnTarget = Target block must be a mob spawner. @@ -176,6 +185,7 @@ mutedUserSpeaks = {0} tried to speak, but is muted. needTpohere = You need access to /tpohere to teleport other players. negativeBalanceError = User is not allowed to have a negative balance. nickChanged = Nickname changed. +nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. nickInUse = \u00a7cThat name is already in use. nickNamesAlpha = \u00a7cNicknames must be alphanumeric. nickNoMore = \u00a77You no longer have a nickname. @@ -194,6 +204,7 @@ noMailSendPerm = \u00a7cYou do not have the \u00a7fessentials.mail.send\u00a7c p noMotd = \u00a7cThere is no message of the day. noNewMail = \u00a77You have no new mail. noPendingRequest = You do not have a pending request. +noPowerTools = You have no power tools assigned. noPlacePermission = \u00a7cYou do not have permission to place a block near that sign. noRules = \u00a7cThere are no rules specified yet. noWarpsDefined = No warps defined @@ -208,6 +219,14 @@ numberRequired = A number goes there, silly. onlyDayNight = /time only supports day/night. onlyPlayers = Only in-game players can use {0}. onlySunStorm = /weather only supports sun/storm. +pTimeCurrent = \u00a7e{0}''s\u00a7f time is {1}. +pTimeCurrentFixed = \u00a7e{0}''s\u00a7f time is fixed to {1}. +pTimeNormal = \u00a7e{0}''s\u00a7f time is normal and matches the server. +pTimeOthersPermission = \u00a7cYou are not authorized to set other players'' time. +pTimePlayers = These players have their own time: +pTimeReset = Player time has been reset for: \u00a7e{0} +pTimeSet = Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} +pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError = Error parsing {0} on line {1} pendingTeleportCancelled = \u00a7cPending teleportation request cancelled. permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled. @@ -224,13 +243,27 @@ playerUnmuted = \u00a77You have been unmuted pong = Pong! possibleWorlds = \u00a77Possible worlds are the numbers 0 through {0}. powerToolAir = Command can''t be attached to air. -powerToolAttach = Command assigned to {0} -powerToolRemove = Command removed from {0} +powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. +powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. +powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. +powerToolListEmpty = {0} has no commands assigned. +powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. +powerToolRemove = Command \u00a7c{0}\u00a7f removed from {1}. +powerToolRemoveAll = All commands removed from {0}. +powerToolsEnabled = All of your power tools have been enabled. +powerToolsDisabled = All of your power tools have been disabled. protectionOwner = \u00a76[EssentialsProtect] Protection owner: {0} questionFormat = \u00a77[Question]\u00a7f {0} reloadAllPlugins = \u00a77Reloaded all plugins. +repair = You have successfully repaired your: \u00a7e{0}. +repairAlreadyFixed = \u00a77This item does not need repairing. +repairInvalidType = \u00a7cThis item cannot be repaired. +repairNone = There were no items that needing repairing. requestAccepted = \u00a77Teleport request accepted. +requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Teleport request denied. +requestDeniedFrom = \u00a77{0} denied your teleport request. requestSent = \u00a77Request sent to {0}\u00a77. returnPlayerToJailError = Error occured when trying to return player to jail. second = second @@ -238,8 +271,13 @@ seconds = seconds seenOffline = Player {0} is offline since {1} seenOnline = Player {0} is online since {1} serverFull = Server is full +setSpawner = Changed spawner type to {0} sheepMalformedColor = Malformed color. shoutFormat = \u00a77[Shout]\u00a7f {0} +signFormatFail = \u00a74[{0}] +signFormatSuccess = \u00a71[{0}] +signFormatTemplate = [{0}] +signProtectInvalidLocation = \u00a74You are not allowed to create sign here. similarWarpExist = A warp with a similar name already exists. slimeMalformedSize = Malformed size. soloMob = That mob likes to be alone @@ -249,10 +287,11 @@ suicideMessage = \u00a77Goodbye Cruel World... suicideSuccess = \u00a77{0} took their own life takenFromAccount = \u00a7c{0} has been taken from your account. takenFromOthersAccount = \u00a7c{0} has been taken from {1} account. +teleportAAll = \u00a77Teleporting request sent to all players... teleportAll = \u00a77Teleporting all players... teleportAtoB = \u00a77{0}\u00a77 teleported you to {1}\u00a77. teleportDisabled = {0} has teleportation disabled. -teleportHereRequest = \u00a7c{0}\u00a7c has requested that you teleport to him/her. +teleportHereRequest = \u00a7c{0}\u00a7c has requested that you teleport to them. teleportNewPlayerError = Failed to teleport new player teleportRequest = \u00a7c{0}\u00a7c has requested to teleport to you. teleportTop = \u00a77Teleporting to top. @@ -267,17 +306,21 @@ thunder = You {0} thunder in your world thunderDuration = You {0} thunder in your world for {1} seconds. timeBeforeHeal = Time before next heal: {0} timeBeforeTeleport = Time before next teleport: {0} +timeFormat = \u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? timeSet = Time set in all worlds. +timeSetPermission = \u00a7cYou are not authorized to set the time. +timeWorldCurrent = The current time in {0} is \u00a73{1} +timeWorldSet = The time was set to {0} in: \u00a7c{1} tradeCompleted = \u00a77Trade completed. -tradeSignEmpty = The trade sign does not have enough supply left. +tradeSignEmpty = The trade sign has nothing available for you. +tradeSignEmptyOwner = There is nothing to collect from this trade sign. treeFailure = \u00a7cTree generation failure. Try again on grass or dirt. treeSpawned = \u00a77Tree spawned. typeTpaccept = \u00a77To teleport, type \u00a7c/tpaccept\u00a77. typeTpdeny = \u00a77To deny this request, type \u00a7c/tpdeny\u00a77. typeWorldName = \u00a77You can also type the name of a specific world. unableToSpawnMob = Unable to spawn mob. -unableToSpawnMob = Unable to spawn mob. unbannedIP = Unbanned IP address. unbannedPlayer = Unbanned player. unignorePlayer = You are not ignoring player {0} anymore. @@ -307,6 +350,7 @@ warpNotExist = That warp does not exist. warpSet = \u00a77Warp {0} set. warpUsePermission = \u00a7cYou do not have Permission to use that warp. warpingTo = \u00a77Warping to {0}. +warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}. weatherStorm = \u00a77You set the weather to storm in your world weatherStormFor = \u00a77You set the weather to storm in your world for {0} seconds weatherSun = \u00a77You set the weather to sun in your world diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index de0c930bc..1f21b1a50 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -1,22 +1,22 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here -#Danish Translation by papand13, papand13@gmail.com -#Danish Translation Version: 1.0 +# by: papand13, papand13@gmail.com addedToAccount = \u00a7a{0} er tilf\u00f8jet til din konto. addedToOthersAccount = \u00a7a{0} er blevet tilf\u00f8jet til {1} konto. alertBroke = \u00f8delagde: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} ved: {3} alertPlaced = placerede: alertUsed = brugte: +autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath = \u00a77Brug /back kommandoen for at retunere til dit d\u00f8ds punkt. backUsageMsg = \u00a77Returnere til tidligere placering. backupFinished = Backup sluttede backupStarted = Backup startede balance = \u00a77Balance: {0} balanceTop = \u00a77 Top {0} saldi -banIpAddress = \u00a77Bannede IP addresse banExempt = \u00a7cDu kan ikke forbyde den p\u00e5g\u00e6ldende spiller. +banIpAddress = \u00a77Bannede IP addresse bannedIpsFileError = Fejl i l\u00e6sning af banned-ips.txt bannedIpsFileNotFound = banned-ips.txt ikke fundet bannedPlayersFileError = Fejl i l\u00e6sning af banned-players.txt @@ -49,6 +49,7 @@ day = dag days = dage defaultBanReason = Ban hammeren har talt! deleteFileError = Kunne ikke slette fil: {0} +deleteHome = \u00a77Home {0} has been removed. deleteJail = \u00a77F\u00e6ngsel {0} er fjernet. deleteWarp = \u00a77Warp {0} er fjernet. deniedAccessCommand = {0} var n\u00e6gtet adgang til kommando. @@ -64,7 +65,6 @@ disabled = deaktiveret dontMoveMessage = \u00a77Teleportering vil begynde om {0}. Bev\u00e6g dig ikke. downloadingGeoIp = Downloader GeoIP database ... det her kan tage et stykke tid (land: 0.6 MB, by: 20MB) duplicatedUserdata = Duplikerede userdata: {0} og {1} -emptyWorldName = S\u00e6t Hjem: World navn er null eller tom. enableUnlimited = \u00a77Giver ubegr\u00e6nset m\u00e6ngde af {0} til {1}. enabled = aktiveret errorCallingCommand = Fejl ved opkald af kommando /{0} @@ -99,6 +99,7 @@ helpPages = Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: holeInFloor = Hul i gulv homeSet = \u00a77Hjem sat. homeSetToBed = \u00a77Dit hjem er nu sat til denne seng. +homes = Homes: {0} hour = time hours = timer ignorePlayer = Du ignorere spiller {0} fra nu af. @@ -130,8 +131,12 @@ itemSold = \u00a77Solgte for \u00a7c {0} \u00a77 ({1} elementer for {2} hver) itemSoldConsole = {0} solgte {1} for \u00a77 {2} \u00a77 ({3} elementer for {4} hver) itemSpawn = \u00a77Giver {0} af {1} itemsCsvNotLoaded = Kunne ikke indl\u00e6se items.csv. +jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0} jailMessage = \u00a7cBryd reglerne, og tag din straf. jailNotExist = Det f\u00e6ngsel eksisterer ikke. +jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed. +jailReleasedPlayerNotify = \u00a77You have been released! +jailSentenceExtended = Jail time extend to: {0) jailSet = \u00a77F\u00e6ngsel {0} er blevet sat jumpError = Det ville skade din computer''s hjerne. kickDefault = Kicket fra serveren @@ -155,6 +160,7 @@ mailSent = \u00a77Post sendt! markMailAsRead = \u00a7cTo marker din post som l\u00e6st, skriv /post ryd markedAsAway = \u00a77Du er nu markeret som v\u00e6k. markedAsNotAway = \u00a77Du er ikke l\u00e6ngere markeret som v\u00e6k. +maxHomes=You cannot set more than {0} homes. mayNotJail = \u00a7cDu m\u00e5 ikke f\u00e6ngsle den person me = mig minute = minut @@ -178,6 +184,7 @@ mutedUserSpeaks = {0} pr\u00f8vede at snakke, men er muted. needTpohere = Du skal have adgang til /tpohere for at teleporter andre spillere. negativeBalanceError = Brugeren er ikke tilladt at have en negativ saldo. nickChanged = Kaldenavn \u00e6ndret. +nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. nickInUse = \u00a7cDet navn er allerede i brug. nickNamesAlpha = \u00a7cKaldenavne skal v\u00e6re alfanumeriske. nickNoMore = \u00a7Du har ikke l\u00e6ngere et kaldenavn. @@ -197,6 +204,7 @@ noMotd = \u00a7cDer er ikke nogen besked for dagen. noNewMail = \u00a77Du har ingen ny post. noPendingRequest = Du har ikke en ventende anmodning. noPlacePermission = \u00a7cYou do not have permission to place a block near that sign. +noPowerTools= You have no power tools assigned. noRules = \u00a7cDer er ingen regler fastsat endnu. noWarpsDefined = Ingen warps defineret none = ingen @@ -210,6 +218,14 @@ numberRequired = Der skal v\u00e6re et nummer, fjolle. onlyDayNight = /time underst\u00f8tter kun day/night. onlyPlayers = Kun in-game spillere kan bruge {0}. onlySunStorm = /weather only supports sun/storm. +pTimeCurrent = \u00a7e{0}''s\u00a7f time is {1}. +pTimeCurrentFixed = \u00a7e{0}''s\u00a7f time is fixed to {1}. +pTimeNormal = \u00a7e{0}''s\u00a7f time is normal and matches the server. +pTimeOthersPermission = \u00a7cYou are not authorized to set other players'' time. +pTimePlayers = These players have their own time: +pTimeReset = Player time has been reset for: \u00a7e{0} +pTimeSet = Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} +pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError = Fejl ved parsing {0} p\u00e5 linje {1} pendingTeleportCancelled = \u00a7cVentende teleportations anmodning aflyst. permissionsError = Mangler Permissions/GroupManager; chat pr\u00e6fikser/suffikser vil v\u00e6re sl\u00e5et fra. @@ -226,13 +242,27 @@ playerUnmuted = \u00a77You have been unmuted pong = Pong! possibleWorlds = \u00a77Mulige verdener er numrene 0 igennem {0}. powerToolAir = Kommando kan ikke blive tildelt luft. -powerToolAttach = Kommando tildelt til {0} -powerToolRemove = Kommando fjernet fra {0} +powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. +powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. +powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. +powerToolListEmpty = {0} has no commands assigned. +powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. +powerToolRemove = Command \u00a7c{0}\u00a7f removed from {1}. +powerToolRemoveAll = All commands removed from {0}. +powerToolsEnabled= All of your power tools have been enabled. +powerToolsDisabled= All of your power tools have been disabled. protectionOwner = \u00a76[EssentialsProtect] Beskyttelses ejer: {0} questionFormat = \u00a77[Sp\u00f8rgsm\u00e5l]\u00a7f {0} reloadAllPlugins = \u00a77Genindl\u00e6ste alle tilf\u00f8jelser. +repair = You have successfully repaired your: \u00a7e{0}. +repairAlreadyFixed = \u00a77This item does not need repairing. +repairInvalidType = \u00a7cThis item cannot be repaired. +repairNone = There were no items that needing repairing. requestAccepted = \u00a77Teleporterings anmodning n\u00e6gtet. +requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Teleporterings anmodning n\u00e6gtet. +requestDeniedFrom = \u00a77{0} denied your teleport request. requestSent = \u00a77Anmodning sendt til {0}\u00a77. returnPlayerToJailError = En fejl opstod ved fors\u00f8g p\u00e5 at returnere spiller til f\u00e6ngsel. second = sekunde @@ -240,8 +270,13 @@ seconds = sekunder seenOffline = Spiller {0} er offline siden {1} seenOnline = Spiller {0} er online siden {1} serverFull = Server er fuld +setSpawner = Changed spawner type to {0} sheepMalformedColor = Misdannet farve. shoutFormat = \u00a77[R\u00e5b]\u00a7f {0} +signFormatFail = \u00a74[{0}] +signFormatSuccess = \u00a71[{0}] +signFormatTemplate = [{0}] +signProtectInvalidLocation = \u00a74You are not allowed to create sign here. similarWarpExist = En warp med lignende tekst eksisterer allerede. slimeMalformedSize = Misdannet st\u00f8rrelse. soloMob = Den mob kan godt lide at v\u00e6re alene @@ -251,6 +286,7 @@ suicideMessage = \u00a77Farvel grusomme verden... suicideSuccess = \u00a77{0} tog sit eget liv takenFromAccount = \u00a7c{0} er taget fra din konto. takenFromOthersAccount = \u00a7c{0} er blevet taget fra {1} konto. +teleportAAll = \u00a77Teleporting request sent to all players... teleportAll = \u00a77Teleportere alle spillere... teleportAtoB = \u00a77{0}\u00a77 teleporterede dig til {1}\u00a77. teleportDisabled = {0} har teleportation deaktiveret. @@ -269,16 +305,20 @@ thunder = Du {0} torden i din verden thunderDuration = Du {0} torden i din verden i {1} sekunder. timeBeforeHeal = Tid inden n\u00e6ste helbredelse: {0} timeBeforeTeleport = Tid f\u00f8r n\u00e6ste teleportering: {0} +timeFormat = \u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern = (?:([0-9]+)\\s*[a\u00e5y][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[wu][a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[ht][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? timeSet = Tid er sat i alle verdener. +timeSetPermission = \u00a7cYou are not authorized to set the time. +timeWorldCurrent = The current time in {0} is \u00a73{1} +timeWorldSet = The time was set to {0} in: \u00a7c{1} tradeCompleted = \u00a77Forhandling fuldf\u00f8rt. tradeSignEmpty = Forhandlings skiltet har ikke nok forsyning tilbage. +tradeSignEmptyOwner = There is nothing to collect from this trade sign. treeFailure = \u00a7cTr\u00e6 genererings fejl. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. treeSpawned = \u00a77Tr\u00e6 fremkaldt. typeTpaccept = \u00a77For at teleportere, skriv \u00a7c/tpaccept\u00a77. typeTpdeny = \u00a77For at n\u00e6gte denne anmodning, skriv \u00a7c/tpdeny\u00a77. typeWorldName = \u00a77Du kan ogs\u00e5 skrive nanvet p\u00e5 en specifik verden. -unableToSpawnMob = Kan ikke spawne mob. unableToSpawnMob = Kunne ikke fremkalde mob. unbannedIP = Tilgav IP addresse, ikke l\u00e6ngere bannet. unbannedPlayer = Tilgav spiller, ikke l\u00e6ngere bannet. @@ -309,6 +349,7 @@ warpNotExist = Den warp eksisterer ikke. warpSet = \u00a77Warp {0} sat. warpUsePermission = \u00a7cDu har ikke tilladelse til at benytte den warp. warpingTo = \u00a77Warper til {0}. +warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}. weatherStorm = \u00a77Du har sat vejret til storm i din verden weatherStormFor = \u00a77Du har sat vejret til storm i din verden i {0} sekunder weatherSun = \u00a77Du har sat vejret til sol @@ -328,3 +369,5 @@ year = \u00e5r years = \u00e5r youAreHealed = \u00a77Du er blevet helbredt. youHaveNewMail = \u00a7cDu har {0} beskeder!\u00a7f Type \u00a77/post l\u00e6s\u00a7f for at se din post. + + diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index be8fb9b4e..e7c0aa8b3 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -1,30 +1,32 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here +# by: addedToAccount = \u00a7a{0} wurden zu deiner Geldb\u00f6rse hinzugef\u00fcgt. -addedToOthersAccount = \u00a7a{0} muss {1} Konto hinzugef\u00fcgt. +addedToOthersAccount = \u00a7a{0} wurden zu {1}s Konto hinzugef\u00fcgt. alertBroke = zerst\u00f6rt: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} bei: {3} -alertPlaced = plaziert: +alertPlaced = platziert: alertUsed = benutzt: +autoAfkKickReason = Du wurdest gekickt, weil du f\u00fcr {0} Minuten inaktiv warst. backAfterDeath = \u00a77Benutze den Befehl /back um zu deinem Todespunkt zur\u00fcck zu kehren. backUsageMsg = \u00a77Kehre zur letzten Position zur\u00fcck. backupFinished = Backup beendet backupStarted = Backup gestartet balance = \u00a77Geldb\u00f6rse: {0} balanceTop = \u00a77 Top {0} Guthaben -banIpAddress = \u00a77IP-Adresse gesperrt. banExempt = \u00a7cDu kannst diesen Spieler nicht sperren. +banIpAddress = \u00a77IP-Adresse gesperrt. bannedIpsFileError = Fehler beim Lesen von banned-ips.txt bannedIpsFileNotFound = banned-ips.txt nicht gefunden bannedPlayersFileError = Fehler beim Lesen von banned-players.txt bannedPlayersFileNotFound = banned-players.txt nicht gefunden -bigTreeFailure = \u00a7cFehler beim Pflanzen von grossem Baum. Versuch es auf Gras oder Dreck. +bigTreeFailure = \u00a7cFehler beim Pflanzen eines grossen Baums. Versuch es auf Gras oder Dreck. bigTreeSuccess = \u00a77Grosser Baum gepflanzt. broadcast = [\u00a7cRundruf\u00a7f]\u00a7a {0} buildAlert = \u00a7cDu hast keine Rechte zum Bauen. bukkitFormatChanged = Bukkit-Versionsformat hat sich ge\u00e4ndert. Version nicht kontrolliert. -burnMsg = \u00a77Du hast {0} in Flammen gesetzt f\u00fcr {1} Sekunden. +burnMsg = \u00a77Du hast {0} f\u00fcr {1} Sekunden in Flammen gesetzt. canTalkAgain = \u00a77Du kannst wieder sprechen. cantFindGeoIpDB = Kann GeoIP-Datenbank nicht finden! cantReadGeoIpDB = Fehler beim Einlesen der GeoIP-Datenbank! @@ -33,7 +35,7 @@ commandFailed = Befehl {0} scheiterte: commandHelpFailedForPlugin=Fehler beim Abrufen der Hilfe f\u00fcr: {0} commandNotLoaded = \u00a7cBefehl {0} ist nicht richtig geladen. compassBearing = \u00a77Peilung: {0} ({1} Grad). -configFileMoveError = Verschieben von config.yml zu einer Sicherheitskopie gescheitert. +configFileMoveError = Verschieben von config.yml in den Sicherheitskopien-Ordner gescheitert. configFileRenameError = Verschieben einer tempor\u00e4ren Datei nach config.yml gescheitert. connectedPlayers = Verbundene Spieler: connectionFailed = Fehler beim Verbindungsaufbau. @@ -45,8 +47,9 @@ creatingEmptyConfig = Erstelle leere Konfiguration: {0} creatingPortal = Erzeuge Portal bei {0},{1},{2}. day = Tag days = Tage -defaultBanReason = Der Bann-Hammer hat gesprochen! +defaultBanReason = Der Bann-Hammer hat gesprochen! deleteFileError = Konnte Datei nicht l\u00f6schen: {0} +deleteHome = \u00a77Zuhause {0} wurde gel\u00f6scht. deleteJail = \u00a77Gef\u00e4ngnis {0} wurde gel\u00f6scht. deleteWarp = \u00a77Warp-Punkt {0} wurde gel\u00f6scht. deniedAccessCommand = {0} hat keinen Zugriff auf diesen Befehl. @@ -59,10 +62,9 @@ depthBelowSea = \u00a77Du bist {0} Bl\u00f6cke unter Meeresh\u00f6he. destinationNotSet = Ziel nicht gesetzt disableUnlimited = \u00a77Deaktiviere unendliches Platzieren von {0} f\u00fcr {1}. disabled = deaktiviert -dontMoveMessage = \u00a77Teleportierung startet in {0}. Beweg dich nicht. +dontMoveMessage = \u00a77Teleportvorgang startet in {0}. Beweg dich nicht. downloadingGeoIp = Lade GeoIP-Datenbank ... dies kann etwas dauern (country: 0.6 MB, city: 20MB) -duplicatedUserdata = Doppelte Datei in userdata: {0} and {1} -emptyWorldName = /sethome: Weltname ist null oder leer. +duplicatedUserdata = Doppelte Datei in userdata: {0} und {1} enableUnlimited = \u00a77Gebe {1} unendliche Mengen von {0}. enabled = aktiviert errorCallingCommand = Fehler beim Aufrufen des Befehls /{0} @@ -97,6 +99,7 @@ helpPages = Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f: holeInFloor = Loch im Boden homeSet = \u00a77Zuhause gesetzt. homeSetToBed = \u00a77Dein Zuhause ist nun an diesem Bett. +homes = Homes: {0} hour = Stunde hours = Stunden ignorePlayer = Du ignorierst ab jetzt Spieler {0}. @@ -128,8 +131,12 @@ itemSold = \u00a77Verkauft f\u00fcr \u00a7c{0}\u00a77 ({1} Einheiten je {2}) itemSoldConsole = {0} verkauft {1} f\u00fcr \u00a77{2}\u00a77 ({3} Einheiten je {4}) itemSpawn = \u00a77Gebe {0}x {1} itemsCsvNotLoaded = Konnte items.csv nicht laden. +jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0} jailMessage = \u00a7cYou do the crime, you do the time. jailNotExist = Dieses Gef\u00e4ngnis existiert nicht. +jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed. +jailReleasedPlayerNotify = \u00a77You have been released! +jailSentenceExtended = Jail time extend to: {0) jailSet = \u00a77Gef\u00e4ngnis {0} wurde erstellt. jumpError = Das w\u00fcrde deinen Computer \u00fcberlasten. kickDefault = Vom Server geworfen @@ -153,6 +160,7 @@ mailSent = \u00a77Nachricht gesendet! markMailAsRead = \u00a7cUm deine Nachrichten zu l\u00f6schen, schreibe /mail clear markedAsAway = \u00a77Du wirst als abwesend angezeigt. markedAsNotAway = \u00a77Du wirst nicht mehr als abwesend angezeigt. +maxHomes = Du kannst nicht mehr als {0} Zuhause setzen. mayNotJail = \u00a7cDu kannst diese Person nicht einsperren. me = mir minute = Minute @@ -172,10 +180,11 @@ msgFormat = \u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} muteExempt = \u00a7cDu darfst diesen Spieler nicht stumm machen. mutedPlayer = Player {0} ist nun stumm. mutedPlayerFor = Player {0} ist nun stumm f\u00fcr {1}. -mutedUserSpeaks = {0} versuchte zu sprechen, aber ist stumm geschalt. +mutedUserSpeaks = {0} versuchte zu sprechen, aber ist stumm geschaltet. needTpohere = Du brauchst Zugriff auf /tpohere um andere Spieler teleportieren zu k\u00f6nnen. negativeBalanceError = Spieler darf keine Schulden machen. nickChanged = Nickname ge\u00e4ndert. +nickDisplayName=\u00a77Du musst \u00a7fchange-displayname\u00a7c in der Essentials-Config aktivieren. nickInUse = \u00a7cDieser Name wird bereits verwendet. nickNamesAlpha = \u00a7cNicknamen d\u00fcrfen nur alphanumerische Zeichen enthalten. nickNoMore = \u00a7Du hast keinen Nicknamen mehr. @@ -195,27 +204,36 @@ noMotd = \u00a7cEs existiert keine Willkommensnachricht. noNewMail = \u00a77Du hast keine Nachrichten. noPendingRequest = Du hast keine Teleportierungsanfragen. noPlacePermission = \u00a7cDu hast keine Rechte, einen Block in der N\u00e4he des Schildes zu platzieren. +noPowerTools=You have no power tools assigned. noRules = \u00a7cEs wurden keine Regeln definiert. noWarpsDefined = Keine Warp-Punkte erstellt. none = keine notAllowedToQuestion = \u00a7cDu bist nicht berechtigt zu fragen. notAllowedToShout = \u00a7cDu bist nicht berechtigt zu schreien. notEnoughMoney = Du hast nicht genug Geld. -notRecommendedBukkit = Die verwendete Bukkit-Version ist nicht empfohlen f\u00fcr Essentials. +notRecommendedBukkit = Die verwendete Bukkit-Version ist nicht f\u00fcr Essentials empfohlen. notSupportedYet = Noch nicht verf\u00fcgbar. now = jetzt numberRequired = Ein Zahl wird ben\u00f6tigt. -onlyDayNight = /time unterst\u00fctzt nur day/night. +onlyDayNight = /time unterst\u00fctzt nur day und night. onlyPlayers = Nur Spieler k\u00f6nnen {0} benutzen. -onlySunStorm = /weather unterst\u00fctzt nur sun/storm. +onlySunStorm = /weather unterst\u00fctzt nur sun und storm. +pTimeCurrent = \u00a7e{0}''s\u00a7f time is {1}. +pTimeCurrentFixed = \u00a7e{0}''s\u00a7f Zeit wurde zu {1} gesetzt. +pTimeNormal = \u00a7e{0}''s\u00a7f Zeit ist normal und entspricht der Serverzeit. +pTimeOthersPermission = \u00a7cDu hast keine Berechtigung die Zeit von anderen Spielern zu \u00e4ndern. +pTimePlayers = Diese Spieler haben ihre eigene Zeit: +pTimeReset = Zeit wurde zur\u00fcgesetzt f\u00fcr: \u00a7e{0} +pTimeSet = Zeit wurde f\u00fcr \u00a7e{1}\u00a7f zu \u00a73{0}\u00a7f gesetzt. +pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError = Fehler beim Parsen von {0} in Zeile {1} pendingTeleportCancelled = \u00a7cLaufende Teleportierung abgebrochen. permissionsError = Permissions/GroupManager fehlt; Chat-Prefixe/-Suffixe sind ausgeschaltet. -playerBanned = \u00a7cPlayer {0} banned {1} for {2} +playerBanned = \u00a7cSpieler {0} gesperrt: {1} playerInJail = \u00a7cSpieler ist bereits in Gef\u00e4ngnis {0}. playerJailed = \u00a77Spieler {0} eingesperrt. playerJailedFor = \u00a77Spieler {0} eingesperrt f\u00fcr {1}. -playerKicked = \u00a7cPlayer {0} kicked {1} for {2} +playerKicked = \u00a7cSpieler {0} rausgeworfen: {1} playerMuted = \u00a77Du bist jetzt stumm. playerMutedFor = \u00a77Du bist jetzt stumm f\u00fcr {0}. playerNeverOnServer = \u00a7cSpieler {0} war niemals auf diesem Server. @@ -224,13 +242,26 @@ playerUnmuted = \u00a77Du bist nicht mehr stumm. pong = Pong! possibleWorlds = \u00a77M\u00f6gliche Welten sind nummeriet von 0 bis {0}. powerToolAir = Befehl kann nicht mit Luft verbunden werden. -powerToolAttach = Befehl verbunden mit {0} -powerToolRemove = Befehl entfernt von {0} +powerToolAlreadySet = Befehl \u00a7c{0}\u00a7f ist bereits zu {1} hinzugef\u00fcgt. +powerToolAttach = Befehl \u00a7c{0}\u00a7f erfolgreich zu {1} hinzugef\u00fcgt. +powerToolList = {1} hat die folgenden Befehle: \u00a7c{0}\u00a7f. +powerToolListEmpty = {0} hat keinen Befehl. +powerToolNoSuchCommandAssigned = Befehl \u00a7c{0}\u00a7f wurde nicht zu {1} hinzugef\u00fcgt. +powerToolRemove = Befehl \u00a7c{0}\u00a7f erfolgreich von {1} entfernt. +powerToolRemoveAll = Alle Befehle von {0} entfernt. +powerToolsEnabled=All of your power tools have been enabled. +powerToolsDisabled=All of your power tools have been disabled. protectionOwner = \u00a76[EssentialsProtect] Besitzer dieses Blocks: {0} questionFormat = \u00a77[Frage]\u00a7f {0} reloadAllPlugins = \u00a77Alle plugins neu geladen. +repair = Du hast erfolgreich deine {0} repariert. +repairAlreadyFixed = \u00a77Dieser Gegenstand ben\u00f6tigt keine Reparatur. +repairInvalidType = \u00a7cDieser Gegenstand kann nicht repariert werden. +repairNone = Es sind keine Gegenst\u00e4nde vorhanden, die repariert werden k\u00f6nnen. requestAccepted = \u00a77Teleportierungsanfrage akzeptiert. +requestAcceptedFrom = \u00a77{0} hat deine Teleportierungsanfrage angenommen. requestDenied = \u00a77Teleportierungsanfrage verweigert. +requestDeniedFrom = \u00a77{0} hat deine Teleportierungsanfrage abgelehnt. requestSent = \u00a77Anfrage gesendet an {0}\u00a77. returnPlayerToJailError = Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren. second = Sekunde @@ -238,8 +269,13 @@ seconds = Sekunden seenOffline = Spieler {0} ist offline seit {1} seenOnline = Spieler {0} ist online seit {1} serverFull = Server ist voll +setSpawner = \u00c4ndere Mob-Spawner zu {0} sheepMalformedColor = Ung\u00fcltige Farbe. shoutFormat = \u00a77[Schrei]\u00a7f {0} +signFormatFail = \u00a74[{0}] +signFormatSuccess = \u00a71[{0}] +signFormatTemplate = [{0}] +signProtectInvalidLocation = \u00a74You are not allowed to create sign here. similarWarpExist = Ein Warp-Punkt mit einem \u00e4hnlichen Namen existiert bereits. slimeMalformedSize = Ung\u00fcltige Gr\u00f6sse. soloMob = Das Monster m\u00f6chte allein sein. @@ -249,6 +285,7 @@ suicideMessage = \u00a77Lebewohl grausame Welt... suicideSuccess = \u00a77{0} hat sich das Leben genommen. takenFromAccount = \u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen. takenFromOthersAccount = \u00a7c{0} wurde von {1} wurde Rechnung getragen. +teleportAAll = \u00a77Teleportierungsanfrage zu allen Spielern gesendet... teleportAll = \u00a77Teleportiere alle Spieler... teleportAtoB = \u00a77{0}\u00a77 teleportiert dich zu {1}\u00a77. teleportDisabled = {0} verweigert die Teleportierung. @@ -256,28 +293,32 @@ teleportHereRequest = \u00a7c{0}\u00a7c fragt, ob du dich zu ihm teleportierst. teleportNewPlayerError = Fehler beim Teleportieren eines neuen Spielers teleportRequest = \u00a7c{0}\u00a7c fragt, ob er sich zu dir teleportieren darf. teleportTop = \u00a77Teleportiere nach oben. -teleportationCommencing = \u00a77Teleportierung started... +teleportationCommencing = \u00a77Teleportierung gestartet... teleportationDisabled = \u00a77Teleportierung deaktiviert. teleportationEnabled = \u00a77Teleportierung aktiviert. teleporting = \u00a77Teleportiere... teleportingPortal = \u00a77Teleportiere durch Portal. tempBanned = Zeitlich gesperrt vom Server f\u00fcr {0} tempbanExempt = \u00a77Du kannst diesen Spieler nicht zeitlich sperren. -thunder = Du hast Donner in deiner Welt {0}. -thunderDuration = Du hast Donner in deiner Welt {0} f\u00fcr {1} Sekunden. +thunder = Es donnert nun in deiner Welt {0}. +thunderDuration = Es donnert nun f\u00fcr {1} Sekunden in deiner Welt {0}. timeBeforeHeal = Zeit bis zur n\u00e4chsten Heilung: {0} timeBeforeTeleport = Zeit bis zum n\u00e4chsten Teleport: {0} +timeFormat = \u00a73{0}\u00a7f oder \u00a73{1}\u00a7f oder \u00a73{2}\u00a7f timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[dt][a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:h|st)[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? -timeSet = Zeit gesetzt in allen Welten. +timeSet = Zeit in allen Welten gesetzt. +timeSetPermission = \u00a7cDu hast keine Berechtigung die Zeit zu \u00e4ndern. +timeWorldCurrent = Die momentane Zeit in {0} ist \u00a73{1} +timeWorldSet = Die Zeit in \u00a7c{1}\u00a7f wurde zu {0} gesetzt. tradeCompleted = \u00a77Handel abgeschlossen. tradeSignEmpty = Der Bestand des Trade-Schild ist aufgebraucht. +tradeSignEmptyOwner = Es gibt nichts mehr zu Sammeln von diesem Trade-Schild. treeFailure = \u00a7cBaumpflanzung gescheitert. Versuche es auf Gras oder Dreck. treeSpawned = \u00a77Baum gepflanzt. typeTpaccept = \u00a77Um zu teleportieren, schreibe \u00a7c/tpaccept\u00a77. typeTpdeny = \u00a77Um diese Anfrage abzulehnen, schreibe \u00a7c/tpdeny\u00a77. typeWorldName = \u00a77Du kannst auch den Namen der Welt eingeben. -unableToSpawnMob = Erzeugen von Monster gescheitert -unableToSpawnMob = Fehler beim Erzeugen von Monster. +unableToSpawnMob = Fehler beim Erzeugen eines Monster. unbannedIP = Verbannung von IP-Adresse r\u00fcckg\u00e4ngig gemacht. unbannedPlayer = Verbannung von Spieler r\u00fcckg\u00e4ngig gemacht. unignorePlayer = Du ignorierst Spieler {0} nicht mehr. @@ -305,12 +346,13 @@ warpDeleteError = Fehler beim L\u00f6schen der Warp-Datei. warpListPermission = \u00a7cDu hast keine Berechtigung, die Warp-Punkte anzuzeigen. warpNotExist = Warp-Punkt existiert nicht. warpSet = \u00a77Warp-Punkt {0} wurde erstellt. -warpUsePermission = \u00a7cDu hast keinen Zugriff auf diesen Warp-Punkt. +warpUsePermission = \u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt. warpingTo = \u00a77Teleportiere zu Warp-Punkt {0}. -weatherStorm = \u00a77Du hast das Wetter zu Sturm in deiner Welt ge\u00e4ndert. -weatherStormFor = \u00a77Du hast das Wetter zu Sturm f\u00fcr {0} Sekunden in deiner Welt ge\u00e4ndert. -weatherSun = \u00a77Du hast das Wetter zu Sonne in deiner Welt ge\u00e4ndert. -weatherSunFor = \u00a77Du hast das Wetter zu Sonne f\u00fcr {0} Sekunden in deiner Welt ge\u00e4ndert. +warpsCount = \u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}. +weatherStorm = \u00a77In deiner Welt st\u00fcrmt es nun. +weatherStormFor = \u00a77In deiner Welt st\u00fcrmt es nun f\u00fcr {0} Sekunden. +weatherSun = \u00a77In deiner Welt scheint nun die Sonne. +weatherSunFor = \u00a77In deiner Welt scheint nun f\u00fcr {0} Sekunden die Sonne. whoisGeoLocation = \u00a79 - Herkunft: {0} whoisHealth = \u00a79 - Gesundheit: {0}/20 whoisIPAddress = \u00a79 - IP-Adresse: {0} @@ -326,4 +368,6 @@ year = Jahr years = Jahre youAreHealed = \u00a77Du wurdest geheilt. youHaveNewMail = \u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen. -invalidCharge = \u00a7cUng\u00fcltige Verf\u00fcgung. +powerToolClearAll= All powertool commands have been cleared. + + diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 1da3bc4a5..a9dc9c9a8 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -1,20 +1,22 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here +# by: addedToAccount = \u00a7a{0} has been added to your account. addedToOthersAccount = \u00a7a{0} has been added to {1} account. alertBroke = broke: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} alertPlaced = placed: alertUsed = used: +autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath = \u00a77Use the /back command to return to your death point. backUsageMsg = \u00a77Returning to previous location. backupFinished = Backup finished backupStarted = Backup started balance = \u00a77Balance: {0} balanceTop = \u00a77 Top {0} balances -banIpAddress = \u00a77Banned IP address banExempt = \u00a7cYou can not ban that player. +banIpAddress = \u00a77Banned IP address bannedIpsFileError = Error reading banned-ips.txt bannedIpsFileNotFound = banned-ips.txt not found bannedPlayersFileError = Error reading banned-players.txt @@ -47,6 +49,7 @@ day = day days = days defaultBanReason = The Ban Hammer has spoken! deleteFileError = Could not delete file: {0} +deleteHome = \u00a77Home {0} has been removed. deleteJail = \u00a77Jail {0} has been removed. deleteWarp = \u00a77Warp {0} has been removed. deniedAccessCommand = {0} was denied access to command. @@ -62,7 +65,6 @@ disabled = disabled dontMoveMessage = \u00a77Teleportation will commence in {0}. Don''t move. downloadingGeoIp = Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) duplicatedUserdata = Duplicated userdata: {0} and {1} -emptyWorldName = Set Home: World name is null or empty. enableUnlimited = \u00a77Giving unlimited amount of {0} to {1}. enabled = enabled errorCallingCommand = Error calling command /{0} @@ -97,6 +99,7 @@ helpPages = Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: holeInFloor = Hole in floor homeSet = \u00a77Home set. homeSetToBed = \u00a77Your home is now set to this bed. +homes = Homes: {0} hour = hour hours = hours ignorePlayer = You ignore player {0} from now on. @@ -128,8 +131,12 @@ itemSold = \u00a77Sold for \u00a7c {0} \u00a77 ({1} items at {2} each) itemSoldConsole = {0} sold {1} for \u00a77 {2} \u00a77 ({3} items at {4} each) itemSpawn = \u00a77Giving {0} of {1} itemsCsvNotLoaded = Could not load items.csv. +jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0} jailMessage = \u00a7cYou do the crime, you do the time. jailNotExist = That jail does not exist. +jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed. +jailReleasedPlayerNotify = \u00a77You have been released! +jailSentenceExtended = Jail time extend to: {0) jailSet = \u00a77Jail {0} has been set jumpError = That would hurt your computer''s brain. kickDefault = Kicked from server @@ -145,7 +152,7 @@ kits = \u00a77Kits: {0} lightningSmited = \u00a77You have just been smited lightningUse = \u00a77Smiting {0} loadWarpError = Failed to load warp {0} -loadinfo = Loaded {0} build {1} by {2} +loadinfo = Loaded {0} build {1} by: {2} localFormat = Local: <{0}> {1} mailClear = \u00a7cTo mark your mail as read, type /mail clear mailCleared = \u00a77Mail Cleared! @@ -153,6 +160,7 @@ mailSent = \u00a77Mail sent! markMailAsRead = \u00a7cTo mark your mail as read, type /mail clear markedAsAway = \u00a77You are now marked as away. markedAsNotAway = \u00a77You are no longer marked as away. +maxHomes=You cannot set more than {0} homes. mayNotJail = \u00a7cYou may not jail that person me = me minute = minute @@ -176,6 +184,7 @@ mutedUserSpeaks = {0} tried to speak, but is muted. needTpohere = You need access to /tpohere to teleport other players. negativeBalanceError = User is not allowed to have a negative balance. nickChanged = Nickname changed. +nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. nickInUse = \u00a7cThat name is already in use. nickNamesAlpha = \u00a7cNicknames must be alphanumeric. nickNoMore = \u00a77You no longer have a nickname. @@ -195,6 +204,7 @@ noMotd = \u00a7cThere is no message of the day. noNewMail = \u00a77You have no new mail. noPendingRequest = You do not have a pending request. noPlacePermission = \u00a7cYou do not have permission to place a block near that sign. +noPowerTools=You have no power tools assigned. noRules = \u00a7cThere are no rules specified yet. noWarpsDefined = No warps defined none = none @@ -208,6 +218,14 @@ numberRequired = A number goes there, silly. onlyDayNight = /time only supports day/night. onlyPlayers = Only in-game players can use {0}. onlySunStorm = /weather only supports sun/storm. +pTimeCurrent = \u00a7e{0}''s\u00a7f time is {1}. +pTimeCurrentFixed = \u00a7e{0}''s\u00a7f time is fixed to {1}. +pTimeNormal = \u00a7e{0}''s\u00a7f time is normal and matches the server. +pTimeOthersPermission = \u00a7cYou are not authorized to set other players'' time. +pTimePlayers = These players have their own time: +pTimeReset = Player time has been reset for: \u00a7e{0} +pTimeSet = Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} +pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError = Error parsing {0} on line {1} pendingTeleportCancelled = \u00a7cPending teleportation request cancelled. permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled. @@ -224,13 +242,27 @@ playerUnmuted = \u00a77You have been unmuted pong = Pong! possibleWorlds = \u00a77Possible worlds are the numbers 0 through {0}. powerToolAir = Command can''t be attached to air. -powerToolAttach = Command assigned to {0} -powerToolRemove = Command removed from {0} +powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. +powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. +powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. +powerToolListEmpty = {0} has no commands assigned. +powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. +powerToolRemove = Command \u00a7c{0}\u00a7f removed from {1}. +powerToolRemoveAll = All commands removed from {0}. +powerToolsEnabled=All of your power tools have been enabled. +powerToolsDisabled=All of your power tools have been enabled. protectionOwner = \u00a76[EssentialsProtect] Protection owner: {0} questionFormat = \u00a77[Question]\u00a7f {0} reloadAllPlugins = \u00a77Reloaded all plugins. +repair = You have successfully repaired your: \u00a7e{0}. +repairAlreadyFixed = \u00a77This item does not need repairing. +repairInvalidType = \u00a7cThis item cannot be repaired. +repairNone = There were no items that needing repairing. requestAccepted = \u00a77Teleport request accepted. +requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Teleport request denied. +requestDeniedFrom = \u00a77{0} denied your teleport request requestSent = \u00a77Request sent to {0}\u00a77. returnPlayerToJailError = Error occured when trying to return player to jail. second = second @@ -238,8 +270,13 @@ seconds = seconds seenOffline = Player {0} is offline since {1} seenOnline = Player {0} is online since {1} serverFull = Server is full +setSpawner = Changed spawner type to {0} sheepMalformedColor = Malformed color. shoutFormat = \u00a77[Shout]\u00a7f {0} +signFormatFail = \u00a74[{0}] +signFormatSuccess = \u00a71[{0}] +signFormatTemplate = [{0}] +signProtectInvalidLocation = \u00a74You are not allowed to create sign here. similarWarpExist = A warp with a similar name already exists. slimeMalformedSize = Malformed size. soloMob = That mob likes to be alone @@ -249,10 +286,11 @@ suicideMessage = \u00a77Goodbye Cruel World... suicideSuccess = \u00a77{0} took their own life takenFromAccount = \u00a7c{0} has been taken from your account. takenFromOthersAccount = \u00a7c{0} has been taken from {1} account. +teleportAAll = \u00a77Teleporting request sent to all players... teleportAll = \u00a77Teleporting all players... teleportAtoB = \u00a77{0}\u00a77 teleported you to {1}\u00a77. teleportDisabled = {0} has teleportation disabled. -teleportHereRequest = \u00a7c{0}\u00a7c has requested that you teleport to him/her. +teleportHereRequest = \u00a7c{0}\u00a7c has requested that you teleport to them. teleportNewPlayerError = Failed to teleport new player teleportRequest = \u00a7c{0}\u00a7c has requested to teleport to you. teleportTop = \u00a77Teleporting to top. @@ -267,17 +305,21 @@ thunder = You {0} thunder in your world thunderDuration = You {0} thunder in your world for {1} seconds. timeBeforeHeal = Time before next heal: {0} timeBeforeTeleport = Time before next teleport: {0} +timeFormat = \u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern = (?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? timeSet = Time set in all worlds. +timeSetPermission = \u00a7cYou are not authorized to set the time. +timeWorldCurrent = The current time in {0} is \u00a73{1} +timeWorldSet = The time was set to {0} in: \u00a7c{1} tradeCompleted = \u00a77Trade completed. tradeSignEmpty = The trade sign does not have enough supply left. +tradeSignEmptyOwner = There is nothing to collect from this trade sign. treeFailure = \u00a7cTree generation failure. Try again on grass or dirt. treeSpawned = \u00a77Tree spawned. typeTpaccept = \u00a77To teleport, type \u00a7c/tpaccept\u00a77. typeTpdeny = \u00a77To deny this request, type \u00a7c/tpdeny\u00a77. typeWorldName = \u00a77You can also type the name of a specific world. unableToSpawnMob = Unable to spawn mob. -unableToSpawnMob = Unable to spawn mob. unbannedIP = Unbanned IP address. unbannedPlayer = Unbanned player. unignorePlayer = You are not ignoring player {0} anymore. @@ -307,6 +349,7 @@ warpNotExist = That warp does not exist. warpSet = \u00a77Warp {0} set. warpUsePermission = \u00a7cYou do not have Permission to use that warp. warpingTo = \u00a77Warping to {0}. +warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}. weatherStorm = \u00a77You set the weather to storm in your world weatherStormFor = \u00a77You set the weather to storm in your world for {0} seconds weatherSun = \u00a77You set the weather to sun in your world @@ -326,3 +369,5 @@ year = year years = years youAreHealed = \u00a77You have been healed. youHaveNewMail = \u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. + + diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index a4c007a1a..987a41eb0 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -1,20 +1,22 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here +# by: addedToAccount = \u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 a votre compte. addedToOthersAccount = \u00a7a{0} a \u00e9t\u00e9 ajout\u00e9 \u00e0 {1} compte. alertBroke = a cass\u00e9: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} \u00e0:{3} alertPlaced = a plac\u00e9: alertUsed = a utilis\u00e9: +autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath = \u00a77Utilisez la commande /back pour retourner \u00e0 l''endroit ou vous \u00eates mort. backUsageMsg = \u00a77Retour a votre emplacement pr\u00e9c\u00e8dent. backupFinished = Backup termin\u00e9 backupStarted = D\u00e9but du backup balance = \u00a77Solde: {0} balanceTop = \u00a77 Top {0} soldes -banIpAddress = \u00a77Adresse IP banni banExempt = \u00a77Vous ne pouvez pas interdire ce joueur. +banIpAddress = \u00a77Adresse IP banni bannedIpsFileError = Erreur de lecture de banned-ips.txt bannedIpsFileNotFound = Fichier banned-ips.txt introuvable bannedPlayersFileError = Erreur lors de la lecture de banned-players.txt @@ -47,6 +49,7 @@ day = jour days = jours defaultBanReason = Le marteau du ban a frapp\u00e9! deleteFileError = Le fichier n''a pas pu \u00eatre supprim\u00e9: {0} +deleteHome = \u00a77Home {0} has been removed. deleteJail = \u00a77La prison {0} a \u00e9t\u00e9 supprim\u00e9e. deleteWarp = \u00a77Warp {0} supprim\u00e9. deniedAccessCommand = L''acc\u00e8s \u00e0 la commande a \u00e9t\u00e9 refus\u00e9 pour {0}. @@ -62,7 +65,6 @@ disabled = d\u00e9sactiv\u00e9 dontMoveMessage = \u00a77La t\u00e9l\u00e9portation commence dans {0}. Ne bougez pas. downloadingGeoIp = T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... cela peut prendre un moment (campagne : 0.6 Mo, ville : 20Mo) duplicatedUserdata = Donn\u00e9e utilisateur dupliqu\u00e9e: {0} et {1} -emptyWorldName = Set Home: Le nom du monte est nul ou vide. enableUnlimited = \u00a77Donner un nombre illimit\u00e9 de {0} \u00e0 {1}. enabled = activ\u00e9 errorCallingCommand = Erreur en appelant la commande /{0} @@ -97,6 +99,7 @@ helpPages = Page \u00a7c{0}\u00a7f sur \u00a7c{1}\u00a7f. holeInFloor = Trou dans le Sol. homeSet = \u00a77Home d\u00e9fini. homeSetToBed = \u00a77Votre home est d\u00e9sormais d\u00e9fini sur ce lit. +homes = Homes: {0} hour = heure hours = heures ignorePlayer = Vous ignorez d\u00e9sormais {0}. @@ -128,8 +131,12 @@ itemSold = \u00a77Vendu pour \u00a7c {0} \u00a77 ({1} objet(s) \u00e0 {2} chacun itemSoldConsole = {0} vendu {1} pour \u00a77 {2} \u00a77 ({3} objet(s) \u00e0 {4} chacun) itemSpawn = \u00a77Donne {0} de {1} itemsCsvNotLoaded = N''a pas pu charger items.csv. +jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0} jailMessage = \u00a7cVous avez commis un crime, vous en payez le prix. jailNotExist = Cette prison n''existe pas. +jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed. +jailReleasedPlayerNotify = \u00a77You have been released! +jailSentenceExtended = Jail time extend to: {0) jailSet = \u00a77La prison {0} a \u00e9t\u00e9 cr\u00e9\u00e9. jumpError = \u00c7a aurait pu faire mal au cerveau de votre ordinateur. kickDefault = Kick\u00e9 du serveur @@ -153,6 +160,7 @@ mailSent = \u00a77Courrier envoy\u00e9 ! markMailAsRead = \u00a7cPour marquer votre courrier en tant que lu, entrez /mail clear markedAsAway = \u00a77Vous \u00eates d\u00e9sormais AFK. markedAsNotAway = \u00a77Vous n''\u00eates d\u00e9sormais plus AFK. +maxHomes=You cannot set more than {0} homes. mayNotJail = \u00a7cVous ne pouvez pas emprisonner cette personne. me = moi minute = minute @@ -176,6 +184,7 @@ mutedUserSpeaks = {0} a essay\u00e9 de parler mais est muet. needTpohere = Vous avez besoin de l''acc\u00e8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d''autres joueurs. negativeBalanceError = L''utilisateur n''est pas autoris\u00e9 \u00e0 avoir un solde n\u00e9gatif. nickChanged = Pseudo modifi\u00e9. +nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. nickInUse = \u00a7cCe nom est d\u00e9j\u00e0 utilis\u00e9. nickNamesAlpha = \u00a7cLes pseudos doivent \u00eatre alphanum\u00e9riques. nickNoMore = \u00a7Vous n''avez plus de surnom. @@ -195,6 +204,7 @@ noMotd = \u00a7cIl n''y a pas de message su jour. noNewMail = \u00a77Vous n''avez pas de courrier. noPendingRequest = Vous n''avez pas de requ\u00eate non lue. noPlacePermission = \u00a7cYou do not have permission to place a block near that sign. +noPowerTools=You have no power tools assigned. noRules = \u00a7cIl n''y a pas encore de r\u00e8gles d\u00e9finies. noWarpsDefined = Aucun warps d\u00e9finis. none = aucun @@ -208,6 +218,14 @@ numberRequired = On a besoin d''un nombre ici, idiot. onlyDayNight = /time ne supporte que (jour) day/night (nuit). onlyPlayers = Seulement les joueurs en jeu peuvent utiliser {0}. onlySunStorm = /weather only supports sun/storm. +pTimeCurrent = \u00a7e{0}''s\u00a7f time is {1}. +pTimeCurrentFixed = \u00a7e{0}''s\u00a7f time is fixed to {1}. +pTimeNormal = \u00a7e{0}''s\u00a7f time is normal and matches the server. +pTimeOthersPermission = \u00a7cYou are not authorized to set other players'' time. +pTimePlayers = These players have their own time: +pTimeReset = Player time has been reset for: \u00a7e{0} +pTimeSet = Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} +pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError = Erreur de conversion {0} \u00e0 la ligne {1} pendingTeleportCancelled = \u00a7cRequete de t\u00e9l\u00e9portation annul\u00e9e. permissionsError = Permissions/GroupManager manquant, les pr\u00e9fixes et suffixes ne seront pas affich\u00e9s. @@ -224,13 +242,27 @@ playerUnmuted = \u00a77You have been unmuted pong = Pong! possibleWorlds = \u00a77Les mondes possibles sont les nombres 0 par {0}. powerToolAir = La commande ne peut pas \u00eatre attach\u00e9e \u00e0 l''air. -powerToolAttach = Commande assign\u00e9e \u00e0 {0} -powerToolRemove = Commande enlev\u00e9e \u00e0 {0} +powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. +powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. +powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. +powerToolListEmpty = {0} has no commands assigned. +powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. +powerToolRemove = Command \u00a7c{0}\u00a7f removed from {1}. +powerToolRemoveAll = All commands removed from {0}. +powerToolsEnabled=All of your power tools have been enabled. +powerToolsDisabled=All of your power tools have been disabled. protectionOwner = \u00a76[EssentialsProtect] Propri\u00e9taire de la protection : {0} questionFormat = \u00a77[Question]\u00a7f {0} reloadAllPlugins = \u00a77Tous les plugins ont \u00e9t\u00e9 recharg\u00e9s. +repair = You have successfully repaired your: \u00a7e{0}. +repairAlreadyFixed = \u00a77This item does not need repairing. +repairInvalidType = \u00a7cThis item cannot be repaired. +repairNone = There were no items that needing repairing. requestAccepted = \u00a77Demande de t\u00e9l\u00e9portation accept\u00e9e. +requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e. +requestDeniedFrom = \u00a77{0} denied your teleport request. requestSent = \u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77. returnPlayerToJailError = Erreur survenue lors de la tentative d''emprisonner de nouveau un joueur. second = seconde @@ -238,8 +270,13 @@ seconds = secondes seenOffline = Le joueur {0} est hors ligne depuis {1} seenOnline = Le joueur {0} est en ligne depuis {1} serverFull = Le serveur est plein. +setSpawner = Changed spawner type to {0} sheepMalformedColor = Couleur mal form\u00e9e. shoutFormat = \u00a77[Crie]\u00a7f {0} +signFormatFail = \u00a74[{0}] +signFormatSuccess = \u00a71[{0}] +signFormatTemplate = [{0}] +signProtectInvalidLocation = \u00a74You are not allowed to create sign here. similarWarpExist = Un warp avec un nom similaire existe d\u00e9j\u00e0. slimeMalformedSize = Taille mal form\u00e9e. soloMob = Ce monstre aime \u00eatre seul. @@ -249,6 +286,7 @@ suicideMessage = \u00a77Au revoir monde cruel... suicideSuccess = \u00a77{0} a pris sa propre vie. takenFromAccount = \u00a7c{0} ont \u00e9t\u00e9 pris de votre compte. takenFromOthersAccount = \u00a7c{0} a \u00e9t\u00e9 prise de {1} compte. +teleportAAll = \u00a77Teleporting request sent to all players... teleportAll = \u00a77T\u00e9l\u00e9poration de tous les joueurs. teleportAtoB = \u00a77{0}\u00a77 vous a t\u00e9l\u00e9port\u00e9 \u00e0 {1}\u00a77. teleportDisabled = {0} a la t\u00e9l\u00e9portation d\u00e9sactiv\u00e9. @@ -267,10 +305,15 @@ thunder = Vous avez {0} la foudre dans votre monde. thunderDuration = Vous avez {0} la foudre dans le serveur {1} secondes. timeBeforeHeal = Temps avant le prochain soin : {0} timeBeforeTeleport = Temps avant prochaine t\u00e9l\u00e9portation {0} +timeFormat = \u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern = (?:([0-9]+)\\\\s*[ya][a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*mo[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*(?:sem|w)[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*[dj][a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*h[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*m[a-z]*[,\\\\s]*)?(?:([0-9]+)\\\\s*(?:s[a-z]*)?)? timeSet = Heure modifi\u00e9e dans tous les mondes. +timeSetPermission = \u00a7cYou are not authorized to set the time. +timeWorldCurrent = The current time in {0} is \u00a73{1} +timeWorldSet = The time was set to {0} in: \u00a7c{1} tradeCompleted = \u00a77\u00c9change termin\u00e9. tradeSignEmpty = Le panneau de vente n''as pas encore assez de stock. +tradeSignEmptyOwner = There is nothing to collect from this trade sign. treeFailure = \u00a7cEchec de la g\u00e9n\u00e9ration de l''arbre. Essayez de nouveau sur de l''herbe ou de la terre. treeSpawned = \u00a77Arbre cr\u00e9\u00e9. typeTpaccept = \u00a77Pour le t\u00e9l\u00e9porter, tapez \u00a7c/tpaccept\u00a77. @@ -306,6 +349,7 @@ warpNotExist = Ce warp n''existe pas. warpSet = \u00a77Le warp {0} a \u00e9t\u00e9 cr\u00e9\u00e9. warpUsePermission = \u00a7cVous n''avez pas la permission d''utiliser ce warp. warpingTo = \u00a77T\u00e9l\u00e9portation au warp {0}. +warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}. weatherStorm = \u00a77Vous avez d\u00e9fini l''orage dans votre monde weatherStormFor = \u00a77Vous avez d\u00e9fini l''orage dans votre monde pour {0} secondes. weatherSun = \u00a77Vous avez mis le beau temps dans votre monde @@ -325,3 +369,5 @@ year = ann\u00e9e years = ann\u00e9es youAreHealed = \u00a77Vous avez \u00e9t\u00e9 soign\u00e9. youHaveNewMail = \u00a7cVous avez {0} messages! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. + + diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 375d9248f..e11791444 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -1,21 +1,22 @@ #version: TeamCity # Single quotes have to be doubled: '' # Translations start here -# by Geertje123 +# by: Geertje123 addedToAccount = \u00a7a{0} is gestort op je account. addedToOthersAccount = \u00a7a{0} is overgemaakt naar {1}''s rekening alertBroke = gebroken: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} bij: {3} alertPlaced = geplaatst: alertUsed = gebruikt: +autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath = \u00a77Gebruik het /back command om terug te keren naar je sterfplaats. backUsageMsg = \u00a77Naar de vorige locatie aan het gaan. backupFinished = Backup voltooid backupStarted = Backup gestart balance = \u00a77Saldo: {0} balanceTop = \u00a77 Top {0} saldi -banIpAddress = \u00a77Verbannen IP-adres banExempt = \u00a77Je kunt deze speler niet verbannen. +banIpAddress = \u00a77Verbannen IP-adres bannedIpsFileError = Fout bij het lezen van banned-ips.txt bannedIpsFileNotFound = banned-ips.txt werd niet gevonden bannedPlayersFileError = Fout bij het lezen van banned-players.txt @@ -48,6 +49,7 @@ day = dag days = dagen defaultBanReason = De Ban Hamer heeft gesproken! deleteFileError = Het bestand kon niet verwijderd worden: {0} +deleteHome = \u00a77Home {0} has been removed. deleteJail = \u00a77Gevangenis {0} is verwijderd. deleteWarp = \u00a77Warp {0} is verwijderd. deniedAccessCommand = {0} was de toegang verboden tot het commando. @@ -63,7 +65,6 @@ disabled = uitgeschakeld dontMoveMessage = \u00a77Beginnen met teleporteren in {0}. Niet bewegen. downloadingGeoIp = Bezig met downloaden van GeoIP database ... Dit kan een tijdje duren (country: 0.6 MB, city: 20MB) duplicatedUserdata = Dubbele userdata: {0} en {1}. -emptyWorldName = Set Home: Naam van wereld is leeg. enableUnlimited = \u00a77Oneindig aantal {0} aan {1} gegeven. enabled = ingeschakeld errorCallingCommand = Fout bij het aanroepen van de opdracht /{0} @@ -98,6 +99,7 @@ helpPages = Pagina \u00a7c{0}\u00a7f van de \u00a7c{1}\u00a7f: holeInFloor = Gat in de vloer homeSet = \u00a77Home ingesteld. homeSetToBed = \u00a77Je home is is nu verplaatst naar dit bed. +homes = Homes: {0} hour = uur hours = uren ignorePlayer = Je negeert {0} vanaf nu. @@ -129,8 +131,12 @@ itemSold = \u00a77Verkocht voor \u00a7c {0} \u00a77 ({1} voorwerpen voor {2} per itemSoldConsole = {0} verkocht {1} voor \u00a77 {2} \u00a77 ({3} voorwerpen voor {4} per stuk) itemSpawn = \u00a77Geeft {0} {1} itemsCsvNotLoaded = De item kunnen niet geladen worden.csv. +jailAlreadyIncarcerated = \u00a7cPerson is already in jail: {0} jailMessage = \u00a7cYou do the crime, you do the time. jailNotExist = Die gevangenis bestaat niet. +jailReleased = \u00a77Player \u00a7e{0}\u00a77 unjailed. +jailReleasedPlayerNotify = \u00a77You have been released! +jailSentenceExtended = Jail time extend to: {0) jailSet = \u00a77Gevangenis {0} is ingesteld jumpError = Dat zou je computers hersenen beschadigen. kickDefault = Gekicked van de server @@ -154,6 +160,7 @@ mailSent = \u00a77Bericht verzonden! markMailAsRead = \u00a7cType /mail clear, om je berichten als gelezen te markeren markedAsAway = \u00a77Je staat nu als afwezig gemeld. markedAsNotAway = \u00a77Je staat niet meer als afwezig gemeld. +maxHomes=You cannot set more than {0} homes. mayNotJail = \u00a7cJe mag die speler niet in de gevangenis zetten. me = me minute = minuut @@ -177,6 +184,7 @@ mutedUserSpeaks = {0} probeerde te praten, maar is gemute. needTpohere = Je moet toegang krijgen tot /tpohere om naar andere spelers te teleporteren. negativeBalanceError = Speler is niet toegestaan om een negatief saldo te hebben. nickChanged = Nickname veranderd. +nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. nickInUse = \u00a7cDie naam is al in gebruik. nickNamesAlpha = \u00a7cNicknames moeten alfanumeriek zijn. nickNoMore = \u00a7Je hebt geen nickname meer. @@ -196,6 +204,7 @@ noMotd = \u00a7cEr is geen bericht van de dag. noNewMail = \u00a77Je hebt geen nieuwe berichten. noPendingRequest = Je hebt geen aanvragen. noPlacePermission = \u00a7cJe hebt geen toestemming om een blok naast die sign te plaatsen. +noPowerTools=You have no power tools assigned. noRules = \u00a7cEr zijn nog geen regels gegeven. noWarpsDefined = Geen warps gedefinieerd none = geen @@ -209,6 +218,14 @@ numberRequired = Er moet daar een nummer, grapjas. onlyDayNight = /time ondersteund alleen day/night. onlyPlayers = Alleen in-game spelers kunnen {0} gebruiken. onlySunStorm = /weather only supports sun/storm. +pTimeCurrent = \u00a7e{0}''s\u00a7f time is {1}. +pTimeCurrentFixed = \u00a7e{0}''s\u00a7f time is fixed to {1}. +pTimeNormal = \u00a7e{0}''s\u00a7f time is normal and matches the server. +pTimeOthersPermission = \u00a7cYou are not authorized to set other players'' time. +pTimePlayers = These players have their own time: +pTimeReset = Player time has been reset for: \u00a7e{0} +pTimeSet = Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} +pTimeSetFixed = Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError = Fout bij ontleding {0} op regel {1} pendingTeleportCancelled = \u00a7cAangevraagde teleportatie afgelast. permissionsError = Permissions/GroupManager ontbreekt; chat prefixes/suffixes worden uitgeschakeld. @@ -225,13 +242,27 @@ playerUnmuted = \u00a77Speler mag weer praten pong = Pong! possibleWorlds = \u00a77Mogelijk zijn de werelden de nummer 0 tot en met {0}. powerToolAir = Command kan niet worden bevestigd aan lucht. -powerToolAttach = Command toegewezen aan {0} -powerToolRemove = Command verwijderd van {0} +powerToolAlreadySet = Command \u00a7c{0}\u00a7f is already assigned to {1}. +powerToolAttach = \u00a7c{0}\u00a7f command assigned to {1}. +powerToolClearAll = All powertool commands have been cleared. +powerToolList = {1} has the following commands: \u00a7c{0}\u00a7f. +powerToolListEmpty = {0} has no commands assigned. +powerToolNoSuchCommandAssigned = Command \u00a7c{0}\u00a7f has not been assigned to {1}. +powerToolRemove = Command \u00a7c{0}\u00a7f removed from {1}. +powerToolRemoveAll = All commands removed from {0}. +powerToolsEnabled=All of your power tools have been enabled. +powerToolsDisabled=All of your power tools have been disabled. protectionOwner = \u00a76[EssentialsProtect] Beschermingeigenaar: {0} questionFormat = \u00a77[Vraag]\u00a7f {0} reloadAllPlugins = \u00a77Alle plugins zijn herladen. +repair = You have successfully repaired your: \u00a7e{0}. +repairAlreadyFixed = \u00a77This item does not need repairing. +repairInvalidType = \u00a7cThis item cannot be repaired. +repairNone = There were no items that needing repairing. requestAccepted = \u00a77Teleporteer aanvraag geaccepteerd. +requestAcceptedFrom = \u00a77{0} accepted your teleport request. requestDenied = \u00a77Teleporteer aanvraag geweigerd. +requestDeniedFrom = \u00a77{0} denied your teleport request. requestSent = \u00a77Aanvraag verstuurd naar {0}\u00a77. returnPlayerToJailError = Fout opgetreden bij terugzetten van speler in gevangenis. second = seconde @@ -239,8 +270,13 @@ seconds = seconde seenOffline = Speler {0} is offline vanaf {1} seenOnline = Speler {0} is online vanaf {1} serverFull = Server is vol +setSpawner = Changed spawner type to {0} sheepMalformedColor = Misvoormde kleur. shoutFormat = \u00a77[Shout]\u00a7f {0} +signFormatFail = \u00a74[{0}] +signFormatSuccess = \u00a71[{0}] +signFormatTemplate = [{0}] +signProtectInvalidLocation = \u00a74You are not allowed to create sign here. similarWarpExist = Er bestaat al een warp met dezelfde naam. slimeMalformedSize = Misvoormde grootte. soloMob = Die mob is liever in zijn eentje @@ -250,6 +286,7 @@ suicideMessage = \u00a77Vaarwel vreedzame wereld... suicideSuccess = \u00a77{0} pleegde zelfmoord takenFromAccount = \u00a7c{0} is van je bank rekening afgehaald. takenFromOthersAccount = \u00a7c{0} is overgenomen uit {1} account. +teleportAAll = \u00a77Teleporting request sent to all players... teleportAll = \u00a77Bezig met teleporteren van alle spelers... teleportAtoB = \u00a77{0}\u00a77 is naar {1}\u00a77 geteleporteerd. teleportDisabled = {0} heeft teleporteren uit gezet. @@ -268,17 +305,21 @@ thunder = Je {0} onweert de wereld thunderDuration = Je {0} onweert de wereld voor {1} seconde. timeBeforeHeal = Afkoeltijd tot de volgende heal: {0} timeBeforeTeleport = Afkoeltijd tot de volgende teleport: {0} +timeFormat = \u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern = (?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[oa][a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[hu][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? timeSet = Tijd ingesteld in alle werelden. +timeSetPermission = \u00a7cYou are not authorized to set the time. +timeWorldCurrent = The current time in {0} is \u00a73{1} +timeWorldSet = The time was set to {0} in: \u00a7c{1} tradeCompleted = \u00a77Ruil verricht. tradeSignEmpty = Het handelsbordje heeft een te kleine voorraad. +tradeSignEmptyOwner = There is nothing to collect from this trade sign. treeFailure = \u00a7cFout bij het genereren van boom. Pobeer het opnieuw op gras of dirt. treeSpawned = \u00a77Boom gespawned. typeTpaccept = \u00a77Om te teleporten, type \u00a7c/tpaccept\u00a77. typeTpdeny = \u00a77Om te weigeren, type \u00a7c/tpdeny\u00a77. typeWorldName = \u00a77Je kan ook de exacte naam van de wereld typen. unableToSpawnMob = De mob kan niet gespawned worden. -unableToSpawnMob = Mob kon niet gespawnd worden. unbannedIP = IP adres ontbannen. unbannedPlayer = Speler ontbannen. unignorePlayer = Je negeert {0} niet meer. @@ -308,6 +349,7 @@ warpNotExist = Die warp bestaat niet. warpSet = \u00a77Warp {0} ingesteld. warpUsePermission = \u00a7cOnbevoegd om die warp te gebruiken. warpingTo = \u00a77Aan het warpen naar {0}. +warpsCount = \u00a77There are {0} warps. Showing page {1} of {2}. weatherStorm = \u00a77Je hebt het weer naar storm gezet in de wereld weatherStormFor = \u00a77Je hebt het weer in de wereld naar storm gezet voor {0} seconde weatherSun = \u00a77Je hebt het weer naar zon gezet in de wereld @@ -326,4 +368,6 @@ worthSet = Waarde ingesteld year = jaar years = jaren youAreHealed = \u00a77Je bent genezen. -youHaveNewMail = \u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken.
\ No newline at end of file +youHaveNewMail = \u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken. + + diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 9c0d51d71..0c5f689a7 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials version: TeamCity website: http://www.earth2me.net:8001/ description: Provides an essential, core set of commands for Bukkit. -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology] +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] commands: afk: description: Marks you as away-from-keyboard. @@ -59,6 +59,10 @@ commands: description: Describes your current bearing. usage: /<command> aliases: [ecompass] + delhome: + description: Removes a home + usage: /<command> [player:]<name> + aliases: [edelhome,remhome,rmhome,eremhome,ermhome] deljail: description: Removes a jail usage: /<command> [jailname] @@ -116,7 +120,7 @@ commands: aliases: [ehelpop] home: description: Teleport to your home. - usage: /<command> <player> + usage: /<command> [player:][name] aliases: [ehome] ignore: description: Ignore other players. @@ -204,8 +208,12 @@ commands: aliases: [pong,eping,epong] powertool: description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click. - usage: /<command> [command] <arguments> + usage: /<command> [l:|a:|r:][command] <arguments> aliases: [pt,epowertool,ept] + powertooltoggle: + description: Enables or disables all current powertools + usage: /<command> + aliases: [ptt,epowertooltoggle,eptt] ptime: description: Adjust player's client time. Add @ prefix to fix. usage: /<command> [list|reset|day|night|dawn|17:30|4pm|4000ticks] <player|*> @@ -222,6 +230,10 @@ commands: description: Reloads all plugins. usage: /<command> aliases: [rel,ereloadall,ereload,erel] + repair: + description: Repairs the durability of all or one item. + usage: /<command> [hand|all] + aliases: [fix,erepair,efix] rules: description: Views the server rules. usage: /<command> @@ -236,7 +248,7 @@ commands: aliases: [esell] sethome: description: Set your home to your current location. - usage: /<command> + usage: /<command> [[player:]name] aliases: [esethome] setjail: description: Creates a jail where you specified named [jailname] @@ -275,7 +287,7 @@ commands: usage: /<command> <true/false> [duration] aliases: [ethunder] time: - description: Change the world time. Defaults tos current world. + description: Change the world time. Defaults to current world. usage: /<command> [day|night|dawn|17:30|4pm|4000ticks] [worldname|all] aliases: [etime, day, night] togglejail: @@ -293,6 +305,9 @@ commands: tpa: description: Request to teleport to the specified player. usage: /<command> <player> + tpaall: + description: Requests all players online to teleport to you. + usage: /<command> <player> tpaccept: description: Accepts a teleport request. usage: /<command> @@ -319,7 +334,7 @@ commands: usage: /<command> <player> tppos: description: Teleport to coordinates. - usage: /<command> <x> <y> <z> + usage: /<command> <x> <y> <z> [yaw] [pitch] tptoggle: description: Blocks all forms of teleportation. usage: /<command> @@ -341,7 +356,7 @@ commands: aliases: [eunlimited,ul,unl,eul,eunl] warp: description: List all warps or warp to the specified location. - usage: /<command> <warp> <player> + usage: /<command> [pagenumber|warp] <player> aliases: [ewarp,warps] weather: description: Setting the weather. diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index e3c0e2364..ac5636c61 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -4,10 +4,12 @@ import com.avaje.ebean.config.ServerConfig; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.Future; import java.util.logging.Logger; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; @@ -17,6 +19,7 @@ import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; import org.bukkit.generator.ChunkGenerator; import org.bukkit.inventory.Recipe; +import org.bukkit.map.MapView; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.ServicesManager; @@ -341,4 +344,118 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int getViewDistance() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getAllowNether() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean hasWhitelist() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public MapView getMap(short s) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public MapView createMap(World world) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getAllowFlight() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setWhitelist(boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Set<org.bukkit.OfflinePlayer> getWhitelistedPlayers() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void reloadWhitelist() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Player getPlayerExact(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void shutdown() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int broadcast(String string, String string1) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public org.bukkit.OfflinePlayer getOfflinePlayer(String string) + { + return null; + } + + @Override + public Set<String> getIPBans() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void banIP(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void unbanIP(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Set<org.bukkit.OfflinePlayer> getBannedPlayers() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public GameMode getDefaultGameMode() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setDefaultGameMode(GameMode gm) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/test/com/earth2me/essentials/UserTest.java b/Essentials/test/com/earth2me/essentials/UserTest.java index 4724c96d6..35244ac90 100644 --- a/Essentials/test/com/earth2me/essentials/UserTest.java +++ b/Essentials/test/com/earth2me/essentials/UserTest.java @@ -46,7 +46,7 @@ public class UserTest extends TestCase OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess); assertEquals(base1alt, ess.getUser(base1alt).getBase()); } - + public void testHome() { User user = ess.getUser(base1); @@ -54,13 +54,21 @@ public class UserTest extends TestCase user.setHome(); OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); User user2 = ess.getUser(base2); - Location home = user2.getHome(loc); - assertEquals(loc.getWorld().getName(), home.getWorld().getName()); - assertEquals(loc.getX(), home.getX()); - assertEquals(loc.getY(), home.getY()); - assertEquals(loc.getZ(), home.getZ()); - assertEquals(loc.getYaw(), home.getYaw()); - assertEquals(loc.getPitch(), home.getPitch()); + try + { + Location home = user2.getHome(loc); + assertEquals(loc.getWorld().getName(), home.getWorld().getName()); + assertEquals(loc.getX(), home.getX()); + assertEquals(loc.getY(), home.getY()); + assertEquals(loc.getZ(), home.getZ()); + assertEquals(loc.getYaw(), home.getYaw()); + assertEquals(loc.getPitch(), home.getPitch()); + } + catch (Exception ex) + { + fail("Exception"); + } + } public void testMoney() diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java index 6b3039d0b..85e821e7f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayerListener.java @@ -1,6 +1,8 @@ package com.earth2me.essentials.chat; +import com.earth2me.essentials.ChargeException; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; import java.util.Map; @@ -8,6 +10,7 @@ import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.World; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerListener; @@ -59,29 +62,38 @@ public class EssentialsChatPlayerListener extends PlayerListener } radius *= radius; - if (event.getMessage().startsWith("!") && event.getMessage().length() > 1) - { - if (user.isAuthorized("essentials.chat.shout")) + try { + if (event.getMessage().startsWith("!") && event.getMessage().length() > 1) { - event.setMessage(event.getMessage().substring(1)); - event.setFormat(Util.format("shoutFormat", event.getFormat())); + if (user.isAuthorized("essentials.chat.shout")) + { + charge(user,"chat-shout"); + event.setMessage(event.getMessage().substring(1)); + event.setFormat(Util.format("shoutFormat", event.getFormat())); + return; + } + user.sendMessage(Util.i18n("notAllowedToShout")); + event.setCancelled(true); return; } - user.sendMessage(Util.i18n("notAllowedToShout")); - event.setCancelled(true); - return; - } - if (event.getMessage().startsWith("?") && event.getMessage().length() > 1) - { - if (user.isAuthorized("essentials.chat.question")) + if (event.getMessage().startsWith("?") && event.getMessage().length() > 1) { - event.setMessage(event.getMessage().substring(1)); - event.setFormat(Util.format("questionFormat", event.getFormat())); + if (user.isAuthorized("essentials.chat.question")) + { + charge(user,"chat-question"); + event.setMessage(event.getMessage().substring(1)); + event.setFormat(Util.format("questionFormat", event.getFormat())); + return; + } + user.sendMessage(Util.i18n("notAllowedToQuestion")); + event.setCancelled(true); return; } - user.sendMessage(Util.i18n("notAllowedToQuestion")); - event.setCancelled(true); + } + catch (ChargeException ex) + { + ess.showError(user, ex, "Shout"); return; } @@ -123,4 +135,12 @@ public class EssentialsChatPlayerListener extends PlayerListener u.sendMessage(message); } } + protected void charge(final CommandSender sender, final String command) throws ChargeException + { + if (sender instanceof Player) + { + final Trade charge = new Trade(command, ess); + charge.charge(ess.getUser((Player)sender)); + } + } } diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml index 87033cdc9..371c169dd 100644 --- a/EssentialsGroupManager/src/groups.yml +++ b/EssentialsGroupManager/src/groups.yml @@ -13,43 +13,6 @@ groups: prefix: '&e' build: false suffix: '' - SemiAdmin: - default: false - permissions: - - -groupmanager.mantogglesave - - essentials - - essentials.antioch - - essentials.burn - - essentials.clearinventory - - essentials.cooldown.bypass - - essentials.deljail - - essentials.fireball - - essentials.gc - - essentials.give - - essentials.god - - essentials.heal - - essentials.heal.others - - essentials.lightning - - essentials.invsee - - essentials.item - - essentials.jails - - essentials.kickall - - essentials.kit.* - - essentials.mute - - essentials.sell - - essentials.setjail - - essentials.signs.* - - essentials.spawnmob - - essentials.teleport.cooldown.bypass - - essentials.teleport.timer.bypass - - essentials.togglejail - - groupmanager.* - inheritance: - - moderator - info: - prefix: '&c' - build: true - suffix: '' Builder: default: false permissions: @@ -57,10 +20,15 @@ groups: - essentials.back - essentials.back.ondeath - essentials.balance + - essentials.balance.others + - essentials.balancetop + - essentials.chat.color - essentials.chat.shout + - essentials.chat.question - essentials.compass - - essentials.home - essentials.depth + - essentials.home + - essentials.ignore - essentials.kit - essentials.kit.tools - essentials.mail @@ -69,6 +37,7 @@ groups: - essentials.msg - essentials.nick - essentials.pay + - essentials.ping - essentials.portal - essentials.powertool - essentials.protect @@ -83,6 +52,7 @@ groups: - essentials.signs.break.protection - essentials.signs.break.trade - essentials.suicide + - essentials.time - essentials.tpa - essentials.tpaccept - essentials.tpahere @@ -100,28 +70,41 @@ groups: default: false permissions: - essentials.ban + - essentials.ban.notify - essentials.banip - essentials.broadcast + - essentials.clearinventory - essentials.delwarp - - essentials.eco + - essentials.eco.loan - essentials.ext - essentials.getpos + - essentials.helpop.recieve + - essentials.home.others + - essentials.invsee + - essentials.jails - essentials.jump - essentials.kick + - essentials.kick.notify - essentials.kill + - essentials.mute + - essentials.nick.others + - essentials.realname - essentials.setwarp - essentials.signs.create.* - essentials.signs.break.* - essentials.spawner - essentials.thunder - essentials.time - - essentials.time.world + - essentials.time.set + - essentials.protect.alerts + - essentials.protect.admin + - essentials.protect.ownerinfo + - essentials.ptime + - essentials.ptime.others - essentials.togglejail - essentials.top - essentials.tp - essentials.tphere - - essentials.tpo - - essentials.tpohere - essentials.tppos - essentials.tptoggle - essentials.unban @@ -131,12 +114,11 @@ groups: - essentials.world - groupmanager.listgroups - groupmanager.mandemote - - groupmanager.manload - groupmanager.manpromote - - groupmanager.mansave - groupmanager.manselect - groupmanager.manuadd - groupmanager.manudel + - groupmanager.manwhois inheritance: - builder info: @@ -146,9 +128,30 @@ groups: Admin: default: false permissions: + - -essentials.backup + - -essentials.essentials + - -essentials.setspawn + - -essentials.reloadall + - -essentials.plugin + - essentials.* + - groupmanager.mantogglevalidate + - groupmanager.mansave + - groupmanager.mangcheckp + - groupmanager.manglistp + - groupmanager.manucheckp + - groupmanager.manulistp + inheritance: + - moderator + info: + prefix: '&c' + build: true + suffix: '' + Owner: + default: false + permissions: - '*' inheritance: - - semiadmin + - admin info: prefix: '&4' build: true diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index bae792d06..fa1fadad6 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -190,6 +190,14 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect { storage.onPluginDeactivation(); } + // Sleep for a second to allow the database to close. + try + { + Thread.sleep(1000); + } + catch (InterruptedException ex) + { + } } public IEssentials getEssentials() diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index 7b5f93d0e..8717825b3 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -61,7 +61,7 @@ public class EssentialsProtectBlockListener extends BlockListener } final Block below = blockPlaced.getRelative(BlockFace.DOWN); - if (below.getType() == Material.RAILS + if ((below.getType() == Material.RAILS || below.getType() == Material.POWERED_RAIL || below.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.prevent_block_on_rail) && prot.getStorage().isProtected(below, user.getName())) { @@ -70,7 +70,7 @@ public class EssentialsProtectBlockListener extends BlockListener } final List<Block> protect = new ArrayList<Block>(); - if (blockPlaced.getType() == Material.RAILS + if ((blockPlaced.getType() == Material.RAILS || blockPlaced.getType() == Material.POWERED_RAIL || blockPlaced.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails) && user.isAuthorized("essentials.protect")) { @@ -103,8 +103,8 @@ public class EssentialsProtectBlockListener extends BlockListener { return; } - Block block = event.getBlock(); - if (block.getType() == Material.RAILS + final Block block = event.getBlock(); + if ((block.getType() == Material.RAILS || block.getType() == Material.POWERED_RAIL || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); @@ -155,7 +155,7 @@ public class EssentialsProtectBlockListener extends BlockListener return; } final Block toBlock = event.getToBlock(); - if (toBlock.getType() == Material.RAILS + if ((toBlock.getType() == Material.RAILS || toBlock.getType() == Material.POWERED_RAIL || toBlock.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); @@ -196,7 +196,7 @@ public class EssentialsProtectBlockListener extends BlockListener return; } final Block block = event.getBlock(); - if (block.getType() == Material.RAILS && prot.getSettingBool(ProtectConfig.protect_rails)) + if ((block.getType() == Material.RAILS || block.getType() == Material.POWERED_RAIL || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); return; @@ -257,10 +257,10 @@ public class EssentialsProtectBlockListener extends BlockListener if (user.isAuthorized("essentials.protect.admin")) { - if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS) + if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL) { storage.unprotectBlock(block); - if (type == Material.RAILS || type == Material.SIGN_POST) + if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL || type == Material.SIGN_POST) { final Block below = block.getRelative(BlockFace.DOWN); storage.unprotectBlock(below); @@ -293,10 +293,10 @@ public class EssentialsProtectBlockListener extends BlockListener } else { - if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS) + if (type == Material.WALL_SIGN || type == Material.SIGN_POST || type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL) { storage.unprotectBlock(block); - if (type == Material.RAILS || type == Material.SIGN_POST) + if (type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL || type == Material.SIGN_POST) { final Block below = block.getRelative(BlockFace.DOWN); storage.unprotectBlock(below); @@ -337,7 +337,11 @@ public class EssentialsProtectBlockListener extends BlockListener return; } if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS - || block.getType() == Material.RAILS) + || block.getType() == Material.RAILS + || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL + || block.getType() == Material.POWERED_RAIL + || block.getRelative(BlockFace.UP).getType() == Material.DETECTOR_RAIL + || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); @@ -385,7 +389,11 @@ public class EssentialsProtectBlockListener extends BlockListener return; } if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS - || block.getType() == Material.RAILS) + || block.getType() == Material.RAILS + || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL + || block.getType() == Material.POWERED_RAIL + || block.getRelative(BlockFace.UP).getType() == Material.DETECTOR_RAIL + || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index d85d2b3d7..f28fd1185 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -1,10 +1,11 @@ package com.earth2me.essentials.protect; -import com.earth2me.essentials.EssentialsBlockListener; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; import java.util.HashSet; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import net.minecraft.server.ChunkPosition; import net.minecraft.server.Packet60Explosion; import org.bukkit.Location; @@ -13,19 +14,16 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.craftbukkit.entity.CraftFireball; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.craftbukkit.entity.CraftTNTPrimed; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.Fireball; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityExplodeEvent; @@ -39,15 +37,15 @@ public class EssentialsProtectEntityListener extends EntityListener { private final transient IProtect prot; private final transient IEssentials ess; - + public EssentialsProtectEntityListener(final IProtect prot) { this.prot = prot; this.ess = prot.getEssentials(); } - + @Override - public void onEntityDamage(EntityDamageEvent event) + public void onEntityDamage(final EntityDamageEvent event) { if (event.isCancelled()) { @@ -58,7 +56,7 @@ public class EssentialsProtectEntityListener extends EntityListener if (event instanceof EntityDamageByBlockEvent) { final DamageCause cause = event.getCause(); - + if (prot.getSettingBool(ProtectConfig.disable_contactdmg) && cause == DamageCause.CONTACT && !(target instanceof Player @@ -87,7 +85,7 @@ public class EssentialsProtectEntityListener extends EntityListener return; } } - + if (event instanceof EntityDamageByEntityEvent) { final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event; @@ -102,7 +100,7 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); return; } - + //Creeper explode prevention if (eAttack instanceof Creeper && prot.getSettingBool(ProtectConfig.prevent_creeper_explosion) && !(target instanceof Player @@ -112,7 +110,7 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); return; } - + if (eAttack instanceof Creeper && prot.getSettingBool(ProtectConfig.prevent_creeper_playerdmg) && !(target instanceof Player && user.isAuthorized("essentials.protect.damage.creeper") @@ -139,19 +137,22 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); return; } + + if (edEvent.getDamager() instanceof Projectile + && target instanceof Player + && ((prot.getSettingBool(ProtectConfig.disable_projectiles) + && !(user.isAuthorized("essentials.protect.damage.projectiles") + && !user.isAuthorized("essentials.protect.damage.disable"))) + || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player + && prot.getSettingBool(ProtectConfig.disable_pvp) + && (!user.isAuthorized("essentials.protect.pvp") + || !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp"))))) + { + event.setCancelled(true); + return; + } } - - if (event instanceof EntityDamageByProjectileEvent - && target instanceof Player - && prot.getSettingBool(ProtectConfig.disable_projectiles) - && !(user.isAuthorized("essentials.protect.damage.projectiles") - && !user.isAuthorized("essentials.protect.damage.disable"))) - { - event.setCancelled(true); - ((EntityDamageByProjectileEvent)event).setBounce(true); - return; - } - + final DamageCause cause = event.getCause(); if (target instanceof Player) { @@ -163,7 +164,7 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); return; } - + if (cause == DamageCause.SUFFOCATION && prot.getSettingBool(ProtectConfig.disable_suffocate) && !(user.isAuthorized("essentials.protect.damage.suffocation") @@ -199,9 +200,9 @@ public class EssentialsProtectEntityListener extends EntityListener } } } - + @Override - public void onEntityExplode(EntityExplodeEvent event) + public void onEntityExplode(final EntityExplodeEvent event) { if (event.isCancelled()) { @@ -214,43 +215,50 @@ public class EssentialsProtectEntityListener extends EntityListener || prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg) || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) { - final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size()); - final Player[] players = ess.getServer().getOnlinePlayers(); - final Set<ChunkPosition> blocksUnderPlayers = new HashSet<ChunkPosition>(players.length); - final Location loc = event.getLocation(); - for (Player player : players) + try { - if (player.getWorld().equals(loc.getWorld())) + final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size()); + final Player[] players = ess.getServer().getOnlinePlayers(); + final Set<ChunkPosition> blocksUnderPlayers = new HashSet<ChunkPosition>(players.length); + final Location loc = event.getLocation(); + for (Player player : players) { - blocksUnderPlayers.add( - new ChunkPosition( - player.getLocation().getBlockX(), - player.getLocation().getBlockY() - 1, - player.getLocation().getBlockZ())); + if (player.getWorld().equals(loc.getWorld())) + { + blocksUnderPlayers.add( + new ChunkPosition( + player.getLocation().getBlockX(), + player.getLocation().getBlockY() - 1, + player.getLocation().getBlockZ())); + } } - } - ChunkPosition cp; - for (Block block : event.blockList()) - { - cp = new ChunkPosition(block.getX(), block.getY(), block.getZ()); - if (!blocksUnderPlayers.contains(cp)) + ChunkPosition cp; + for (Block block : event.blockList()) { - set.add(cp); + cp = new ChunkPosition(block.getX(), block.getY(), block.getZ()); + if (!blocksUnderPlayers.contains(cp)) + { + set.add(cp); + } } + + ((CraftServer)ess.getServer()).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0D, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, + new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0f, set)); + } + catch (Throwable ex) + { + Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); } - - ((CraftServer)ess.getServer()).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0D, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, - new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0f, set)); event.setCancelled(true); return; } - else if (event.getEntity() instanceof CraftTNTPrimed + else if (event.getEntity() instanceof TNTPrimed && prot.getSettingBool(ProtectConfig.prevent_tnt_explosion)) { event.setCancelled(true); return; } - else if (event.getEntity() instanceof CraftFireball + else if (event.getEntity() instanceof Fireball && prot.getSettingBool(ProtectConfig.prevent_fireball_explosion)) { event.setCancelled(true); @@ -261,7 +269,12 @@ public class EssentialsProtectEntityListener extends EntityListener for (Block block : event.blockList()) { - if ((block.getType() == Material.RAILS || block.getRelative(BlockFace.UP).getType() == Material.RAILS) + if ((block.getRelative(BlockFace.UP).getType() == Material.RAILS + || block.getType() == Material.RAILS + || block.getRelative(BlockFace.UP).getType() == Material.POWERED_RAIL + || block.getType() == Material.POWERED_RAIL + || block.getRelative(BlockFace.UP).getType() == Material.DETECTOR_RAIL + || block.getType() == Material.DETECTOR_RAIL) && prot.getSettingBool(ProtectConfig.protect_rails)) { event.setCancelled(true); @@ -279,19 +292,13 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); return; } - /*if (EssentialsBlockListener.protectedBlocks.contains(block.getType()) - && EssentialsBlockListener.isBlockProtected(block)) - { - event.setCancelled(true); - return; - }*/ } } - + @Override public void onCreatureSpawn(final CreatureSpawnEvent event) { - if (event.getEntity() instanceof CraftPlayer) + if (event.getEntity() instanceof Player) { return; } @@ -309,7 +316,7 @@ public class EssentialsProtectEntityListener extends EntityListener event.setCancelled(true); } } - + @Override public void onEntityTarget(final EntityTargetEvent event) { @@ -335,12 +342,12 @@ public class EssentialsProtectEntityListener extends EntityListener return; } } - + @Override public void onExplosionPrime(ExplosionPrimeEvent event) { - if (event.getEntity() instanceof CraftFireball - && prot.getSettingBool(ProtectConfig.prevent_fireball_fire)) + if (event.getEntity() instanceof Fireball + && prot.getSettingBool(ProtectConfig.prevent_fireball_fire)) { event.setFire(false); } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java index 6f538ac92..9ffc1c3f0 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java @@ -16,7 +16,6 @@ public class Commandsetspawn extends EssentialsCommand @Override public void run(Server server, User user, String commandLabel, String[] args) throws Exception { - charge(user); final String group = args.length > 0 ? getFinalArg(args, 0) : "default"; ess.getSpawn().setSpawn(user.getLocation(), group); user.sendMessage(Util.format("spawnSet", group)); diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 3c85c3661..459eee60a 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -79,7 +79,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener if (ess.getSettings().getAnnounceNewPlayers()) { - ess.broadcastMessage(user.getName(), ess.getSettings().getAnnounceNewPlayerFormat(user)); + ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user)); } } } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java index 8ab62cd4d..34f862627 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.xmpp; import com.earth2me.essentials.IEssentials; +import com.earth2me.essentials.IUser; import com.earth2me.essentials.Util; import java.util.List; import java.util.logging.Level; @@ -83,9 +84,10 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP } @Override - public String getUserByAddress(final String address) + public IUser getUserByAddress(final String address) { - return instance.users.getUserByAddress(address); + String username = instance.users.getUserByAddress(address); + return username == null ? null : ess.getUser(username); } @Override @@ -122,9 +124,9 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP } @Override - public void broadcastMessage(final String name, final String message) + public void broadcastMessage(final IUser sender, final String message) { - ess.broadcastMessage(name, message); + ess.broadcastMessage(sender, message); try { for (String address : getSpyUsers()) diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java index d90bff803..1ed9fa732 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.xmpp; +import com.earth2me.essentials.IUser; import java.util.List; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -13,7 +14,7 @@ public interface IEssentialsXMPP extends Plugin List<String> getSpyUsers(); - String getUserByAddress(final String address); + IUser getUserByAddress(final String address); boolean sendMessage(final Player user, final String message); @@ -23,5 +24,5 @@ public interface IEssentialsXMPP extends Plugin boolean toggleSpy(final Player user); - void broadcastMessage(final String name, final String message); + void broadcastMessage(final IUser sender, final String message); } diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java index 6a2a6e80a..9734444ad 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java @@ -47,7 +47,7 @@ public class UserManager implements IConf return username; } } - return search; + return null; } public void setAddress(final String username, final String address) diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java index e43844c5b..d7aedb9f4 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.xmpp; import com.earth2me.essentials.Console; import com.earth2me.essentials.EssentialsConf; import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IUser; import java.io.File; import java.util.ArrayList; import java.util.Collections; @@ -101,8 +102,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager sendCommand(chat, message); break; default: - final String name = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant())); - parent.broadcastMessage(name, "="+name+": "+ message); + final IUser sender = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant())); + parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message); } } } diff --git a/build.xml b/build.xml new file mode 100644 index 000000000..e0172132c --- /dev/null +++ b/build.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project default="collect"> + <target name="setversion"> + <replace dir="." includes="**/src/plugin.yml" token="version: TeamCity" value="version: ${build.number}"/> + <replace dir="." includes="**/src/messages*.properties" token="version: TeamCity" value="version: ${build.number}"/> + <replace dir="." includes="**/src/items.csv" token="version: TeamCity" value="version: ${build.number}"/> + </target> + <target name="buildall" depends="setversion"> + <ant dir="Essentials" antfile="build.xml"/> + <ant dir="EssentialsChat" antfile="build.xml"/> + <ant dir="EssentialsSpawn" antfile="build.xml"/> + <ant dir="EssentialsProtect" antfile="build.xml"/> + <ant dir="EssentialsGroupManager" antfile="build.xml"/> + <ant dir="EssentialsGroupBridge" antfile="build.xml"/> + <ant dir="EssentialsGeoIP" antfile="build.xml"/> + <ant dir="EssentialsXMPP" antfile="build.xml"/> + </target> + <target name="collect" depends="buildall"> + <mkdir dir="jars"/> + <copy todir="jars"> + <fileset dir="."> + <include name="**/dist/Essentials*.jar"/> + <include name="**/Essentials/src/config.yml" /> + <include name="**/src/messages*.properties" /> + <include name="**/src/items.csv" /> + </fileset> + <flattenmapper/> + </copy> + </target> +</project> diff --git a/lib/PermissionsBukkit-1.2.jar b/lib/PermissionsBukkit-1.2.jar Binary files differnew file mode 100644 index 000000000..3f5caf1b4 --- /dev/null +++ b/lib/PermissionsBukkit-1.2.jar diff --git a/lib/bPermissions.jar b/lib/bPermissions.jar Binary files differnew file mode 100644 index 000000000..b3b38e425 --- /dev/null +++ b/lib/bPermissions.jar diff --git a/lib/bukkit-0.0.1-SNAPSHOT.jar b/lib/bukkit-0.0.1-SNAPSHOT.jar Binary files differindex 011a54e63..02cf2905d 100644 --- a/lib/bukkit-0.0.1-SNAPSHOT.jar +++ b/lib/bukkit-0.0.1-SNAPSHOT.jar diff --git a/lib/craftbukkit-0.0.1-SNAPSHOT.jar b/lib/craftbukkit-0.0.1-SNAPSHOT.jar Binary files differindex 7aff0e06c..ff71362dc 100644 --- a/lib/craftbukkit-0.0.1-SNAPSHOT.jar +++ b/lib/craftbukkit-0.0.1-SNAPSHOT.jar |