/** * Sets the id for the manipulator. The id should be formatted * according to the normal {@link CatalogType} standard: * <code>{manipulator-id|</code> since the * <code>"pluginid"</code> * is gathered from {@link #buildAndRegister(PluginContainer)} provided * {@link PluginContainer}. * * <p>The importance of the id is that the id is what will be used for * serialization and deserialization of custom plugin provided data, * such that if the string changes, or a plugin is no longer available * to register the data, the custom data being deserialized will not be * available through the system, and may be lost.</p> * * @param id The id for the manipulator * @return This builder, for chaining * @deprecated Use {@link #id(String)} instead */ @Deprecated default Builder<T, I> manipulatorId(String id) { final int index = id.indexOf(':'); if (index != -1) { id = id.substring(index + 1); } return id(id); }
.dataClass(LastPowerData.class) .immutableClass(ImmutableLastPowerData.class) .builder(new LastPowerDataManipulatorBuilder()) .manipulatorId("last_power") .dataName("LastPower") .buildAndRegister(CraftBookPlugin.spongeInst().container); .dataClass(ICData.class) .immutableClass(ImmutableICData.class) .builder(new ICDataManipulatorBuilder()) .manipulatorId("ic") .dataName("IC") .buildAndRegister(CraftBookPlugin.spongeInst().container); .dataClass(NamespaceData.class) .immutableClass(ImmutableNamespaceData.class) .builder(new NamespaceDataBuilder()) .manipulatorId("namespace") .dataName("Namespace") .buildAndRegister(CraftBookPlugin.spongeInst().container); .dataClass(EmbeddedBlockBagData.class) .immutableClass(ImmutableEmbeddedBlockBagData.class) .builder(new EmbeddedBlockBagDataBuilder()) .manipulatorId("embedded_blockbag") .dataName("EmbeddedBlockBag") .buildAndRegister(CraftBookPlugin.spongeInst().container); .dataClass(BlockBagData.class)
@Listener public void onDataRegistration(GameRegistryEvent.Register<DataRegistration<?, ?>> event) { final DataManager dataManager = Sponge.getDataManager(); // Home stuff dataManager.registerBuilder(Home.class, new HomeBuilder()); dataManager.registerContentUpdater(Home.class, new HomeBuilder.NameUpdater()); dataManager.registerContentUpdater(HomeData.class, new HomeDataBuilder.HomesUpdater()); this.HOME_DATA_REGISTRATION = DataRegistration.builder() .dataClass(HomeData.class) .immutableClass(ImmutableHomeData.class) .dataImplementation(HomeDataImpl.class) .immutableImplementation(ImmutableHomeDataImpl.class) .dataName("Home Data") .manipulatorId("myhomes:home") .buildAndRegister(this.container); // Friends stuff this.FRIENDS_DATA_REGISTRATION = DataRegistration.builder() .dataClass(FriendsData.class) .immutableClass(ImmutableFriendsData.class) .dataImplementation(FriendsDataImpl.class) .immutableImplementation(ImmutableFriendsDataImpl.class) .dataName("Friends Data") .manipulatorId("myhomes:friends") .buildAndRegister(this.container); }
try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { frame.pushCause(container); return build();