private void load() { IDataNode teleportNode = _dataNode.getNode("teleport"); for (IDataNode node : teleportNode) { SyncLocation syncLocation = node.getLocation(""); if (syncLocation == null) continue; NamedLocation location = new NamedLocation(node.getName(), syncLocation); _jailLocations.put(location.getSearchName(), location); } _releaseLocation = _dataNode.getLocation("release-location"); }
@Override public boolean addTeleport(NamedLocation teleport) { PreCon.notNull(teleport); checkDisposed(); // make sure the name is not already in use NamedLocation location = _jailLocations.get(teleport.getSearchName()); if (location != null) return false; _jailLocations.put(teleport.getSearchName(), teleport); IDataNode teleportNode = _dataNode.getNode("teleport"); teleportNode.set(teleport.getSearchName(), teleport); teleportNode.save(); return true; }