CoreProtect

CoreProtect

1M Downloads

Add support for entry annotations, or add mutable pre-log event

bermudalocket opened this issue ยท 2 comments

commented

Hi,

My server recently switched from LogBlock to CoreProtect. We are finding it to be much more robust and sincerely appreciate the work put into maintaining and improving this plugin.

I have encountered one problem area, namely the lack of ability to "annotate" an entry.

Consider a survival server with a plugin that allows server staff to enter "admin mode" in which moderation tasks (e.g. grief investigation) are completed. This "admin mode" gives the staff member elevated privileges including access to creative mode. In the past I have been able to hook into LogBlock's LogBlockPreLogEvent and mutate the player's name, prepending "adminmode_", which effectively separates their "staff edits" from their "player edits". I'm not finding an easy way to do that with CoreProtect.

I can think of two general solutions. Both involve creating some sort of CoreProtectPreLogEvent.

  1. Allow entries to be annotated with a short string message, i.e. event.annotation = "admin mode", which is then searchable, i.e. /co lookup p:bermudalocket t:1d annotation:"admin mode", or

  2. Allow player names to be mutable, i.e. event.player = "adminmode_" + event.player, /co lookup p:adminmode_bermudalocket t:1d.

commented

Hi @Intelli, if you give me some guidance I'm happy to start work on a pull request. I'm thinking solution 2 is probably the least invasive.

commented

Solution 2 seems like it'd be fine.

The best spot to hook in async would likely be under net.coreprotect.database.logger, in the Logger classes:
https://github.com/PlayPro/CoreProtect/tree/master/src/main/java/net/coreprotect/database/logger