Add example of config as well
This commit is contained in:
25
src/main/java/dev/hytalemodding/config/ExampleConfig.java
Normal file
25
src/main/java/dev/hytalemodding/config/ExampleConfig.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package dev.hytalemodding.config;
|
||||
|
||||
import com.hypixel.hytale.codec.Codec;
|
||||
import com.hypixel.hytale.codec.KeyedCodec;
|
||||
import com.hypixel.hytale.codec.builder.BuilderCodec;
|
||||
|
||||
public class ExampleConfig {
|
||||
|
||||
public static final BuilderCodec<ExampleConfig> CODEC = BuilderCodec.builder(ExampleConfig.class, ExampleConfig::new)
|
||||
.append(
|
||||
new KeyedCodec<>("EnableWelcomeMessage", Codec.BOOLEAN),
|
||||
(exConfig, aBoolean, extraInfo) -> exConfig.enabledWelcomeMessage = aBoolean,
|
||||
(exConfig, extraInfo) -> exConfig.enabledWelcomeMessage
|
||||
)
|
||||
.add()
|
||||
.build();
|
||||
|
||||
private boolean enabledWelcomeMessage;
|
||||
|
||||
private ExampleConfig() {}
|
||||
|
||||
public boolean isEnabledWelcomeMessage() {
|
||||
return enabledWelcomeMessage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user