本文整理汇总了Java中org.spongepowered.api.data.DataContainer.contains方法的典型用法代码示例。如果您正苦于以下问题:Java DataContainer.contains方法的具体用法?Java DataContainer.contains怎么用?Java DataContainer.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.data.DataContainer
的用法示例。
在下文中一共展示了DataContainer.contains方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<RottenData> from(DataContainer container) {
if (!container.contains(UPDATE_TIME.getQuery(), AGE.getQuery())) {
return Optional.empty();
}
this.lastUpdate = container.getLong(UPDATE_TIME.getQuery()).get();
this.age = container.getLong(AGE.getQuery()).get();
return Optional.of(this);
}
示例2: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<TrailData> from(DataContainer container) {
if (!container.contains(TRAIL.getQuery())) {
return Optional.empty();
}
final Trail trail = container.getCatalogType(TRAIL.getQuery(), Trail.class).orElse(TrailRegistry.getInstance().getDefaultTrail());
this.setValue(trail);
return Optional.of(this);
}
示例3: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<InvincibilityData> from(DataContainer container) {
if (container.contains(BedrockKeys.IS_INVINCIBLE.getQuery())) {
return Optional.of(new InvincibilityData(container.getBoolean(BedrockKeys.IS_INVINCIBLE.getQuery()).get()));
}
return Optional.empty();
}
示例4: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<FlagMapDataImpl> from(DataContainer container) {
if (container.contains(FlagHelper.FLAGMAP)) {
// Loads the structure defined in toContainer
setValue(container.getSerializable(FlagHelper.FLAGMAP.getQuery(), FlagMap.class).get());
return Optional.of(this);
}
return Optional.empty();
}
示例5: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<SilkTouchData> from(DataContainer container) {
if ( ! container.contains(SilkTouchKeys.BACKPACK.getQuery())) return Optional.empty();
String backpackUUID = container.getString(SilkTouchKeys.BACKPACK.getQuery()).get();
return Optional.of(new SilkTouchData(backpackUUID));
}
示例6: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<ShootingItemData> from(DataContainer container) {
if (!container.contains(SHOOTING_ITEM_DATA_KEY.getQuery())) {
return Optional.empty();
}
this.snapshot = container.getSerializable(SHOOTING_ITEM_DATA_KEY.getQuery(), ItemStackSnapshot.class).orElse(null);
return Optional.of(this);
}
示例7: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<WarpData> from(DataContainer container) {
if (container.contains(WARP.getQuery())) {
return Optional.of(set(WARP, container.getSerializable(WARP.getQuery(), Warp.class).orElse(getValue())));
}
return Optional.empty();
}
示例8: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<SignJobData> from(DataContainer container) {
if (!container.contains(LiteKeys.JOB_NAME.getQuery())) {
return Optional.empty();
}
final String jobName = container.getString(LiteKeys.JOB_NAME.getQuery()).get();
this.jobName = jobName;
return Optional.of(this);
}
示例9: from
import org.spongepowered.api.data.DataContainer; //导入方法依赖的package包/类
@Override
public Optional<JobData> from(DataContainer container) {
if (!container.contains(LiteKeys.JOB_NAME.getQuery(), LiteKeys.LEVEL.getQuery(), LiteKeys.EXP.getQuery())) {
return Optional.empty();
}
final String jobName = container.getString(LiteKeys.JOB_NAME.getQuery()).get();
final int exp = container.getInt(LiteKeys.EXP.getQuery()).get();
final int level = container.getInt(LiteKeys.LEVEL.getQuery()).get();
this.jobName = jobName;
this.exp = exp;
this.level = level;
return Optional.of(this);
}