当前位置: 首页>>代码示例>>Java>>正文


Java TypeSerializers类代码示例

本文整理汇总了Java中ninja.leaping.configurate.objectmapping.serialize.TypeSerializers的典型用法代码示例。如果您正苦于以下问题:Java TypeSerializers类的具体用法?Java TypeSerializers怎么用?Java TypeSerializers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TypeSerializers类属于ninja.leaping.configurate.objectmapping.serialize包,在下文中一共展示了TypeSerializers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadCameras

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
/**
 * loads the cameras from the config
 *
 * may only be called after the worlds of the server have been loaded
 */
public void loadCameras() {
    plugin.getCameras().clear();

    // yes i know it is bad to register it every time the config is loaded but i doesn't seem to work otherwise...
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Location.class), new LocationSerializer());

    config.getNode("cameras").getChildrenList().forEach((node) -> {
        try {
            Camera cam = node.getValue(TypeToken.of(Camera.class));
            cam.setLocation(node.getNode("location").getValue(TypeToken.of(Location.class)));
            plugin.getCameras().put(cam.getId(), cam);
        } catch (ObjectMappingException e) {
            System.out.println(TypeSerializers.getDefaultSerializers().get(TypeToken.of(Location.class)));
            logger.warn("Couldn't load Camera: " + e.getMessage());
        }
    });

    logger.info(String.format("Loaded %d Cameras", plugin.getCameras().size()));
}
 
开发者ID:Lergin,项目名称:Vigilate,代码行数:25,代码来源:Config.java

示例2: onFirst

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
protected void onFirst() throws PluginDisableException, ServerDisableException {
	TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(EMessageBuilder.class), new EMessageBuilderSerializer(this));
	TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(EFormat.class), new EFormatSerializer());
	
	this.threadAsync = this.getGame().getScheduler().createAsyncExecutor(this);
	this.threadSync = this.getGame().getScheduler().createSyncExecutor(this);
	
	this.chat = new EChat(this);
	this.configs = new EAConfig(this);
	
	this.messages = new EAMessage(this);
	this.server = new EServer(this);
	this.managerUtils = new ManagerUtils(this);
	this.service = new ManagerService(this);
	new ManagerRegister(this);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:17,代码来源:EverAPI.java

示例3: onPreInit

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
@Listener
   public void onPreInit(GamePreInitializationEvent evt) {
	logger.info("Pre-Initializing...");
	
	DataRegistration.builder()
		.dataClass(RottenData.class)
		.immutableClass(ImmutableRottenData.class)
		.builder(new RottenDataBuilder())
		.manipulatorId(PLUGIN_ID + "_rottendata")
		.dataName("Rotten Food")
		.buildAndRegister(Sponge.getPluginManager().getPlugin(PLUGIN_ID).get());
	//Sponge.getDataManager().registerBuilder(RottenData.class, new RottenDataBuilder());

	TypeSerializers.getDefaultSerializers().registerType(ItemConfig.TOKEN, new ItemConfigSerializer());
}
 
开发者ID:TBlueF,项目名称:RottenFood,代码行数:16,代码来源:RottenFood.java

