Package me.devnatan.inventoryframework
Class IFViewFrame<S extends IFViewFrame<S,V>,V extends PlatformView<S,?,?,?,?,?,?,?>>
java.lang.Object
me.devnatan.inventoryframework.IFViewFrame<S,V>
abstract class IFViewFrame<S extends IFViewFrame<S,V>,V extends PlatformView<S,?,?,?,?,?,?,?>>
extends Object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<me.devnatan.inventoryframework.ViewConfigBuilder>static final me.devnatan.inventoryframework.pipeline.PipelinePhaseCalled when aIFViewFrameis registered.static final me.devnatan.inventoryframework.pipeline.PipelinePhaseCalled when aIFViewFrameis unregistered. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddViewer(@NotNull me.devnatan.inventoryframework.Viewer viewer) final me.devnatan.inventoryframework.context.EndlessContextInfocreateEndlessContext(@NotNull Class<? extends me.devnatan.inventoryframework.RootView> viewClass) Creates a context that is never invalidated.final me.devnatan.inventoryframework.context.EndlessContextInfocreateEndlessContext(@NotNull Class<? extends me.devnatan.inventoryframework.RootView> viewClass, Object initialData) Creates a context that is never invalidated.final SdefaultConfig(@NotNull Consumer<me.devnatan.inventoryframework.ViewConfigBuilder> defaultConfig) Sets the default configuration that will be used for all views registered from this framework.final SEnables internal code debugs.(package private) final Consumer<me.devnatan.inventoryframework.ViewConfigBuilder>The default configuration applier of this framework.final @NotNull me.devnatan.inventoryframework.pipeline.Pipeline<IFViewFrame>This is an internal inventory-framework API that should not be used from outside of this library.final VgetRegisteredViewByType(@NotNull Class<?> type) Gets an instance of a registered view from its class-type.All registered views.protected final StringinternalOpen(@NotNull Class<? extends V> viewClass, @NotNull Collection<?> viewers, Object initialData) Opens a view to more than one player with initial data.protected final voidinternalOpenActiveContext(Class<? extends me.devnatan.inventoryframework.RootView> viewClass, String contextId, Object viewer, Object initialData) Opens an active context.final booleanIf this view frame is registered.abstract Sregister()Registers this view frame.final voidRemoves a view from this view frame.(package private) voidremoveViewer(@NotNull me.devnatan.inventoryframework.Viewer viewer) protected final voidsetRegistered(boolean registered) Sets the registered state of this view frame.abstract voidUnregisters this view frame and closes all registered views.final SRegisters a new view to this view frame.
-
Field Details
-
FRAME_REGISTERED
public static final me.devnatan.inventoryframework.pipeline.PipelinePhase FRAME_REGISTEREDCalled when aIFViewFrameis registered. -
FRAME_UNREGISTERED
public static final me.devnatan.inventoryframework.pipeline.PipelinePhase FRAME_UNREGISTEREDCalled when aIFViewFrameis unregistered. -
registeredViews
-
viewerById
-
defaultConfig
-
-
Constructor Details
-
IFViewFrame
protected IFViewFrame()
-
-
Method Details
-
getPipeline
@Internal @NotNull public final @NotNull me.devnatan.inventoryframework.pipeline.Pipeline<IFViewFrame> getPipeline()This is an internal inventory-framework API that should not be used from outside of this library. No compatibility guarantees are provided. -
getRegisteredViews
All registered views.- Returns:
- A Map containing all registered views in this view frame.
-
getRegisteredViewByType
Gets an instance of a registered view from its class-type.- Parameters:
type- The view type.- Returns:
- An RootView instance of the given type.
- Throws:
IllegalArgumentException- If the given cannot be found.
-
with
Registers a new view to this view frame.- Parameters:
views- The views that'll be registered.- Returns:
- This platform view frame.
-
remove
Removes a view from this view frame.- Parameters:
views- The views that'll be removed.
-
register
Registers this view frame.- Returns:
- This platform view frame.
- Throws:
IllegalStateException- If this view frame is already registered.
-
unregister
public abstract void unregister()Unregisters this view frame and closes all registered views. -
isRegistered
public final boolean isRegistered()If this view frame is registered.- Returns:
trueif it's registered orfalseotherwise.
-
setRegistered
protected final void setRegistered(boolean registered) Sets the registered state of this view frame.- Parameters:
registered-trueto mark this view frame as registered.
-
internalOpen
protected final String internalOpen(@NotNull @NotNull Class<? extends V> viewClass, @NotNull @NotNull Collection<?> viewers, 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.
- Parameters:
viewClass- The target view to be opened.viewers- The viewers that the view will be open to.initialData- The initial data.- Returns:
- The id of the newly created
IFContext.
-
internalOpenActiveContext
protected final void internalOpenActiveContext(Class<? extends me.devnatan.inventoryframework.RootView> viewClass, String contextId, Object viewer, Object initialData) Opens an active context.- Parameters:
viewClass- The target view to be opened.contextId- Context id to open into.viewer- The viewer to attach into the specified context.initialData- The initial viewer data.
-
createEndlessContext
@Experimental public final me.devnatan.inventoryframework.context.EndlessContextInfo createEndlessContext(@NotNull @NotNull Class<? extends me.devnatan.inventoryframework.RootView> viewClass) Creates a context that is never invalidated.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 view of the context to be later opened.- Returns:
- The id of the context.
-
createEndlessContext
@Experimental public final me.devnatan.inventoryframework.context.EndlessContextInfo createEndlessContext(@NotNull @NotNull Class<? extends me.devnatan.inventoryframework.RootView> viewClass, Object initialData) Creates a context that is never invalidated.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 view of the context to be later opened.initialData- Initial setup data to pass to opening handler.- Returns:
- The id of the context.
-
addViewer
void addViewer(@NotNull @NotNull me.devnatan.inventoryframework.Viewer viewer) -
removeViewer
void removeViewer(@NotNull @NotNull me.devnatan.inventoryframework.Viewer viewer) -
defaultConfig
@Experimental public final S defaultConfig(@NotNull @NotNull Consumer<me.devnatan.inventoryframework.ViewConfigBuilder> defaultConfig) Sets the default configuration that will be used for all views registered from this framework.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.
- Returns:
- This framework instance.
- See Also:
-
getDefaultConfig
The default configuration applier of this framework.- Returns:
- The default configuration applier of this framework.
-
enableDebug
Enables internal code debugs.This is an internal inventory-framework API that should not be used from outside of this library. No compatibility guarantees are provided.
- Returns:
- Enable InventoryFramework debugs.
-