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


Java StringTag类代码示例

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


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

示例1: ServerListEntry

import com.flowpowered.nbt.StringTag; //导入依赖的package包/类
ServerListEntry(Map<String, Tag<?>> tagData) {
	if (tagData.containsKey(NAME_KEY)) {
		name = ((StringTag) tagData.get(NAME_KEY)).getValue();
	}
	if (tagData.containsKey(ICON_KEY)) {
		icon = ((StringTag) tagData.get(ICON_KEY)).getValue();
	}
	if (tagData.containsKey(IP_KEY)) {
		ip = ((StringTag) tagData.get(IP_KEY)).getValue();
	}
	if (tagData.containsKey(HIDE_ADDRESS_KEY)) {
		hideAddress = ((ByteTag) tagData.get(HIDE_ADDRESS_KEY)).getValue();
	}
	if (tagData.containsKey(ACCEPT_TEXTURES_KEY)) {
		acceptTextures = ((ByteTag) tagData.get(ACCEPT_TEXTURES_KEY)).getValue();
	}
}
 
开发者ID:Azzurite,项目名称:MinecraftServerSync,代码行数:18,代码来源:ServerListEntry.java

示例2: toTag

import com.flowpowered.nbt.StringTag; //导入依赖的package包/类
public CompoundTag toTag() {
	CompoundMap map = new CompoundMap();
	if (name != null) {
		map.put(NAME_KEY, new StringTag(NAME_KEY, name));
	}
	if (icon != null) {
		map.put(ICON_KEY, new StringTag(ICON_KEY, icon));
	}
	if (ip != null) {
		map.put(IP_KEY, new StringTag(IP_KEY, ip));
	}
	if (hideAddress != null) {
		map.put(HIDE_ADDRESS_KEY, new ByteTag(HIDE_ADDRESS_KEY, hideAddress));
	}
	if (acceptTextures != null) {
		map.put(ACCEPT_TEXTURES_KEY, new ByteTag(ACCEPT_TEXTURES_KEY, acceptTextures));
	}
	return new CompoundTag("", map);
}
 
开发者ID:Azzurite,项目名称:MinecraftServerSync,代码行数:20,代码来源:ServerListEntry.java

示例3: extractVersionInfo

import com.flowpowered.nbt.StringTag; //导入依赖的package包/类
protected void extractVersionInfo(CompoundMap dataMap, WorldDescriptor worldDescriptor) {
    if (dataMap.containsKey("BorderSize")) {
        // ge 1.8
        if (dataMap.containsKey("Version")) {
            final CompoundTag versionTag = (CompoundTag) dataMap.get("Version");
            final CompoundMap versionData = versionTag.getValue();

            final ByteTag snapshot = (ByteTag) versionData.get("Snapshot");
            final StringTag versionName = (StringTag) versionData.get("Name");
            if (snapshot.getValue().intValue() == 1) {
                worldDescriptor.setServerType(ServerType.SNAPSHOT);
                worldDescriptor.setMinecraftVersion(ComparableVersion.of(versionName.getValue(),
                        SNAPSHOT_VER_PATTERN));
            }
            else {
                worldDescriptor.setMinecraftVersion(ComparableVersion.of(versionName.getValue()));
            }
        }
        else {
            worldDescriptor.setMinecraftVersion(ComparableVersion.of("1.8"));
        }
    }
    else {
        worldDescriptor.setMinecraftVersion(ComparableVersion.of("1.7"));
    }
}
 
开发者ID:moorkop,项目名称:mccy-engine,代码行数:27,代码来源:LevelDatServiceImpl.java

示例4: toNode

import com.flowpowered.nbt.StringTag; //导入依赖的package包/类
private Node toNode(Object value)
{
    if (value instanceof Tag)
    {
        if (value instanceof CompoundTag)
        {
            MapNode mapNode = MapNode.emptyMap();
            this.toMapNode(mapNode, ((CompoundTag)value).getValue());
            return mapNode;
        }
        else if (value instanceof ListTag)
        {
            ListNode listNode = ListNode.emptyList();
            for (Object o : ((ListTag)value).getValue())
            {
                listNode.addNode(this.toNode(o));
            }
            return listNode;
        }
        else if (value instanceof ByteTag || value instanceof StringTag || value instanceof DoubleTag
            || value instanceof FloatTag || value instanceof IntTag || value instanceof LongTag
            || value instanceof ShortTag)
        {
            try
            {
                return this.getConverterManager().convertToNode(((Tag)value).getValue());
            }
            catch (ConversionException e)
            {
                throw new IllegalStateException("Could not convert a value!", e);
            }
        }
        else if (value instanceof EndTag)
        {
            return NullNode.emptyNode();
        }
    }
    throw new IllegalStateException("Unknown Tag! " + value.getClass().getName());
}
 
开发者ID:CubeEngine,项目名称:ReflecT,代码行数:40,代码来源:NBTCodec.java

示例5: getStringTagValue

import com.flowpowered.nbt.StringTag; //导入依赖的package包/类
private String getStringTagValue(CompoundMap dataMap, String tagName) {
    return ((StringTag) dataMap.get(tagName)).getValue();
}
 
开发者ID:moorkop,项目名称:mccy-engine,代码行数:4,代码来源:LevelDatServiceImpl.java

示例6: convertValue

import com.flowpowered.nbt.StringTag; //导入依赖的package包/类
private Tag<?> convertValue(String name, Node value)
{
    if (value instanceof MapNode)
    {
        CompoundMap map = new CompoundMap();
        this.convertMap(map, ((MapNode)value).getValue(), (MapNode)value);
        return new CompoundTag(name, map);
    }
    else if (value instanceof ListNode)
    {
        List<Tag> tagList = new ArrayList<Tag>();
        java.lang.Integer i = 0;
        for (Node node : ((ListNode)value).getValue())
        {
            i++;
            tagList.add(this.convertValue(i.toString(), node));
        }
        if (tagList.size() == 0)
        {
            return new ListTag(name, CompoundTag.class, tagList);
        }
        return new ListTag(name, tagList.get(0).getClass(), tagList);
    }
    else if (value instanceof BooleanNode)
    {
        return new ByteTag(name, (Boolean)value.getValue());
    }
    else if (value instanceof ByteNode)
    {
        return new ByteTag(name, (Byte)value.getValue());
    }
    else if (value instanceof CharNode)
    {
        return new StringTag(name, value.getValue().toString());
    }
    else if (value instanceof DoubleNode)
    {
        return new DoubleTag(name, (Double)value.getValue());
    }
    else if (value instanceof FloatNode)
    {
        return new FloatTag(name, (Float)value.getValue());
    }
    else if (value instanceof IntNode)
    {
        return new IntTag(name, (Integer)value.getValue());
    }
    else if (value instanceof LongNode)
    {
        return new LongTag(name, (Long)value.getValue());
    }
    else if (value instanceof ShortNode)
    {
        return new ShortTag(name, (Short)value.getValue());
    }
    else if (value instanceof StringNode)
    {
        return new StringTag(name, (String)value.getValue());
    }
    else if (value instanceof NullNode)
    {
        return new EndTag();
    }
    throw new IllegalStateException("Unknown Node! " + value.getClass().getName());
}
 
开发者ID:CubeEngine,项目名称:ReflecT,代码行数:66,代码来源:NBTCodec.java


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