@minecraft/server-ui 2.1.0-beta.1.26.20-preview.22 → 2.1.0-beta.1.26.20-preview.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.d.ts +48 -0
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -74,6 +74,39 @@ export enum FormRejectReason {
74
74
  ServerShutdown = 'ServerShutdown',
75
75
  }
76
76
 
77
+ /**
78
+ * @beta
79
+ * An enum representing the errors that can occur during text
80
+ * filtering. This is used to provide more context about the
81
+ * filtering process.
82
+ */
83
+ export declare enum TextFilteringError {
84
+ /**
85
+ * @remarks
86
+ * The text was not filtered because the player disabled text
87
+ * filtering in their settings.
88
+ *
89
+ */
90
+ DisabledByPlayer = 'DisabledByPlayer',
91
+ /**
92
+ * @remarks
93
+ * The text was not filtered because the service is
94
+ * unreachable. This can occur if there are network issues or
95
+ * if the service is down for maintenance.
96
+ *
97
+ */
98
+ TextProcessorServiceUnreachable = 'TextProcessorServiceUnreachable',
99
+ /**
100
+ * @remarks
101
+ * An unknown error occurred during text filtering. This can
102
+ * occur if there is an unexpected issue with the text
103
+ * filtering service or if the service returns an error that is
104
+ * not categorized under the other error types.
105
+ *
106
+ */
107
+ Unknown = 'Unknown',
108
+ }
109
+
77
110
  /**
78
111
  * Builds a simple player form with buttons that let the player
79
112
  * take action.
@@ -895,6 +928,21 @@ export declare class Observable<T extends string | number | boolean | UIRawMessa
895
928
  *
896
929
  */
897
930
  getData(): T;
931
+ /**
932
+ * @remarks
933
+ * Gets filtered data from the Observable (only available for
934
+ * strings). In case of failure, it will return an array of
935
+ * TextFilteringError that can provide more context about the
936
+ * filtering process. For testing purposes, the options are
937
+ * available under "Creator -> Text Filtering" settings menu.
938
+ * This delay is only applied to the getFilteredText function
939
+ * and can be used to simulate network latency when testing.
940
+ *
941
+ */
942
+ getFilteredText(
943
+ this: Observable<T & string>,
944
+ player: minecraftserver.Player,
945
+ ): Promise<string | TextFilteringError[]>;
898
946
  /**
899
947
  * @remarks
900
948
  * Sets the data on this Observable and notifies the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server-ui",
3
- "version": "2.1.0-beta.1.26.20-preview.22",
3
+ "version": "2.1.0-beta.1.26.20-preview.26",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "peerDependencies": {
16
16
  "@minecraft/common": "^1.0.0",
17
- "@minecraft/server": "^2.0.0 || ^2.8.0-beta.1.26.20-preview.22"
17
+ "@minecraft/server": "^2.0.0 || ^2.8.0-beta.1.26.20-preview.26"
18
18
  },
19
19
  "license": "MIT"
20
20
  }