mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-27 19:09:19 +00:00
Improvement to MessagesUtil
This commit is contained in:
@@ -17,6 +17,7 @@ import com.hibiscusmc.hmccosmetics.hooks.worldguard.WGListener;
|
||||
import com.hibiscusmc.hmccosmetics.listener.PlayerConnectionListener;
|
||||
import com.hibiscusmc.hmccosmetics.listener.PlayerGameListener;
|
||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
import com.hibiscusmc.hmccosmetics.util.misc.Translation;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -120,6 +121,23 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// Messages setup
|
||||
final File messagesFile = Path.of(getInstance().getDataFolder().getPath(), "messages.yml").toFile();
|
||||
final YamlConfigurationLoader messagesLoader = YamlConfigurationLoader.
|
||||
builder().
|
||||
path(messagesFile.toPath()).
|
||||
defaultOptions(opts ->
|
||||
opts.serializers(build -> {
|
||||
build.register(Location.class, LocationSerializer.INSTANCE);
|
||||
build.register(ItemStack.class, ItemSerializer.INSTANCE);
|
||||
}))
|
||||
.build();
|
||||
try {
|
||||
MessagesUtil.setup(messagesLoader.load());
|
||||
} catch (ConfigurateException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// Translation setup
|
||||
Translation.setup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user