Skip to content

Commit

Permalink
wp group update
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Jul 12, 2024
1 parent 1e83811 commit d3df4e8
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import journeymap.api.v2.common.event.impl.JourneyMapEvent;
import journeymap.api.v2.common.waypoint.WaypointGroup;

import static journeymap.api.v2.common.event.common.WaypointGroupEvent.Context.DELETED;

public class WaypointGroupEvent extends JourneyMapEvent
{
private final WaypointGroup group;
Expand All @@ -11,7 +13,7 @@ public class WaypointGroupEvent extends JourneyMapEvent
/**
* On DELETED if all waypoints are deleted.
*/
final boolean deleteWaypoints;
private final boolean deleteWaypoints;

public WaypointGroupEvent(WaypointGroup group, Context context)
{
Expand All @@ -26,6 +28,23 @@ public WaypointGroupEvent(WaypointGroup group, Context context, boolean deleteWa
this.deleteWaypoints = deleteWaypoints;
}

/**
* If the delete group event is also deleting all the waypoints in the group
*
* @return - the boolean
*/
public boolean deleteWaypoints()
{
if (DELETED == this.context)
{
return this.deleteWaypoints;
}
else
{
throw new UnsupportedOperationException("deleteWaypoint can only be called on context DELETED!");
}
}

/**
* Gets the waypoint group that the event is handling.
*
Expand Down

0 comments on commit d3df4e8

Please sign in to comment.