示例4: VirtualChestItemStackSerializer

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
VirtualChestItemStackSerializer(VirtualChestPlugin plugin)
{
    this.plugin = plugin;
    this.serializers = TypeSerializers.getDefaultSerializers().newChild()
            .registerType(TypeToken.of(Text.class), TEXT_SERIALIZER)
            .registerType(ITEM_ENCHANTMENT, ITEM_ENCHANTMENT_SERIALIZER)
            .registerType(TypeToken.of(GameProfile.class), GAME_PROFILE_SERIALIZER);
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:9,代码来源:VirtualChestItemStackSerializer.java

示例5: init

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public static void init(File rootDir) throws IOException
{
	carrotshopsFile = new File(rootDir, "shops.json");
	rootDir.mkdirs();
	carrotshopsFile.createNewFile();

	TypeSerializerCollection serializers = TypeSerializers.getDefaultSerializers().newChild();
	serializers.registerType(TypeToken.of(Inventory.class), new InventorySerializer());
	serializers.registerType(TypeToken.of(Currency.class), new CurrencySerializer());
	ConfigurationOptions options = ConfigurationOptions.defaults().setSerializers(serializers);

	loader = HoconConfigurationLoader.builder().setFile(carrotshopsFile).build();
	shopsNode = loader.load(options);
}
 
开发者ID:TheoKah,项目名称:CarrotShop,代码行数:15,代码来源:ShopsData.java

示例6: reload

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public void reload() {
    try {
        this.root = this.loader.load(ConfigurationOptions.defaults()
                .setSerializers(
                        TypeSerializers.getDefaultSerializers().newChild().registerType(TypeToken.of(IpSet.class), new IpSet.IpSetSerializer()))
                .setHeader(GriefPreventionPlugin.CONFIG_HEADER));
        this.configBase = this.configMapper.populate(this.root.getNode(GriefPreventionPlugin.MOD_ID));
    } catch (Exception e) {
        SpongeImpl.getLogger().error("Failed to load configuration", e);
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:12,代码来源:GriefPreventionConfig.java

示例7: onInit

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
@Override
public void onInit(GameInitializationEvent event) {
    if (!Sponge.getPluginManager().getPlugin("nuvotifier").isPresent()) {
        return;
    }
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new VotifierListener());
    UltimateCore.get().getTickService().addRunnable("votifier", new VotifierTickRunnable());

    //Config
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Vote.class), new VoteSerializer());
    this.config = new RawModuleConfig("votifier");

    onReload(null);
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:15,代码来源:VotifierModule.java

示例8: onInit

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(BloodEffect.class), new BloodEffect.BloodEffectSerializer());
    config = new RawModuleConfig("blood");
    //Check if all entity types are in the config
    CommentedConfigurationNode node = config.get();
    boolean modified = false;
    //For every entitytype, if it doesnt exist in the config add it
    for (EntityType type : Sponge.getRegistry().getAllOf(CatalogTypes.ENTITY_TYPE)) {
        if (!Living.class.isAssignableFrom(type.getEntityClass())) {
            continue;
        }
        //If entitytype is not in config
        if (node.getNode("types", type.getId(), "enabled").getValue() == null) {
            modified = true;
            CommentedConfigurationNode typenode = node.getNode("types", type.getId());
            try {
                typenode.setValue(TypeToken.of(BloodEffect.class), BloodEffects.DEFAULT);
            } catch (ObjectMappingException e) {
                ErrorLogger.log(e, "Failed to set default blood effect.");
            }
        }
    }
    if (modified) {
        config.save(node);
    }
    //Load blood effects from config
    BloodEffects.reload();
    //Listeners
    Sponge.getEventManager().registerListeners(UltimateCore.get(), new BloodListener());
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:33,代码来源:BloodModule.java

示例9: onInit

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
@Override
public void onInit(GameInitializationEvent event) {
    //Config
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Automessage.class), new AutomessageSerializer());
    config = new RawModuleConfig("automessage");
    //Runnables
    try {
        for (Automessage message : config.get().getNode("automessages").getList(TypeToken.of(Automessage.class))) {
            message.start();
        }
    } catch (ObjectMappingException e) {
        ErrorLogger.log(e, "Failed to load automessages from config.");
    }
}
 
开发者ID:Bammerbom,项目名称:UltimateCore,代码行数:15,代码来源:AutomessageModule.java

示例10: setup

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
private static void setup() {

        // cache main thread in this class
        getMainThread();

        // register configurate serializers

        TypeSerializerCollection defs = TypeSerializers.getDefaultSerializers();

        defs.registerType(TypeToken.of(JsonArray.class), JsonArraySerializer.INSTANCE);
        defs.registerType(TypeToken.of(JsonObject.class), JsonObjectSerializer.INSTANCE);
        defs.registerType(TypeToken.of(JsonPrimitive.class), JsonPrimitiveSerializer.INSTANCE);
        defs.registerType(TypeToken.of(JsonNull.class), JsonNullSerializer.INSTANCE);

        defs.registerType(TypeToken.of(GsonSerializable.class), GsonSerializableConfigurateProxy.INSTANCE);

    }
 
开发者ID:lucko,项目名称:helper,代码行数:18,代码来源:LoaderUtils.java

示例11: register

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public static void register() {
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(CuboidRegion.class), new CuboidRegionSerializer());
}
 
开发者ID:Zerthick,项目名称:PlayerShopsRPG,代码行数:4,代码来源:CuboidRegionSerializer.java

示例12: register

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public static void register() {
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(ShopItem.class), new ShopItemSerializer());
}
 
开发者ID:Zerthick,项目名称:PlayerShopsRPG,代码行数:4,代码来源:ShopItemSerializer.java

示例13: register

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public static void register() {
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Shop.class), new ShopSerializer());
}
 
开发者ID:Zerthick,项目名称:PlayerShopsRPG,代码行数:4,代码来源:ShopSerializer.java

示例14: register

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public static void register() {
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(ShopType.class), new ShopTypeSerializer());
}
 
开发者ID:Zerthick,项目名称:PlayerShopsRPG,代码行数:4,代码来源:ShopTypeSerializer.java

示例15: register

import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers; //导入依赖的package包/类
public static void register() {
    TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(ShopContainer.class), new ShopContainerSerializer());
}
 
开发者ID:Zerthick,项目名称:PlayerShopsRPG,代码行数:4,代码来源:ShopContainerSerializer.java


注:本文中的ninja.leaping.configurate.objectmapping.serialize.TypeSerializers类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。