Package com.massivecraft.factions

Examples of com.massivecraft.factions.TerritoryAccess


  @Override
  public TerritoryAccess getTerritoryAccessAt(PS ps)
  {
    if (ps == null) return null;
    ps = ps.getChunkCoords(true);
    TerritoryAccess ret = this.map.get(ps);
    if (ret == null) ret = TerritoryAccess.valueOf(UConf.get(this).factionIdNone);
    return ret;
  }
View Full Code Here


 
  @Override
  public Faction getFactionAt(PS ps)
  {
    if (ps == null) return null;
    TerritoryAccess ta = this.getTerritoryAccessAt(ps);
    return ta.getHostFaction(this);
  }
View Full Code Here

  }
 
  @Override
  public void setFactionAt(PS ps, Faction faction)
  {
    TerritoryAccess territoryAccess = null;
    if (faction != null)
    {
      territoryAccess = TerritoryAccess.valueOf(faction.getId());
    }
    this.setTerritoryAccessAt(ps, territoryAccess);
View Full Code Here

  {
    String factionId = faction.getId();
   
    for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
    {
      TerritoryAccess territoryAccess = entry.getValue();
      if ( ! territoryAccess.getHostFactionId().equals(factionId)) continue;
     
      PS ps = entry.getKey();
      this.removeAt(ps);
    }
  }
View Full Code Here

  {
    FactionColl factionColl = FactionColls.get().get(this);
   
    for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
    {
      TerritoryAccess territoryAccess = entry.getValue();
      String factionId = territoryAccess.getHostFactionId();
      if (factionColl.containsId(factionId)) continue;
     
      PS ps = entry.getKey();
      this.removeAt(ps);
     
View Full Code Here

  public Set<PS> getChunks(String factionId)
  {
    Set<PS> ret = new HashSet<PS>();
    for (Entry<PS, TerritoryAccess> entry : this.map.entrySet())
    {
      TerritoryAccess ta = entry.getValue();
      if (!ta.getHostFactionId().equals(factionId)) continue;
     
      PS ps = entry.getKey();
      ps = ps.withWorld(this.getId());
      ret.add(ps);
    }
View Full Code Here

      String[] ChunkCoordParts = entry.getKey().split("[,\\s]+");
      int chunkX = Integer.parseInt(ChunkCoordParts[0]);
      int chunkZ = Integer.parseInt(ChunkCoordParts[1]);
      PS chunk = PS.valueOf(chunkX, chunkZ);
     
      TerritoryAccess territoryAccess = context.deserialize(entry.getValue(), TerritoryAccess.class);
     
      ret.put(chunk, territoryAccess);
    }
   
    return ret;
View Full Code Here

    JsonObject ret = new JsonObject();
   
    for (Entry<PS, TerritoryAccess> entry : src.entrySet())
    {
      PS ps = entry.getKey();
      TerritoryAccess territoryAccess = entry.getValue();
     
      ret.add(ps.getChunkX().toString() + "," + ps.getChunkZ().toString(), context.serialize(territoryAccess, TerritoryAccess.class));
    }
   
    return ret;
View Full Code Here

        String[] ChunkCoordParts = entry2.getKey().trim().split("[,\\s]+");
        int chunkX = Integer.parseInt(ChunkCoordParts[0]);
        int chunkZ = Integer.parseInt(ChunkCoordParts[1]);
        PS ps = new PSBuilder().chunkX(chunkX).chunkZ(chunkZ).build();
       
        TerritoryAccess territoryAccess = entry2.getValue();
       
        board.setTerritoryAccessAt(ps, territoryAccess);
      }
    }
   
View Full Code Here

      }
      player.sendMessage(msg);
    }

    // Show access level message if it changed.
    TerritoryAccess accessFrom = BoardColls.get().getTerritoryAccessAt(chunkFrom);
    Boolean hasTerritoryAccessFrom = accessFrom.hasTerritoryAccess(uplayer);
   
    TerritoryAccess accessTo = BoardColls.get().getTerritoryAccessAt(chunkTo);
    Boolean hasTerritoryAccessTo = accessTo.hasTerritoryAccess(uplayer);
   
    if (!MUtil.equals(hasTerritoryAccessFrom, hasTerritoryAccessTo))
    {
      if (hasTerritoryAccessTo == null)
      {
View Full Code Here

TOP

Related Classes of com.massivecraft.factions.TerritoryAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.