use of org.spongepowered.api.data.type.DyeColor in project Skree by Skelril.
the class JungleRaidInstance method smartStart.
public void smartStart() {
List<Player> ffaList = new ArrayList<>();
List<Player> redList = new ArrayList<>();
List<Player> blueList = new ArrayList<>();
Collection<Player> containedPlayers = getPlayers(PARTICIPANT);
if (containedPlayers.size() <= 1) {
return;
}
for (Player player : containedPlayers) {
BlockState state = player.getLocation().add(0, -1, 0).getBlock();
if (state.getType() != BlockTypes.WOOL) {
return;
}
Optional<?> optColor = state.getTraitValue(EnumTraits.WOOL_COLOR);
if (optColor.isPresent()) {
DyeColor color = (DyeColor) optColor.get();
if (color == DyeColors.RED) {
redList.add(player);
} else if (color == DyeColors.BLUE) {
blueList.add(player);
} else if (color == DyeColors.WHITE) {
ffaList.add(player);
} else {
return;
}
}
}
if (getWinner(ffaList, blueList, redList).isPresent()) {
getPlayerMessageChannel(SPECTATOR).send(Text.of(TextColors.RED, "All players are on one team, the game will not start."));
return;
}
ffaList.stream().forEach(p -> addFFAPlayer(p, classMap.getOrDefault(p, JungleRaidClass.BALANCED)));
redList.stream().forEach(p -> addRedPlayer(p, classMap.getOrDefault(p, JungleRaidClass.BALANCED)));
blueList.stream().forEach(p -> addBluePlayer(p, classMap.getOrDefault(p, JungleRaidClass.BALANCED)));
state = JungleRaidState.INITIALIZE;
startTime = System.currentTimeMillis();
}
use of org.spongepowered.api.data.type.DyeColor in project HuskyCrates-Sponge by codeHusky.
the class SpinnerCrateView method confettiBorder.
private ItemStack confettiBorder() {
DyeColor[] colors = { DyeColors.BLUE, DyeColors.CYAN, DyeColors.GREEN, DyeColors.LIGHT_BLUE, DyeColors.LIME, DyeColors.MAGENTA, DyeColors.ORANGE, DyeColors.PINK, DyeColors.PURPLE, DyeColors.RED, DyeColors.YELLOW };
ItemStack g = ItemStack.builder().itemType(ItemTypes.STAINED_GLASS_PANE).add(Keys.DYE_COLOR, colors[(int) Math.floor(Math.random() * colors.length)]).build();
g.offer(Keys.DISPLAY_NAME, Text.of(TextStyles.RESET, "You won an item!"));
return g;
}
Aggregations