Search in sources :

Example 1 with Region

use of pl.themolka.arcade.region.Region 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 Region

use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.

the class FlagFactory method parseFlagCapture.

public FlagCapture parseFlagCapture(CaptureGame game, Element xml, FlagCapture capture) {
    Region region = XMLRegion.parseUnion(game.getGame(), xml);
    if (region == null) {
        return null;
    }
    capture.setFieldStrategy(this.findRegionFieldStrategy(xml, FlagCapture.DEFAULT_FIELD_STRATEGY));
    capture.setFilter(this.findFilter(game.getGame(), xml.getAttributeValue("filter"), FlagCapture.DEFAULT_FILTER));
    capture.setRegion(region);
    return capture;
}
Also used : XMLRegion(pl.themolka.arcade.xml.XMLRegion) Region(pl.themolka.arcade.region.Region)

Example 3 with Region

use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.

the class FlagFactory method parseFlagSpawn.

public FlagSpawn parseFlagSpawn(CaptureGame game, Element xml, FlagSpawn spawn) {
    Region region = XMLRegion.parseUnion(game.getGame(), xml);
    if (region == null) {
        return null;
    }
    spawn.setFieldStrategy(this.findRegionFieldStrategy(xml, FlagSpawn.DEFAULT_FIELD_STRATEGY));
    spawn.setFilter(this.findFilter(game.getGame(), xml.getAttributeValue("filter"), FlagSpawn.DEFAULT_FILTER));
    spawn.setRegion(region);
    return spawn;
}
Also used : XMLRegion(pl.themolka.arcade.xml.XMLRegion) Region(pl.themolka.arcade.region.Region)

Example 4 with Region

use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.

the class PointFactory method parsePointCapture.

public PointCapture parsePointCapture(CaptureGame game, Element xml, PointCapture capture) {
    Region region = XMLRegion.parseUnion(game.getGame(), xml);
    if (region == null) {
        return null;
    }
    capture.setFieldStrategy(this.findRegionFieldStrategy(xml, PointCapture.DEFAULT_FIELD_STRATEGY));
    capture.setFilter(this.findFilter(game.getGame(), xml.getAttributeValue("filter"), PointCapture.DEFAULT_FILTER));
    capture.setRegion(region);
    return capture;
}
Also used : XMLRegion(pl.themolka.arcade.xml.XMLRegion) Region(pl.themolka.arcade.region.Region)

Example 5 with Region

use of pl.themolka.arcade.region.Region in project Arcade2 by ShootGame.

the class PointFactory method parsePointXml.

public Point parsePointXml(CaptureGame game, Element xml, Point point) {
    // capture region
    Element captureElement = xml.getChild("capture");
    if (captureElement == null) {
        return null;
    }
    PointCapture capture = this.parsePointCapture(game, captureElement, new PointCapture(game, point));
    if (capture == null) {
        return null;
    }
    // state region
    Element stateElement = xml.getChild("state");
    Region stateRegion = stateElement != null ? XMLRegion.parseUnion(game.getGame(), stateElement) : null;
    if (stateRegion == null) {
        // Set state region to the capture region (if it is not set).
        stateRegion = capture.getRegion();
    }
    // setup
    point.setCapture(capture);
    point.setCaptureTime(Time.parseTime(xml.getAttributeValue("capture-time"), Point.DEFAULT_CAPTURE_TIME));
    point.setCapturingCapturedEnabled(XMLParser.parseBoolean(xml.getAttributeValue("capturing-captured"), false));
    point.setDominatorStrategy(this.findDominatorStrategy(xml, Point.DEFAULT_DOMINATOR_STRATEGY));
    point.setDominateFilter(this.findFilter(game.getGame(), xml.getAttributeValue("dominate-filter"), Point.DEFAULT_DOMINATE_FILTER));
    point.setLoseTime(Time.parseTime(xml.getAttributeValue("lose-time"), Point.DEFAULT_LOSE_TIME));
    point.setNeutralColor(Color.parse(xml.getAttributeValue("color"), Point.DEFAULT_NEUTRAL_COLOR));
    point.setObjective(XMLParser.parseBoolean(xml.getAttributeValue("objective"), false));
    point.setPermanent(XMLParser.parseBoolean(xml.getAttributeValue("permanent"), false));
    point.setPointReward(XMLParser.parseDouble(xml.getAttributeValue("point-reward"), Score.ZERO));
    point.setStateRegion(stateRegion);
    return point;
}
Also used : Element(org.jdom2.Element) XMLRegion(pl.themolka.arcade.xml.XMLRegion) Region(pl.themolka.arcade.region.Region)

Aggregations

Region (pl.themolka.arcade.region.Region)7 XMLRegion (pl.themolka.arcade.xml.XMLRegion)6 Element (org.jdom2.Element)2 Handler (net.engio.mbassy.listener.Handler)1 DyeColor (org.bukkit.DyeColor)1 Location (org.bukkit.Location)1 Material (org.bukkit.Material)1 Attribute (org.jdom2.Attribute)1 GoalFireworkHandler (pl.themolka.arcade.goal.GoalFireworkHandler)1 Liquid (pl.themolka.arcade.leak.Liquid)1 Color (pl.themolka.arcade.util.Color)1