mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Don't fire entity powertool commands, with our user object.
This commit is contained in:
parent
a97b3abca3
commit
01ba8dbc3f
@ -32,18 +32,28 @@ public class EssentialsEntityListener implements Listener
|
|||||||
{
|
{
|
||||||
final User defender = ess.getUser(eDefend);
|
final User defender = ess.getUser(eDefend);
|
||||||
final User attacker = ess.getUser(eAttack);
|
final User attacker = ess.getUser(eAttack);
|
||||||
if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport()) {
|
if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport())
|
||||||
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
attacker.updateActivity(true);
|
attacker.updateActivity(true);
|
||||||
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
|
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
|
||||||
if (commandList != null && !commandList.isEmpty())
|
if (commandList != null && !commandList.isEmpty())
|
||||||
{
|
{
|
||||||
for (String command : commandList)
|
for (final String command : commandList)
|
||||||
{
|
{
|
||||||
if (command != null && !command.isEmpty())
|
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);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user