Conversation
This ddui changes has been tested by 1.26.11 client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What to do in this update:
.idea(JetBrains IDE) project configuration files from version controlTranslateabletoUIRawMessageCustomFormMessageBoxMessageBoxResultObservablesetData()getData()getFilteredText()(added in 1.26.20.23)subscribe()UIRawMessageDataDrivenScreenClosedReason(added in 1.26.20.22)PlayerLeftError(added in 1.26.20.22)TextFilteringError(added in 1.26.20.23)FormCloseError(added in 1.26.20.22)ServerShutdownError(added in 1.26.20.22)Breaking Changes Summary
DavyCraft648\PMServerUI\...Azvyl\PMServerUI\...orAzvyl\PMServerUI\ui\...FormDataHandlerwas removed (replaced byServerUIarchitecture + per-form response parsing).PMServerUI::register()no longer accepts the optional translation flag (bool $tl).Promise::resolve()changed from variadic arguments to a single value.FormRejectErrorno longer extendsError; it now extendsRuntimeException.Package Metadata Changes
davycraft648/pmserver-ui->azvyl/pmserver-uiDavyCraft648\PMServerUI->Azvyl\PMServerUIDavyCraft648->Azvyl1.0.2->2.0.0Moved Classes / Namespace Replacements
The following classes are conceptually the same, but were moved into the
uinamespace:ActionFormData->Azvyl\PMServerUI\ui\ActionFormDataActionFormResponse->Azvyl\PMServerUI\ui\ActionFormResponseFormCancelationReason->Azvyl\PMServerUI\ui\FormCancelationReasonFormRejectError->Azvyl\PMServerUI\ui\FormRejectErrorFormRejectReason->Azvyl\PMServerUI\ui\FormRejectReasonFormResponse->Azvyl\PMServerUI\ui\FormResponseMessageFormData->Azvyl\PMServerUI\ui\MessageFormDataMessageFormResponse->Azvyl\PMServerUI\ui\MessageFormResponseModalFormData->Azvyl\PMServerUI\ui\ModalFormDataModalFormResponse->Azvyl\PMServerUI\ui\ModalFormResponseUIManager->Azvyl\PMServerUI\ui\UIManagerClasses that remain in the root namespace (with internal changes):
PMServerUI->Azvyl\PMServerUI\PMServerUIPromise->Azvyl\PMServerUI\PromiseRemoved / Replaced Classes
DavyCraft648\PMServerUI\FormDataHandlerAzvyl\PMServerUI\ui\ServerUI(form abstraction)Azvyl\PMServerUI\ui\UIManager(tracking + response dispatch)processResponse()implemented per form class (ActionFormData,MessageFormData,ModalFormData)New Classes in v2
Root
Azvyl\PMServerUI\UIRawMessageNew UI Layer
Azvyl\PMServerUI\ui\ServerUIData Driven UI (
ddui)Azvyl\PMServerUI\ddui\DDUIAzvyl\PMServerUI\ddui\DDUIManagerAzvyl\PMServerUI\ddui\CustomFormAzvyl\PMServerUI\ddui\CustomFormPayloadComposerAzvyl\PMServerUI\ddui\CustomFormRenderContextAzvyl\PMServerUI\ddui\DropdownItemAzvyl\PMServerUI\ddui\ObservableAzvyl\PMServerUI\ddui\SubscriptionAzvyl\PMServerUI\ddui\MessageBox(currently placeholder / TODO)DDUI Elements
Azvyl\PMServerUI\ddui\elements\CustomFormElement(interface)Azvyl\PMServerUI\ddui\elements\ButtonElementAzvyl\PMServerUI\ddui\elements\DividerElementAzvyl\PMServerUI\ddui\elements\DropdownElementAzvyl\PMServerUI\ddui\elements\HeaderElementAzvyl\PMServerUI\ddui\elements\LabelElementAzvyl\PMServerUI\ddui\elements\SliderElementAzvyl\PMServerUI\ddui\elements\SpacerElementAzvyl\PMServerUI\ddui\elements\TextFieldElementAzvyl\PMServerUI\ddui\elements\ToggleElementDDUI Packets and Types
Azvyl\PMServerUI\ddui\packets\ClientboundDataStorePacketAzvyl\PMServerUI\ddui\packets\types\DataStorePropertyValueAzvyl\PMServerUI\ddui\packets\types\DataStorePropertyTypeAzvyl\PMServerUI\ddui\packets\types\DataStoreChangeAzvyl\PMServerUI\ddui\packets\types\DataStoreMapEntryAzvyl\PMServerUI\ddui\packets\types\BoolDataStorePropertyValueAzvyl\PMServerUI\ddui\packets\types\Int64DataStorePropertyValueAzvyl\PMServerUI\ddui\packets\types\StringDataStorePropertyValueAzvyl\PMServerUI\ddui\packets\types\ListDataStorePropertyValueAzvyl\PMServerUI\ddui\packets\types\MapDataStorePropertyValueAzvyl\PMServerUI\ddui\packets\types\NoneDataStorePropertyValueNote:
Azvyl\PMServerUI\ddui\packetswas made as a compatibility workaround because PocketMine'sClientboundDataStorePacketencoding has parts that are not encoded correctly for this DDUI use case.Important Method/API Changes
1) Library Bootstrap (
PMServerUI)register(Plugin $plugin, bool $tl = false): voidInvalidArgumentExceptionregister(Plugin $plugin): voidreturn(idempotent)getDDUIManager(): DDUIManagerImpact:
$tlmust migrate toUIRawMessage-based formatting.2) Form Sending (
show) and TrackingFormDataHandler;show()sends packets via that handler.ServerUI; finalshow()callsPMServerUI::getUIManager()->___send(...).Impact:
trackForm(...)to___track(...)and___send(...)(internal API).3)
UIManagerResponse Handlingplayer !== null10 * 1024bytes)nullform data without cancel reasonNote:
closeAllForms(Player $player)exists in v2, but is not implemented yet (RuntimeException: Not implemented yet).4) Static Form Builder API
Translatable|string(v1) tostring|UIRawMessage(v2).ActionFormData::button():button(..., ?string $iconPath = null, string $iconType = "path")button(..., ?string $iconPath = null, ?string $iconUrl = null)ModalFormData:ModalFormResponse::validate(...)toModalFormData::processResponse(...)processResponse().5) Response Objects
(?FormCancelationReason, bool $canceled, ?payload)(?FormCancelationReason, ?payload)and computescanceledautomatically ($cancelationReason !== null)validate(...)methods were removed fromActionFormResponse,MessageFormResponse, andModalFormResponse.6) Errors and Enums
FormRejectError:ErrorRuntimeExceptionFormCancelationReasonandFormRejectReason:7) Promise API
resolve(mixed ...$value)(variadic)resolve(mixed $value)(single value, generic template)then(...)callbacks in v2 are designed around one resolved value.New Architecture: Data Driven UI
v2 introduces a DDUI ecosystem that does not exist in v1:
DDUIManagerfor lifecycle, observable binding, packet handling, and datastore synchronization.Observable+Subscriptionfor reactive server <-> client state.CustomFormand DDUI elements for dynamic UI composition.