當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。