public CompoundMap save() { CompoundMap map = new CompoundMap(); for (FieldValue<?> field : fields) { field.save(map); } return map; }
public CompoundMap save() { CompoundMap map = new CompoundMap(); for (FieldValue<?> field : fields) { field.save(map); } return map; }
public CompoundMap save() { CompoundMap map = new CompoundMap(); for (FieldValue<?> field : fields) { field.save(map); } return map; }
public CompoundTag clone() { CompoundMap map = new CompoundMap(value); return new CompoundTag(getName(), map); } }
public CompoundTag clone() { CompoundMap map = new CompoundMap(value); return new CompoundTag(getName(), map); } }
public CompoundTag clone() { CompoundMap map = new CompoundMap(value); return new CompoundTag(getName(), map); } }
public void saveServers(ServerInfo[] servers) throws IOException { if(file.exists()) if(!file.delete()) throw new IOException("Could not overwrite '".concat(file.getAbsolutePath()).concat("'")); final FileOutputStream fos = new FileOutputStream(file); NBTOutputStream nbtOutputStream = new NBTOutputStream(fos, false); ArrayList<CompoundTag> serversList = new ArrayList<CompoundTag>(); for(ServerInfo server : servers){ serversList.add(new CompoundTag("", createCompoundFromServer(server))); } ListTag<CompoundTag> listTag = new ListTag<CompoundTag>("servers", CompoundTag.class, serversList); CompoundTag root = new CompoundTag("", new CompoundMap()); root.getValue().put("servers", listTag); nbtOutputStream.writeTag(root); nbtOutputStream.flush(); fos.flush(); nbtOutputStream.close(); fos.close(); } }
@Test public void preserveOrder() { CompoundMap tag = new CompoundMap(random, false, false); assertEquals("Tag setup", tag, random); tag = new CompoundMap(false, false); for (Tag t : random) { tag.put(t); } assertEquals("Tag setup", tag, random); }
@Test public void sorted() { CompoundMap tag = new CompoundMap(random, true, false); assertEquals("Tag setup", tag, sorted); tag = new CompoundMap(true, false); for (Tag t : random) { tag.put(t); } assertEquals("Tag setup", tag, sorted); }
@Test public void reverseSorted() { CompoundMap tag = new CompoundMap(random, true, true); assertEquals("Tag setup", tag, reverse); tag = new CompoundMap(true, true); for (Tag t : random) { tag.put(t); } assertEquals("Tag setup", tag, reverse); }
private CompoundMap createCompoundFromServer(ServerInfo server){ CompoundMap result = new CompoundMap(); result.put("name", new StringTag("name", server.getName())); String ipString = server.getIP(); if(server.getPort() != DEFAULT_PORT) ipString = ipString.concat(":".concat(Integer.toString(server.getPort()))); result.put("ip", new StringTag("ip", ipString)); if(server.hasIcon()) result.put("icon", new StringTag("icon", server.getIcon())); return result; }
@Before public void setUp() { subject = new ExampleHolder(); CompoundMap map = new CompoundMap(); map.put(new StringTag("name", "helloworld")); CompoundTag mapTag = new CompoundTag("", map); subject.load(mapTag); }
CompoundMap compoundTagList = new CompoundMap(); while (true) { Tag tag = readTag(depth + 1);
CompoundMap compoundTagList = new CompoundMap(); while (true) { Tag tag = readTag(depth + 1);
CompoundMap compoundTagList = new CompoundMap(); while (true) { Tag tag = readTag(depth + 1);