org.bukkit.Material#BANNER源码实例Demo

下面列出了org.bukkit.Material#BANNER 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码2 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码3 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码4 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码5 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码6 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码7 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码8 项目: SkyWarsReloaded   文件: NMSHandler.java
@Override
public ItemStack getColorItem(String mat, byte color) {
	if (mat.equalsIgnoreCase("wool")) {
		return new ItemStack(Material.WOOL, 1, (short) color);
	} else if (mat.equalsIgnoreCase("glass")) {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	} else if (mat.equalsIgnoreCase("banner")) {
		return new ItemStack(Material.BANNER, 1, (short) color);
	} else {
		return new ItemStack(Material.STAINED_GLASS, 1, (short) color);
	}
}
 
源代码9 项目: PGM   文件: Flag.java
protected Flag(Match match, FlagDefinition definition, ImmutableSet<Net> nets)
    throws ModuleLoadException {
  super(definition, match);
  this.nets = nets;

  TeamMatchModule tmm = match.getModule(TeamMatchModule.class);

  if (definition.getOwner() != null) {
    this.owner = tmm.getTeam(definition.getOwner());
  } else {
    this.owner = null;
  }

  ImmutableSet.Builder<Team> capturersBuilder = ImmutableSet.builder();
  if (tmm != null) {
    for (Team team : tmm.getTeams()) {
      Query query = team.getQuery();
      if (getDefinition().canPickup(query) && canCapture(query)) {
        capturersBuilder.add(team);
      }
    }
  }
  this.capturers = capturersBuilder.build();

  ImmutableSet.Builder<Team> controllersBuilder = ImmutableSet.builder();
  ImmutableSet.Builder<Team> completersBuilder = ImmutableSet.builder();
  for (Net net : nets) {
    if (net.getReturnPost() != null && net.getReturnPost().getOwner() != null) {
      Team controller = tmm.getTeam(net.getReturnPost().getOwner());
      controllersBuilder.add(controller);

      if (net.getReturnPost().isPermanent()) {
        completersBuilder.add(controller);
      }
    }
  }
  this.controllers = controllersBuilder.build();
  this.completers = completersBuilder.build();

  Banner banner = null;
  pointLoop:
  for (PointProvider returnPoint : definition.getDefaultPost().getReturnPoints()) {
    Region region = returnPoint.getRegion();
    if (region instanceof PointRegion) {
      // Do not require PointRegions to be at the exact center of the block.
      // It might make sense to just override PointRegion.getBlockVectors() to
      // always do this, but it does technically violate the contract of that method.
      banner =
          toBanner(((PointRegion) region).getPosition().toLocation(match.getWorld()).getBlock());
      if (banner != null) break pointLoop;
    } else {
      for (BlockVector pos : returnPoint.getRegion().getBlockVectors()) {
        banner = toBanner(pos.toLocation(match.getWorld()).getBlock());
        if (banner != null) break pointLoop;
      }
    }
  }

  if (banner == null) {
    throw new ModuleLoadException(
        "Flag '" + getName() + "' must have a banner at its default post");
  }

  this.bannerLocation = Materials.getLocationWithYaw(banner);
  this.bannerMeta = Materials.getItemMeta(banner);
  this.bannerYawProvider = new StaticAngleProvider(this.bannerLocation.getYaw());
  this.bannerItem = new ItemStack(Material.BANNER);
  this.bannerItem.setItemMeta(this.getBannerMeta());
}
 
源代码10 项目: Kettle   文件: Banner.java
public Banner() {
    super(Material.BANNER);
}
 
源代码11 项目: Kettle   文件: CraftMetaBanner.java
@Override
boolean applicableTo(Material type) {
    return type == Material.BANNER;
}
 
源代码12 项目: ProjectAres   文件: Flag.java
protected Flag(Match match, FlagDefinition definition, ImmutableSet<Net> nets) throws ModuleLoadException {
    super(definition, match);
    this.nets = nets;

    final TeamMatchModule tmm = match.getMatchModule(TeamMatchModule.class);

    this.owner = definition.owner()
                           .map(def -> tmm.team(def)) // Do not use a method ref here, it will NPE if tmm is null
                           .orElse(null);

    this.capturers = Lazy.from(
        () -> Optionals.stream(match.module(TeamMatchModule.class))
                       .flatMap(TeamMatchModule::teams)
                       .filter(team -> getDefinition().canPickup(team) && canCapture(team))
                       .collect(Collectors.toSet())
    );

    this.controllers = Lazy.from(
        () -> nets.stream()
                  .flatMap(net -> Optionals.stream(net.returnPost()
                                                      .flatMap(Post::owner)))
                  .map(def -> tmm.team(def))
                  .collect(Collectors.toSet())
    );

    this.completers = Lazy.from(
        () -> nets.stream()
                  .flatMap(net -> Optionals.stream(net.returnPost()))
                  .filter(Post::isPermanent)
                  .flatMap(post -> Optionals.stream(post.owner()))
                  .map(def -> tmm.team(def))
                  .collect(Collectors.toSet())
    );

    Banner banner = null;
    pointLoop: for(PointProvider returnPoint : definition.getDefaultPost().getReturnPoints()) {
        Region region = returnPoint.getRegion();
        if(region instanceof PointRegion) {
            // Do not require PointRegions to be at the exact center of the block.
            // It might make sense to just override PointRegion.getBlockVectors() to
            // always do this, but it does technically violate the contract of that method.
            banner = toBanner(((PointRegion) region).getPosition().toLocation(match.getWorld()).getBlock());
            if(banner != null) break pointLoop;
        } else {
            for(BlockVector pos : returnPoint.getRegion().getBlockVectors()) {
                banner = toBanner(pos.toLocation(match.getWorld()).getBlock());
                if(banner != null) break pointLoop;
            }
        }
    }

    if(banner == null) {
        throw new ModuleLoadException("Flag '" + getName() + "' must have a banner at its default post");
    }

    final Location location = Banners.getLocationWithYaw(banner);
    bannerInfo = new BannerInfo(location,
                                Banners.getItemMeta(banner),
                                new ItemStack(Material.BANNER),
                                new StaticAngleProvider(location.getYaw()));
    bannerInfo.item.setItemMeta(bannerInfo.meta);

    match.registerEvents(this);

    this.state = new Returned(this, this.getDefinition().getDefaultPost(), bannerInfo.location);
    this.state.enterState();
}
 
 方法所在类
 同类方法