mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Move costs to after other precondition check
This commit is contained in:
parent
bc3df49775
commit
0ff3ee72e9
@ -166,12 +166,13 @@ public class CommandTrait extends Trait {
|
||||
|
||||
public void dispatch(final Player player, final Hand hand) {
|
||||
NPCCommandDispatchEvent event = new NPCCommandDispatchEvent(npc, player);
|
||||
event.setCancelled(!checkPreconditions(player, hand));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
Runnable task = new Runnable() {
|
||||
boolean charged = false;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
List<NPCCommand> commandList = Lists
|
||||
@ -234,6 +235,10 @@ public class CommandTrait extends Trait {
|
||||
if (info != null && !info.canUse(CommandTrait.this, player, command)) {
|
||||
return;
|
||||
}
|
||||
if (!charged && !checkPreconditions(player, hand)) {
|
||||
charged = true;
|
||||
return;
|
||||
}
|
||||
PermissionAttachment attachment = player.addAttachment(CitizensAPI.getPlugin());
|
||||
if (temporaryPermissions.size() > 0) {
|
||||
for (String permission : temporaryPermissions) {
|
||||
|
Loading…
Reference in New Issue
Block a user