summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-01-02 18:24:34 -0500
committerIaccidentally <coryhuckaby@gmail.com>2013-01-02 18:24:34 -0500
commit9b8991788ba2fb24be8a2665fc4401e418f8d7cf (patch)
treeda033558ee9f7bed4af34d0e995a25eaa8ed42c7
parent8e92150cb7de104fe11c328402e3155e248ce2c0 (diff)
parent9a91c99391d6e7aeae1b66a1aebac0b7a19b5599 (diff)
downloadEssentials-9b8991788ba2fb24be8a2665fc4401e418f8d7cf.tar
Essentials-9b8991788ba2fb24be8a2665fc4401e418f8d7cf.tar.gz
Essentials-9b8991788ba2fb24be8a2665fc4401e418f8d7cf.tar.lz
Essentials-9b8991788ba2fb24be8a2665fc4401e418f8d7cf.tar.xz
Essentials-9b8991788ba2fb24be8a2665fc4401e418f8d7cf.zip
Merge branch '2.9' of https://github.com/essentials/Essentials into 2.9
-rw-r--r--Essentials/nbproject/project.properties4
-rw-r--r--Essentials/src/com/earth2me/essentials/Enchantments.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java70
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java48
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java82
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/Jails.java22
-rw-r--r--Essentials/src/com/earth2me/essentials/Kit.java32
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java67
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandban.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandenchant.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgive.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanditem.java17
-rwxr-xr-xEssentials/src/com/earth2me/essentials/commands/Commandrecipe.java22
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtempban.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandunban.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java11
-rw-r--r--Essentials/src/com/earth2me/essentials/perm/SimplyPermsHandler.java53
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java14
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignProtection.java6
-rw-r--r--Essentials/src/config.yml6
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java6
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java2
-rw-r--r--EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java4
-rw-r--r--lib/SimplyPerms.jarbin0 -> 90589 bytes
-rw-r--r--lib/bukkit.jarbin4820949 -> 4829571 bytes
-rw-r--r--lib/craftbukkit.jarbin12472010 -> 12531025 bytes
36 files changed, 443 insertions, 167 deletions
diff --git a/Essentials/nbproject/project.properties b/Essentials/nbproject/project.properties
index 40b0ae9b6..f749b8553 100644
--- a/Essentials/nbproject/project.properties
+++ b/Essentials/nbproject/project.properties
@@ -78,6 +78,7 @@ 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
+file.reference.SimplyPerms.jar=../lib/SimplyPerms.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=true
@@ -97,7 +98,8 @@ javac.classpath=\
${file.reference.bukkit.jar}:\
${file.reference.Vault.jar}:\
${file.reference.Privileges.jar}:\
- ${file.reference.bpermissions2.jar}
+ ${file.reference.bpermissions2.jar}:\
+ ${file.reference.SimplyPerms.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked
javac.deprecation=false
diff --git a/Essentials/src/com/earth2me/essentials/Enchantments.java b/Essentials/src/com/earth2me/essentials/Enchantments.java
index 875fd72e7..ef9cfc5bd 100644
--- a/Essentials/src/com/earth2me/essentials/Enchantments.java
+++ b/Essentials/src/com/earth2me/essentials/Enchantments.java
@@ -20,7 +20,7 @@ public class Enchantments
ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL);
ALIASENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL);
ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL);
- ENCHANTMENTS.put("sharp", Enchantment.DAMAGE_ALL);
+ ALIASENCHANTMENTS.put("sharp", Enchantment.DAMAGE_ALL);
ALIASENCHANTMENTS.put("dal", Enchantment.DAMAGE_ALL);
ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS);
@@ -40,10 +40,16 @@ public class Enchantments
ALIASENCHANTMENTS.put("ds", Enchantment.DIG_SPEED);
ENCHANTMENTS.put("durability", Enchantment.DURABILITY);
- ENCHANTMENTS.put("dura", Enchantment.DURABILITY);
+ ALIASENCHANTMENTS.put("dura", Enchantment.DURABILITY);
ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY);
ALIASENCHANTMENTS.put("d", Enchantment.DURABILITY);
+ ENCHANTMENTS.put("thorns", Enchantment.THORNS);
+ ENCHANTMENTS.put("highcrit", Enchantment.THORNS);
+ ALIASENCHANTMENTS.put("thorn", Enchantment.THORNS);
+ ALIASENCHANTMENTS.put("highercrit", Enchantment.THORNS);
+ ALIASENCHANTMENTS.put("t", Enchantment.THORNS);
+
ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT);
ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT);
ALIASENCHANTMENTS.put("meleefire", Enchantment.FIRE_ASPECT);
@@ -83,7 +89,7 @@ public class Enchantments
ALIASENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL);
ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL);
ENCHANTMENTS.put("featherfall", Enchantment.PROTECTION_FALL);
- ENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL);
+ ALIASENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL);
ALIASENCHANTMENTS.put("pfa", Enchantment.PROTECTION_FALL);
ALIASENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE);
@@ -129,7 +135,7 @@ public class Enchantments
ALIASENCHANTMENTS.put("infinite", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE);
ALIASENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE);
- ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE);
+ ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE);
}
public static Enchantment getByName(String name) {
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 49c09fe90..0aca8bb88 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -50,6 +50,7 @@ import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
+import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.world.WorldLoadEvent;
@@ -176,6 +177,8 @@ public class Essentials extends JavaPlugin implements IEssentials
itemDb = new ItemDb(this);
confList.add(itemDb);
execTimer.mark("Init(Worth/ItemDB)");
+ jails = new Jails(this);
+ confList.add(jails);
reload();
}
catch (YAMLException exception)
@@ -207,6 +210,39 @@ public class Essentials extends JavaPlugin implements IEssentials
backup = new Backup(this);
permissionsHandler = new PermissionsHandler(this, settings.useBukkitPermissions());
alternativeCommandsHandler = new AlternativeCommandsHandler(this);
+
+ timer = new EssentialsTimer(this);
+ getScheduler().scheduleSyncRepeatingTask(this, timer, 100, 100);
+
+ Economy.setEss(this);
+ execTimer.mark("RegHandler");
+
+ final MetricsStarter metricsStarter = new MetricsStarter(this);
+ if (metricsStarter.getStart() != null && metricsStarter.getStart() == true)
+ {
+ getScheduler().scheduleAsyncDelayedTask(this, metricsStarter, 1);
+ }
+ else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false)
+ {
+ final MetricsListener metricsListener = new MetricsListener(this, metricsStarter);
+ pm.registerEvents(metricsListener, this);
+ }
+
+ final String timeroutput = execTimer.end();
+ if (getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
+ }
+ }
+
+ private void registerListeners(PluginManager pm) {
+ HandlerList.unregisterAll(this);
+
+ if (getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, "Registering Listeners");
+ }
+
final EssentialsPluginListener serverListener = new EssentialsPluginListener(this);
pm.registerEvents(serverListener, this);
confList.add(serverListener);
@@ -231,35 +267,10 @@ public class Essentials extends JavaPlugin implements IEssentials
final EssentialsWorldListener worldListener = new EssentialsWorldListener(this);
pm.registerEvents(worldListener, this);
-
- //TODO: Check if this should be here, and not above before reload()
- jails = new Jails(this);
- confList.add(jails);
-
+
pm.registerEvents(tntListener, this);
-
- timer = new EssentialsTimer(this);
- getScheduler().scheduleSyncRepeatingTask(this, timer, 100, 100);
-
- Economy.setEss(this);
- execTimer.mark("RegListeners");
-
- final MetricsStarter metricsStarter = new MetricsStarter(this);
- if (metricsStarter.getStart() != null && metricsStarter.getStart() == true)
- {
- getScheduler().scheduleAsyncDelayedTask(this, metricsStarter, 1);
- }
- else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false)
- {
- final MetricsListener metricsListener = new MetricsListener(this, metricsStarter);
- pm.registerEvents(metricsListener, this);
- }
-
- final String timeroutput = execTimer.end();
- if (getSettings().isDebug())
- {
- LOGGER.log(Level.INFO, "Essentials load " + timeroutput);
- }
+
+ jails.resetListener();
}
@Override
@@ -291,6 +302,9 @@ public class Essentials extends JavaPlugin implements IEssentials
}
i18n.updateLocale(settings.getLocale());
+
+ final PluginManager pm = getServer().getPluginManager();
+ registerListeners(pm);
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
index 0c6bec0fe..c5c35d901 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java
@@ -28,8 +28,7 @@ public class EssentialsBlockListener implements Listener
return;
}
final User user = ess.getUser(event.getPlayer());
- final boolean unlimitedForUser = user.hasUnlimited(is);
- if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
+ if (user.hasUnlimited(is) && user.getGameMode() == GameMode.SURVIVAL)
{
ess.scheduleSyncDelayedTask(
new Runnable()
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index e93c61952..a0d3d091f 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -30,44 +30,40 @@ public class EssentialsEntityListener implements Listener
{
final Entity eAttack = event.getDamager();
final Entity eDefend = event.getEntity();
- if (eDefend instanceof Player && eAttack instanceof Player)
+ if (eAttack instanceof Player)
{
- final User defender = ess.getUser(eDefend);
final User attacker = ess.getUser(eAttack);
- onPlayerVsPlayerDamage(event, defender, attacker);
- onPlayerVsPlayerPowertool(event, defender, attacker);
- }
- else if (eDefend instanceof Player && eAttack instanceof Projectile)
- {
- Entity shooter = ((Projectile)event.getDamager()).getShooter();
- if (shooter instanceof Player)
+ if (eDefend instanceof Player)
{
- final User defender = ess.getUser(eDefend);
- final User attacker = ess.getUser(shooter);
- onPlayerVsPlayerDamage(event, defender, attacker);
- onPlayerVsPlayerPowertool(event, defender, attacker);
+ onPlayerVsPlayerDamage(event, (Player)eDefend, attacker);
}
- }
- else if (eAttack instanceof Player)
- {
- final User player = ess.getUser(eAttack);
- player.updateActivity(true);
- if (eDefend instanceof Ageable)
+ else if (eDefend instanceof Ageable)
{
- final ItemStack hand = player.getItemInHand();
+ final ItemStack hand = attacker.getItemInHand();
if (hand != null && hand.getType() == Material.MILK_BUCKET)
{
((Ageable)eDefend).setBaby();
hand.setType(Material.BUCKET);
- player.setItemInHand(hand);
- player.updateInventory();
+ attacker.setItemInHand(hand);
+ attacker.updateInventory();
event.setCancelled(true);
}
}
+ attacker.updateActivity(true);
+ }
+ else if (eAttack instanceof Projectile && eDefend instanceof Player)
+ {
+ Entity shooter = ((Projectile)event.getDamager()).getShooter();
+ if (shooter instanceof Player)
+ {
+ final User attacker = ess.getUser(shooter);
+ onPlayerVsPlayerDamage(event, (Player)eDefend, attacker);
+ attacker.updateActivity(true);
+ }
}
}
- private void onPlayerVsPlayerDamage(final EntityDamageByEntityEvent event, final User defender, final User attacker)
+ private void onPlayerVsPlayerDamage(final EntityDamageByEntityEvent event, final Player defender, final User attacker)
{
if (ess.getSettings().getLoginAttackDelay() > 0 && !attacker.isAuthorized("essentials.pvpdelay.exempt")
&& (System.currentTimeMillis() < (attacker.getLastLogin() + ess.getSettings().getLoginAttackDelay())))
@@ -75,7 +71,7 @@ public class EssentialsEntityListener implements Listener
event.setCancelled(true);
}
- if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport())
+ if (!defender.equals(attacker.getBase()) && (attacker.hasInvulnerabilityAfterTeleport() || ess.getUser(defender).hasInvulnerabilityAfterTeleport()))
{
event.setCancelled(true);
}
@@ -90,10 +86,10 @@ public class EssentialsEntityListener implements Listener
event.setCancelled(true);
}
- attacker.updateActivity(true);
+ onPlayerVsPlayerPowertool(event, defender, attacker);
}
- private void onPlayerVsPlayerPowertool(final EntityDamageByEntityEvent event, final User defender, final User attacker)
+ private void onPlayerVsPlayerPowertool(final EntityDamageByEntityEvent event, final Player defender, final User attacker)
{
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 8887955a4..9b4585112 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -15,6 +15,7 @@ import java.util.logging.Logger;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.World;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -26,6 +27,7 @@ import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
+import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@@ -76,10 +78,20 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerMove(final PlayerMoveEvent event)
{
- if ((!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers())
- || event.getFrom().getBlockX() == event.getTo().getBlockX()
- && event.getFrom().getBlockZ() == event.getTo().getBlockZ()
- && event.getFrom().getBlockY() == event.getTo().getBlockY())
+ if (!ess.getSettings().cancelAfkOnMove() && !ess.getSettings().getFreezeAfkPlayers())
+ {
+ event.getHandlers().unregister(this);
+
+ if (ess.getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, "Unregistering move listener");
+ }
+
+ return;
+ }
+ if (event.getFrom().getBlockX() == event.getTo().getBlockX()
+ && event.getFrom().getBlockZ() == event.getTo().getBlockZ()
+ && event.getFrom().getBlockY() == event.getTo().getBlockY())
{
return;
}
@@ -131,6 +143,10 @@ public class EssentialsPlayerListener implements Listener
{
user.setLastLocation();
}
+ if (user.isRecipeSee())
+ {
+ user.getPlayer().getOpenInventory().getTopInventory().clear();
+ }
user.updateActivity(false);
user.dispose();
}
@@ -223,6 +239,24 @@ public class EssentialsPlayerListener implements Listener
user.sendMessage(_("youHaveNewMail", mail.size()));
}
}
+ if (user.isAuthorized("essentials.fly.safelogin"))
+ {
+ final World world = user.getLocation().getWorld();
+ final int x = user.getLocation().getBlockX();
+ int y = user.getLocation().getBlockY();
+ final int z = user.getLocation().getBlockZ();
+ while (Util.isBlockUnsafe(world, x, y, z) && y > -1)
+ {
+ y--;
+ }
+
+ if (user.getLocation().getBlockY() - y > 1 || y < 0)
+ {
+ user.setAllowFlight(true);
+ user.setFlying(true);
+ user.sendMessage(_("flyMode", _("enabled"), user.getDisplayName()));
+ }
+ }
}
// Makes the compass item ingame always point to the first essentials home. #EasterEgg
@@ -514,10 +548,13 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onInventoryClickEvent(final InventoryClickEvent event)
{
- if (event.getView().getTopInventory().getType() == InventoryType.PLAYER)
+ final Inventory top = event.getView().getTopInventory();
+ final InventoryType type = top.getType();
+
+ if (type == InventoryType.PLAYER)
{
final User user = ess.getUser(event.getWhoClicked());
- final InventoryHolder invHolder = event.getView().getTopInventory().getHolder();
+ final InventoryHolder invHolder = top.getHolder();
if (invHolder != null && invHolder instanceof HumanEntity)
{
final User invOwner = ess.getUser((HumanEntity)invHolder);
@@ -526,10 +563,11 @@ public class EssentialsPlayerListener implements Listener
|| !invOwner.isOnline()))
{
event.setCancelled(true);
+ user.updateInventory();
}
}
}
- else if (event.getView().getTopInventory().getType() == InventoryType.ENDER_CHEST)
+ else if (type == InventoryType.ENDER_CHEST)
{
final User user = ess.getUser(event.getWhoClicked());
if (user.isEnderSee() && (!user.isAuthorized("essentials.enderchest.modify")))
@@ -537,7 +575,7 @@ public class EssentialsPlayerListener implements Listener
event.setCancelled(true);
}
}
- else if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH)
+ else if (type == InventoryType.WORKBENCH)
{
User user = ess.getUser(event.getWhoClicked());
if (user.isRecipeSee())
@@ -545,30 +583,50 @@ public class EssentialsPlayerListener implements Listener
event.setCancelled(true);
}
}
+ else if (type == InventoryType.CHEST && top.getSize() == 9)
+ {
+ final User user = ess.getUser(event.getWhoClicked());
+ final InventoryHolder invHolder = top.getHolder();
+ if (invHolder != null && invHolder instanceof HumanEntity && user.isInvSee())
+ {
+ event.setCancelled(true);
+ }
+ }
}
@EventHandler(priority = EventPriority.MONITOR)
public void onInventoryCloseEvent(final InventoryCloseEvent event)
{
- if (event.getView().getTopInventory().getType() == InventoryType.PLAYER)
+ final Inventory top = event.getView().getTopInventory();
+ final InventoryType type = top.getType();
+ if (type == InventoryType.PLAYER)
{
final User user = ess.getUser(event.getPlayer());
user.setInvSee(false);
}
- else if (event.getView().getTopInventory().getType() == InventoryType.ENDER_CHEST)
+ else if (type == InventoryType.ENDER_CHEST)
{
final User user = ess.getUser(event.getPlayer());
user.setEnderSee(false);
}
- if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH)
+ else if (type == InventoryType.WORKBENCH)
{
final User user = ess.getUser(event.getPlayer());
- if(user.isRecipeSee())
+ if (user.isRecipeSee())
{
user.setRecipeSee(false);
event.getView().getTopInventory().clear();
}
}
+ else if (type == InventoryType.CHEST && top.getSize() == 9)
+ {
+ final InventoryHolder invHolder = top.getHolder();
+ if (invHolder != null && invHolder instanceof HumanEntity)
+ {
+ final User user = ess.getUser(event.getPlayer());
+ user.setInvSee(false);
+ }
+ }
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index a261c80bb..c58ffa8e7 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -151,6 +151,8 @@ public interface ISettings extends IConf
Set<String> getNoGodWorlds();
boolean getUpdateBedAtDaytime();
+
+ boolean allowUnsafeEnchantments();
boolean getRepairEnchanted();
diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java
index 0aa90e08c..740ae0bff 100644
--- a/Essentials/src/com/earth2me/essentials/Jails.java
+++ b/Essentials/src/com/earth2me/essentials/Jails.java
@@ -44,6 +44,10 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
final PluginManager pluginManager = ess.getServer().getPluginManager();
final JailListener blockListener = new JailListener();
pluginManager.registerEvents(blockListener, ess);
+ if (ess.getSettings().isDebug())
+ {
+ LOGGER.log(Level.INFO, "Registering Jail listener");
+ }
}
@Override
@@ -55,16 +59,24 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
@Override
public void finishRead()
{
- if (enabled == false && getCount() > 0)
- {
- registerListeners();
- }
+ checkRegister();
}
@Override
public void finishWrite()
{
- if (enabled == false)
+ checkRegister();
+ }
+
+ public void resetListener()
+ {
+ enabled = false;
+ checkRegister();
+ }
+
+ private void checkRegister()
+ {
+ if (enabled == false && getCount() > 0)
{
registerListeners();
}
diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java
index fcd1b4932..0611cafec 100644
--- a/Essentials/src/com/earth2me/essentials/Kit.java
+++ b/Essentials/src/com/earth2me/essentials/Kit.java
@@ -34,12 +34,13 @@ public class Kit
{
throw new Exception(_("kitError"), ex);
}
-
+
}
-
+
public static void checkTime(final User user, final String kitName, final Map<String, Object> els) throws Exception
{
- if (user.isAuthorized("essentials.kit.exemptdelay")) {
+ if (user.isAuthorized("essentials.kit.exemptdelay"))
+ {
return;
}
@@ -55,7 +56,7 @@ public class Kit
// When was the last kit used?
final long lastTime = user.getKitTimestamp(kitName);
-
+
if (lastTime < earliestLong || lastTime == 0L)
{
user.setKitTimestamp(kitName, time.getTimeInMillis());
@@ -80,15 +81,15 @@ public class Kit
throw new NoChargeException();
}
}
-
+
public static List<String> getItems(final User user, final Map<String, Object> kit) throws Exception
{
if (kit == null)
{
throw new Exception(_("kitError2"));
}
-
-
+
+
try
{
return (List<String>)kit.get("items");
@@ -99,7 +100,7 @@ public class Kit
throw new Exception(_("kitErrorHelp"), e);
}
}
-
+
public static void expandItems(final IEssentials ess, final User user, final List<String> items) throws Exception
{
try
@@ -107,7 +108,7 @@ public class Kit
boolean spew = false;
for (String d : items)
{
- if (d.startsWith(ess.getSettings().getCurrencySymbol()))
+ if (d.startsWith(ess.getSettings().getCurrencySymbol()))
{
Double value = Double.parseDouble(d.substring(ess.getSettings().getCurrencySymbol().length()).trim());
Trade t = new Trade(value, ess);
@@ -119,7 +120,7 @@ public class Kit
final int id = Material.getMaterial(Integer.parseInt(item[0])).getId();
final short data = item.length > 1 ? Short.parseShort(item[1]) : 0;
final int amount = parts.length > 1 ? Integer.parseInt(parts[1]) : 1;
-
+
final ItemStack stack = new ItemStack(id, amount, data);
if (parts.length > 2)
{
@@ -146,7 +147,14 @@ public class Kit
}
try
{
- stack.addEnchantment(enchantment, level);
+ if (ess.getSettings().allowUnsafeEnchantments())
+ {
+ stack.addUnsafeEnchantment(enchantment, level);
+ }
+ else
+ {
+ stack.addEnchantment(enchantment, level);
+ }
}
catch (Exception ex)
{
@@ -154,7 +162,7 @@ public class Kit
}
}
}
-
+
final Map<Integer, ItemStack> overfilled;
if (user.isAuthorized("essentials.oversizedstacks"))
{
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index a47b32582..4e61177c9 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -1150,4 +1150,10 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public void setTexturePack(String string)
+ {
+ 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 d3c6b49d5..95123d051 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -856,6 +856,12 @@ public class Settings implements ISettings
{
return config.getBoolean("repair-enchanted", true);
}
+
+ @Override
+ public boolean allowUnsafeEnchantments()
+ {
+ return config.getBoolean("unsafe-enchantments", false);
+ }
@Override
public boolean isWorldTeleportPermissions()
@@ -923,7 +929,7 @@ public class Settings implements ISettings
@Override
public long getTpaAcceptCancellation()
{
- return config.getLong("tpa-accept-cancellation", 0);
+ return config.getLong("tpa-accept-cancellation", 120);
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index 241a8328d..fc1a2cc04 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -16,30 +16,30 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Teleport implements Runnable, ITeleport
{
private static final double MOVE_CONSTANT = 0.3;
-
-
+
+
private class Target
{
private final Location location;
private final String name;
-
+
Target(Location location)
{
this.location = location;
this.name = null;
}
-
+
Target(Player entity)
{
this.name = entity.getName();
this.location = null;
}
-
+
public Location getLocation()
{
if (this.name != null)
{
-
+
return ess.getServer().getPlayerExact(name).getLocation();
}
return location;
@@ -63,12 +63,12 @@ public class Teleport implements Runnable, ITeleport
private final IEssentials ess;
private static final Logger logger = Logger.getLogger("Minecraft");
private TeleportCause cause;
-
+
private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause)
{
initTimer(delay, user, target, chargeFor, cause, false);
}
-
+
private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause, boolean respawn)
{
this.started = System.currentTimeMillis();
@@ -83,11 +83,11 @@ public class Teleport implements Runnable, ITeleport
this.cause = cause;
this.respawn = respawn;
}
-
+
@Override
public void run()
{
-
+
if (user == null || !user.isOnline() || user.getLocation() == null)
{
cancel(false);
@@ -98,7 +98,7 @@ public class Teleport implements Runnable, ITeleport
cancel(false);
return;
}
-
+
if (!user.isAuthorized("essentials.teleport.timer.move")
&& (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX
|| Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY
@@ -119,10 +119,12 @@ public class Teleport implements Runnable, ITeleport
teleportUser.sendMessage(_("teleportationCommencing"));
try
{
- if (respawn) {
+ if (respawn)
+ {
teleportUser.getTeleport().respawn(cause);
}
- else {
+ else
+ {
teleportUser.getTeleport().now(teleportTarget, cause);
}
cancel(false);
@@ -146,13 +148,13 @@ public class Teleport implements Runnable, ITeleport
}
}
}
-
+
public Teleport(IUser user, IEssentials ess)
{
this.user = user;
this.ess = ess;
}
-
+
public void cooldown(boolean check) throws Exception
{
final Calendar time = new GregorianCalendar();
@@ -168,7 +170,7 @@ public class Teleport implements Runnable, ITeleport
// When was the last teleport used?
final Long lastTime = user.getLastTeleportTimestamp();
-
+
if (lastTime > time.getTimeInMillis())
{
// This is to make sure time didn't get messed up on last kit use.
@@ -225,7 +227,7 @@ public class Teleport implements Runnable, ITeleport
}
now(new Target(loc), cause);
}
-
+
public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception
{
if (cooldown)
@@ -234,7 +236,7 @@ public class Teleport implements Runnable, ITeleport
}
now(new Target(entity), cause);
}
-
+
private void now(Target target, TeleportCause cause) throws Exception
{
cancel(false);
@@ -249,21 +251,21 @@ public class Teleport implements Runnable, ITeleport
{
teleport(loc, chargeFor, TeleportCause.PLUGIN);
}
-
+
public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
{
teleport(new Target(loc), chargeFor, cause);
}
-
+
public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception
{
teleport(new Target(entity), chargeFor, cause);
}
-
+
private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
{
double delay = ess.getSettings().getTeleportDelay();
-
+
if (chargeFor != null)
{
chargeFor.isAffordableFor(user);
@@ -279,11 +281,11 @@ public class Teleport implements Runnable, ITeleport
}
return;
}
-
+
cancel(false);
warnUser(user, delay);
initTimer((long)(delay * 1000.0), target, chargeFor, cause);
-
+
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
@@ -292,7 +294,7 @@ public class Teleport implements Runnable, ITeleport
{
Target target = new Target(user);
double delay = ess.getSettings().getTeleportDelay();
-
+
if (chargeFor != null)
{
chargeFor.isAffordableFor(user);
@@ -308,13 +310,13 @@ public class Teleport implements Runnable, ITeleport
}
return;
}
-
+
cancel(false);
warnUser(otherUser, delay);
initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause, false);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
-
+
private void warnUser(final IUser user, final double delay)
{
Calendar c = new GregorianCalendar();
@@ -342,22 +344,27 @@ public class Teleport implements Runnable, ITeleport
}
return;
}
-
+
cancel(false);
+ warnUser(user, delay);
initTimer((long)(delay * 1000.0), user, null, chargeFor, cause, true);
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
-
+
public void respawn(TeleportCause cause) throws Exception
{
final Player player = user.getBase();
Location bed = player.getBedSpawnLocation();
- if (bed != null && bed.getBlock().getType() != Material.BED_BLOCK)
+ if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK)
{
now(new Target(bed), cause);
}
else
{
+ if (ess.getSettings().isDebug())
+ {
+ ess.getLogger().info("Could not find bed spawn, forcing respawn event.");
+ }
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, player.getWorld().getSpawnLocation(), false);
ess.getServer().getPluginManager().callEvent(pre);
now(new Target(pre.getRespawnLocation()), cause);
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index bb1e290f4..6fce1c087 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -12,6 +12,8 @@ import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@@ -536,7 +538,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
setDisplayNick();
final String msg = _("userIsNotAway", getDisplayName());
if (!msg.isEmpty())
- {
+ {
ess.broadcastMessage(this, msg);
}
}
@@ -573,7 +575,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
setDisplayNick();
final String msg = _("userIsAway", getDisplayName());
if (!msg.isEmpty())
- {
+ {
ess.broadcastMessage(this, msg);
}
}
@@ -685,6 +687,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
setHidden(true);
ess.getVanishedPlayers().add(getName());
+ if (isAuthorized("essentials.vanish.effect"))
+ {
+ this.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false));
+ }
}
else
{
@@ -694,6 +700,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
setHidden(false);
ess.getVanishedPlayers().remove(getName());
+ if (isAuthorized("essentials.vanish.effect"))
+ {
+ this.removePotionEffect(PotionEffectType.INVISIBILITY);
+ }
}
}
@@ -737,7 +747,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
@Override
public boolean isIgnoreExempt()
{
- return this.isAuthorized("essentials.chat.ignoreexempt");
+ return this.isAuthorized("essentials.chat.ignoreexempt");
}
public boolean isRecipeSee()
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
index 3c31469e3..776f4ab55 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
@@ -71,7 +71,7 @@ public class Commandban extends EssentialsCommand
server.getLogger().log(Level.INFO, _("playerBanned", senderName, user.getName(), banReason));
if (nomatch) {
- sender.sendMessage(_("userUnknown", user.getName()));
+ sender.sendMessage(_("userUnknown", args[0]));
}
for (Player onlinePlayer : server.getOnlinePlayers())
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java
index 579be06ff..c338090aa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandenchant.java
@@ -35,7 +35,7 @@ public class Commandenchant extends EssentialsCommand
for (Map.Entry<String, Enchantment> entry : Enchantments.entrySet())
{
final String enchantmentName = entry.getValue().getName().toLowerCase(Locale.ENGLISH);
- if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName))
+ if (enchantmentslist.contains(enchantmentName) || (user.isAuthorized("essentials.enchant." + enchantmentName) && entry.getValue().canEnchantItem(stack)))
{
enchantmentslist.add(entry.getKey());
//enchantmentslist.add(enchantmentName);
@@ -56,7 +56,8 @@ public class Commandenchant extends EssentialsCommand
}
}
final Enchantment enchantment = getEnchantment(args[0], user);
- if (level < 0 || level > enchantment.getMaxLevel())
+ final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchant.allowunsafe");
+ if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel()))
{
level = enchantment.getMaxLevel();
}
@@ -66,7 +67,14 @@ public class Commandenchant extends EssentialsCommand
}
else
{
- stack.addEnchantment(enchantment, level);
+ if (allowUnsafe)
+ {
+ stack.addUnsafeEnchantment(enchantment, level);
+ }
+ else
+ {
+ stack.addEnchantment(enchantment, level);
+ }
}
user.getInventory().setItemInHand(stack);
user.updateInventory();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
index c4e26d9a8..c9dde4688 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java
@@ -81,7 +81,19 @@ public class Commandgive extends EssentialsCommand
{
level = enchantment.getMaxLevel();
}
- stack.addEnchantment(enchantment, level);
+ boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
+ if (allowUnsafe && sender instanceof Player && !ess.getUser(sender).isAuthorized("essentials.enchant.allowunsafe"))
+ {
+ allowUnsafe = false;
+ }
+ if (allowUnsafe)
+ {
+ stack.addUnsafeEnchantment(enchantment, level);
+ }
+ else
+ {
+ stack.addEnchantment(enchantment, level);
+ }
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index 293dbfb6d..a5d355415 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -69,7 +69,7 @@ public class Commandhome extends EssentialsCommand
}
else if (homes.isEmpty())
{
- throw new Exception(player == user ? _("noHomeSet") : _("noHomeSetPlayer"));
+ throw new Exception(_("noHomeSetPlayer"));
}
else if (homes.size() == 1 && player.equals(user))
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
index 3964dbe67..1f9083351 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandinvsee.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import org.bukkit.Server;
+import org.bukkit.inventory.Inventory;
public class Commandinvsee extends EssentialsCommand
@@ -10,6 +11,8 @@ public class Commandinvsee extends EssentialsCommand
{
super("invsee");
}
+
+ //This method has a hidden param, which if given will display the equip slots. #easteregg
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
@@ -18,8 +21,20 @@ public class Commandinvsee extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
+
final User invUser = getPlayer(server, args, 0);
+ Inventory inv;
+
+ if (args.length > 1 && user.isAuthorized("essentials.invsee.equip"))
+ {
+ inv = server.createInventory(invUser, 9, "Equipped");
+ inv.setContents(invUser.getInventory().getArmorContents());
+ }
+ else
+ {
+ inv = invUser.getInventory();
+ }
+ user.openInventory(inv);
user.setInvSee(true);
- user.openInventory(invUser.getInventory());
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java
index d14b04d2a..a5c59deb6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java
@@ -16,7 +16,7 @@ public class Commanditem extends EssentialsCommand
{
super("item");
}
-
+
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
@@ -25,7 +25,7 @@ public class Commanditem extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final ItemStack stack = ess.getItemDb().get(args[0]);
-
+
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
if (ess.getSettings().permissionBasedItemSpawn()
? (!user.isAuthorized("essentials.itemspawn.item-all")
@@ -69,7 +69,14 @@ public class Commanditem extends EssentialsCommand
{
level = enchantment.getMaxLevel();
}
- stack.addEnchantment(enchantment, level);
+ if (ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchant.allowunsafe"))
+ {
+ stack.addUnsafeEnchantment(enchantment, level);
+ }
+ else
+ {
+ stack.addEnchantment(enchantment, level);
+ }
}
}
}
@@ -77,12 +84,12 @@ public class Commanditem extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
-
+
if (stack.getType() == Material.AIR)
{
throw new Exception(_("cantSpawnItem", "Air"));
}
-
+
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
if (user.isAuthorized("essentials.oversizedstacks"))
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
index e5c69a88b..57294e53c 100755
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
@@ -97,13 +97,21 @@ public class Commandrecipe extends EssentialsCommand
final User user = ess.getUser(sender);
user.setRecipeSee(true);
final InventoryView view = user.openWorkbench(null, true);
- final String shapeMap = recipe.getShape().length == 2 ? " abecdfghi" : " abcdefghi";
- for (Entry<Character, ItemStack> e : ((ShapedRecipe)recipe).getIngredientMap().entrySet())
- {
- e.getValue().setAmount(0);
- view.setItem(shapeMap.indexOf(e.getKey()), e.getValue());
+ final String[] recipeShape = recipe.getShape();
+ final Map<Character, ItemStack> ingredientMap = recipe.getIngredientMap();
+ for (int j = 0; j < recipeShape.length; j++)
+ {
+ for (int k = 0; k < recipeShape[j].length(); k++)
+ {
+ final ItemStack item = ingredientMap.get(recipeShape[j].toCharArray()[k]);
+ if(item == null)
+ {
+ continue;
+ }
+ item.setAmount(0);
+ view.getTopInventory().setItem(j * 3 + k + 1, item);
+ }
}
-
}
else
{
@@ -186,4 +194,4 @@ public class Commandrecipe extends EssentialsCommand
}
return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH);
}
-} \ No newline at end of file
+}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
index 97aa2ea3b..fd959472c 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
@@ -47,7 +47,7 @@ public class Commandtempban extends EssentialsCommand
final long banTimestamp = Util.parseDateDiff(time, true);
final long maxBanLength = ess.getSettings().getMaxTempban() * 1000;
- if(maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) && ess.getUser(sender).isAuthorized("essentials.tempban.unlimited"))
+ if(maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) && !(ess.getUser(sender).isAuthorized("essentials.tempban.unlimited")))
{
sender.sendMessage(_("oversizedTempban"));
throw new NoChargeException();
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
index dda1475d0..439e715e5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
+import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -23,12 +24,19 @@ public class Commandunban extends EssentialsCommand
try
{
- final User player = getPlayer(server, args, 0, true);
- player.setBanned(false);
+ final User user = getPlayer(server, args, 0, true);
+ user.setBanned(false);
sender.sendMessage(_("unbannedPlayer"));
}
catch (NoSuchFieldException e)
{
+ final OfflinePlayer player = server.getOfflinePlayer(args[0]);
+ if (player.isBanned()) {
+ player.setBanned(false);
+ sender.sendMessage(_("unbannedPlayer"));
+ return;
+ }
+
throw new Exception(_("playerNotFound"), e);
}
}
diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
index ab2332528..c5653b0ad 100644
--- a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
+++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java
@@ -134,6 +134,17 @@ public class PermissionsHandler implements IPermissionsHandler
return;
}
+ final Plugin simplyPermsPlugin = pluginManager.getPlugin("SimplyPerms");
+ if (simplyPermsPlugin != null && simplyPermsPlugin.isEnabled())
+ {
+ if (!(handler instanceof SimplyPermsHandler))
+ {
+ LOGGER.log(Level.INFO, "Essentials: Using SimplyPerms based permissions.");
+ handler = new SimplyPermsHandler(simplyPermsPlugin);
+ }
+ return;
+ }
+
final Plugin privPlugin = pluginManager.getPlugin("Privileges");
if (privPlugin != null && privPlugin.isEnabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/perm/SimplyPermsHandler.java b/Essentials/src/com/earth2me/essentials/perm/SimplyPermsHandler.java
new file mode 100644
index 000000000..cdd9ffa93
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/perm/SimplyPermsHandler.java
@@ -0,0 +1,53 @@
+package com.earth2me.essentials.perm;
+
+import java.util.List;
+
+import net.crystalyx.bukkit.simplyperms.SimplyAPI;
+import net.crystalyx.bukkit.simplyperms.SimplyPlugin;
+
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+public class SimplyPermsHandler extends SuperpermsHandler {
+
+ private final transient SimplyAPI api;
+
+ public SimplyPermsHandler(final Plugin plugin) {
+ this.api = ((SimplyPlugin) plugin).getAPI();
+ }
+
+ @Override
+ public String getGroup(final Player base)
+ {
+ final List<String> groups = api.getPlayerGroups(base.getName());
+ if (groups == null || groups.isEmpty()) return null;
+ return groups.get(0);
+ }
+
+ @Override
+ public List<String> getGroups(final Player base)
+ {
+ return api.getPlayerGroups(base.getName());
+ }
+
+ @Override
+ public boolean inGroup(final Player base, final String group)
+ {
+ final List<String> groups = api.getPlayerGroups(base.getName());
+ for (String group1 : groups)
+ {
+ if (group1.equalsIgnoreCase(group))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canBuild(Player base, String group)
+ {
+ return hasPermission(base, "essentials.build") || hasPermission(base, "permissions.allow.build");
+ }
+
+}
diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
index e5f125cf8..aeecf5368 100644
--- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
+++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java
@@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
public class EssentialsSign
{
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
+
protected transient final String signName;
public EssentialsSign(final String signName)
@@ -258,6 +259,11 @@ public class EssentialsSign
{
return EMPTY_SET;
}
+
+ public boolean areHeavyEventRequired()
+ {
+ return false;
+ }
protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
{
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
index 517c313cc..ab914c629 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java
@@ -32,6 +32,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -65,7 +66,7 @@ public class SignBlockListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, player, ess))
{
LOGGER.log(Level.INFO, "A block was protected by a sign.");
@@ -80,6 +81,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
User user = ess.getUser(event.getPlayer());
@@ -105,6 +107,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -129,6 +132,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -148,7 +152,7 @@ public class SignBlockListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockPlace(block, event.getPlayer(), ess))
{
event.setCancelled(true);
@@ -162,6 +166,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -176,7 +181,7 @@ public class SignBlockListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockBurn(block, ess))
{
event.setCancelled(true);
@@ -190,6 +195,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -204,7 +210,7 @@ public class SignBlockListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockIgnite(block, ess))
{
event.setCancelled(true);
@@ -218,6 +224,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -233,7 +240,7 @@ public class SignBlockListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockPush(block, ess))
{
event.setCancelled(true);
@@ -248,6 +255,7 @@ public class SignBlockListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -264,7 +272,7 @@ public class SignBlockListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockPush(block, ess))
{
event.setCancelled(true);
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
index edc5b856d..fbbd1cd8c 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java
@@ -24,6 +24,7 @@ public class SignEntityListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -39,7 +40,7 @@ public class SignEntityListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType()))
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType()))
{
event.setCancelled(!sign.onBlockExplode(block, ess));
return;
@@ -53,6 +54,7 @@ public class SignEntityListener implements Listener
{
if (ess.getSettings().areSignsDisabled())
{
+ event.getHandlers().unregister(this);
return;
}
@@ -67,7 +69,7 @@ public class SignEntityListener implements Listener
}
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, ess))
{
event.setCancelled(true);
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
index 12296b023..b447ed9dd 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java
@@ -25,11 +25,15 @@ public class SignPlayerListener implements Listener
//Right clicking signs with a block in hand, can now fire cancelled events.
//This is because when the block place is cancelled (for example not enough space for the block to be placed),
//the event will be marked as cancelled, thus preventing 30% of sign purchases.
-
@EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event)
{
- if (ess.getSettings().areSignsDisabled() || (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR))
+ if (ess.getSettings().areSignsDisabled())
+ {
+ event.getHandlers().unregister(this);
+ return;
+ }
+ if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR)
{
return;
}
@@ -62,10 +66,10 @@ public class SignPlayerListener implements Listener
final int mat = block.getTypeId();
if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
{
- final Sign csign = (Sign)block.getState();
+ final String csign = ((Sign)block.getState()).getLine(0);
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (csign.getLine(0).equalsIgnoreCase(sign.getSuccessName()))
+ if (csign.equalsIgnoreCase(sign.getSuccessName()))
{
sign.onSignInteract(block, event.getPlayer(), ess);
event.setCancelled(true);
@@ -77,7 +81,7 @@ public class SignPlayerListener implements Listener
{
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
- if (sign.getBlocks().contains(block.getType())
+ if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
&& !sign.onBlockInteract(block, event.getPlayer(), ess))
{
event.setCancelled(true);
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
index 1ea26c859..b5a679324 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java
@@ -241,6 +241,12 @@ public class SignProtection extends EssentialsSign
{
return protectedBlocks;
}
+
+ @Override
+ public boolean areHeavyEventRequired()
+ {
+ return true;
+ }
@Override
protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 3b03a9560..10247ab09 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -334,6 +334,10 @@ oversized-stacksize: 64
# essentials.repair.enchanted
repair-enchanted: true
+# Allow 'unsafe' enchantments in kits and item spawning.
+# Warning: Mixing and overleveling some enchantments can cause issues with clients, servers and plugins.
+unsafe-enchantments: false
+
#Do you want essentials to keep track of previous location for /back in the teleport listener?
#If you set this to true any plugin that uses teleport will have the previous location registered.
register-back-in-listener: false
@@ -379,7 +383,7 @@ sethome-multiple:
# Set timeout in seconds for players to accept tpa before request is cancelled.
# Set to 0 for no timeout
-tpa-accept-cancellation: 0
+tpa-accept-cancellation: 120
############################################################
# +------------------------------------------------------+ #
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
index 2324c65d9..8ca1e0726 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java
@@ -134,14 +134,10 @@ public abstract class EssentialsChatPlayer implements Listener
return;
}
- for (Player onlinePlayer : server.getOnlinePlayers())
+ for (Player onlinePlayer : event.getRecipients())
{
String type = _("chatTypeLocal");
final User onlineUser = ess.getUser(onlinePlayer);
- if (onlineUser.isIgnoredPlayer(sender))
- {
- continue;
- }
if (!onlineUser.equals(sender))
{
boolean abort = false;
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index 1ca9519ce..4770248b9 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -233,7 +233,7 @@ public class EssentialsProtectEntityListener implements Listener
event.setCancelled(true);
return;
}
-
+
// This code will prevent explosions near protected rails, signs or protected chests
// TODO: Use protect db instead of this code
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
index 673ef3377..582c8cbef 100644
--- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
+++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java
@@ -11,6 +11,7 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
import org.bukkit.entity.Player;
import org.jivesoftware.smack.*;
import org.jivesoftware.smack.Roster.SubscriptionMode;
@@ -22,6 +23,7 @@ import org.jivesoftware.smack.util.StringUtils;
public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IConf
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
+ private static final SimpleFormatter formatter = new SimpleFormatter();
private final transient EssentialsConf config;
private transient XMPPConnection connection;
private transient ChatManager chatManager;
@@ -262,7 +264,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
XMPPManager.this.startChat(user);
for (LogRecord logRecord : copy)
{
- final String message = String.format("[" + logRecord.getLevel().getLocalizedName() + "] " + logRecord.getMessage(), logRecord.getParameters());
+ final String message = formatter.format(logRecord);
if (!XMPPManager.this.sendMessage(user, Util.stripLogColorFormat(message)))
{
failedUsers.add(user);
diff --git a/lib/SimplyPerms.jar b/lib/SimplyPerms.jar
new file mode 100644
index 000000000..c7c5ec64e
--- /dev/null
+++ b/lib/SimplyPerms.jar
Binary files differ
diff --git a/lib/bukkit.jar b/lib/bukkit.jar
index 7abca416e..4d9d59cf2 100644
--- a/lib/bukkit.jar
+++ b/lib/bukkit.jar
Binary files differ
diff --git a/lib/craftbukkit.jar b/lib/craftbukkit.jar
index 6f375cc83..e7b6ea107 100644
--- a/lib/craftbukkit.jar
+++ b/lib/craftbukkit.jar
Binary files differ