Class DefaultContent
java.lang.Object
studio.mevera.lotus.internal.content.DefaultContent
- All Implemented Interfaces:
Content,ContentEditor,ContentView
Default
Content implementation backed by a HashMap<Slot, Button>. Not thread-safe;
mutated only on the server main thread.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Capacitycapacity()Returns the capacity this content was created for.voidclear()Removes all buttons.entries()Returns the stored entries as a stream.voidFills all slots in the mask with the same button.voidforEach(@NotNull BiConsumer<Slot, Button> consumer) Visits every stored button.Returns the button at the given slot, if one exists.booleanisEmpty()Returns whether no buttons are present.@NotNull ContentmergeWith(@NotNull ContentView other) Returns a new content object with entries from both sources.Returns the next empty slot starting fromfrom.voidRemoves the button at the given slot.voidSets or clears the button at the given slot.intsize()Returns the number of occupied slots.voidtrimTo(int maxButtons) Removes extra buttons after the given limit is reached.voidupdate(@NotNull Slot slot, @NotNull UnaryOperator<Button> updater) Replaces the button at the given slot using the updater result.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface studio.mevera.lotus.api.content.ContentEditor
placeSpanning
-
Constructor Details
-
DefaultContent
-
-
Method Details
-
capacity
Description copied from interface:ContentViewReturns the capacity this content was created for.- Specified by:
capacityin interfaceContentView
-
get
Description copied from interface:ContentViewReturns the button at the given slot, if one exists.- Specified by:
getin interfaceContentView
-
size
public int size()Description copied from interface:ContentViewReturns the number of occupied slots.- Specified by:
sizein interfaceContentView
-
isEmpty
public boolean isEmpty()Description copied from interface:ContentViewReturns whether no buttons are present.- Specified by:
isEmptyin interfaceContentView
-
nextEmpty
Description copied from interface:ContentViewReturns the next empty slot starting fromfrom.- Specified by:
nextEmptyin interfaceContentView
-
entries
Description copied from interface:ContentViewReturns the stored entries as a stream.- Specified by:
entriesin interfaceContentView
-
forEach
Description copied from interface:ContentViewVisits every stored button.- Specified by:
forEachin interfaceContentView
-
set
Description copied from interface:ContentEditorSets or clears the button at the given slot.- Specified by:
setin interfaceContentEditor
-
remove
Description copied from interface:ContentEditorRemoves the button at the given slot.- Specified by:
removein interfaceContentEditor
-
update
Description copied from interface:ContentEditorReplaces the button at the given slot using the updater result.- Specified by:
updatein interfaceContentEditor
-
fill
Description copied from interface:ContentEditorFills all slots in the mask with the same button.- Specified by:
fillin interfaceContentEditor
-
clear
public void clear()Description copied from interface:ContentEditorRemoves all buttons.- Specified by:
clearin interfaceContentEditor
-
mergeWith
Description copied from interface:ContentReturns a new content object with entries from both sources.Entries from
otheroverwrite entries from this content when both use the same slot. -
trimTo
public void trimTo(int maxButtons) Description copied from interface:ContentRemoves extra buttons after the given limit is reached.
-