summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-02-02 11:41:18 +0000
committerKHobbits <rob@khobbits.co.uk>2012-02-02 11:41:18 +0000
commit6ca1cdec4f2b57de8063d955bf8a1058bdf85ca5 (patch)
treed8ef5e7e532185bd55b50906328b2d79bcbda16b
parente2abf05a27b375fcb961156f5fb3cede8ac47b8f (diff)
parent86a1dda46c6b269bb3c95fc0431e15838eeafbca (diff)
downloadEssentials-6ca1cdec4f2b57de8063d955bf8a1058bdf85ca5.tar
Essentials-6ca1cdec4f2b57de8063d955bf8a1058bdf85ca5.tar.gz
Essentials-6ca1cdec4f2b57de8063d955bf8a1058bdf85ca5.tar.lz
Essentials-6ca1cdec4f2b57de8063d955bf8a1058bdf85ca5.tar.xz
Essentials-6ca1cdec4f2b57de8063d955bf8a1058bdf85ca5.zip
Merge branch 'master' into releasestable-2.8.2
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsConf.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsTimer.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/Jails.java70
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/Util.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandmail.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrepair.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignProtection.java2
-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--lib/bukkit.jarbin4718659 -> 4718663 bytes
-rw-r--r--lib/craftbukkit.jarbin10689331 -> 10691664 bytes
18 files changed, 88 insertions, 46 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index e1c8c28b9..21f2e38ea 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -61,7 +61,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 = 1846;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
index 35252532f..ec6e27b53 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java
@@ -110,9 +110,10 @@ public class EssentialsConf extends Configuration
super.load();
}
catch (RuntimeException e)
- {
- LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString());
- throw e;
+ {
+ 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(), e.getCause());
}
if (this.root == 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/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/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/Util.java b/Essentials/src/com/earth2me/essentials/Util.java
index 386433326..65077a7fc 100644
--- a/Essentials/src/com/earth2me/essentials/Util.java
+++ b/Essentials/src/com/earth2me/essentials/Util.java
@@ -21,11 +21,17 @@ 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("_");
+ return INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
+ }
+
+ 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/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/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/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/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/lib/bukkit.jar b/lib/bukkit.jar
index a06058767..aa26f4f35 100644
--- a/lib/bukkit.jar
+++ b/lib/bukkit.jar
Binary files differ
diff --git a/lib/craftbukkit.jar b/lib/craftbukkit.jar
index 188d0cabb..190294358 100644
--- a/lib/craftbukkit.jar
+++ b/lib/craftbukkit.jar
Binary files differ