示例#1
0
  public boolean destroy(final ABPortal portal) {
    // See if we can remove the portal.
    if (!remove(portal)) return false;

    // Now, make it self destruct.
    portal.destroyEntities(false);
    return true;
  }
示例#2
0
  public void updateName(final ABPortal portal, String oldName) {
    if (oldName != null) {
      oldName = oldName.toLowerCase();
      if (portalNames.containsKey(oldName)) portalNames.remove(oldName);
    }

    if (allPortals.containsKey(portal.uid))
      portalNames.put(portal.getName().toLowerCase(), portal.uid);
  }
示例#3
0
  public boolean remove(final ABPortal portal) {
    // If we don't have the portal, return true.
    if (portal == null || !allPortals.containsKey(portal.uid)) return true;

    // See if we can remove it, spatially.
    if (!spatial_remove(portal)) return false;

    // Remove it from allPortals and the networks.
    allPortals.remove(portal.uid);
    portalNames.remove(portal.getName().toLowerCase());
    removeFromNetwork(portal);
    removeFromNetworkIds(portal);

    return true;
  }
示例#4
0
  public boolean add(final ABPortal portal) {
    if (portal == null) return false;

    final UUID uid = portal.uid;

    // If it's already in allPortals, we can't add it again.
    if (allPortals.containsKey(uid)) return false;

    // Try to add it to the spatial tracker.
    if (!spatial_add(portal)) return false;

    // Since that succeeded, add it to allPortals and the networks.
    allPortals.put(uid, portal);
    portalNames.put(portal.getName().toLowerCase(), uid);
    addToNetwork(portal);
    addToNetworkIds(portal);
    addFrames(portal);

    return true;
  }