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


Java DataContainer.contains方法代码示例

本文整理汇总了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);
}
 
开发者ID:TBlueF,项目名称:RottenFood,代码行数:12,代码来源:RottenData.java

示例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);
}
 
开发者ID:gabizou,项目名称:HappyTrails,代码行数:10,代码来源:TrailData.java

示例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();
}
 
开发者ID:prism,项目名称:Bedrock,代码行数:9,代码来源:InvincibilityData.java

示例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();
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:10,代码来源:FlagMapDataImpl.java

示例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));
}
 
开发者ID:redstone,项目名称:SilkTouch,代码行数:9,代码来源:SilkTouchData.java

示例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);
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:11,代码来源:ShootingItemData.java

示例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();
}
 
开发者ID:RobertHerhold,项目名称:BLWarps,代码行数:8,代码来源:WarpData.java

示例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);
}
 
开发者ID:Flibio,项目名称:JobsLite,代码行数:10,代码来源:SignJobData.java

示例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);
}
 
开发者ID:Flibio,项目名称:JobsLite,代码行数:14,代码来源:JobData.java


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