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


Java EndTag类代码示例

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


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

示例1: isValidTag

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
public static boolean isValidTag(Tag tag) {
    if (tag instanceof EndTag) {
        return false;
    } else if (tag instanceof ListTag) {
        ListTag lt = (ListTag) tag;
        if ((lt).getType() == EndTag.class) {
            return false;
        }
    } else if (tag instanceof CompoundTag) {
        for (Entry<String, Tag> entry : ((CompoundTag) tag).getValue().entrySet()) {
            if (!isValidTag(entry.getValue())) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:MainUtil.java

示例2: fromNative

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
private static Tag fromNative(cn.nukkit.nbt.tag.Tag other) {
    if (other instanceof cn.nukkit.nbt.tag.IntArrayTag) {
        return fromNative((cn.nukkit.nbt.tag.IntArrayTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.ListTag) {
        return fromNative((cn.nukkit.nbt.tag.ListTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.EndTag) {
        return fromNative((cn.nukkit.nbt.tag.EndTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.LongTag) {
        return fromNative((cn.nukkit.nbt.tag.LongTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.StringTag) {
        return fromNative((cn.nukkit.nbt.tag.StringTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.IntTag) {
        return fromNative((cn.nukkit.nbt.tag.IntTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.ByteTag) {
        return fromNative((cn.nukkit.nbt.tag.ByteTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.ByteArrayTag) {
        return fromNative((cn.nukkit.nbt.tag.ByteArrayTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.CompoundTag) {
        return fromNative((cn.nukkit.nbt.tag.CompoundTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.FloatTag) {
        return fromNative((cn.nukkit.nbt.tag.FloatTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.ShortTag) {
        return fromNative((cn.nukkit.nbt.tag.ShortTag) other);

    } else if (other instanceof cn.nukkit.nbt.tag.DoubleTag) {
        return fromNative((cn.nukkit.nbt.tag.DoubleTag) other);
    } else {
        throw new IllegalArgumentException("Can't convert other of type " + other.getClass().getCanonicalName());
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:41,代码来源:NBTConverter.java

示例3: asTag

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
public static ListTag asTag(Object... values) {
    Class clazz = null;
    List<Tag> list = new ArrayList<>(values.length);
    for (Object value : values) {
        Tag tag = asTag(value);
        if (clazz == null) {
            clazz = tag.getClass();
        }
        list.add(tag);
    }
    if (clazz == null) clazz = EndTag.class;
    return new ListTag(clazz, list);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:14,代码来源:FaweCache.java

示例4: toNative

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
private Tag toNative(NBTBase foreign)
{
    if (foreign == null) {
        return null;
    }
    if ((foreign instanceof NBTTagCompound))
    {
        Map<String, Tag> values = new HashMap();
        Set<String> foreignKeys = ((NBTTagCompound)foreign).c();
        for (String str : foreignKeys)
        {
            NBTBase base = ((NBTTagCompound)foreign).get(str);
            values.put(str, toNative(base));
        }
        return new CompoundTag(values);
    }
    if ((foreign instanceof NBTTagByte)) {
        return new ByteTag(((NBTTagByte)foreign).f());
    }
    if ((foreign instanceof NBTTagByteArray)) {
        return new ByteArrayTag(((NBTTagByteArray)foreign).c());
    }
    if ((foreign instanceof NBTTagDouble)) {
        return new DoubleTag(((NBTTagDouble)foreign).g());
    }
    if ((foreign instanceof NBTTagFloat)) {
        return new FloatTag(((NBTTagFloat)foreign).h());
    }
    if ((foreign instanceof NBTTagInt)) {
        return new IntTag(((NBTTagInt)foreign).d());
    }
    if ((foreign instanceof NBTTagIntArray)) {
        return new IntArrayTag(((NBTTagIntArray)foreign).c());
    }
    if ((foreign instanceof NBTTagList)) {
        try
        {
            return toNativeList((NBTTagList)foreign);
        }
        catch (Throwable e)
        {
            this.logger.log(Level.WARNING, "Failed to convert NBTTagList", e);
            return new ListTag(ByteTag.class, new ArrayList());
        }
    }
    if ((foreign instanceof NBTTagLong)) {
        return new LongTag(((NBTTagLong)foreign).c());
    }
    if ((foreign instanceof NBTTagShort)) {
        return new ShortTag(((NBTTagShort)foreign).e());
    }
    if ((foreign instanceof NBTTagString)) {
        return new StringTag(((NBTTagString)foreign).a_());
    }
    if ((foreign instanceof NBTTagEnd)) {
        return new EndTag();
    }
    throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:60,代码来源:FaweAdapter_1_9.java

示例5: toNative

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
/**
 * Converts from a non-native NMS NBT structure to a native WorldEdit NBT
 * structure.
 *
 * @param foreign non-native NMS NBT structure
 * @return native WorldEdit NBT structure
 */
@SuppressWarnings("unchecked")
private Tag toNative(NBTBase foreign) {
    if (foreign == null) {
        return null;
    }
    if (foreign instanceof NBTTagCompound) {
        Map<String, Tag> values = new HashMap<String, Tag>();
        Set<String> foreignKeys = ((NBTTagCompound) foreign).c();

        for (String str : foreignKeys) {
            NBTBase base = ((NBTTagCompound) foreign).get(str);
            values.put(str, toNative(base));
        }
        return new CompoundTag(values);
    } else if (foreign instanceof NBTTagByte) {
        return new ByteTag(((NBTTagByte) foreign).f()); // getByte
    } else if (foreign instanceof NBTTagByteArray) {
        return new ByteArrayTag(((NBTTagByteArray) foreign).c()); // data
    } else if (foreign instanceof NBTTagDouble) {
        return new DoubleTag(((NBTTagDouble) foreign).g()); // getDouble
    } else if (foreign instanceof NBTTagFloat) {
        return new FloatTag(((NBTTagFloat) foreign).h()); // getFloat
    } else if (foreign instanceof NBTTagInt) {
        return new IntTag(((NBTTagInt) foreign).d()); // getInt
    } else if (foreign instanceof NBTTagIntArray) {
        return new IntArrayTag(((NBTTagIntArray) foreign).c()); // data
    } else if (foreign instanceof NBTTagList) {
        try {
            return toNativeList((NBTTagList) foreign);
        } catch (Throwable e) {
            logger.log(Level.WARNING, "Failed to convert NBTTagList", e);
            return new ListTag(ByteTag.class, new ArrayList<ByteTag>());
        }
    } else if (foreign instanceof NBTTagLong) {
        return new LongTag(((NBTTagLong) foreign).c()); // getLong
    } else if (foreign instanceof NBTTagShort) {
        return new ShortTag(((NBTTagShort) foreign).e()); // getShort
    } else if (foreign instanceof NBTTagString) {
        return new StringTag(((NBTTagString) foreign).a_()); // data
    } else if (foreign instanceof NBTTagEnd) {
        return new EndTag();
    } else {
        throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName());
    }
}
 
开发者ID:sk89q,项目名称:worldedit-adapters,代码行数:53,代码来源:Spigot_v1_8_R2.java

示例6: toNative

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
/**
 * Converts from a non-native NMS NBT structure to a native WorldEdit NBT
 * structure.
 *
 * @param foreign non-native NMS NBT structure
 * @return native WorldEdit NBT structure
 */
@SuppressWarnings("unchecked")
private Tag toNative(NBTBase foreign) {
    if (foreign == null) {
        return null;
    }
    if (foreign instanceof NBTTagCompound) {
        Map<String, Tag> values = new HashMap<String, Tag>();
        Collection<Object> foreignKeys = ((NBTTagCompound) foreign).c();

        for (Object obj : foreignKeys) {
            String key = (String) obj;
            NBTBase base = ((NBTTagCompound) foreign).get(key);
            values.put(key, toNative(base));
        }
        return new CompoundTag(values);
    } else if (foreign instanceof NBTTagByte) {
        return new ByteTag(((NBTTagByte) foreign).f()); // getByte
    } else if (foreign instanceof NBTTagByteArray) {
        return new ByteArrayTag(((NBTTagByteArray) foreign).c()); // data
    } else if (foreign instanceof NBTTagDouble) {
        return new DoubleTag(((NBTTagDouble) foreign).g()); // getDouble
    } else if (foreign instanceof NBTTagFloat) {
        return new FloatTag(((NBTTagFloat) foreign).h()); // getFloat
    } else if (foreign instanceof NBTTagInt) {
        return new IntTag(((NBTTagInt) foreign).d()); // getInt
    } else if (foreign instanceof NBTTagIntArray) {
        return new IntArrayTag(((NBTTagIntArray) foreign).c()); // data
    } else if (foreign instanceof NBTTagList) {
        try {
            return toNativeList((NBTTagList) foreign);
        } catch (Throwable e) {
            logger.log(Level.WARNING, "Failed to convert NBTTagList", e);
            return new ListTag(ByteTag.class, new ArrayList<ByteTag>());
        }
    } else if (foreign instanceof NBTTagLong) {
        return new LongTag(((NBTTagLong) foreign).c()); // getLong
    } else if (foreign instanceof NBTTagShort) {
        return new ShortTag(((NBTTagShort) foreign).e()); // getShort
    } else if (foreign instanceof NBTTagString) {
        return new StringTag(((NBTTagString) foreign).a_()); // data
    } else if (foreign instanceof NBTTagEnd) {
        return new EndTag();
    } else {
        throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName());
    }
}
 
开发者ID:sk89q,项目名称:worldedit-adapters,代码行数:54,代码来源:CraftBukkit_v1_7_R2.java

示例7: toNative

import com.sk89q.jnbt.EndTag; //导入依赖的package包/类
/**
 * Converts from a non-native NMS NBT structure to a native WorldEdit NBT
 * structure.
 *
 * @param foreign non-native NMS NBT structure
 * @param name name for the tag, if it has one
 * @return native WorldEdit NBT structure
 */
@SuppressWarnings("unchecked")
private Tag toNative(String name, NBTBase foreign) {
    if (foreign == null) {
        return null;
    }
    if (foreign instanceof NBTTagCompound) {
        Map<String, Tag> values = new HashMap<String, Tag>();
        Collection<Object> foreignKeys = ((NBTTagCompound) foreign).c();

        for (Object obj : foreignKeys) {
            String key = (String) obj;
            NBTBase base = ((NBTTagCompound) foreign).get(key);
            values.put(key, toNative(key, base));
        }
        return new CompoundTag(values);
    } else if (foreign instanceof NBTTagByte) {
        return new ByteTag(((NBTTagByte) foreign).data); // getByte
    } else if (foreign instanceof NBTTagByteArray) {
        return new ByteArrayTag(((NBTTagByteArray) foreign).data); // data
    } else if (foreign instanceof NBTTagDouble) {
        return new DoubleTag(((NBTTagDouble) foreign).data); // getDouble
    } else if (foreign instanceof NBTTagFloat) {
        return new FloatTag(((NBTTagFloat) foreign).data); // getFloat
    } else if (foreign instanceof NBTTagInt) {
        return new IntTag(((NBTTagInt) foreign).data); // getInt
    } else if (foreign instanceof NBTTagIntArray) {
        return new IntArrayTag(((NBTTagIntArray) foreign).data); // data
    } else if (foreign instanceof NBTTagList) {
        try {
            return toNative((NBTTagList) foreign);
        } catch (Throwable e) {
            logger.log(Level.WARNING, "Failed to convert NBTTagList", e);
            return new ListTag(ByteTag.class, new ArrayList<ByteTag>());
        }
    } else if (foreign instanceof NBTTagLong) {
        return new LongTag(((NBTTagLong) foreign).data); // getLong
    } else if (foreign instanceof NBTTagShort) {
        return new ShortTag(((NBTTagShort) foreign).data); // getShort
    } else if (foreign instanceof NBTTagString) {
        return new StringTag(((NBTTagString) foreign).data); // data
    } else if (foreign instanceof NBTTagEnd) {
        return new EndTag();
    } else {
        throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName());
    }
}
 
开发者ID:sk89q,项目名称:worldedit-adapters,代码行数:55,代码来源:CraftBukkit_v1_6_R3.java


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