summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-04-16 10:18:18 +0100
committerKHobbits <rob@khobbits.co.uk>2012-04-16 10:19:19 +0100
commit922a32e0329ce1a38e320d96ec51ca1c12b99735 (patch)
tree0710c4490c2b13e9092426e1da13b552f8dd127f
parentcdb847dbb35f89f21f44cf4279611cd39350817c (diff)
downloadEssentials-922a32e0329ce1a38e320d96ec51ca1c12b99735.tar
Essentials-922a32e0329ce1a38e320d96ec51ca1c12b99735.tar.gz
Essentials-922a32e0329ce1a38e320d96ec51ca1c12b99735.tar.lz
Essentials-922a32e0329ce1a38e320d96ec51ca1c12b99735.tar.xz
Essentials-922a32e0329ce1a38e320d96ec51ca1c12b99735.zip
Don't fire entity powertool commands, with our user object.
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index 029288530..829ef0313 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -32,18 +32,28 @@ public class EssentialsEntityListener implements Listener
{
final User defender = ess.getUser(eDefend);
final User attacker = ess.getUser(eAttack);
- if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport()) {
+ if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport())
+ {
event.setCancelled(true);
}
attacker.updateActivity(true);
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())
{
- for (String command : commandList)
+ for (final String command : commandList)
{
if (command != null && !command.isEmpty())
{
- attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
+ ess.scheduleSyncDelayedTask(
+ new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ attacker.getServer().dispatchCommand(attacker.getBase(), command.replaceAll("\\{player\\}", defender.getName()));
+ }
+ });
+
event.setCancelled(true);
return;
}