Skip to content

Commit 2dce671

Browse files
committed
Fall back to command from PlayerPreProcessEvent in case PluginCommand is null
1 parent 295bc9f commit 2dce671

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,18 @@ public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
572572
user.updateActivityOnInteract(broadcast);
573573
}
574574

575-
if (ess.getSettings().isCommandCooldownsEnabled() && pluginCommand != null
575+
if (ess.getSettings().isCommandCooldownsEnabled()
576576
&& !user.isAuthorized("essentials.commandcooldowns.bypass")) {
577577
final int argStartIndex = event.getMessage().indexOf(" ");
578578
final String args = argStartIndex == -1 ? "" // No arguments present
579579
: " " + event.getMessage().substring(argStartIndex); // arguments start at argStartIndex; substring from there.
580-
final String fullCommand = pluginCommand.getName() + args;
580+
581+
final String fullCommand;
582+
if (pluginCommand != null) {
583+
fullCommand = pluginCommand.getName() + args;
584+
} else {
585+
fullCommand = cmd + args;
586+
}
581587

582588
// Used to determine whether a user already has an existing cooldown
583589
// If so, no need to check for (and write) new ones.

0 commit comments

Comments
 (0)