|
2 | 2 |
|
3 | 3 | import journeymap.api.v2.common.CommonAPI; |
4 | 4 | import journeymap.api.v2.common.waypoint.Waypoint; |
| 5 | +import journeymap.api.v2.common.waypoint.WaypointGroup; |
5 | 6 | import net.minecraft.server.level.ServerPlayer; |
6 | 7 |
|
7 | 8 | import java.util.List; |
8 | 9 | import java.util.UUID; |
9 | 10 |
|
10 | 11 | /** |
11 | | - * Currently unused, just a placeholder. Please do not code any of this as it will likely change. |
| 12 | + * Server-side JourneyMap API for reading and manipulating waypoints. |
12 | 13 | */ |
13 | | -@Deprecated |
14 | 14 | public interface IServerAPI extends CommonAPI |
15 | 15 | { |
| 16 | + // ---- Player waypoint getters ---- |
| 17 | + |
16 | 18 | /** |
17 | | - * Gets all the waypoints stored for the target Server Player. |
| 19 | + * Gets all waypoints stored for the given server player. |
18 | 20 | * |
19 | | - * @param player - the Player |
20 | | - * @return - the waypoints. |
| 21 | + * @param player the server player |
| 22 | + * @return the player's waypoints |
21 | 23 | */ |
22 | 24 | List<Waypoint> getWaypoints(ServerPlayer player); |
23 | 25 |
|
24 | 26 | /** |
25 | | - * Gets all the waypoints stored for the target Server Player. |
| 27 | + * Gets all waypoints stored for the player with the given UUID. |
26 | 28 | * |
27 | | - * @param id - the player uuid |
28 | | - * @return - the waypoints. |
| 29 | + * @param playerUUID the player UUID |
| 30 | + * @return the player's waypoints |
29 | 31 | */ |
30 | | - List<Waypoint> getWaypoints(UUID id); |
| 32 | + List<Waypoint> getWaypoints(UUID playerUUID); |
31 | 33 |
|
32 | 34 | /** |
33 | | - * Gets All waypoints stored on the server for all players and all common/global waypoints. |
| 35 | + * Gets all waypoints stored on the server for all players and all global waypoints. |
34 | 36 | * |
35 | 37 | * @return all waypoints |
36 | 38 | */ |
37 | 39 | List<Waypoint> getWaypoints(); |
38 | 40 |
|
| 41 | + /** |
| 42 | + * Gets the waypoint with the given GUID for the specified player. |
| 43 | + * |
| 44 | + * @param playerUUID the player UUID |
| 45 | + * @param guid the waypoint GUID |
| 46 | + * @return the waypoint, or null if not found |
| 47 | + */ |
| 48 | + Waypoint getWaypoint(UUID playerUUID, String guid); |
| 49 | + |
| 50 | + /** |
| 51 | + * Gets all waypoint groups for the specified player. |
| 52 | + * |
| 53 | + * @param playerUUID the player UUID |
| 54 | + * @return the player's waypoint groups |
| 55 | + */ |
| 56 | + List<WaypointGroup> getAllGroups(UUID playerUUID); |
| 57 | + |
| 58 | + /** |
| 59 | + * Gets the waypoint group with the given GUID for the specified player. |
| 60 | + * |
| 61 | + * @param playerUUID the player UUID |
| 62 | + * @param guid the group GUID |
| 63 | + * @return the group, or null if not found |
| 64 | + */ |
| 65 | + WaypointGroup getGroup(UUID playerUUID, String guid); |
| 66 | + |
| 67 | + // ---- Player waypoint mutations ---- |
| 68 | + |
| 69 | + /** |
| 70 | + * Adds or updates a waypoint for the specified player. |
| 71 | + * Fires {@link journeymap.api.v2.common.event.common.WaypointEvent} (CREATE or UPDATE, cancellable). |
| 72 | + * |
| 73 | + * @param playerUUID the player UUID |
| 74 | + * @param waypoint the waypoint to add or update |
| 75 | + */ |
| 76 | + void addPlayerWaypoint(UUID playerUUID, Waypoint waypoint); |
| 77 | + |
| 78 | + /** |
| 79 | + * Deletes the waypoint with the given GUID for the specified player. |
| 80 | + * Fires {@link journeymap.api.v2.common.event.common.WaypointEvent} (DELETED). |
| 81 | + * |
| 82 | + * @param playerUUID the player UUID |
| 83 | + * @param guid the waypoint GUID to delete |
| 84 | + */ |
| 85 | + void deletePlayerWaypoint(UUID playerUUID, String guid); |
| 86 | + |
| 87 | + /** |
| 88 | + * Adds or updates a waypoint group for the specified player. |
| 89 | + * |
| 90 | + * @param playerUUID the player UUID |
| 91 | + * @param group the group to add or update |
| 92 | + */ |
| 93 | + void addPlayerGroup(UUID playerUUID, WaypointGroup group); |
| 94 | + |
| 95 | + /** |
| 96 | + * Deletes the waypoint group with the given GUID for the specified player. |
| 97 | + * |
| 98 | + * @param playerUUID the player UUID |
| 99 | + * @param guid the group GUID to delete |
| 100 | + * @param deleteWaypoints if true, also deletes all waypoints belonging to the group |
| 101 | + */ |
| 102 | + void deletePlayerGroup(UUID playerUUID, String guid, boolean deleteWaypoints); |
| 103 | + |
| 104 | + // ---- Global waypoint getters ---- |
| 105 | + |
39 | 106 | /** |
40 | 107 | * Gets all waypoints that are not tied to specific players. |
41 | | - * These waypoints are created for every player when they log in. |
| 108 | + * These waypoints are visible to every player when they log in. |
42 | 109 | * |
43 | | - * @return |
| 110 | + * @return all global waypoints |
44 | 111 | */ |
45 | 112 | List<Waypoint> getGlobalWaypoints(); |
| 113 | + |
| 114 | + /** |
| 115 | + * Gets the global waypoint with the given GUID. |
| 116 | + * |
| 117 | + * @param guid the waypoint GUID |
| 118 | + * @return the waypoint, or null if not found |
| 119 | + */ |
| 120 | + Waypoint getGlobalWaypoint(String guid); |
| 121 | + |
| 122 | + /** |
| 123 | + * Gets all global waypoint groups. |
| 124 | + * |
| 125 | + * @return all global waypoint groups |
| 126 | + */ |
| 127 | + List<WaypointGroup> getAllGlobalGroups(); |
| 128 | + |
| 129 | + /** |
| 130 | + * Gets the global waypoint group with the given GUID. |
| 131 | + * |
| 132 | + * @param guid the group GUID |
| 133 | + * @return the group, or null if not found |
| 134 | + */ |
| 135 | + WaypointGroup getGlobalGroup(String guid); |
| 136 | + |
| 137 | + // ---- Global waypoint mutations ---- |
| 138 | + |
| 139 | + /** |
| 140 | + * Adds or updates a global waypoint. |
| 141 | + * Fires {@link journeymap.api.v2.server.event.server.GlobalWaypointEvent} (CREATE or UPDATE, cancellable). |
| 142 | + * |
| 143 | + * @param waypoint the waypoint to add or update |
| 144 | + */ |
| 145 | + void addGlobalWaypoint(Waypoint waypoint); |
| 146 | + |
| 147 | + /** |
| 148 | + * Deletes the global waypoint with the given GUID. |
| 149 | + * Fires {@link journeymap.api.v2.server.event.server.GlobalWaypointEvent} (DELETED). |
| 150 | + * |
| 151 | + * @param guid the waypoint GUID to delete |
| 152 | + */ |
| 153 | + void deleteGlobalWaypoint(String guid); |
| 154 | + |
| 155 | + /** |
| 156 | + * Adds or updates a global waypoint group. |
| 157 | + * Fires {@link journeymap.api.v2.server.event.server.GlobalWaypointGroupEvent} (CREATE or UPDATE, cancellable). |
| 158 | + * |
| 159 | + * @param group the group to add or update |
| 160 | + */ |
| 161 | + void addGlobalGroup(WaypointGroup group); |
| 162 | + |
| 163 | + /** |
| 164 | + * Deletes the global waypoint group with the given GUID. |
| 165 | + * Fires {@link journeymap.api.v2.server.event.server.GlobalWaypointGroupEvent} (DELETED). |
| 166 | + * |
| 167 | + * @param guid the group GUID to delete |
| 168 | + * @param deleteWaypoints if true, also deletes all waypoints belonging to the group |
| 169 | + */ |
| 170 | + void deleteGlobalGroup(String guid, boolean deleteWaypoints); |
| 171 | + |
| 172 | + // ---- Share hook ---- |
| 173 | + |
| 174 | + /** |
| 175 | + * Programmatically share a waypoint with one or more players. |
| 176 | + * Fires {@link journeymap.api.v2.server.event.ServerEventRegistry#WAYPOINT_SHARE_SUBMIT_EVENT} (cancellable) |
| 177 | + * before storing pending entries. |
| 178 | + * |
| 179 | + * @param waypoint the waypoint to share |
| 180 | + * @param fromUUID UUID of the player or system initiating the share |
| 181 | + * @param fromName display name shown to recipients |
| 182 | + * @param targetIds specific recipients; ignored if allKnownUsers is true |
| 183 | + * @param allKnownUsers if true, shares with all players in PlayerData |
| 184 | + */ |
| 185 | + void shareWaypoint(Waypoint waypoint, UUID fromUUID, String fromName, |
| 186 | + List<UUID> targetIds, boolean allKnownUsers); |
46 | 187 | } |
0 commit comments