Пример #1
0
  public List<Region> getContainingRegions(Location location) {
    /*
    if(getName().equalsIgnoreCase("Race for Victory 2")) {
    	String[] checks = new String[]{"blue-wool-rooms", "red-wool-rooms"};
    	for(String check : checks) {
    		try {
    			UnionRegion region = (UnionRegion) getRegion(check);
    			if(region == null) {
    				Log.info(check + " does not exist!");
    				continue;
    			}

    			Log.info("Checking '" + region.getName() + "' (" + region.getClass().getSimpleName() + ") for " + block);
    			boolean inside = region.isInside(block, true);
    			Log.info((inside ? "Found " : "Could not find ") + block + " inside '" + region.getName() + "'");
    		} catch(ClassCastException e) {
    			Log.info("Checked Region was not a Union Region");
    		}
    	}
    }
    */

    BlockRegion block =
        new BlockRegion(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    List<Region> regionList = new ArrayList<>();
    for (Region region : regions) {
      if (region.isInside(block)) {
        // Log.info(block + " was found inside '" + region.getName() + "' (" +
        // region.getClass().getSimpleName() + ")");
        regionList.add(region);
      }
    }
    return regionList;
  }
Пример #2
0
  public Region getRegion(String string) {
    for (Region region : regions) {
      String name = region.getName();
      if (region.getName() != null && name.equalsIgnoreCase(string)) return region;
    }

    return null;
  }
Пример #3
0
 private String region(Region region) {
   return region.getName() + ": " + region.getClass().getSimpleName();
 }