Open Z0rdak opened 1 year ago
Consider an "Endpoint" for providing region area information to display them on mini-map mods.
Events when adding and removing Flags for Regions. This could be usefull for internal thing but as well as for some custom logic for modpack making.
Example: Useful for spawning flags to clear all mobs in a region when a spawning flag is added. Currently this is hard-coded. A event could be used to decouple this logic
Note: FlagBuilder to easily create Flag instances
Description
To ease integration and interoperability with other mods, an API to manage the regions of YAWP would be of great value. Among other things, this would help make mod packs easier.
In the first iteration, this API should provide a programmatic abstraction for the functions already be covered by the commands.
To know whether an action was successful, it is important to return an appropriate value for feedback. Most of the time a boolean is just fine, but throwing an exception would also be fine. In this case, a custom Exception implementation would be great.
With this API in place, most of the logic in the command utilities could also be replaced with the corresponding API calls.
Note: These todos serve only as a rough guideline. There will certainly be cases in which it may make sense to deviate from the exemplary method signature.
Important: Implementation target for this feature should be any fabric or forge port above 1.19.2. The backports are done after that by myself.
Todos
[ ] Dimensional Region API
List<ResourceKey<World>> GetDimensionalRegions();
List<String> GetLocalRegionsIn(ResourceKey<World>);
boolean reset(ResourceKey<World>);
void activateDimensionalRegion(ResourceKey<World>, boolean);
boolean isActive(ResourceKey<World>);
boolean addFlag(ResourceKey<World>, IFlag);
boolean addFlag(ResourceKey<World>, RegionFlag);
(adds default IFlag instance)boolean removeFlag(ResourceKey<World>, IFlag);
boolean removeFlag(ResourceKey<World>, RegionFlag);
boolean hasFlag(ResourceKey<World>, IFlag);
boolean hasFlag(ResourceKey<World>, RegionFlag);
boolean permitsPlayer(ResourceKey<World>, Player);
boolean permitsTeam(ResourceKey<World>, Team);
boolean addTeamAsOwner(ResourceKey<World>, Team);
boolean addTeamAsMember(ResourceKey<World>, Team);
boolean addPlayerAsOwner(ResourceKey<World>, Player);
(maybe overload with Uuid)boolean addPlayerAsMember(ResourceKey<World>, Player);
(maybe overload with Uuid)boolean removedTeamFromOwners(ResourceKey<World>, Team);
boolean removeTeamFromMembers(ResourceKey<World>, Team);
boolean removePlayerFromOwners(ResourceKey<World>, Player);
(maybe overload with Uuid)boolean removePlayerFromMembers(ResourceKey<World>, Player);
(maybe overload with Uuid)Events