/** * Takes in an NBT tag, sanely checks null status, and then returns its value. * * @param t Tag to get value from * @return tag value as an object or null if no value */ public static Object toTagValue(Tag<?> t) { if (t == null) { return null; } else { return t.getValue(); } }
/** * Takes in an NBT tag, sanely checks null status, and then returns its value. * * @param t Tag to get value from * @return tag value as an object or null if no value */ public static Object toTagValue(Tag<?> t) { if (t == null) { return null; } else { return t.getValue(); } }
/** * Takes in an NBT tag, sanely checks null status, and then returns its value. * * @param t Tag to get value from * @return tag value as an object or null if no value */ public static Object toTagValue(Tag<?> t) { if (t == null) { return null; } else { return t.getValue(); } }
public T getValue(Tag<?> tag) throws IllegalArgumentException { Tag<T> value = FieldUtils.checkTagCast(tag, valueType); return value.getValue(); }
public T getValue(Tag<?> tag) throws IllegalArgumentException { Tag<T> value = FieldUtils.checkTagCast(tag, valueType); return value.getValue(); }
public T getValue(Tag<?> tag) throws IllegalArgumentException { Tag<T> value = FieldUtils.checkTagCast(tag, valueType); return value.getValue(); }
private static ServerInfo createServerFromTag(CompoundMap compound){ String ipString, ip, name, icon = null; int port; ipString = compound.get("ip").getValue().toString(); name = compound.get("name").getValue().toString(); if(ipString.contains(":")){ ip = ipString.split(":")[0]; port = Integer.parseInt(ipString.split(":")[1]); } else { ip = ipString; port = DEFAULT_PORT; } if(compound.containsKey("icon")){ icon = ((StringTag)compound.get("icon")).getValue(); } return new ServerInfo(ip, name, icon,port); }
@SuppressWarnings ("unchecked") private static DefaultMutableTreeNode getNode(Tag<?> tag, boolean includeName) { if (tag == null) { return new DefaultMutableTreeNode("Empty"); } else if (tag instanceof CompoundTag) { return getNode((CompoundTag) tag); } else if (tag instanceof ListTag<?>) { try { return getNode((ListTag<Tag<?>>) tag); } catch (ClassCastException e) { } } else if (tag instanceof ByteArrayTag) { return getNode((ByteArrayTag) tag); } else if (tag instanceof ShortArrayTag) { return getNode((ShortArrayTag) tag); } else if (tag instanceof IntArrayTag) { return getNode((IntArrayTag) tag); } String message = includeName ? (tag.getName() + ":" + tag.getValue()) : tag.getValue().toString(); return new DefaultMutableTreeNode(message); }
@SuppressWarnings ("unchecked") private static DefaultMutableTreeNode getNode(Tag<?> tag, boolean includeName) { if (tag == null) { return new DefaultMutableTreeNode("Empty"); } else if (tag instanceof CompoundTag) { return getNode((CompoundTag) tag); } else if (tag instanceof ListTag<?>) { try { return getNode((ListTag<Tag<?>>) tag); } catch (ClassCastException e) { } } else if (tag instanceof ByteArrayTag) { return getNode((ByteArrayTag) tag); } else if (tag instanceof ShortArrayTag) { return getNode((ShortArrayTag) tag); } else if (tag instanceof IntArrayTag) { return getNode((IntArrayTag) tag); } String message = includeName ? (tag.getName() + ":" + tag.getValue()) : tag.getValue().toString(); return new DefaultMutableTreeNode(message); }
@SuppressWarnings ("unchecked") private static DefaultMutableTreeNode getNode(Tag<?> tag, boolean includeName) { if (tag == null) { return new DefaultMutableTreeNode("Empty"); } else if (tag instanceof CompoundTag) { return getNode((CompoundTag) tag); } else if (tag instanceof ListTag<?>) { try { return getNode((ListTag<Tag<?>>) tag); } catch (ClassCastException e) { } } else if (tag instanceof ByteArrayTag) { return getNode((ByteArrayTag) tag); } else if (tag instanceof ShortArrayTag) { return getNode((ShortArrayTag) tag); } else if (tag instanceof IntArrayTag) { return getNode((IntArrayTag) tag); } String message = includeName ? (tag.getName() + ":" + tag.getValue()) : tag.getValue().toString(); return new DefaultMutableTreeNode(message); }