diff --git a/src/main/java/com/falsepattern/lib/config/Config.java b/src/main/java/com/falsepattern/lib/config/Config.java index 5fa234a..55c2698 100644 --- a/src/main/java/com/falsepattern/lib/config/Config.java +++ b/src/main/java/com/falsepattern/lib/config/Config.java @@ -185,4 +185,31 @@ public @interface Config { @Target({ElementType.FIELD, ElementType.TYPE}) @interface RequiresWorldRestart { } + + /** + * Signals that this configuration entry/class should be synchronized between the client and the server when + * joining a multiplayer instance. + * + * Note that synchronization ALWAYS happens FROM the server TO the client. The server should NEVER attempt to get + * configuration values from a client. This is to avoid malicious clients manipulating the server configs. + */ + @StableAPI(since = "0.10.0") + @Documented + @Retention(RetentionPolicy.RUNTIME) + @Target({ElementType.FIELD, ElementType.TYPE}) + @interface Synchronize { + /** + * This is a limit on how many bytes the client will accept from the server. If this limit is exceeded, + * the client shall refuse to connect to the server. For String[]-s, the amount of bytes is the sum of all + * strings inside the array.

+ * + * This limitation option exists to avoid malicious servers flooding clients with data.

+ * + * By default, the client will accept any amount of bytes.

+ * + * This only applies for String and String[] configurations, and is ignored on the other config types. + * For enums, this value is computed automatically. + */ + int maxLength(); + } } \ No newline at end of file