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


Java IntArrayTag类代码示例

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


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

示例1: fromNative

import com.sk89q.jnbt.IntArrayTag; //导入依赖的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

示例2: toNative

import com.sk89q.jnbt.IntArrayTag; //导入依赖的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

示例3: asTag

import com.sk89q.jnbt.IntArrayTag; //导入依赖的package包/类
public static IntArrayTag asTag(int[] value) {
    return new IntArrayTag(value);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:4,代码来源:FaweCache.java

示例4: parse

import com.sk89q.jnbt.IntArrayTag; //导入依赖的package包/类
public Tag parse() throws NBTException {
    try {
        if (DOUBLE.matcher(this.jsonValue).matches()) {
            return new DoubleTag(Double.parseDouble(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
        }

        if (FLOAT.matcher(this.jsonValue).matches()) {
            return new FloatTag(Float.parseFloat(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
        }

        if (BYTE.matcher(this.jsonValue).matches()) {
            return new ByteTag(Byte.parseByte(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
        }

        if (LONG.matcher(this.jsonValue).matches()) {
            return new LongTag(Long.parseLong(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
        }

        if (SHORT.matcher(this.jsonValue).matches()) {
            return new ShortTag(Short.parseShort(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
        }

        if (INTEGER.matcher(this.jsonValue).matches()) {
            return new IntTag(Integer.parseInt(this.jsonValue));
        }

        if (DOUBLE_UNTYPED.matcher(this.jsonValue).matches()) {
            return new DoubleTag(Double.parseDouble(this.jsonValue));
        }

        if ("true".equalsIgnoreCase(this.jsonValue) || "false".equalsIgnoreCase(this.jsonValue)) {
            return new ByteTag((byte) (Boolean.parseBoolean(this.jsonValue) ? 1 : 0));
        }
    } catch (NumberFormatException var6) {
        this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\"");
        return new StringTag(this.jsonValue);
    }

    if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
        String var7 = this.jsonValue.substring(1, this.jsonValue.length() - 1);
        String[] var8 = (String[]) ((String[]) Iterables.toArray(SPLITTER.split(var7), String.class));

        try {
            int[] var5 = new int[var8.length];

            for (int j = 0; j < var8.length; ++j) {
                var5[j] = Integer.parseInt(var8[j].trim());
            }

            return new IntArrayTag(var5);
        } catch (NumberFormatException var51) {
            return new StringTag(this.jsonValue);
        }
    } else {
        if (this.jsonValue.startsWith("\"") && this.jsonValue.endsWith("\"")) {
            this.jsonValue = this.jsonValue.substring(1, this.jsonValue.length() - 1);
        }

        this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\"");
        StringBuilder stringbuilder = new StringBuilder();

        for (int i = 0; i < this.jsonValue.length(); ++i) {
            if (i < this.jsonValue.length() - 1 && this.jsonValue.charAt(i) == 92 && this.jsonValue.charAt(i + 1) == 92) {
                stringbuilder.append('\\');
                ++i;
            } else {
                stringbuilder.append(this.jsonValue.charAt(i));
            }
        }

        return new StringTag(stringbuilder.toString());
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:74,代码来源:JSON2NBT.java

示例5: toNative

import com.sk89q.jnbt.IntArrayTag; //导入依赖的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.IntArrayTag; //导入依赖的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.IntArrayTag; //导入依赖的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.IntArrayTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。