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

Java DataRegistration类代码示例

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

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



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

示例1: init

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@NModuleTrigger(trigger = "INITIALIZATION")
public void init() {
  service = new ProjectileWatcherServiceImpl();

  // Register Shooting Item Manipulator
  DataRegistration.builder()
      .dataClass(ShootingItemData.class)
      .immutableClass(ImmutableShootingItemData.class)
      .builder(new ShootingItemDataManipulatorBuilder())
      .manipulatorId("shooting_item_manipulator")
      .dataName("Shooting Item Data")
      .buildAndRegister(SkreePlugin.container());

  // Register the service & command
  Sponge.getEventManager().registerListeners(SkreePlugin.inst(), service);
  Sponge.getServiceManager().setProvider(SkreePlugin.inst(), ProjectileWatcherService.class, service);
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:18,代码来源:ProjectileWatcherSystem.java


示例2: Roles

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Inject
public Roles(Reflector reflector, PluginContainer plugin)
{
    DataRegistration<PermissionData, ImmutablePermissionData> dr = DataRegistration.<PermissionData, ImmutablePermissionData>builder()
                    .dataClass(PermissionData.class).immutableClass(ImmutablePermissionData.class)
                    .builder(new PermissionDataBuilder()).manipulatorId("permission")
                    .dataName("CubeEngine Roles Permissions")
                    .buildAndRegister(plugin);

    IPermissionData.OPTIONS.getQuery();

    Sponge.getDataManager().registerLegacyManipulatorIds(PermissionData.class.getName(), dr);

    ConverterManager cManager = reflector.getDefaultConverterManager();
    cManager.registerConverter(new PermissionTreeConverter(this), PermissionTree.class);
    cManager.registerConverter(new PriorityConverter(), Priority.class);
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:18,代码来源:Roles.java


示例3: onPreInit

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Listener
public void onPreInit(GamePreInitializationEvent event)
{
    DataRegistration<LockerData, ImmutableLockerData> dr =
            DataRegistration.<LockerData, ImmutableLockerData>builder()
                    .dataClass(LockerData.class).immutableClass(ImmutableLockerData.class)
                    .builder(new LockerDataBuilder()).manipulatorId("locker")
                    .dataName("CubeEngine Locker Data")
                    .buildAndRegister(plugin);

    LockerData.LOCK_ID.getQuery();

    Sponge.getDataManager().registerLegacyManipulatorIds(LockerData.class.getName(), dr);


    ConverterManager cManager = reflector.getDefaultConverterManager();
    cManager.registerConverter(new BlockLockerConfigConverter(logger, mm), BlockLockConfig.class);
    cManager.registerConverter(new EntityLockerConfigConverter(logger, entityMatcher), EntityLockConfig.class);

    cm.getProviders().register(this, new PlayerAccess.PlayerAccessParser(), PlayerAccess.class);

    this.config = fm.loadConfig(this, LockerConfig.class);
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:24,代码来源:Locker.java


示例4: onEnable

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Listener
public void onEnable(GamePreInitializationEvent event)
{
    this.modulePath = mm.getPathFor(Kits.class);
    this.plugin = mm.getPlugin(Kits.class).get();
    DataRegistration<KitData, ImmutableKitData> dr = DataRegistration.<KitData, ImmutableKitData>builder()
            .dataClass(KitData.class).immutableClass(ImmutableKitData.class)
            .builder(new KitDataBuilder()).manipulatorId("kits")
            .dataName("CubeEngine Kits Data")
            .buildAndRegister(plugin);
    Sponge.getDataManager().registerLegacyManipulatorIds(KitData.class.getName(), dr);
    KitData.TIME.getQuery();

    this.kitManager = new KitManager(this, reflector, sm);
    this.kitManager.loadKits();
    em.registerListener(Kits.class, kitManager);
    cm.getProviders().register(this, new KitParser(kitManager), Kit.class);

    KitCommand cmd = new KitCommand(this, i18n, igf, cm);
    cm.addCommand(cmd);
    cmd.addCommand(new KitEditCommand(cm, i18n, kitManager));
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:23,代码来源:Kits.java


示例5: onEnable

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Listener
public void onEnable(GameInitializationEvent event)
{
    this.tf = mm.getThreadFactory(Vigil.class);
    ReportManager reportManager = new ReportManager(this, em, i18n);
    qm = new QueryManager(tf, bd.getDatabase().getCollection("vigil"), reportManager, i18n, plugin);
    this.cm.getProviders().register(this, new LookupDataParser(i18n), LookupData.class);;
    VigilCommands vc = new VigilCommands(sm, i18n, cm);
    cm.addCommand(vc);
    vc.addCommand(new VigilAdminCommands(cm, i18n, this));
    cm.addCommands(vc, this, new VigilLookupCommands(cm, i18n, qm));

    em.registerListener(Vigil.class, new ToolListener(pm, qm));

    DataRegistration<LookupData, ImmutableLookupData> dr =
            DataRegistration.<LookupData, ImmutableLookupData>builder()
                    .dataClass(LookupData.class).immutableClass(ImmutableLookupData.class)
                    .builder(new LookupDataBuilder()).manipulatorId("vigil-lookup")
                    .dataName("CubeEngine vigil Lookup Data")
                    .buildAndRegister(plugin);

}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:23,代码来源:Vigil.java


示例6: onPreInit

import org.spongepowered.api.data.DataRegistration; //导入依赖的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


示例7: onGameStart

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Listener
public void onGameStart(GamePreInitializationEvent event) {
    this.registry.registerModule(Trail.class, TrailRegistry.getInstance());
    this.manager.registerBuilder(Trail.class, new Trail.Builder());
    DataRegistration.builder()
            .dataClass(TrailData.class)
            .immutableClass(TrailData.Immutable.class)
            .builder(new TrailData.Builder())
            .manipulatorId("trail")
            .dataName("Trail Data")
            .buildAndRegister(this.container);
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:13,代码来源:HappyTrails.java


示例8: register

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
public static void register() {
    FMDB = new FlagMapDataBuilder(FlagMapDataImpl.class, 1);
    DataRegistration.<FlagMapDataImpl, ImmFlagMapDataImpl>builder()
            .dataClass(FlagMapDataImpl.class)
            .immutableClass(ImmFlagMapDataImpl.class)
            .builder(FMDB)
            .manipulatorId("flagmap")
            .dataName("flagmap")
            .buildAndRegister(Denizen2Sponge.plugin);
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:11,代码来源:FlagHelper.java


示例9: registerData

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
private void registerData() {
    DataRegistration.builder()
            .dataClass(CustomItemData.class)
            .immutableClass(CustomItemData.Immutable.class)
            .builder(new CustomItemData.Builder())
            .manipulatorId("custom_item_data")
            .dataName("Custom Item Data")
            .buildAndRegister(toContainer());
}
 
开发者ID:simon816,项目名称:Industrialization,代码行数:10,代码来源:Industrialization.java


示例10: registerAdditionalCatalog

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Override
public void registerAdditionalCatalog(DataRegistration catalogType) {
    if (catalogType instanceof DataManipulatorRegistration) {
        super.register(catalogType);
    } else {
        super.registerAdditionalCatalog(catalogType);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:DataManipulatorRegistryModule.java


示例11: without

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Optional<FluidStackSnapshot> without(Class<? extends ImmutableDataManipulator<?, ?>> containerClass) {
    final LanternFluidStack copy = this.fluidStack.copy();
    final DataRegistration registration = Lantern.getGame().getDataManager().get(containerClass)
            .orElseThrow(() -> new IllegalStateException("The container class " + containerClass.getName() + " isn't registered."));
    if (copy.removeFast(registration.getManipulatorClass())) {
        return Optional.of(new LanternFluidStackSnapshot(copy));
    }
    return Optional.empty();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:LanternFluidStackSnapshot.java


示例12: serializeRawContainerData

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
public static void serializeRawContainerData(DataView dataView, IValueContainer valueContainer, DataQuery query) {
    if (!(valueContainer instanceof AdditionalContainerHolder)) {
        return;
    }
    final ValueCollection valueCollection = valueContainer.getValueCollection();
    final AdditionalContainerCollection<ValueContainer<?>> containers =
            ((AdditionalContainerHolder) valueContainer).getAdditionalContainers();
    final ImmutableList.Builder<DataView> builder = ImmutableList.builder();
    final LanternDataManager dataManager = Lantern.getGame().getDataManager();
    for (ValueContainer<?> manipulator : containers.getAll()) {
        if (!(manipulator instanceof DataManipulator)) {
            continue;
        }
        final Class<?> manipulatorType;
        if (manipulator instanceof IDataManipulator) {
            manipulatorType = ((IDataManipulator) manipulator).getMutableType();
        } else {
            manipulatorType = manipulator.getClass();
        }
        final Optional<DataRegistration> optRegistration = dataManager.get(manipulatorType);
        if (!optRegistration.isPresent()) {
            getLogger().error("Could not serialize {}. No registration could be found.", manipulatorType.getName());
        } else {
            builder.add(DataContainer.createNew()
                    .set(DataQueries.MANIPULATOR_ID, optRegistration.get().getId())
                    .set(DataQueries.MANIPULATOR_DATA, ((DataManipulator) manipulator).toContainer()));
        }
    }
    Element<List<DataView>> holder = valueCollection.getElement(LanternKeys.FAILED_DATA_MANIPULATORS).orElse(null);
    if (holder != null) {
        builder.addAll(holder.get());
    }
    dataView.set(query, builder.build());
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:35,代码来源:DataHelper.java


示例13: buildAndRegister

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Override
public DataRegistration<M, I> buildAndRegister(PluginContainer container)
        throws IllegalStateException, IllegalArgumentException, DataAlreadyRegisteredException {
    this.plugin = checkNotNull(container, "container");
    checkState(this.manipulatorBuilder != null, "ManipulatorBuilder cannot be null!");
    checkState(this.manipulatorClass != null, "DataManipulator class cannot be null!");
    checkState(this.immutableClass != null, "ImmutableDataManipulator class cannot be null!");
    checkState(this.id != null, "Data ID cannot be null!");
    final LanternDataRegistration<M, I> registration = new LanternDataRegistration<>(this);
    registration.validate();
    registration.register();
    return registration;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:14,代码来源:LanternDataRegistrationBuilder.java


示例14: without

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Optional<ItemStackSnapshot> without(Class<? extends ImmutableDataManipulator<?, ?>> containerClass) {
    final LanternItemStack copy = this.itemStack.copy();
    final DataRegistration registration = Lantern.getGame().getDataManager().get(containerClass)
            .orElseThrow(() -> new IllegalStateException("The container class " + containerClass.getName() + " isn't registered."));
    if (copy.removeFast(registration.getManipulatorClass())) {
        return Optional.of(new LanternItemStackSnapshot(copy));
    }
    return Optional.empty();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:LanternItemStackSnapshot.java


示例15: main

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
public static void main(String... args) {
    test(new TypeToken<Key<?>>() {},
            new TypeToken<Key<BaseValue<?>>>() {});
    test(new TypeToken<Key<BaseValue<?>>>() {},
            new TypeToken<Key<BaseValue<?>>>() {});
    test(new TypeToken<Key<BaseValue<?>>>() {},
            new TypeToken<Key<BaseValue<CatalogType>>>() {});
    test(new TypeToken<Key<BaseValue<?>>>() {},
            new TypeToken<Key<BaseValue<? extends CatalogType>>>() {});
    test(new TypeToken<Key<BaseValue<?>>>() {},
            new TypeToken<Key<BaseValue<? extends Advancement>>>() {});
    test(new TypeToken<Key<BaseValue<Advancement>>>() {},
            new TypeToken<Key<BaseValue<Integer>>>() {});
    test(new TypeToken<Key<BaseValue<Slime>>>() {},
            new TypeToken<Key<BaseValue<? extends EnderDragon>>>() {});
    test(new TypeToken<Key<BaseValue<EnderDragon>>>() {},
            new TypeToken<Key<BaseValue<? extends Living>>>() {});
    test(new TypeToken<Key<BaseValue<EnderDragon>>>() {},
            new TypeToken<Key<BaseValue<? extends Living>>>() {});
    test(TypeToken.of(Key.class),
            new TypeToken<Key<BaseValue<? extends Living>>>() {});

    test(new TypeToken<DataRegistration>() {},
            new TypeToken<DataRegistration<?,?>>() {});
    test(new TypeToken<DataRegistration>() {},
            new TypeToken<DataRegistration<LoreData,?>>() {});
    test(new TypeToken<DataRegistration<?,?>>() {},
            new TypeToken<DataRegistration<LoreData,?>>() {});

    // Enclosing classes testing
    test(new TypeToken<A<Object>.B<Value<Double>>>() {},
            new TypeToken<A<Object>.B<Value<? extends Number>>>() {});
    test(new TypeToken<A<Key<BaseValue<EnderDragon>>>.B<Value<Double>>>() {},
            new TypeToken<A<Key<BaseValue<Slime>>>.B<Value<? extends Number>>>() {});
    test(new TypeToken<A<Key<BaseValue<EnderDragon>>>.B<Value<Double>>>() {},
            new TypeToken<A<Key<BaseValue<? extends Living>>>.B<Value<? extends Number>>>() {});
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:38,代码来源:TypeTokenHelper.java


示例16: preinit

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Listener
public void preinit(GamePreInitializationEvent e) {

	DataRegistration.<InventoryCommandItemMenuData, InventoryCommandItemMenuData.Immutable>builder()
			.dataClass(InventoryCommandItemMenuData.class)
			.immutableClass(InventoryCommandItemMenuData.Immutable.class)
			.builder(new InventoryCommandItemMenuData.Builder())
			.manipulatorId("ntrpg-custominventory")
			.dataName("CustomInventory")
			.buildAndRegister(Sponge.getPluginManager().getPlugin("nt-rpg").get());

	DataRegistration.<MenuInventoryData, MenuInventoryData.Immutable>builder()
			.dataClass(MenuInventoryData.class)
			.immutableClass(MenuInventoryData.Immutable.class)
			.builder(new MenuInventoryData.Builder())
			.manipulatorId("ntrpg-menuinventory")
			.dataName("MenuItem")
			.buildAndRegister(Sponge.getPluginManager().getPlugin("nt-rpg").get());


	DataRegistration.<CustomItemData, CustomItemData.Immutable>builder()
			.dataClass(CustomItemData.class)
			.immutableClass(CustomItemData.Immutable.class)
			.builder(new CustomItemData.Builder())
			.manipulatorId("ntrpg-customitemdata")
			.dataName("CustomItemData")
			.buildAndRegister(Sponge.getPluginManager().getPlugin("nt-rpg").get());


	DataRegistration.<CustomItemData, CustomItemData.Immutable>builder()
			.dataClass(SkillTreeInventoryViewControllsData.class)
			.immutableClass(SkillTreeInventoryViewControllsData.Immutable.class)
			.builder(new SkillTreeInventoryViewControllsData.Builder())
			.manipulatorId("ntrpg-stivcd")
			.dataName("SkillTreeInventoryViewControllsData")
			.buildAndRegister(Sponge.getPluginManager().getPlugin("nt-rpg").get());

}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:39,代码来源:NtRpgPlugin.java


示例17: Multiverse

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Inject
public Multiverse(PluginContainer plugin)
{
    DataRegistration<MultiverseData, ImmutableMultiverseData> dr = DataRegistration.<MultiverseData, ImmutableMultiverseData>builder()
            .dataClass(MultiverseData.class).immutableClass(ImmutableMultiverseData.class)
            .builder(new MultiverseDataBuilder()).manipulatorId("multiverse")
            .dataName("CubeEngine Multiverse Data")
            .buildAndRegister(plugin);

    MultiverseData.DATA.getQuery();
    PlayerData.ACTIVE_EFFECTS.getQuery();

    Sponge.getDataManager().registerLegacyManipulatorIds(MultiverseData.class.getName(), dr);
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:15,代码来源:Multiverse.java


示例18: VanillaPlus

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Inject
public VanillaPlus(PluginContainer plugin)
{
    DataRegistration.<SafeLoginData, ImmutableSafeLoginData>builder()
            .dataClass(SafeLoginData.class).immutableClass(ImmutableSafeLoginData.class)
            .builder(new SafeLoginDataBuilder()).manipulatorId("safe_login")
            .dataName("CubeEngine VanillaPlus Safe Login")
            .buildAndRegister(plugin);
    SafeLoginData.FLYMODE.getQuery();
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:11,代码来源:VanillaPlus.java


示例19: setup

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
public void setup(PluginContainer plugin, ItemductConfig config)
{
    if (!this.init)
    {
        DataRegistration.<DuctData, ImmutableDuctData>builder()
                .dataClass(DuctData.class).immutableClass(ImmutableDuctData.class)
                .builder(new DuctDataBuilder()).manipulatorId("duct")
                .dataName("CubeEngine ItemDuct Data")
                .buildAndRegister(plugin);

        DuctData.FILTERS.getQuery();

        Ingredient hopper = Ingredient.of(ItemTypes.HOPPER);
        activatorItem = ItemStack.of(ItemTypes.HOPPER, 1);
        activatorItem.offer(Keys.ITEM_ENCHANTMENTS, singletonList(Enchantment.builder().type(EnchantmentTypes.LOOTING).level(1).build()));
        activatorItem.offer(Keys.DISPLAY_NAME, Text.of(TextColors.GOLD, "ItemDuct Activator"));
        activatorItem.offer(Keys.HIDE_ENCHANTMENTS, true);
        Sponge.getRegistry().getCraftingRecipeRegistry().register(
                CraftingRecipe.shapedBuilder().rows()
                        .row(hopper, hopper, hopper)
                        .row(hopper, Ingredient.of(ItemTypes.DIAMOND), hopper)
                        .row(hopper, hopper, hopper)
                        .result(activatorItem).build("ItemDuctActivator", plugin));
    }

    this.reload(config);

    this.init = true;
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:30,代码来源:ItemDuctManager.java


示例20: onEnable

import org.spongepowered.api.data.DataRegistration; //导入依赖的package包/类
@Listener
public void onEnable(GamePreInitializationEvent event)
{
    DataRegistration.<PowertoolData, ImmutablePowertoolData>builder()
            .dataClass(PowertoolData.class).immutableClass(ImmutablePowertoolData.class)
            .builder(new PowertoolDataBuilder()).manipulatorId("powertools")
            .dataName("CubeEngine PowerTools Data")
            .buildAndRegister(plugin);

    IPowertoolData.POWERS.getQuery();

    PowertoolCommand ptCommands = new PowertoolCommand(cm, this, materialMatcher, i18n);
    cm.addCommand(ptCommands);
    em.registerListener(Powertools.class, ptCommands);
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:16,代码来源:Powertools.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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