Search in sources :

Example 1 with EarlyRegistration

use of org.lanternpowered.server.game.registry.EarlyRegistration in project LanternServer by LanternPowered.

the class TextColorRegistryModule method registerDefaults.

@EarlyRegistration
@Override
public void registerDefaults() {
    register(new LanternTextColor("black", Color.BLACK, TextConstants.BLACK));
    register(new LanternTextColor("dark_blue", Color.ofRgb(0x0000AA), TextConstants.DARK_BLUE));
    register(new LanternTextColor("dark_green", Color.ofRgb(0x00AA00), TextConstants.DARK_GREEN));
    register(new LanternTextColor("dark_aqua", Color.ofRgb(0x00AAAA), TextConstants.DARK_AQUA));
    register(new LanternTextColor("dark_red", Color.ofRgb(0xAA0000), TextConstants.DARK_RED));
    register(new LanternTextColor("dark_purple", Color.ofRgb(0xAA00AA), TextConstants.DARK_PURPLE));
    register(new LanternTextColor("gold", Color.ofRgb(0xFFAA00), TextConstants.GOLD));
    register(new LanternTextColor("gray", Color.ofRgb(0xAAAAAA), TextConstants.GRAY));
    register(new LanternTextColor("dark_gray", Color.ofRgb(0x555555), TextConstants.DARK_GRAY));
    register(new LanternTextColor("blue", Color.ofRgb(0x5555FF), TextConstants.BLUE));
    register(new LanternTextColor("green", Color.ofRgb(0x55FF55), TextConstants.GREEN));
    register(new LanternTextColor("aqua", Color.ofRgb(0x55FFFF), TextConstants.AQUA));
    register(new LanternTextColor("red", Color.ofRgb(0xFF5555), TextConstants.RED));
    register(new LanternTextColor("light_purple", Color.ofRgb(0xFF55FF), TextConstants.LIGHT_PURPLE));
    register(new LanternTextColor("yellow", Color.ofRgb(0xFFFF55), TextConstants.YELLOW));
    register(new LanternTextColor("white", Color.WHITE, TextConstants.WHITE));
    register(new LanternTextColor("reset", Color.WHITE, TextConstants.RESET));
    // Replacing the api class, ids may not be uppercase
    register(new TextColor() {

        @Override
        public String getId() {
            return "none";
        }

        @Override
        public String getName() {
            return getId();
        }

        @Override
        public Color getColor() {
            return Color.BLACK;
        }

        @Override
        public String toString() {
            return getId();
        }
    });
}
Also used : LanternTextColor(org.lanternpowered.server.text.format.LanternTextColor) TextColor(org.spongepowered.api.text.format.TextColor) Color(org.spongepowered.api.util.Color) LanternTextColor(org.lanternpowered.server.text.format.LanternTextColor) TextColor(org.spongepowered.api.text.format.TextColor) LanternTextColor(org.lanternpowered.server.text.format.LanternTextColor) EarlyRegistration(org.lanternpowered.server.game.registry.EarlyRegistration)

Example 2 with EarlyRegistration

use of org.lanternpowered.server.game.registry.EarlyRegistration in project LanternServer by LanternPowered.

the class TextStyleRegistryModule method registerDefaults.

@EarlyRegistration
@Override
public void registerDefaults() {
    register(new LanternTextStyle.Formatting("bold", true, null, null, null, null, TextConstants.BOLD));
    register(new LanternTextStyle.Formatting("italic", null, true, null, null, null, TextConstants.ITALIC));
    register(new LanternTextStyle.Formatting("underline", null, null, true, null, null, TextConstants.UNDERLINE));
    register(new LanternTextStyle.Formatting("strikethrough", null, null, null, true, null, TextConstants.STRIKETHROUGH));
    register(new LanternTextStyle.Formatting("obfuscated", null, null, null, null, true, TextConstants.OBFUSCATED));
    register(new LanternTextStyle.Formatting("reset", false, false, false, false, false, TextConstants.RESET));
    register(new LanternTextStyle("none", null, null, null, null, null));
}
Also used : LanternTextStyle(org.lanternpowered.server.text.format.LanternTextStyle) EarlyRegistration(org.lanternpowered.server.game.registry.EarlyRegistration)

Example 3 with EarlyRegistration

use of org.lanternpowered.server.game.registry.EarlyRegistration in project LanternServer by LanternPowered.

the class TranslationManagerRegistryModule method registerDefaults.

@EarlyRegistration
@Override
public void registerDefaults() {
    this.translationManager = new CombinedTranslationManager();
    // Get the asset repository
    final AssetRepository assetRepository = Lantern.getAssetRepository();
    // Add the translation manager as a reload listener
    assetRepository.addReloadListener(this.translationManager);
    // Add the minecraft language file for defaults and
    // the client translations
    this.translationManager.addManager(new MinecraftTranslationManager());
    final LanternTranslationManager lanternTranslationManager = new LanternTranslationManager();
    // Add the lantern languages
    lanternTranslationManager.addResourceBundle(assetRepository.get("lantern", "lang/en_us.properties").get(), Locale.ENGLISH);
    this.translationManager.addManager(lanternTranslationManager);
    this.translationManager.setDelegateManager(lanternTranslationManager);
}
Also used : MinecraftTranslationManager(org.lanternpowered.server.text.translation.MinecraftTranslationManager) AssetRepository(org.lanternpowered.server.asset.AssetRepository) CombinedTranslationManager(org.lanternpowered.server.text.translation.CombinedTranslationManager) LanternTranslationManager(org.lanternpowered.server.text.translation.LanternTranslationManager) EarlyRegistration(org.lanternpowered.server.game.registry.EarlyRegistration)

Example 4 with EarlyRegistration

use of org.lanternpowered.server.game.registry.EarlyRegistration in project LanternServer by LanternPowered.

the class BanTypeRegistryModule method registerDefaults.

@EarlyRegistration
@Override
public void registerDefaults() {
    register(new LanternBanType("profile", Ban.Profile.class));
    register(new LanternBanType("ip", Ban.Ip.class));
}
Also used : LanternBanType(org.lanternpowered.server.config.user.ban.LanternBanType) EarlyRegistration(org.lanternpowered.server.game.registry.EarlyRegistration)

Example 5 with EarlyRegistration

use of org.lanternpowered.server.game.registry.EarlyRegistration in project LanternServer by LanternPowered.

the class TextFormatRegistryModule method registerDefaults.

@EarlyRegistration
@Override
public void registerDefaults() {
    try {
        // Make sure that the color is updated properly
        final Field colorField = TextFormat.class.getDeclaredField("color");
        final Field styleField = TextFormat.class.getDeclaredField("style");
        ReflectionHelper.setField(colorField, TextFormat.NONE, TextColors.NONE);
        ReflectionHelper.setField(styleField, TextFormat.NONE, TextStyles.NONE);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : Field(java.lang.reflect.Field) EarlyRegistration(org.lanternpowered.server.game.registry.EarlyRegistration)

Aggregations

EarlyRegistration (org.lanternpowered.server.game.registry.EarlyRegistration)6 Field (java.lang.reflect.Field)1 AssetRepository (org.lanternpowered.server.asset.AssetRepository)1 LanternBanType (org.lanternpowered.server.config.user.ban.LanternBanType)1 FormattingCodeTextSerializer (org.lanternpowered.server.text.FormattingCodeTextSerializer)1 PlainTextSerializer (org.lanternpowered.server.text.PlainTextSerializer)1 LanternTextColor (org.lanternpowered.server.text.format.LanternTextColor)1 LanternTextStyle (org.lanternpowered.server.text.format.LanternTextStyle)1 LanternJsonTextSerializer (org.lanternpowered.server.text.gson.LanternJsonTextSerializer)1 CombinedTranslationManager (org.lanternpowered.server.text.translation.CombinedTranslationManager)1 LanternTranslationManager (org.lanternpowered.server.text.translation.LanternTranslationManager)1 MinecraftTranslationManager (org.lanternpowered.server.text.translation.MinecraftTranslationManager)1 TextColor (org.spongepowered.api.text.format.TextColor)1 Color (org.spongepowered.api.util.Color)1