summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/nbproject/project.properties6
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java31
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsConf.java81
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsTimer.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java21
-rw-r--r--Essentials/src/com/earth2me/essentials/Jails.java70
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java68
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java60
-rw-r--r--Essentials/src/com/earth2me/essentials/Trade.java30
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/UserData.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/UserMap.java31
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandback.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkill.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmail.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandping.java15
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrepair.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawner.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsudo.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandwarp.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java42
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java39
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java62
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java44
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java61
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignProtection.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java35
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java31
-rw-r--r--Essentials/src/config.yml36
-rw-r--r--Essentials/src/info.txt7
-rw-r--r--Essentials/src/messages.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties2
-rw-r--r--Essentials/src/messages_es.properties2
-rw-r--r--Essentials/src/messages_fr.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
-rw-r--r--Essentials/src/plugin.yml6
-rw-r--r--Essentials/test/com/earth2me/essentials/FakeServer.java51
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java2
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java2
-rw-r--r--EssentialsChat/src/plugin.yml2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java4
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java4
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java36
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java22
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java16
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java19
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java2
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java7
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java15
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java37
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java4
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java4
-rw-r--r--lib/Privileges.jarbin0 -> 101774 bytes
-rw-r--r--lib/bpermissions2.jarbin0 -> 129139 bytes
-rw-r--r--lib/bukkit.jarbin4718659 -> 4614591 bytes
-rw-r--r--lib/craftbukkit.jarbin10689331 -> 10786423 bytes
71 files changed, 769 insertions, 407 deletions
diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties
index 4e80ceafa..7a5ffe7bb 100644
--- a/Essentials/nbproject/project.properties
+++ b/Essentials/nbproject/project.properties
@@ -66,6 +66,7 @@ endorsed.classpath=
excludes=
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
file.reference.bPermissions.jar=../lib/bPermissions.jar
+file.reference.bpermissions2.jar=../lib/bpermissions2.jar
file.reference.bukkit.jar=../lib/bukkit.jar
file.reference.craftbukkit.jar=../lib/craftbukkit.jar
file.reference.iCo4.jar=../lib/iCo4.jar
@@ -76,6 +77,7 @@ 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
+file.reference.Privileges.jar=..\\lib\\Privileges.jar
file.reference.Vault.jar=../lib/Vault.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
@@ -95,7 +97,9 @@ javac.classpath=\
${reference.EssentialsGroupManager.jar}:\
${file.reference.bukkit.jar}:\
${file.reference.craftbukkit.jar}:\
- ${file.reference.Vault.jar}
+ ${file.reference.Vault.jar}:\
+ ${file.reference.Privileges.jar}:\
+ ${file.reference.bpermissions2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index e1c8c28b9..d8d1f5554 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -32,15 +32,20 @@ import com.earth2me.essentials.signs.SignPlayerListener;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.lang.reflect.Array;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
+import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
@@ -61,7 +66,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
- public static final int BUKKIT_VERSION = 1818;
+ public static final int BUKKIT_VERSION = 1952;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
@@ -277,7 +282,29 @@ public class Essentials extends JavaPlugin implements IEssentials
if (pc != null)
{
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
- return pc.execute(sender, commandLabel, args);
+ try
+ {
+ return pc.execute(sender, commandLabel, args);
+ }
+ catch (final Exception ex)
+ {
+ final ArrayList<StackTraceElement> elements = new ArrayList<StackTraceElement>(Arrays.asList(ex.getStackTrace()));
+ elements.remove(0);
+ final ArrayList<StackTraceElement> toRemove = new ArrayList<StackTraceElement>();
+ for (final StackTraceElement e : elements)
+ {
+ if (e.getClassName().equals("com.earth2me.essentials.Essentials"))
+ {
+ toRemove.add(e);
+ }
+ }
+ elements.removeAll(toRemove);
+ final StackTraceElement[] trace = elements.toArray(new StackTraceElement[elements.size()]);
+ ex.setStackTrace(trace);
+ ex.printStackTrace();
+ sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
+ return true;
+ }
}
}
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
index 35252532f..9ffe7e5b6 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
@@ -3,7 +3,6 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.io.*;
import java.util.HashMap;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
@@ -12,12 +11,14 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
+import org.bukkit.configuration.ConfigurationSection;
+import org.bukkit.configuration.InvalidConfigurationException;
+import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.config.Configuration;
-public class EssentialsConf extends Configuration
+public class EssentialsConf extends YamlConfiguration
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient File configFile;
@@ -26,15 +27,10 @@ public class EssentialsConf extends Configuration
public EssentialsConf(final File configFile)
{
- super(configFile);
+ super();
this.configFile = configFile;
- if (this.root == null)
- {
- this.root = new HashMap<String, Object>();
- }
}
- @Override
public void load()
{
configFile = configFile.getAbsoluteFile();
@@ -105,19 +101,24 @@ public class EssentialsConf extends Configuration
}
}
+
try
{
- super.load();
+ super.load(configFile);
}
- catch (RuntimeException e)
+ catch (FileNotFoundException ex)
{
- LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString());
- throw e;
+ LOGGER.log(Level.SEVERE, null, ex);
}
-
- if (this.root == null)
+ catch (IOException ex)
+ {
+ LOGGER.log(Level.SEVERE, null, ex);
+ }
+ catch (InvalidConfigurationException ex)
{
- this.root = new HashMap<String, Object>();
+ File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis());
+ configFile.renameTo(broken);
+ LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
}
}
@@ -192,7 +193,7 @@ public class EssentialsConf extends Configuration
public boolean hasProperty(final String path)
{
- return getProperty(path) != null;
+ return isSet(path);
}
public Location getLocation(final String path, final Server server) throws Exception
@@ -217,24 +218,25 @@ public class EssentialsConf extends Configuration
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());
+ set((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
+ set((path == null ? "" : path + ".") + "x", loc.getX());
+ set((path == null ? "" : path + ".") + "y", loc.getY());
+ set((path == null ? "" : path + ".") + "z", loc.getZ());
+ set((path == null ? "" : path + ".") + "yaw", loc.getYaw());
+ set((path == null ? "" : path + ".") + "pitch", loc.getPitch());
}
+ @Override
public ItemStack getItemStack(final String path)
{
final ItemStack stack = new ItemStack(
Material.valueOf(getString(path + ".type", "AIR")),
getInt(path + ".amount", 1),
(short)getInt(path + ".damage", 0));
- final List<String> enchants = getKeys(path + ".enchant");
+ final ConfigurationSection enchants = getConfigurationSection(path + ".enchant");
if (enchants != null)
{
- for (String enchant : enchants)
+ for (String enchant : enchants.getKeys(false))
{
final Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH));
if (enchantment == null)
@@ -270,14 +272,14 @@ public class EssentialsConf extends Configuration
}
// getData().getData() is broken
//map.put("data", stack.getDurability());
- setProperty(path, map);
+ set(path, map);
}
public long getLong(final String path, final long def)
{
try
{
- final Number num = (Number)getProperty(path);
+ final Number num = (Number)get(path);
return num == null ? def : num.longValue();
}
catch (ClassCastException ex)
@@ -291,7 +293,7 @@ public class EssentialsConf extends Configuration
{
try
{
- Number num = (Number)getProperty(path);
+ Number num = (Number)get(path);
return num == null ? def : num.doubleValue();
}
catch (ClassCastException ex)
@@ -299,4 +301,27 @@ public class EssentialsConf extends Configuration
return def;
}
}
+
+ public void save() {
+ try
+ {
+ save(configFile);
+ }
+ catch (IOException ex)
+ {
+ LOGGER.log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public Object getProperty(String path) {
+ return get(path);
+ }
+
+ public void setProperty(String path, Object object) {
+ set(path, object);
+ }
+
+ public void removeProperty(String path) {
+ set(path, null);
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java
index f3b447dae..0c413bfc8 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import java.util.logging.Level;
import org.bukkit.entity.Player;
@@ -22,10 +23,17 @@ public class EssentialsTimer implements Runnable
final long currentTime = System.currentTimeMillis();
for (Player player : ess.getServer().getOnlinePlayers())
{
- final User user = ess.getUser(player);
- onlineUsers.add(user);
- user.setLastOnlineActivity(currentTime);
- user.checkActivity();
+ try
+ {
+ final User user = ess.getUser(player);
+ onlineUsers.add(user);
+ user.setLastOnlineActivity(currentTime);
+ user.checkActivity();
+ }
+ catch (Exception e)
+ {
+ ess.getLogger().log(Level.WARNING, "EssentialsTimer Error:", e);
+ }
}
final Iterator<User> iterator = onlineUsers.iterator();
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java
index ae444af2e..26e6f25bc 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java
@@ -95,7 +95,7 @@ public class EssentialsUpgrade
}
final EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
- List<String> lines = conf.getStringList(name, null);
+ List<String> lines = conf.getStringList(name);
if (lines != null && !lines.isEmpty())
{
if (!file.createNewFile())
@@ -332,7 +332,7 @@ public class EssentialsUpgrade
config.setProperty("homes.home", defloc);
}
- List<String> worlds = config.getKeys("home.worlds");
+ Set<String> worlds = config.getConfigurationSection("home.worlds").getKeys(false);
Location loc;
String worldName;
@@ -381,7 +381,7 @@ public class EssentialsUpgrade
}
final EssentialsConf usersConfig = new EssentialsConf(usersFile);
usersConfig.load();
- for (String username : usersConfig.getKeys(null))
+ for (String username : usersConfig.getKeys(false))
{
final User user = new User(new OfflinePlayer(username, ess), ess);
final String nickname = usersConfig.getString(username + ".nickname");
@@ -389,7 +389,7 @@ public class EssentialsUpgrade
{
user.setNickname(nickname);
}
- final List<String> mails = usersConfig.getStringList(username + ".mail", null);
+ final List<String> mails = usersConfig.getStringList(username + ".mail");
if (mails != null && !mails.isEmpty())
{
user.setMails(mails);
@@ -701,7 +701,7 @@ public class EssentialsUpgrade
if (!config.hasProperty("spawns"))
{
final Spawns spawns = new Spawns();
- List<String> keys = config.getKeys();
+ Set<String> keys = config.getKeys(false);
for (String group : keys)
{
Location loc = getFakeLocation(config, group);
@@ -748,7 +748,7 @@ public class EssentialsUpgrade
if (!config.hasProperty("jails"))
{
final com.earth2me.essentials.settings.Jails jails = new com.earth2me.essentials.settings.Jails();
- List<String> keys = config.getKeys();
+ Set<String> keys = config.getKeys(false);
for (String jailName : keys)
{
Location loc = getFakeLocation(config, jailName);
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index 560eb6f79..b7a128ebc 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
+import com.earth2me.essentials.textreader.IText;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
@@ -14,9 +15,7 @@ public interface ISettings extends IConf
{
boolean areSignsDisabled();
- String format(String format, IUser user);
-
- String getAnnounceNewPlayerFormat(IUser user);
+ IText getAnnounceNewPlayerFormat();
boolean getAnnounceNewPlayers();
@@ -35,7 +34,7 @@ public interface ISettings extends IConf
String getCurrencySymbol();
int getOversizedStackSize();
-
+
int getDefaultStackSize();
double getHealCooldown();
@@ -66,7 +65,7 @@ public interface ISettings extends IConf
boolean getRespawnAtHome();
- List getMultipleHomes();
+ Set getMultipleHomes();
int getHomeLimit(String set);
@@ -101,7 +100,7 @@ public interface ISettings extends IConf
boolean isTradeInStacks(int id);
List<Integer> itemSpawnBlacklist();
-
+
List<EssentialsSign> enabledSigns();
boolean permissionBasedItemSpawn();
@@ -143,18 +142,18 @@ public interface ISettings extends IConf
public void setDebug(boolean debug);
Set<String> getNoGodWorlds();
-
+
boolean getUpdateBedAtDaytime();
-
+
boolean getRepairEnchanted();
-
+
boolean getIsWorldTeleportPermissions();
-
+
boolean registerBackInListener();
boolean getDisableItemPickupWhileAfk();
EventPriority getRespawnPriority();
-
+
long getTpaAcceptCancellation();
}
diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java
index f8ab2d02e..0011905ec 100644
--- a/Essentials/src/com/earth2me/essentials/Jails.java
+++ b/Essentials/src/com/earth2me/essentials/Jails.java
@@ -1,18 +1,24 @@
package com.earth2me.essentials;
+import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IJails;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
-import static com.earth2me.essentials.I18n._;
import java.io.File;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
-import org.bukkit.event.block.*;
-import org.bukkit.event.player.*;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockDamageEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.plugin.PluginManager;
@@ -33,13 +39,8 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
final PluginManager pluginManager = ess.getServer().getPluginManager();
final JailBlockListener blockListener = new JailBlockListener();
final JailPlayerListener playerListener = new JailPlayerListener();
- pluginManager.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Low, ess);
- pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess);
- pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess);
- pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess);
- pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess);
- pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess);
- pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess);
+ pluginManager.registerEvents(blockListener, ess);
+ pluginManager.registerEvents(playerListener, ess);
}
@Override
@@ -146,9 +147,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
- private class JailBlockListener extends BlockListener
+ private class JailBlockListener implements Listener
{
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockBreak(final BlockBreakEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -158,7 +159,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockPlace(final BlockPlaceEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -168,7 +169,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onBlockDamage(final BlockDamageEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -180,9 +181,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
- private class JailPlayerListener extends PlayerListener
+ private class JailPlayerListener implements Listener
{
- @Override
+ @EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -192,7 +193,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -207,11 +208,18 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
- LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
+ if (ess.getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
+ }
+ else
+ {
+ LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
+ }
}
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(final PlayerTeleportEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -226,12 +234,19 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
- LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
+ if (ess.getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
+ }
+ else
+ {
+ LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
+ }
}
user.sendMessage(_("jailMessage"));
}
- @Override
+ @EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final User user = ess.getUser(event.getPlayer());
@@ -246,7 +261,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
}
catch (Exception ex)
{
- LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
+ if (ess.getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
+ }
+ else
+ {
+ LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
+ }
}
user.sendMessage(_("jailMessage"));
}
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index fa0be02c7..440d3fad3 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -17,6 +17,8 @@ import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
@@ -665,18 +667,6 @@ public class OfflinePlayer implements Player
}
@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.");
@@ -857,4 +847,58 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public void hidePlayer(Player player)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void showPlayer(Player player)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean canSee(Player player)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addPotionEffect(PotionEffect pe)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addPotionEffect(PotionEffect pe, boolean bln)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addPotionEffects(Collection<PotionEffect> clctn)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean hasPotionEffect(PotionEffectType pet)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void removePotionEffect(PotionEffectType pet)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<PotionEffect> getActivePotionEffects()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index e50e9c16f..218a9163c 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -4,6 +4,10 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.signs.Signs;
+import com.earth2me.essentials.textreader.IText;
+import com.earth2me.essentials.textreader.KeywordReplacer;
+import com.earth2me.essentials.textreader.SimpleTextInput;
+import com.earth2me.essentials.textreader.SimpleTextPager;
import java.io.File;
import java.text.MessageFormat;
import java.util.*;
@@ -41,15 +45,15 @@ public class Settings implements ISettings
}
@Override
- public List<String> getMultipleHomes()
+ public Set<String> getMultipleHomes()
{
- return config.getKeys("sethome-multiple");
+ return config.getConfigurationSection("sethome-multiple").getKeys(false);
}
@Override
public int getHomeLimit(final User user)
{
- final List<String> homeList = getMultipleHomes();
+ final Set<String> homeList = getMultipleHomes();
if (homeList == null)
{
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
@@ -112,7 +116,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandDisabled(String label)
{
- for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
+ for (String c : config.getStringList("disabled-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -132,7 +136,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandRestricted(String label)
{
- for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
+ for (String c : config.getStringList("restricted-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -146,7 +150,7 @@ public class Settings implements ISettings
@Override
public boolean isPlayerCommand(String label)
{
- for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
+ for (String c : config.getStringList("player-commands"))
{
if (!c.equalsIgnoreCase(label))
{
@@ -160,9 +164,7 @@ public class Settings implements ISettings
@Override
public boolean isCommandOverridden(String name)
{
- List<String> defaultList = new ArrayList<String>(1);
- defaultList.add("god");
- for (String c : config.getStringList("overridden-commands", defaultList))
+ for (String c : config.getStringList("overridden-commands"))
{
if (!c.equalsIgnoreCase(name))
{
@@ -211,7 +213,7 @@ public class Settings implements ISettings
@Override
public Object getKit(String name)
{
- Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
+ Map<String, Object> kits = (Map<String, Object>)config.get("kits");
for (Map.Entry<String, Object> entry : kits.entrySet())
{
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
@@ -225,7 +227,7 @@ public class Settings implements ISettings
@Override
public Map<String, Object> getKits()
{
- return (Map<String, Object>)config.getProperty("kits");
+ return (Map<String, Object>)config.get("kits");
}
@Override
@@ -250,7 +252,7 @@ public class Settings implements ISettings
{
}
- return ChatColor.getByCode(Integer.parseInt(colorName, 16));
+ return ChatColor.getByChar(colorName);
}
@Override
@@ -324,15 +326,9 @@ public class Settings implements ISettings
}
@Override
- public String getAnnounceNewPlayerFormat(IUser user)
+ public IText getAnnounceNewPlayerFormat()
{
- return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
- }
-
- @Override
- public String format(String format, IUser user)
- {
- return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
+ return new SimpleTextInput(Util.replaceColor(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
}
@Override
@@ -357,30 +353,34 @@ public class Settings implements ISettings
public void reloadConfig()
{
config.load();
- noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
+ noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
enabledSigns = getEnabledSigns();
itemSpawnBl = getItemSpawnBlacklist();
chatFormats.clear();
}
-
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
-
+
@Override
public List<Integer> itemSpawnBlacklist()
{
return itemSpawnBl;
}
-
+
private List<Integer> getItemSpawnBlacklist()
{
final List<Integer> epItemSpwn = new ArrayList<Integer>();
+ if (ess.getItemDb() == null)
+ {
+ logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
+ return epItemSpwn;
+ }
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
{
itemName = itemName.trim();
if (itemName.isEmpty())
{
continue;
- }
+ }
try
{
final ItemStack iStack = ess.getItemDb().get(itemName);
@@ -393,20 +393,19 @@ public class Settings implements ISettings
}
return epItemSpwn;
}
-
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
-
+
@Override
public List<EssentialsSign> enabledSigns()
{
return enabledSigns;
}
-
+
private List<EssentialsSign> getEnabledSigns()
{
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
-
- for (String signName : config.getStringList("enabledSigns", null))
+
+ for (String signName : config.getStringList("enabledSigns"))
{
signName = signName.trim().toUpperCase(Locale.ENGLISH);
if (signName.isEmpty())
@@ -600,7 +599,6 @@ public class Settings implements ISettings
{
return config.getBoolean("death-messages", true);
}
-
private Set<String> noGodWorlds = new HashSet<String>();
@Override
diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java
index 6cd9ce93a..933b54b3f 100644
--- a/Essentials/src/com/earth2me/essentials/Trade.java
+++ b/Essentials/src/com/earth2me/essentials/Trade.java
@@ -13,6 +13,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
+import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
@@ -38,7 +39,7 @@ public class Trade
{
this(null, null, items, null, ess);
}
-
+
public Trade(final int exp, final IEssentials ess)
{
this(null, null, null, exp, ess);
@@ -79,9 +80,10 @@ public class Trade
{
throw new ChargeException(_("notEnoughMoney"));
}
-
- if (exp != null && exp > 0
- && SetExpFix.getTotalExperience(user) < exp) {
+
+ if (exp != null && exp > 0
+ && SetExpFix.getTotalExperience(user) < exp)
+ {
throw new ChargeException(_("notEnoughExperience"));
}
}
@@ -103,9 +105,25 @@ public class Trade
if (dropItems)
{
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
+ final Location loc = user.getLocation();
for (ItemStack itemStack : leftOver.values())
{
- InventoryWorkaround.dropItem(user.getLocation(), itemStack);
+ final int maxStackSize = itemStack.getType().getMaxStackSize();
+ final int stacks = itemStack.getAmount() / maxStackSize;
+ final int leftover = itemStack.getAmount() % maxStackSize;
+ final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
+ for (int i = 0; i < stacks; i++)
+ {
+ final ItemStack stack = itemStack.clone();
+ stack.setAmount(maxStackSize);
+ itemStacks[i] = loc.getWorld().dropItem(loc, stack);
+ }
+ if (leftover > 0)
+ {
+ final ItemStack stack = itemStack.clone();
+ stack.setAmount(leftover);
+ itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
+ }
}
}
else
@@ -173,7 +191,7 @@ public class Trade
{
return itemStack;
}
-
+
public Integer getExperience()
{
return exp;
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index e23fe1de0..b289333aa 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -544,6 +544,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
public boolean canBuild()
{
+ if (isOp())
+ {
+ return true;
+ }
return ess.getPermissionsHandler().canBuild(base, getGroup());
}
diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java
index e2a365ad2..44ac096b9 100644
--- a/Essentials/src/com/earth2me/essentials/UserData.java
+++ b/Essentials/src/com/earth2me/essentials/UserData.java
@@ -209,7 +209,7 @@ public abstract class UserData extends PlayerExtension implements IConf
private List<Integer> _getUnlimited()
{
- return config.getIntList("unlimited", new ArrayList<Integer>());
+ return config.getIntegerList("unlimited");
}
public List<Integer> getUnlimited()
@@ -383,7 +383,7 @@ public abstract class UserData extends PlayerExtension implements IConf
private List<String> _getMails()
{
- return config.getStringList("mail", new ArrayList<String>());
+ return config.getStringList("mail");
}
public List<String> getMails()
@@ -491,7 +491,7 @@ public abstract class UserData extends PlayerExtension implements IConf
public List<String> getIgnoredPlayers()
{
- return config.getStringList("ignore", new ArrayList<String>());
+ return config.getStringList("ignore");
}
public void setIgnoredPlayers(List<String> players)
diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java
index d15438c7d..94b504241 100644
--- a/Essentials/src/com/earth2me/essentials/UserMap.java
+++ b/Essentials/src/com/earth2me/essentials/UserMap.java
@@ -61,7 +61,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
try
{
- return users.get(Util.sanitizeFileName(name));
+ return users.get(name);
}
catch (ExecutionException ex)
{
@@ -76,18 +76,31 @@ public class UserMap extends CacheLoader<String, User> implements IConf
@Override
public User load(final String name) throws Exception
{
+ String sanitizedName = Util.sanitizeFileName(name);
+ if (!sanitizedName.equals(name))
+ {
+ User user = getUser(sanitizedName);
+ if (user == null)
+ {
+ throw new Exception("User not found!");
+ }
+ else
+ {
+ return user;
+ }
+ }
for (Player player : ess.getServer().getOnlinePlayers())
{
if (player.getName().equalsIgnoreCase(name))
{
- keys.add(Util.sanitizeFileName(name));
+ keys.add(sanitizedName);
return new User(player, ess);
}
}
- final File userFile = getUserFile(name);
+ final File userFile = getUserFile2(sanitizedName);
if (userFile.exists())
{
- keys.add(Util.sanitizeFileName(name));
+ keys.add(sanitizedName);
return new User(new OfflinePlayer(name, ess), ess);
}
throw new Exception("User not found!");
@@ -103,6 +116,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
keys.remove(Util.sanitizeFileName(name));
users.invalidate(Util.sanitizeFileName(name));
+ users.invalidate(name);
}
public Set<String> getAllUniqueUsers()
@@ -114,10 +128,15 @@ public class UserMap extends CacheLoader<String, User> implements IConf
{
return keys.size();
}
-
+
public File getUserFile(final String name)
{
+ return getUserFile2(Util.sanitizeFileName(name));
+ }
+
+ private File getUserFile2(final String name)
+ {
final File userFolder = new File(ess.getDataFolder(), "userdata");
- return new File(userFolder, Util.sanitizeFileName(name) + ".yml");
+ return new File(userFolder, name + ".yml");
}
}
diff --git a/Essentials/src/com/earth2me/essentials/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index 386433326..3e3a7efd0 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -21,11 +21,18 @@ public class Util
{
}
private final static Logger logger = Logger.getLogger("Minecraft");
- private final static Pattern INVALIDCHARS = Pattern.compile("[^a-z0-9]");
+ private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
+ private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
public static String sanitizeFileName(final String name)
{
- return INVALIDCHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
+ final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
+ return newName;
+ }
+
+ public static String sanitizeString(final String string)
+ {
+ return INVALIDCHARS.matcher(string).replaceAll("");
}
public static String formatDateDiff(long date)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandback.java b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
index 67698598a..2ad39ceea 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandback.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
@@ -20,5 +20,6 @@ public class Commandback extends EssentialsCommand
charge.isAffordableFor(user);
user.sendMessage(_("backUsageMsg"));
user.getTeleport().back(charge);
+ throw new NoChargeException();
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index ebe57adf7..f14422efd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -48,7 +48,7 @@ public class Commandhome extends EssentialsCommand
if ("bed".equalsIgnoreCase(homeName))
{
final Location bed = player.getBedSpawnLocation();
- if (bed != null)
+ if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK)
{
user.getTeleport().teleport(bed, charge, TeleportCause.COMMAND);
throw new NoChargeException();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
index c23161c0e..566cb69d5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
@@ -31,7 +31,8 @@ public class Commandkill extends EssentialsCommand
continue;
}
- matchPlayer.damage(1000);
+ matchPlayer.damage(1000);
+ matchPlayer.setHealth(0);
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
index 4a9928b85..abc551f58 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java
@@ -40,7 +40,7 @@ public class Commandmail extends EssentialsCommand
{
if (!user.isAuthorized("essentials.mail.send"))
{
- throw new Exception(_("noPerm","essentials.mail.send"));
+ throw new Exception(_("noPerm", "essentials.mail.send"));
}
Player player = server.getPlayer(args[1]);
@@ -59,7 +59,8 @@ public class Commandmail extends EssentialsCommand
}
if (!u.isIgnoredPlayer(user.getName()))
{
- u.addMail(user.getName() + ": " + Util.stripColor(getFinalArg(args, 2)));
+ final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2)));
+ u.addMail(user.getName() + ": " + mail);
}
user.sendMessage(_("mailSent"));
return;
@@ -68,7 +69,7 @@ public class Commandmail extends EssentialsCommand
{
if (!user.isAuthorized("essentials.mail.sendall"))
{
- throw new Exception(_("noPerm","essentials.mail.sendall"));
+ throw new Exception(_("noPerm", "essentials.mail.sendall"));
}
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1))));
user.sendMessage(_("mailSent"));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java
index 1fad701b2..0956f4082 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java
@@ -1,8 +1,9 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.Util;
import org.bukkit.Server;
+import org.bukkit.command.CommandSender;
public class Commandping extends EssentialsCommand
@@ -13,8 +14,16 @@ public class Commandping extends EssentialsCommand
}
@Override
- public void run(Server server, User player, String commandLabel, String[] args) throws Exception
+ public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
- player.sendMessage(_("pong"));
+ if (args.length < 1)
+ {
+
+ sender.sendMessage(_("pong"));
+ }
+ else
+ {
+ sender.sendMessage(Util.replaceColor(getFinalArg(args, 0)));
+ }
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
index cf9e43f9f..8d1278fd0 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
@@ -80,7 +80,7 @@ public class Commandrepair extends EssentialsCommand
private void repairItem(final ItemStack item) throws Exception
{
final Material material = Material.getMaterial(item.getTypeId());
- if (material.isBlock() || material.getMaxDurability() < 0)
+ if (material.isBlock() || material.getMaxDurability() < 1)
{
throw new Exception(_("repairInvalidType"));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
index 73c86eba4..d52315241 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawner.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Mob;
+import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
@@ -47,11 +48,14 @@ public class Commandspawner extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
- if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase()))
+ if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("unableToSpawnMob"));
}
+ final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess);
+ charge.isAffordableFor(user);
((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
+ charge.charge(user);
user.sendMessage(_("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 f867a1503..948c82871 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -7,6 +7,7 @@ import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.util.Locale;
import java.util.Random;
+import java.util.Set;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -26,7 +27,19 @@ public class Commandspawnmob extends EssentialsCommand
{
if (args.length < 1)
{
- throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList())));
+ Set<String> availableList = Mob.getMobList();
+ for (String mob : availableList)
+ {
+ if (!user.isAuthorized("essentials.spawnmob." + mob.toLowerCase()))
+ {
+ availableList.remove(mob);
+ }
+ }
+ if (availableList.isEmpty())
+ {
+ availableList.add(_("none"));
+ }
+ throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(availableList)));
}
@@ -79,7 +92,7 @@ public class Commandspawnmob extends EssentialsCommand
User otherUser = null;
if (args.length >= 3)
{
- otherUser = getPlayer(ess.getServer(), args, 2);
+ otherUser = getPlayer(ess.getServer(), args, 2);
}
final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
final Location sloc = Util.getSafeDestination(loc);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
index 7f758ad2e..86394e502 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java
@@ -30,7 +30,13 @@ public class Commandsudo extends EssentialsCommand
}
//TODO: Translate this.
- sender.sendMessage("Running the command as " + user.getDisplayName());
+ if (user.isAuthorized("essentials.sudo.exempt"))
+ {
+ throw new Exception("You cannot sudo this user");
+ }
+
+ //TODO: Translate this.
+ sender.sendMessage("Forcing " + user.getDisplayName() + " to run: /" + command + " " + arguments);
final PluginCommand execCommand = ess.getServer().getPluginCommand(command);
if (execCommand != null)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java
index 6ccb3f7b6..64f7fe04a 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandsuicide.java
@@ -19,6 +19,7 @@ public class Commandsuicide extends EssentialsCommand
EntityDamageEvent ede = new EntityDamageEvent(user, EntityDamageEvent.DamageCause.SUICIDE, 1000);
server.getPluginManager().callEvent(ede);
user.damage(1000);
+ user.setHealth(0);
user.sendMessage(_("suicideMessage"));
ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName()));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 2e3e024a3..891742043 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -22,7 +22,9 @@ public class Commandtpaccept extends EssentialsCommand
final User target = user.getTeleportRequest();
if (target == null
|| target.getBase() instanceof OfflinePlayer
- || (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
+ || (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere"))
+ || (!user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall"))
+ )
{
throw new Exception(_("noPendingRequest"));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
index 51b64563b..62641172b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java
@@ -8,6 +8,7 @@ import com.earth2me.essentials.Warps;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -44,10 +45,10 @@ public class Commandwarp extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
- warpUser(otherUser, args[0]);
+ warpUser(user, otherUser, args[0]);
throw new NoChargeException();
}
- warpUser(user, args[0]);
+ warpUser(user, user, args[0]);
throw new NoChargeException();
}
}
@@ -65,7 +66,7 @@ public class Commandwarp extends EssentialsCommand
{
throw new Exception(_("playerNotFound"));
}
- warpUser(otherUser, args[0]);
+ otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
throw new NoChargeException();
}
@@ -112,17 +113,12 @@ public class Commandwarp extends EssentialsCommand
}
}
- private void warpUser(final User user, final String name) throws Exception
+ private void warpUser(final User owner, final User user, final String name) throws Exception
{
- final Trade charge = new Trade(this.getName(), ess);
- charge.isAffordableFor(user);
- if (ess.getSettings().getPerWarpPermission())
+ final Trade charge = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess);
+ charge.isAffordableFor(owner);
+ if (ess.getSettings().getPerWarpPermission() && !owner.isAuthorized("essentials.warp." + name))
{
- if (user.isAuthorized("essentials.warp." + name))
- {
- user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
- return;
- }
throw new Exception(_("warpUsePermission"));
}
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
index 57e2eda63..0ea06e72b 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
@@ -232,12 +232,6 @@ public class FakeWorld implements World
}
@Override
- public long getId()
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
public Location getSpawnLocation()
{
throw new UnsupportedOperationException("Not supported yet.");
@@ -554,4 +548,40 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public long getTicksPerAnimalSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setTicksPerAnimalSpawns(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public long getTicksPerMonsterSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setTicksPerMonsterSpawns(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> type)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<Entity> getEntitiesByClasses(Class<?>... types)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
index 308568452..a6d5d4fbc 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
@@ -1,17 +1,12 @@
package com.earth2me.essentials.craftbukkit;
-import com.earth2me.essentials.craftbukkit.FakeInventory;
import java.util.HashMap;
import java.util.Map;
-import org.bukkit.Location;
-import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/*
- * This class can be removed when
- * https://github.com/Bukkit/CraftBukkit/pull/193
- * is accepted to CraftBukkit
+ * This class can be removed when https://github.com/Bukkit/CraftBukkit/pull/193 is accepted to CraftBukkit
*/
public final class InventoryWorkaround
@@ -47,7 +42,7 @@ public final class InventoryWorkaround
{
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
}
-
+
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
{
if (item == null)
@@ -93,10 +88,9 @@ public final class InventoryWorkaround
{
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
- /* TODO: some optimization
- * - Create a 'firstPartial' with a 'fromIndex'
- * - Record the lastPartial per Material
- * - Cache firstEmpty result
+ /*
+ * TODO: some optimization - Create a 'firstPartial' with a 'fromIndex' - Record the lastPartial per Material -
+ * Cache firstEmpty result
*/
// combine items
@@ -175,7 +169,7 @@ public final class InventoryWorkaround
final int amount = item.getAmount();
final int partialAmount = partialItem.getAmount();
-
+
// Check if it fully fits
if (amount + partialAmount <= maxAmount)
{
@@ -325,25 +319,4 @@ public final class InventoryWorkaround
}
return leftover.isEmpty();
}
-
- public static Item[] dropItem(final Location loc, final ItemStack itm)
- {
- final int maxStackSize = itm.getType().getMaxStackSize();
- final int stacks = itm.getAmount() / maxStackSize;
- final int leftover = itm.getAmount() % maxStackSize;
- final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
- for (int i = 0; i < stacks; i++)
- {
- final ItemStack stack = itm.clone();
- stack.setAmount(maxStackSize);
- itemStacks[i] = loc.getWorld().dropItem(loc, stack);
- }
- if (leftover > 0)
- {
- final ItemStack stack = itm.clone();
- stack.setAmount(leftover);
- itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
- }
- return itemStacks;
- }
}
diff --git a/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java b/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java
new file mode 100644
index 000000000..f4122bf53
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/perm/BPermissions2Handler.java
@@ -0,0 +1,62 @@
+package com.earth2me.essentials.perm;
+
+import de.bananaco.bpermissions.api.ApiLayer;
+import de.bananaco.bpermissions.api.World;
+import de.bananaco.bpermissions.api.WorldManager;
+import de.bananaco.bpermissions.api.util.Calculable;
+import de.bananaco.bpermissions.api.util.CalculableType;
+import java.util.Arrays;
+import java.util.List;
+import org.bukkit.entity.Player;
+
+
+public class BPermissions2Handler extends SuperpermsHandler
+{
+ public BPermissions2Handler()
+ {
+
+ }
+
+ @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 String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
+ return Arrays.asList(groups);
+ }
+
+ @Override
+ public boolean inGroup(final Player base, final String group)
+ {
+ return ApiLayer.hasGroup(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
+ }
+
+ @Override
+ public boolean canBuild(final Player base, final String group)
+ {
+ return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
+ }
+
+ @Override
+ public String getPrefix(final Player base)
+ {
+ return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
+ }
+
+ @Override
+ public String getSuffix(final Player base)
+ {
+ return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
+ }
+
+}
diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
index 8c16aab7a..a344968c2 100644
--- a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.perm;
+import com.earth2me.essentials.Util;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
@@ -111,17 +112,6 @@ public class PermissionsHandler implements IPermissionsHandler
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 GMplugin = pluginManager.getPlugin("GroupManager");
if (GMplugin != null && GMplugin.isEnabled())
{
@@ -144,6 +134,38 @@ public class PermissionsHandler implements IPermissionsHandler
return;
}
+ final Plugin privPlugin = pluginManager.getPlugin("Privileges");
+ if (privPlugin != null && privPlugin.isEnabled())
+ {
+ if (!(handler instanceof PrivilegesHandler))
+ {
+ LOGGER.log(Level.INFO, "Essentials: Using Privileges based permissions.");
+ handler = new PrivilegesHandler(privPlugin);
+ }
+ return;
+ }
+
+ final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
+ if (bPermPlugin != null && bPermPlugin.isEnabled())
+ {
+ final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
+ if (Util.isInt(bVer) && Integer.parseInt(bVer) < 284)
+ {
+ if (!(handler instanceof BPermissionsHandler))
+ {
+ LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
+ handler = new BPermissionsHandler();
+ }
+ return;
+ }
+ if (!(handler instanceof BPermissions2Handler))
+ {
+ LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
+ handler = new BPermissions2Handler();
+ }
+ return;
+
+ }
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
if (permPlugin != null && permPlugin.isEnabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java b/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java
new file mode 100644
index 000000000..c81f93cbc
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/perm/PrivilegesHandler.java
@@ -0,0 +1,61 @@
+package com.earth2me.essentials.perm;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.krinsoft.privileges.Privileges;
+import net.krinsoft.privileges.groups.Group;
+import net.krinsoft.privileges.groups.GroupManager;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+public class PrivilegesHandler extends SuperpermsHandler
+{
+ private final transient Privileges plugin;
+ private final GroupManager manager;
+
+ public PrivilegesHandler(final Plugin plugin)
+ {
+ this.plugin = (Privileges) plugin;
+ this.manager = this.plugin.getGroupManager();
+ }
+
+ @Override
+ public String getGroup(final Player base)
+ {
+ Group group = manager.getGroup(base);
+ if (group == null)
+ {
+ return null;
+ }
+ return group.getName();
+ }
+
+ @Override
+ public List<String> getGroups(final Player base)
+ {
+ Group group = manager.getGroup(base);
+ if (group == null)
+ {
+ return new ArrayList<String>();
+ }
+ return group.getGroupTree();
+ }
+
+ @Override
+ public boolean inGroup(final Player base, final String group)
+ {
+ Group pGroup = manager.getGroup(base);
+ if (pGroup == null)
+ {
+ return false;
+ }
+ return pGroup.isMemberOf(group);
+ }
+
+ @Override
+ public boolean canBuild(Player base, String group)
+ {
+ return base.hasPermission("essentials.build") || base.hasPermission("privileges.build");
+ }
+
+}
diff --git a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java
index 70a118bcf..2e767cb72 100644
--- a/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/SuperpermsHandler.java
@@ -27,7 +27,7 @@ public class SuperpermsHandler implements IPermissionsHandler
@Override
public boolean inGroup(final Player base, final String group)
{
- return false;
+ return hasPermission(base, "group." + group);
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
index d9e28becc..a0446179f 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
@@ -6,7 +6,7 @@ import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EndermanPickupEvent;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
@@ -44,7 +44,7 @@ public class SignEntityListener implements Listener
}
@EventHandler(priority = EventPriority.LOW)
- public void onEndermanPickup(final EndermanPickupEvent event)
+ public void onEntityChangeBlock(final EntityChangeBlockEvent event)
{
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
index f64b6f3f1..088e74f01 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
@@ -129,7 +129,7 @@ public class SignProtection extends EssentialsSign
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
{
final BlockSign sign = new BlockSign(block);
- if (sign.getLine(0).equalsIgnoreCase(this.getSuccessName()))
+ if (sign.getLine(0).equals(this.getSuccessName()))
{
return checkProtectionSign(sign, user, username);
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index 943a14a83..6b47ebc76 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -36,7 +36,7 @@ public class SignTrade extends EssentialsSign
try
{
stored = getTrade(sign, 1, true, true, ess);
- substractAmount(sign, 1, stored, ess);
+ subtractAmount(sign, 1, stored, ess);
stored.pay(player);
}
catch (SignException e)
@@ -53,12 +53,14 @@ public class SignTrade extends EssentialsSign
final Trade charge = getTrade(sign, 1, false, false, ess);
final Trade trade = getTrade(sign, 2, false, true, ess);
charge.isAffordableFor(player);
+ addAmount(sign, 1, charge, ess);
+ subtractAmount(sign, 2, trade, ess);
if (!trade.pay(player, false))
{
+ subtractAmount(sign, 1, charge, ess);
+ addAmount(sign, 2, trade, ess);
throw new ChargeException("Full inventory");
}
- substractAmount(sign, 2, trade, ess);
- addAmount(sign, 1, charge, ess);
charge.charge(player);
Trade.log("Sign", "Trade", "Interact", sign.getLine(3), charge, username, trade, sign.getBlock().getLocation(), ess);
}
@@ -256,7 +258,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(_("invalidSignLine", index + 1));
}
- protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
+ protected final void subtractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
{
final Double money = trade.getMoney();
if (money != null)
@@ -294,6 +296,7 @@ public class SignTrade extends EssentialsSign
}
}
+ //TODO: Translate these exceptions.
private void changeAmount(final ISign sign, final int index, final double value, final IEssentials ess) throws SignException
{
@@ -313,7 +316,7 @@ public class SignTrade extends EssentialsSign
final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
if (newline.length() > 15)
{
- throw new SignException("Line too long!");
+ throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -329,7 +332,7 @@ public class SignTrade extends EssentialsSign
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
if (newline.length() > 15)
{
- throw new SignException("Line too long!");
+ throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
@@ -343,7 +346,7 @@ public class SignTrade extends EssentialsSign
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
if (newline.length() > 15)
{
- throw new SignException("Line too long!");
+ throw new SignException("This sign is full: Line too long!");
}
sign.setLine(index, newline);
return;
diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java
index a7aab67ba..4c4e3364b 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java
@@ -33,12 +33,14 @@ public class KeywordReplacer implements IText
String displayName, ipAddress, balance, mails, world;
String worlds, online, unique, playerlist, date, time;
String worldTime12, worldTime24, worldDate, plugins;
- String version;
+ String userName, address, version;
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
displayName = user.getDisplayName();
+ userName = user.getName();
ipAddress = user.getAddress().getAddress().toString();
+ address = user.getAddress().toString();
balance = Double.toString(user.getMoney());
mails = Integer.toString(user.getMails().size());
world = user.getLocation().getWorld().getName();
@@ -107,8 +109,12 @@ public class KeywordReplacer implements IText
for (int i = 0; i < input.getLines().size(); i++)
{
String line = input.getLines().get(i);
+
line = line.replace("{PLAYER}", displayName);
+ line = line.replace("{DISPLAYNAME}", displayName);
+ line = line.replace("{USERNAME}", displayName);
line = line.replace("{IP}", ipAddress);
+ line = line.replace("{ADDRESS}", ipAddress);
line = line.replace("{BALANCE}", balance);
line = line.replace("{MAILS}", mails);
line = line.replace("{WORLD}", world);
diff --git a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java
new file mode 100644
index 000000000..a9f9e1480
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java
@@ -0,0 +1,35 @@
+package com.earth2me.essentials.textreader;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+
+public class SimpleTextInput implements IText
+{
+ private final transient List<String> lines = new ArrayList<String>();
+
+ public SimpleTextInput (final String input) {
+ lines.add(input);
+ }
+
+ @Override
+ public List<String> getLines()
+ {
+ return lines;
+ }
+
+ @Override
+ public List<String> getChapters()
+ {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Map<String, Integer> getBookmarks()
+ {
+ return Collections.emptyMap();
+ }
+
+}
diff --git a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java
new file mode 100644
index 000000000..ea1b787d5
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java
@@ -0,0 +1,31 @@
+package com.earth2me.essentials.textreader;
+
+import org.bukkit.command.CommandSender;
+
+
+public class SimpleTextPager
+{
+ private final transient IText text;
+
+ public SimpleTextPager(final IText text)
+ {
+ this.text = text;
+ }
+
+ public void showPage(final CommandSender sender)
+ {
+ for (String line : text.getLines())
+ {
+ sender.sendMessage(line);
+ }
+ }
+
+ public String getString(int line)
+ {
+ if (text.getLines().size() < line)
+ {
+ return null;
+ }
+ return text.getLines().get(line);
+ }
+}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 63770a293..00585f35f 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -291,8 +291,8 @@ sethome-multiple:
# essentials.sethome.multiple.staff
staff: 10
-#Set timeout in seconds for players to accept tpa before request is cancelled.
-#Set to 0 for no timeout
+# Set timeout in seconds for players to accept tpa before request is cancelled.
+# Set to 0 for no timeout
tpa-accept-cancellation: 0
############################################################
@@ -313,7 +313,7 @@ command-costs:
#example: 1000
# /kit tools costs $1500 PER USE
#kit-tools: 1500
-
+
# Set this to a currency symbol you want to use.
currency-symbol: '$'
@@ -335,7 +335,7 @@ 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.
+# The individual 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
@@ -346,22 +346,22 @@ hide-permissionless-help: true
############################################################
chat:
-
+
# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.
# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
# Or with essentials.chat.question can override this by prefixing text with a question mark (?)
# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
radius: 0
-
+
# Chat formatting can be done in two ways, you can either define a standard format for all chat
# Or you can give a group specific chat format, to give some extra variation.
# If set to the default chat format which "should" be compatible with ichat.
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
-
+
format: '<{DISPLAYNAME}> {MESSAGE}'
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
-
+
group-formats:
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
@@ -400,13 +400,13 @@ protect:
# Which blocks should people be prevented from placing
placement: 10,11,46,327
-
+
# Which items should people be prevented from using
usage: 327
-
+
# Which blocks should people be prevented from breaking
break:
-
+
# Which blocks should not be pushed by pistons
piston:
@@ -460,12 +460,12 @@ protect:
mushroom_cow: false
magma_cube: false
snowman: false
-
+
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
creeper:
max-height: -1
-
+
# Protect various blocks.
protect:
# Protect all signs
@@ -481,7 +481,7 @@ protect:
# 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
memstore: false
@@ -510,16 +510,16 @@ protect:
# Burn, baby, burn! Should fire damage be disabled?
firedmg: false
-
+
# Should the damage after hit by a lightning be disabled?
lightning: false
# Should people with build: false in permissions be allowed to build
# Set true to disable building for those people
build: true
-
+
# Should people with build: false in permissions be allowed to use items
- # Set true to disable useing for those people
+ # Set true to disable using for those people
use: true
# Should we tell people they are not allowed to build
@@ -544,7 +544,7 @@ newbies:
# If not, set to ''
#announce-format: ''
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
-
+
# When we spawn for the first time, which spawnpoint do we use?
# Set to "none" if you want to use the spawn point of the world.
spawnpoint: newbies
diff --git a/Essentials/src/info.txt b/Essentials/src/info.txt
index e05843dcb..efc629923 100644
--- a/Essentials/src/info.txt
+++ b/Essentials/src/info.txt
@@ -7,6 +7,10 @@ Name it info_username.txt or info_groupname.txt
This also works with motd and rules.
+Extra pages:
+Type /info Colours
+Type /info Tags
+
It can contain chapters like the Chapter1 below:
#Chapter1
@@ -25,7 +29,9 @@ Minecraft colors:
#Tags
PLAYER: {PLAYER}
+USERNAME: {PLAYER}
IP: {IP}
+ADDRESS: {ADDRESS}
BALANCE: {BALANCE}
MAILS: {MAILS}
WORLD: {WORLD}
@@ -39,3 +45,4 @@ WORLDTIME12: {WORLDTIME12}
WORLDTIME24: {WORLDTIME24}
WORLDDATE: {WORLDDATE}
PLUGINS: {PLUGINS}
+VERSION: {VERSION} \ No newline at end of file
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index abc643ae4..ec55210b0 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Request sent to {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
-returnPlayerToJailError=Error occurred when trying to return player to jail.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=second
seconds=seconds
seenOffline=Player {0} is offline since {1}
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index b3821ea27..03bbe6f78 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport.
requestSent=\u00a77Anmodning sendt til {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
-returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=sekund
seconds=sekunder
seenOffline=Spilleren {0} har v\u00c3\u00a6ret offline i {1}
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 1b84e78a8..edffe33ac 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt.
requestSent=\u00a77Anfrage gesendet an {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
-returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=Sekunde
seconds=Sekunden
seenOffline=Spieler {0} ist offline seit {1}
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index 86dbc9a37..b03a49812 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} denied your teleport request
requestSent=\u00a77Request sent to {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
-returnPlayerToJailError=Error occurred when trying to return player to jail.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=second
seconds=seconds
seenOffline=Player {0} is offline since {1}
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index 7227f375c..4f3da7738 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte.
requestSent=\u00a77Peticion enviada a {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
-returnPlayerToJailError=Error al intentar quitar al jugador de la carcel.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=segundo
seconds=segundos
seenOffline=El jugador {0} esta desconectado desde {1}
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 9258963bd..1649a552a 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portat
requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77.
requestTimedOut=\u00a7cLa de mande de t\u00e9l\u00e9portation a expir\u00e9.
requiredBukkit=* ! * Vous avez besoin au moins de la version {0} de CraftBukkit. T\u00e9l\u00e9chargez-la ici http://ci.bukkit.org.
-returnPlayerToJailError=Erreur survenue lors de la tentative d'emprisonner de nouveau un joueur.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=seconde
seconds=secondes
seenOffline=Le joueur {0} est hors ligne depuis {1}
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 30c9caaee..16d942b0d 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -295,7 +295,7 @@ requestDeniedFrom=\u00a77{0} denied your teleport request.
requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77.
requestTimedOut=\u00a7cTeleport request has timed out
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
-returnPlayerToJailError=Fout opgetreden bij terugzetten van speler in gevangenis.
+returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
second=seconde
seconds=seconde
seenOffline=Speler {0} is offline vanaf {1}
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 0ec1ee6d9..b9cbd5227 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides an essential, core set of commands for Bukkit.
-authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
+authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5]
commands:
afk:
description: Marks you as away-from-keyboard.
@@ -120,7 +120,7 @@ commands:
aliases: [mem,memory,egc,emem,ememory]
give:
description: Give a player an item.
- usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
+ usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
aliases: [egive]
god:
description: Enables your godly powers.
@@ -220,7 +220,7 @@ commands:
aliases: [emute]
near:
description: Lists the players near by or around a player
- usage: /<command> [playername] [radius]
+ usage: /<command> [playername] [radius]
aliases: [nearby,enear,enearby]
nick:
description: Change your nickname or that of another player.
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index 7090c26b6..a7335a957 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -14,6 +14,7 @@ import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.generator.ChunkGenerator;
+import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.map.MapView;
import org.bukkit.plugin.Plugin;
@@ -250,7 +251,6 @@ public class FakeServer implements Server
return worlds;
}
- @Override
public World createWorld(String string, Environment e)
{
World w = new FakeWorld(string, e);
@@ -258,7 +258,6 @@ public class FakeServer implements Server
return w;
}
- @Override
public World createWorld(String string, Environment e, long l)
{
World w = new FakeWorld(string, e);
@@ -332,18 +331,6 @@ public class FakeServer implements Server
}
@Override
- public World createWorld(String string, Environment e, ChunkGenerator cg)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public World createWorld(String string, Environment e, long l, ChunkGenerator cg)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
public World createWorld(WorldCreator creator)
{
throw new UnsupportedOperationException("Not supported yet.");
@@ -654,4 +641,40 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public int getTicksPerAnimalSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int getTicksPerMonsterSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public List<Recipe> getRecipesFor(ItemStack is)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Iterator<Recipe> recipeIterator()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void clearRecipes()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void resetRecipes()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java b/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java
index 38239abfe..d353d5d6c 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java
@@ -36,7 +36,7 @@ public class ChatStore
public String getLongType()
{
- return type.length() > 0 ? "chat" : "chat-" + type;
+ return type.length() == 0 ? "chat" : "chat-" + type;
}
public long getRadius()
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
index 21a71f046..436bb55e5 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
@@ -7,8 +7,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
diff --git a/EssentialsChat/src/plugin.yml b/EssentialsChat/src/plugin.yml
index 6f899e33f..af0ed0c13 100644
--- a/EssentialsChat/src/plugin.yml
+++ b/EssentialsChat/src/plugin.yml
@@ -5,6 +5,6 @@ main: com.earth2me.essentials.chat.EssentialsChat
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides chat control features for Essentials. Requires Permissions.
-authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Okamosy]
+authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy]
depend: [Essentials]
#softdepend: [Factions] \ No newline at end of file
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
index 8115b1a75..e766b6c78 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java
@@ -856,7 +856,7 @@ public class WorldDataHolder {
PluginManager pm = server.getPluginManager();
Plugin[] plugins = pm.getPlugins();
for (int i = 0; i < plugins.length; i++) {
- plugins[i].getConfiguration().load();
+ //plugins[i].getConfiguration().load();
try {
plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]);
} catch (Exception ex) {
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
index fdb740646..f109cf4f7 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java
@@ -37,7 +37,7 @@ public class GMGroupEvent extends Event {
protected Action action;
public GMGroupEvent(Group group, Action action) {
- super(action.toString());
+ super();
this.group = group;
this.action = action;
@@ -45,7 +45,7 @@ public class GMGroupEvent extends Event {
}
public GMGroupEvent(String groupName, Action action) {
- super(action.toString());
+ super();
this.groupName = groupName;
this.action = action;
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
index 1ff605d5c..6f4c0ea08 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java
@@ -32,7 +32,7 @@ public class GMSystemEvent extends Event {
protected Action action;
public GMSystemEvent(Action action) {
- super(action.toString());
+ super();
this.action = action;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
index d40a7d63e..543580f41 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java
@@ -37,7 +37,7 @@ public class GMUserEvent extends Event {
protected Action action;
public GMUserEvent(User user, Action action) {
- super(action.toString());
+ super();
this.user = user;
this.action = action;
@@ -45,7 +45,7 @@ public class GMUserEvent extends Event {
}
public GMUserEvent(String userName, Action action) {
- super(action.toString());
+ super();
this.userName = userName;
this.action = action;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java
deleted file mode 100644
index 7ff17b381..000000000
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.earth2me.essentials.protect;
-
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockBurnEvent;
-import org.bukkit.event.block.BlockFromToEvent;
-import org.bukkit.event.block.BlockIgniteEvent;
-import org.bukkit.event.block.BlockListener;
-
-@Deprecated
-public class EmergencyBlockListener extends BlockListener
-{
-
- @Override
- public void onBlockBurn(final BlockBurnEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onBlockIgnite(final BlockIgniteEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onBlockFromTo(final BlockFromToEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onBlockBreak(final BlockBreakEvent event)
- {
- event.setCancelled(true);
- }
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java
deleted file mode 100644
index 08b04aae1..000000000
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.earth2me.essentials.protect;
-
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.EntityListener;
-
-@Deprecated
-public class EmergencyEntityListener extends EntityListener
-{
-
- @Override
- public void onEntityExplode(final EntityExplodeEvent event)
- {
- event.setCancelled(true);
- }
-
- @Override
- public void onEntityDamage(final EntityDamageEvent event)
- {
- event.setCancelled(true);
- }
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java
deleted file mode 100644
index 169e9af79..000000000
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.earth2me.essentials.protect;
-
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerListener;
-
-@Deprecated
-public class EmergencyPlayerListener extends PlayerListener
-{
-
- @Override
- public void onPlayerJoin(PlayerJoinEvent event)
- {
- event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
- }
-
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index af80647a6..9c257662d 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -9,8 +9,6 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@@ -65,21 +63,8 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
private void enableEmergencyMode(final PluginManager pm)
{
- //final EmergencyListener emListener = new EmergencyListener();
- //pm.registerEvents(emListener, this);
-
- //TODO: Remove deprecated listners in a few weeks.
-
- final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
- final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
- final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener();
- pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this);
- pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this);
- pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this);
+ final EmergencyListener emListener = new EmergencyListener();
+ pm.registerEvents(emListener, this);
for (Player player : getServer().getOnlinePlayers())
{
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index 40167ec41..57302517f 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -328,7 +328,7 @@ public class EssentialsProtectEntityListener implements Listener
}
@EventHandler(priority = EventPriority.HIGHEST)
- public void onEndermanPickup(EndermanPickupEvent event)
+ public void onEntityChangeBlock(EntityChangeBlockEvent event)
{
if (event.isCancelled())
{
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index b68b4e350..083fd66a5 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -4,6 +4,9 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.OfflinePlayer;
import com.earth2me.essentials.User;
+import com.earth2me.essentials.textreader.IText;
+import com.earth2me.essentials.textreader.KeywordReplacer;
+import com.earth2me.essentials.textreader.SimpleTextPager;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
@@ -73,7 +76,9 @@ public class EssentialsSpawnPlayerListener implements Listener
if (ess.getSettings().getAnnounceNewPlayers())
{
- ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user));
+ final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess);
+ final SimpleTextPager pager = new SimpleTextPager(output);
+ ess.broadcastMessage(user, pager.getString(0));
}
LOGGER.log(Level.FINE, "New player join");
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
index 4ed1df602..7dd46451a 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
@@ -7,16 +7,15 @@ import java.util.Map;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
-public class EssentialsHelp extends PlayerListener
+public class EssentialsHelp implements Listener
{
private transient Player chatUser;
private final transient Server server;
@@ -39,8 +38,7 @@ public class EssentialsHelp extends PlayerListener
public void registerEvents()
{
final PluginManager pluginManager = server.getPluginManager();
- pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
- pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Low, plugin);
+ pluginManager.registerEvents(this, plugin);
}
public void onCommand(final CommandSender sender)
@@ -155,18 +153,17 @@ public class EssentialsHelp extends PlayerListener
ircBot = new IrcBot(player, "Ess_" + player.getName(), UsernameUtil.createUsername(player));
}
- @Override
+ @EventHandler
public void onPlayerChat(final PlayerChatEvent event)
{
if (event.getPlayer() == chatUser)
{
final boolean success = sendChatMessage(event.getPlayer(), event.getMessage());
event.setCancelled(success);
- return;
}
}
- @Override
+ @EventHandler
public void onPlayerQuit(final PlayerQuitEvent event)
{
closeConnection();
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
index 1b26f1d32..9fa587f8f 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
@@ -7,18 +7,15 @@ import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.CustomEventListener;
-import org.bukkit.event.Event;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
-public class UpdateProcess extends PlayerListener
+public class UpdateProcess implements Listener
{
private transient Player currentPlayer;
private final transient Plugin plugin;
@@ -34,21 +31,7 @@ public class UpdateProcess extends PlayerListener
public void registerEvents()
{
- final PluginManager pluginManager = plugin.getServer().getPluginManager();
- pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
- pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Lowest, plugin);
- pluginManager.registerEvent(Type.PLAYER_JOIN, this, Priority.Normal, plugin);
- pluginManager.registerEvent(Type.CUSTOM_EVENT, new CustomEventListener()
- {
- @Override
- public void onCustomEvent(final Event event)
- {
- if (event instanceof InstallationFinishedEvent)
- {
- UpdateProcess.this.currentPlayer = null;
- }
- }
- }, Priority.Normal, plugin);
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public boolean selfUpdate()
@@ -110,7 +93,13 @@ public class UpdateProcess extends PlayerListener
return false;
}
- @Override
+ @EventHandler
+ public void onInstallationFinished(final InstallationFinishedEvent event)
+ {
+ UpdateProcess.this.currentPlayer = null;
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
{
if (event.getPlayer() == currentPlayer)
@@ -130,7 +119,7 @@ public class UpdateProcess extends PlayerListener
}
}
- @Override
+ @EventHandler
public void onPlayerJoin(final PlayerJoinEvent event)
{
final Player player = event.getPlayer();
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
index 930a31bda..02b35c3d6 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java
@@ -7,6 +7,6 @@ public class InstallationFinishedEvent extends Event
{
public InstallationFinishedEvent()
{
- super(Type.CUSTOM_EVENT);
+ super();
}
}
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
index 85ef50949..a35312129 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java
@@ -36,7 +36,7 @@ public class UserManager implements IConf
public final String getUserByAddress(final String search)
{
- final List<String> usernames = users.getKeys(null);
+ final Set<String> usernames = users.getKeys(false);
for (String username : usernames)
{
final String address = users.getString(username + "." + ADDRESS, null);
@@ -73,7 +73,7 @@ public class UserManager implements IConf
{
users.load();
spyusers.clear();
- final List<String> keys = users.getKeys(null);
+ final Set<String> keys = users.getKeys(false);
for (String key : keys)
{
if (isSpy(key))
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
index 72bdb113d..bb44d3127 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
@@ -183,7 +183,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
if (config.getBoolean("log-enabled", false))
{
LOGGER.addHandler(this);
- logUsers = config.getStringList("log-users", new ArrayList<String>());
+ logUsers = config.getStringList("log-users");
final String level = config.getString("log-level", "info");
try
{
@@ -351,7 +351,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
private void sendCommand(final Chat chat, final String message)
{
- if (config.getStringList("op-users", new ArrayList<String>()).contains(StringUtils.parseBareAddress(chat.getParticipant())))
+ if (config.getStringList("op-users").contains(StringUtils.parseBareAddress(chat.getParticipant())))
{
try
{
diff --git a/lib/Privileges.jar b/lib/Privileges.jar
new file mode 100644
index 000000000..e9dd1d04d
--- /dev/null
+++ b/lib/Privileges.jar
Binary files differ
diff --git a/lib/bpermissions2.jar b/lib/bpermissions2.jar
new file mode 100644
index 000000000..b6d344b82
--- /dev/null
+++ b/lib/bpermissions2.jar
Binary files differ
diff --git a/lib/bukkit.jar b/lib/bukkit.jar
index a06058767..e343a9723 100644
--- a/lib/bukkit.jar
+++ b/lib/bukkit.jar
Binary files differ
diff --git a/lib/craftbukkit.jar b/lib/craftbukkit.jar
index 188d0cabb..d51826640 100644
--- a/lib/craftbukkit.jar
+++ b/lib/craftbukkit.jar
Binary files differ