Class ViewFrame

java.lang.Object
me.devnatan.inventoryframework.ViewFrame

public class ViewFrame extends Object
  • Field Details

    • FRAME_REGISTERED

      public static final me.devnatan.inventoryframework.pipeline.PipelinePhase FRAME_REGISTERED
    • FRAME_UNREGISTERED

      public static final me.devnatan.inventoryframework.pipeline.PipelinePhase FRAME_UNREGISTERED
    • registeredViews

      protected final Map<UUID,View> registeredViews
    • viewerById

      protected final Map<String,me.devnatan.inventoryframework.Viewer> viewerById
    • defaultConfig

      protected Consumer<me.devnatan.inventoryframework.ViewConfigBuilder> defaultConfig
  • Method Details

    • getOwner

      @NotNull public final @NotNull org.bukkit.plugin.Plugin getOwner()
    • open

      public final String open(@NotNull @NotNull Class<? extends View> viewClass, @NotNull @NotNull org.bukkit.entity.Player player)
      Opens a view to a player.
      Parameters:
      viewClass - The target view to be opened.
      player - The player that the view will be open to.
      Returns:
      The id of the newly created IFContext.
    • open

      public final String open(@NotNull @NotNull Class<? extends View> viewClass, @NotNull @NotNull org.bukkit.entity.Player player, Object initialData)
      Opens a view to a player with initial data.
      Parameters:
      viewClass - The target view to be opened.
      player - The player that the view will be open to.
      initialData - The initial data.
      Returns:
      The id of the newly created IFContext.
    • open

      @Experimental public final String open(@NotNull @NotNull Class<? extends View> viewClass, @NotNull @NotNull Collection<? extends org.bukkit.entity.Player> players)
      Opens a view to more than one player.

      These players will see the same inventory and share the same context.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Parameters:
      viewClass - The target view to be opened.
      players - The players that the view will be open to.
      Returns:
      The id of the newly created IFContext.
    • open

      @Experimental public final String open(@NotNull @NotNull Class<? extends View> viewClass, @NotNull @NotNull Collection<? extends org.bukkit.entity.Player> players, Object initialData)
      Opens a view to more than one player with initial data.

      These players will see the same inventory and share the same context.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Parameters:
      viewClass - The target view to be opened.
      players - The players that the view will be open to.
      initialData - The initial data.
      Returns:
      The id of the newly created IFContext.
    • openActive

      @Experimental public final void openActive(@NotNull @NotNull Class<? extends View> viewClass, @NotNull @NotNull String contextId, @NotNull @NotNull org.bukkit.entity.Player player)
      Opens an already active context to a player.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Parameters:
      contextId - The id of the context.
      player - Who the context will be open to.
    • openActive

      @Experimental public final void openActive(@NotNull @NotNull Class<? extends View> viewClass, @NotNull @NotNull String contextId, @NotNull @NotNull org.bukkit.entity.Player player, Object initialData)
      Opens an already active context to a player.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Parameters:
      contextId - The id of the context.
      player - Who the context will be open to.
      initialData - Initial data to pass to PlatformView.onViewerAdded(IFContext, Object, Object).
    • openEndless

      @Experimental public final void openEndless(@NotNull @NotNull me.devnatan.inventoryframework.context.EndlessContextInfo endlessContextInfo, @NotNull @NotNull org.bukkit.entity.Player player)
      Opens an already active context to a player.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Parameters:
      endlessContextInfo - The id of the context.
      player - Who the context will be open to.
    • openEndless

      @Experimental public final void openEndless(@NotNull @NotNull me.devnatan.inventoryframework.context.EndlessContextInfo endlessContextInfo, @NotNull @NotNull org.bukkit.entity.Player player, Object initialData)
      Opens an already active context to a player.

      This API is experimental and is not subject to the general compatibility guarantees such API may be changed or may be removed completely in any further release.

      Parameters:
      endlessContextInfo - The id of the context.
      player - Who the context will be open to.
      initialData - Initial data to pass to PlatformView.onViewerAdded(IFContext, Object, Object).
    • register

      public final ViewFrame register()
    • unregister

      public final void unregister()
    • getViewer

      @Internal public final me.devnatan.inventoryframework.Viewer getViewer(@NotNull @NotNull org.bukkit.entity.Player player)
      This is an internal inventory-framework API that should not be used from outside of this library. No compatibility guarantees are provided.
    • create

      @NotNull public static @NotNull ViewFrame create(@NotNull @NotNull org.bukkit.plugin.Plugin owner)
      Creates a new ViewFrame.
      Parameters:
      owner - The plugin that owns this view frame.
      Returns:
      A new ViewFrame instance.
    • install

      public final <C, R> ViewFrame install(@NotNull @NotNull me.devnatan.inventoryframework.feature.Feature<C,R,ViewFrame> feature, @NotNull @NotNull UnaryOperator<C> configure)
      Installs a feature.
      Type Parameters:
      C - The feature configuration type.
      R - The feature value instance type.
      Parameters:
      feature - The feature to be installed.
      configure - The feature configuration.
      Returns:
      An instance of the installed feature.
    • install

      @NotNull public final @NotNull ViewFrame install(@NotNull @NotNull me.devnatan.inventoryframework.feature.Feature<?,?,ViewFrame> feature)
      Installs a feature with no specific configuration.
      Parameters:
      feature - The feature to be installed.
      Returns:
      This view frame.
    • disableMetrics

      public final ViewFrame disableMetrics()
      Disables bStats metrics tracking.

      InventoryFramework use bStats metrics to obtain some information from servers that use it as a library, such as: number of players, version, software, etc.

      **No sensitive information is tracked.**

      Returns:
      This view frame.
    • getPipeline

      @Internal @NotNull public final me.devnatan.inventoryframework.pipeline.Pipeline<me.devnatan.inventoryframework.IFViewFrame> getPipeline()
    • getRegisteredViews

      @NotNull protected final Map<UUID,View> getRegisteredViews()
    • getRegisteredViewByType

      @NotNull public final View getRegisteredViewByType(@NotNull Class<?> arg0)
    • with

      @Contract("_ -> this") public final ViewFrame with(View... arg0)
    • remove

      public final void remove(View... arg0)
    • isRegistered

      public final boolean isRegistered()
    • setRegistered

      protected final void setRegistered(boolean arg0)
    • internalOpen

      protected final String internalOpen(@NotNull Class<? extends View> arg0, @NotNull Collection<?> arg1, Object arg2)
    • internalOpenActiveContext

      protected final void internalOpenActiveContext(Class<? extends me.devnatan.inventoryframework.RootView> arg0, String arg1, Object arg2, Object arg3)
    • createEndlessContext

      @Experimental public final me.devnatan.inventoryframework.context.EndlessContextInfo createEndlessContext(@NotNull Class<? extends me.devnatan.inventoryframework.RootView> arg0)
    • createEndlessContext

      @Experimental public final me.devnatan.inventoryframework.context.EndlessContextInfo createEndlessContext(@NotNull Class<? extends me.devnatan.inventoryframework.RootView> arg0, Object arg1)
    • addViewer

      void addViewer(@NotNull me.devnatan.inventoryframework.Viewer arg0)
    • removeViewer

      void removeViewer(@NotNull me.devnatan.inventoryframework.Viewer arg0)
    • defaultConfig

      @Experimental public final ViewFrame defaultConfig(@NotNull Consumer<me.devnatan.inventoryframework.ViewConfigBuilder> arg0)
    • getDefaultConfig

      final Consumer<me.devnatan.inventoryframework.ViewConfigBuilder> getDefaultConfig()
    • enableDebug

      @Internal public final ViewFrame enableDebug()