summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-01-19 15:15:43 +0000
committerKHobbits <rob@khobbits.co.uk>2013-01-19 15:19:39 +0000
commit56dcf54c2d54d343aae8fd6f7e81f766d0187d76 (patch)
tree8957419d8c4d60698a64423d40c73ef8d9fea6d6
parent27c8584c11d5618572caf7ee56ccbe443acc9a43 (diff)
downloadEssentials-56dcf54c2d54d343aae8fd6f7e81f766d0187d76.tar
Essentials-56dcf54c2d54d343aae8fd6f7e81f766d0187d76.tar.gz
Essentials-56dcf54c2d54d343aae8fd6f7e81f766d0187d76.tar.lz
Essentials-56dcf54c2d54d343aae8fd6f7e81f766d0187d76.tar.xz
Essentials-56dcf54c2d54d343aae8fd6f7e81f766d0187d76.zip
Reduce chance of self repeating powertool actions.
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index 7e7e2763f..653068420 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -94,9 +94,10 @@ public class EssentialsEntityListener implements Listener
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())
{
- for (final String command : commandList)
+ for (final String tempCommand : commandList)
{
- if (command != null && !command.isEmpty())
+ final String command = tempCommand.replaceAll("\\{player\\}", defender.getName());
+ if (command != null && !command.isEmpty() && !command.equals(tempCommand))
{
ess.scheduleSyncDelayedTask(
new Runnable()
@@ -104,7 +105,7 @@ public class EssentialsEntityListener implements Listener
@Override
public void run()
{
- attacker.getServer().dispatchCommand(attacker.getBase(), command.replaceAll("\\{player\\}", defender.getName()));
+ attacker.getServer().dispatchCommand(attacker.getBase(), command);
LOGGER.log(Level.INFO, String.format("[PT] %s issued server command: /%s", attacker.getName(), command));
}
});