Example #1
0
 public static Map<String, Object> nestedData2() {
   Map<String, Object> radius = MapBuilder.instance().put("inner", "1").put("outer", "2").build();
   return MapBuilder.instance()
       .put("type", "washer")
       .put("height", "3")
       .put("radius", radius)
       .build();
 }
Example #2
0
 public static Map<String, Object> nestedData1() {
   return MapBuilder.instance()
       .put("fullname", "Harsh Poddar")
       .put("work", "Intern at a startup by Cisco")
       .put("cities", asList("Surat", "Ahmedabad", "Amherst", "Cambridge"))
       .build();
 }
Example #3
0
 public static Map<String, Object> simpleData2() {
   return MapBuilder.instance()
       .put("computing", "A*")
       .put("physics", "A*")
       .put("math", "A")
       .put("chemistry", "A")
       .build();
 }
Example #4
0
  public SporkMap(MapBuilder builder)
      throws MapLoadException, ModuleLoadException, InvalidRegionException, InvalidFilterException {
    this.builder = builder;
    this.document = builder.getDocument();
    this.folder = builder.getFolder();
    Element root = document.getRootElement();

    this.scoreboard = Spork.get().getServer().getScoreboardManager().getNewScoreboard();
    this.objective = scoreboard.registerNewObjective("Objectives", "dummy");

    this.teams = SporkTeamBuilder.build(this);
    this.observers = SporkTeamBuilder.observers(this);

    this.filters = FilterBuilder.build(this);
    // filters();

    this.regions = new ArrayList<>();
    if (root.element("regions") != null) {
      this.regions = RegionBuilder.parseSubRegions(root.element("regions"));
      this.regions.addAll(filtered());
      search();
    }
    // regions();

    this.visible = visible(false);

    this.kits = builder.getKits();
    this.spawns = SporkSpawnBuilder.build(this);
    for (SporkTeam team : teams) {
      if (team.getSpawns().size() == 0) {
        throw new MapLoadException("No Spawns specified for " + team.getName());
      }
    }

    this.modules = builder.getModules();
    this.timer = ((TimerModule) getModule(TimerModule.class));
    loadModules();

    this.kits = SporkKitBuilder.build(document);
    if (kits == null) {
      this.kits = new ArrayList<>();
    }

    /*
    for(SporkTeam team : teams) {
    	List<ObjectiveModule> fetched = team.getObjectives();
    	// Log.info(team.getName() + ": " + fetched + " (" + fetched.size() + ")");

    	List<ObjectiveModule> objectives = new ArrayList<>();
    	for(Module module : modules) {
    		// Log.info("Checking " + module.getClass().getSimpleName() + " to see if it is an instance of ObjectiveModule");
    		if(module instanceof ObjectiveModule) {
    			ObjectiveModule objective = (ObjectiveModule) module;
    			// Log.info("'" + objective.getName() + "' has been found (" + objective.getTeam().getName().toUpperCase() + ")");
    			if(objective.getTeam().equals(team)) {
    				// Log.info("Found '" + objective.getName() + "' for " + objective.getTeam().getName().toUpperCase());
    				objectives.add(objective);
    			}
    		}
    	}
    	// Log.info(team.getName() + ": " + objectives + " (" + objectives.size() + ")");
    }
    */
  }
Example #5
0
 public InfoModule getInfo() {
   return builder.getInfo();
 }
Example #6
0
 public static Map<String, Object> simpleData1() {
   return MapBuilder.instance().put("name", "Aashna Poddar").put("dob", "02171995").build();
 }