Class Executors

java.lang.Object
ua.mcchickenstudio.opencreative.coding.blocks.executors.Executors

public final class Executors extends Object

Executors

This class represents registry of executors, that can register new executors for coding.

To get instance use getInstance().

To add custom executor create a class, that extends one of prepared: PlayerExecutor, WorldExecutor, EntityExecutor, and register it with registerExecutor(Executor) method.

  • Constructor Details

    • Executors

      public Executors()
  • Method Details

    • getInstance

      @NotNull public static @NotNull Executors getInstance()
      Returns instance of executors controller class.
      Returns:
      instance of executors.
    • registerExecutor

      public void registerExecutor(@NotNull @NotNull Executor executor)
      Registers executor, that will be replaced in coding.
      Parameters:
      executor - executor to register.
    • registerExecutor

      public void registerExecutor(@NotNull @NotNull Executor... executors)
      Registers executors, that will be replaced in coding.
      Parameters:
      executors - executors to register.
    • unregisterExecutor

      public void unregisterExecutor(@NotNull @NotNull Executor executor)
      Unregisters executor if list contains it.
      Parameters:
      executor - executor to unregister.
    • getExecutors

      @NotNull public @NotNull List<Executor> getExecutors()
      Returns a copy of list that contains all registered executors.
      Returns:
      executors list.
    • getByCategories

      @NotNull public @NotNull List<Executor> getByCategories(@NotNull @NotNull ExecutorCategory executorCategory, @NotNull @NotNull MenusCategory menusCategory)
      Returns list of executors, that have same menu category.
      Parameters:
      executorCategory - executor category.
      menusCategory - menu category.
      Returns:
      list of executors with specified menu category.
    • getCategories

      @NotNull public @NotNull List<MenusCategory> getCategories(@NotNull @NotNull ExecutorCategory executorCategory)
      Returns list of all menu categories of specified executor category..
      Parameters:
      executorCategory - executor category.
      Returns:
      list of menu categories.
    • exists

      public boolean exists(@NotNull @NotNull String id)
      Checks if executor with specified ID exists in registry.
      Parameters:
      id - id of executor.
      Returns:
      true - exists, false - not exists.
    • exists

      public boolean exists(@NotNull @NotNull Class<? extends Executor> clazz)
      Checks if executor with specified class exists in registry.
      Parameters:
      clazz - class of executor.
      Returns:
      true - exists, false - not exists.
    • getByClass

      @Nullable public @Nullable Executor getByClass(@NotNull @NotNull Class<? extends Executor> clazz)
      Returns executor from registry by specified class if it exists, otherwise will return null.
      Parameters:
      clazz - class to get executor.
      Returns:
      executor - if exists, or null - not exists.
    • getById

      @Nullable public @Nullable Executor getById(@NotNull @NotNull String id)
      Returns executor from registry by specified id if it exists, otherwise will return null.
      Parameters:
      id - id to get executor.
      Returns:
      executor - if exists, or null - not exists.
    • getByBlock

      @Nullable public @Nullable Executor getByBlock(@NotNull @NotNull org.bukkit.block.Block block)
      Returns executor from registry by specified block if it exists, otherwise will return null.
      Parameters:
      block - block to get executor.
      Returns:
      executor - if exists, or null - not exists.