Skip to content

Commit

Permalink
added waypoint group transfer event
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticdrew committed Jul 9, 2024
1 parent 0e9cfc6 commit 5a0f2a7
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import journeymap.api.v2.client.IClientPlugin;
import journeymap.api.v2.common.event.common.WaypointEvent;
import journeymap.api.v2.common.event.common.WaypointGroupEvent;
import journeymap.api.v2.common.event.common.WaypointGroupTransferEvent;
import journeymap.api.v2.common.event.impl.Event;
import journeymap.api.v2.common.event.impl.EventFactory;

Expand All @@ -25,4 +26,9 @@ public class CommonEventRegistry
* This event handles all the CRUD operations of a waypoint groups on client and server.
*/
public static final Event<WaypointGroupEvent> WAYPOINT_GROUP_EVENT = EventFactory.create(WaypointGroupEvent.class);

/**
* This event fires when a waypoint is transferred from one group to another, from may be null.
*/
public static final Event<WaypointGroupTransferEvent> WAYPOINT_GROUP_TRANSFER_EVENT = EventFactory.create(WaypointGroupTransferEvent.class);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected WaypointGroupEvent(WaypointGroup group, Context context)
}

/**
* Gets the waypoint that the event is handling.
* Gets the waypoint group that the event is handling.
*
* @return - The waypoint group.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package journeymap.api.v2.common.event.common;

import journeymap.api.v2.common.event.impl.JourneyMapEvent;
import journeymap.api.v2.common.waypoint.Waypoint;
import journeymap.api.v2.common.waypoint.WaypointGroup;
import org.jetbrains.annotations.Nullable;

public class WaypointGroupTransferEvent extends JourneyMapEvent
{
private final WaypointGroup to;
private final WaypointGroup from;
private final Waypoint waypoint;

protected WaypointGroupTransferEvent(@Nullable WaypointGroup from, WaypointGroup to, Waypoint waypoint)
{
super(true);
this.from = from;
this.to = to;
this.waypoint = waypoint;
}

/**
* The group the waypoint is transferring to.
*
* @return - The waypoint group.
*/
public WaypointGroup getGroupTo()
{
return to;
}

/**
* The group the waypoint is transferring from.
* <p>
* May be null.
*
* @return - The waypoint group.
*/
@Nullable
public WaypointGroup getGroupFrom()
{
return from;
}

/**
* Gets the waypoint that is transferring groups.
*
* @return - The waypoint group.
*/
public Waypoint getWaypoint()
{
return waypoint;
}
}

0 comments on commit 5a0f2a7

Please sign in to comment.