• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: registerSerializers

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
public static void registerSerializers(DataManager dataManager) {
    dataManager.registerTranslator(UUID.class, UUID_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector2d.class, VECTOR_2_D_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector2f.class, VECTOR_2_F_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector2i.class, VECTOR_2_I_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector2l.class, VECTOR_2_L_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector3d.class, VECTOR_3_D_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector3f.class, VECTOR_3_F_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector3i.class, VECTOR_3_I_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector3l.class, VECTOR_3_L_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector4d.class, VECTOR_4_D_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector4f.class, VECTOR_4_F_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector4i.class, VECTOR_4_I_DATA_SERIALIZER);
    dataManager.registerTranslator(Vector4l.class, VECTOR_4_L_DATA_SERIALIZER);
    dataManager.registerTranslator(Complexd.class, COMPLEXD_DATA_SERIALIZER);
    dataManager.registerTranslator(Complexf.class, COMPLEXF_DATA_SERIALIZER);
    dataManager.registerTranslator(Quaterniond.class, QUATERNIOND_DATA_SERIALIZER);
    dataManager.registerTranslator(Quaternionf.class, QUATERNIONF_DATA_SERIALIZER);
    dataManager.registerTranslator(LocalTime.class, LOCAL_TIME_DATA_SERIALIZER);
    dataManager.registerTranslator(LocalDate.class, LOCAL_DATE_DATA_SERIALIZER);
    dataManager.registerTranslator(LocalDateTime.class, LOCAL_DATE_TIME_DATA_SERIALIZER);
    dataManager.registerTranslator(ZonedDateTime.class, ZONED_DATE_TIME_DATA_SERIALIZER);
    dataManager.registerTranslator(Instant.class, INSTANT_DATA_SERIALIZER);
    dataManager.registerTranslator(Month.class, MONTH_DATA_SERIALIZER);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:26,代码来源:DataTranslators.java


示例2: HappyTrails

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
@Inject
private HappyTrails(
        Logger logger,
        GameRegistry registry,
        PluginContainer container,
        @DefaultConfig(sharedRoot = false) Path defaultConfig,
        DataManager dataManager) {
    this.logger = logger;
    this.registry = registry;
    this.manager = dataManager;
    this.container = container;
    this.defaultConfig = defaultConfig;
    this.config = new TrailConfig();
    INSTANCE = this;
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:16,代码来源:HappyTrails.java


示例3: deserialize

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
public static <T extends DataSerializable> T deserialize(Class<T> clazz, String serial) throws IOException {
    BufferedReader source = new BufferedReader(new StringReader(serial));
    ConfigurationNode node = HoconConfigurationLoader.builder().setSource(() -> source).build().load();

    DataManager manager = Sponge.getDataManager();
    DataTranslator<ConfigurationNode> translator = DataTranslators.CONFIGURATION_NODE;

    Optional<T> snapshot = manager.deserialize(clazz, translator.translate(node));
    if (snapshot.isPresent()) {
        return snapshot.get();
    } else {
        throw new IOException("Failed to deserialize to " + clazz.getSimpleName());
    }
}
 
开发者ID:caseif,项目名称:Inferno,代码行数:15,代码来源:SerializationHelper.java


示例4: onGamePreInitialization

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
@Listener
public void onGamePreInitialization(GamePreInitializationEvent event) {
    DataManager dataManager = Sponge.getDataManager();

    dataManager.register(CustomFeatureData.class, ImmutableCustomFeatureData.class, new CustomFeatureManipulatorBuilder());
    dataManager.register(CustomBlockData.class, ImmutableCustomBlockData.class, new CustomBlockManipulatorBuilder());
    dataManager.register(RepresentedCustomItemSnapshotData.class, ImmutableRepresentedCustomItemSnapshotData.class, new RepresentedCustomItemSnapshotManipulatorBuilder());
    dataManager.register(CustomInventoriesData.class, ImmutableCustomInventoriesData.class, new CustomInventoriesManipulatorBuilder());

    dataManager.registerBuilder(CustomInventoryData.class, new CustomInventoryDataBuilder());
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:12,代码来源:CustomItemLibrary.java


示例5: deserialize

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public DataSerializable deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException {
    final DataManager dataManager = Sponge.getDataManager();
    final Optional<DataBuilder<?>> builderOpt = (Optional) dataManager.getBuilder(type.getRawType().asSubclass(DataSerializable.class));
    if (!builderOpt.isPresent()) {
        throw new ObjectMappingException("No data builder is registered for " + type);
    }
    final Optional<? extends DataSerializable> built = builderOpt.get().build(ConfigurateTranslator.instance().translate(value));
    if (!built.isPresent()) {
        throw new ObjectMappingException("Unable to build instance of " + type);
    }
    return built.get();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:15,代码来源:DataSerializableTypeSerializer.java


示例6: deSerializeJson

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
public static <T extends DataSerializable> T deSerializeJson(String json, Class<T> type) throws IOException {
	DataContainer translate = Sponge.getDataManager().getTranslator(String.class).get().translate(json);

	//DataView target = ConfigurateTranslator.instance().translateFrom(GsonConfigurationLoader.builder().setSource(() -> new BufferedReader(new StringReader(json))).build().load());
	DataManager manager = Sponge.getGame().getDataManager();
	return manager.deserialize(type, translate).orElse(null);
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:8,代码来源:Utils.java


示例7: onPreInitialization

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
@Listener
public void onPreInitialization(GamePreInitializationEvent event)
{
    DataManager dataManager = Sponge.getDataManager();
    dataManager.registerBuilder(VirtualChestInventory.class, new VirtualChestInventoryBuilder(this));
}
 
开发者ID:ustc-zzzz,项目名称:VirtualChest,代码行数:7,代码来源:VirtualChestPlugin.java


示例8: getDataManager

import org.spongepowered.api.data.DataManager; //导入依赖的package包/类
@Override
public DataManager getDataManager() {
    return null;
}
 
开发者ID:InspireNXE,项目名称:Pulse,代码行数:5,代码来源:SpongeGame.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EditorRecord类代码示例发布时间:2022-05-23
下一篇:
Java CacheAdminCmdExecutor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap