@@ -73,7 +73,7 @@ public abstract class BukkitCommand extends org.bukkit.command.Command implement
7373 /**
7474 * The executable action performed when this command is executed.
7575 */
76- private Executable executable = null ;
76+ private CommandPredicate executable = null ;
7777
7878 /**
7979 * Predicate for handling errors during command execution.
@@ -323,15 +323,15 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String label, @No
323323 if (args .length > 1 )
324324 System .arraycopy (args , 1 , newArgs , 0 , last );
325325 try {
326- success = sub .getExecutable ().executeAction (sender , newArgs ). asBoolean ( );
326+ success = sub .getPredicate ().test (sender , newArgs );
327327 } catch (Throwable e ) {
328328 success = executingError .test (sender , e );
329329 }
330330 return success ;
331331 }
332332 }
333333 try {
334- success = getExecutable ().executeAction (sender , args ). asBoolean ( );
334+ success = getPredicate ().test (sender , args );
335335 } catch (Throwable e ) {
336336 success = executingError .test (sender , e );
337337 }
@@ -367,41 +367,32 @@ public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String a
367367 }
368368
369369 /**
370- * Retrieves the executable action associated with this command.
370+ * Retrieves the executable predicate associated with this command.
371371 *
372- * @return the {@link Executable } representing the command's action.
373- * @throws NullPointerException if the executable action is not set.
372+ * @return the {@link CommandPredicate } representing the command's action.
373+ * @throws NullPointerException if the executable predicate is not set.
374374 */
375375 @ NotNull
376- public Executable getExecutable () {
377- return Objects .requireNonNull (executable , "Executable action is not set" );
376+ public CommandPredicate getPredicate () {
377+ return Objects .requireNonNull (executable , "Executable predicate is not set" );
378378 }
379379
380380 /**
381- * Sets the executable action for this command .
381+ * Sets the executable predicate based on a provided {@link CommandPredicate} .
382382 *
383- * @param executable the executable action to assign.
384- */
385- public void setExecutable (Executable executable ) {
386- this .executable = executable ;
387- }
388-
389- /**
390- * Sets the executable action based on a provided {@link CommandPredicate}.
391- *
392- * @param predicate the command predicate used to generate the executable action.
383+ * @param predicate the command predicate used to generate the executable predicate.
393384 */
394385 public void setExecutable (CommandPredicate predicate ) {
395- this .executable = Executable . from ( predicate ) ;
386+ this .executable = predicate ;
396387 }
397388
398389 /**
399- * Sets the executable action to a constant boolean value.
390+ * Sets the executable predicate to a constant boolean value.
400391 *
401392 * @param value the boolean value representing the command outcome.
402393 */
403394 public void setExecutable (boolean value ) {
404- this .executable = Executable . from ( value ) ;
395+ this .executable = ( sender , strings ) -> value ;
405396 }
406397
407398 /**
@@ -539,7 +530,7 @@ public static void syncCommands() {
539530 * @return {@code true} if the command was successfully registered; {@code false} otherwise.
540531 */
541532 public boolean register (boolean sync ) {
542- if (registered || ! isEnabled () ) return false ;
533+ if (registered ) return false ;
543534
544535 org .bukkit .command .Command c = knownCommands ().get (getName ());
545536 if (isOverriding () && c != null )
@@ -574,7 +565,7 @@ public boolean register() {
574565 */
575566 @ SuppressWarnings ("all" )
576567 public boolean unregister (boolean sync ) {
577- if (!registered || isEnabled () ) return false ;
568+ if (!registered ) return false ;
578569
579570 org .bukkit .command .Command c = knownCommands ().get (getName ());
580571 if (!Objects .equals (c , this )) return false ;
0 commit comments