Skip to content

Commit 66a2797

Browse files
committed
begin server-client config sync impl
1 parent 6efb569 commit 66a2797

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/main/java/com/falsepattern/lib/config/Config.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,31 @@
185185
@Target({ElementType.FIELD, ElementType.TYPE})
186186
@interface RequiresWorldRestart {
187187
}
188+
189+
/**
190+
* Signals that this configuration entry/class should be synchronized between the client and the server when
191+
* joining a multiplayer instance.
192+
*
193+
* Note that synchronization ALWAYS happens FROM the server TO the client. The server should NEVER attempt to get
194+
* configuration values from a client. This is to avoid malicious clients manipulating the server configs.
195+
*/
196+
@StableAPI(since = "0.10.0")
197+
@Documented
198+
@Retention(RetentionPolicy.RUNTIME)
199+
@Target({ElementType.FIELD, ElementType.TYPE})
200+
@interface Synchronize {
201+
/**
202+
* This is a limit on how many bytes the client will accept from the server. If this limit is exceeded,
203+
* the client shall refuse to connect to the server. For String[]-s, the amount of bytes is the sum of all
204+
* strings inside the array.<br><br>
205+
*
206+
* This limitation option exists to avoid malicious servers flooding clients with data.<br><br>
207+
*
208+
* By default, the client will accept any amount of bytes.<br><br>
209+
*
210+
* This only applies for String and String[] configurations, and is ignored on the other config types.
211+
* For enums, this value is computed automatically.
212+
*/
213+
int maxLength();
214+
}
188215
}

0 commit comments

Comments
 (0)