Search in sources :

Example 1 with Color

use of pl.themolka.arcade.util.Color in project Arcade2 by ShootGame.

the class PointCaptureFireworks method onPointCaptured.

@Handler(priority = Priority.LAST)
public void onPointCaptured(PointCapturedEvent event) {
    if (this.isEnabled() && !event.isCanceled()) {
        Point point = event.getPoint();
        Region region = point.getCapture().getRegion();
        Color color = event.getNewOwner().getColor();
        for (Location at : this.getRegionCorners(region.getBounds())) {
            this.fireComplete(at, color);
        }
    }
}
Also used : Color(pl.themolka.arcade.util.Color) Region(pl.themolka.arcade.region.Region) Location(org.bukkit.Location) Handler(net.engio.mbassy.listener.Handler) GoalFireworkHandler(pl.themolka.arcade.goal.GoalFireworkHandler)

Example 2 with Color

use of pl.themolka.arcade.util.Color in project Arcade2 by ShootGame.

the class TeamParser method parseDyeColor.

protected DyeColor parseDyeColor(ChatColor chatColor, Property property) throws ParserException {
    DyeColor dyeColor = this.dyeColorParser.parse(property).orDefaultNull();
    if (dyeColor != null) {
        return dyeColor;
    }
    Color localColor = Color.ofChat(chatColor);
    if (localColor == null) {
        throw this.fail(property, property.getName(), property.getValue(), "Unknown chat color type");
    }
    dyeColor = localColor.toDye();
    if (dyeColor == null) {
        throw this.fail(property, property.getName(), property.getValue(), "Given chat color type cannot be converted into a dye color");
    }
    return dyeColor;
}
Also used : Color(pl.themolka.arcade.util.Color) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) DyeColor(org.bukkit.DyeColor)

Example 3 with Color

use of pl.themolka.arcade.util.Color in project Arcade2 by ShootGame.

the class ObserversParser method parseNode.

@Override
protected ParserResult<Observers.Config> parseNode(Node node, String name, String value) throws ParserException {
    Color color = this.colorParser.parse(node.property("color")).orFail();
    String observersName = this.nameParser.parse(node.property("name", "title")).orFail();
    return ParserResult.fine(node, name, value, new Observers.Config() {

        public ChatColor chatColor() {
            return Nulls.defaults(color.toChat(), Observers.OBSERVERS_CHAT_COLOR);
        }

        public DyeColor dyeColor() {
            return Nulls.defaults(color.toDye(), Observers.OBSERVERS_DYE_COLOR);
        }

        public String name() {
            return observersName;
        }
    });
}
Also used : Color(pl.themolka.arcade.util.Color) ChatColor(org.bukkit.ChatColor) DyeColor(org.bukkit.DyeColor) DyeColor(org.bukkit.DyeColor) ChatColor(org.bukkit.ChatColor)

Aggregations

Color (pl.themolka.arcade.util.Color)3 ChatColor (org.bukkit.ChatColor)2 DyeColor (org.bukkit.DyeColor)2 Handler (net.engio.mbassy.listener.Handler)1 Location (org.bukkit.Location)1 GoalFireworkHandler (pl.themolka.arcade.goal.GoalFireworkHandler)1 Region (pl.themolka.arcade.region.Region)1