Civcraft / JukeAlert

Do not open issues here; open them on the maintained fork @ DevotedMC
https://github.com/DevotedMC/JukeAlert
BSD 3-Clause "New" or "Revised" License
5 stars 15 forks source link

Filter options for /jainfo #62

Closed GopherAtl closed 7 years ago

GopherAtl commented 8 years ago

In crowded areas snitch logs can get long and annoying. It would be very convenient if you could specify filters in /jainfo to list only certain events, particularly filtering by name or by type.

Originally suggested on reddit here, after a bit of thought I've tweaked the suggested syntax in a way that ought to simplify the code to a single execution path for all variants, though at the possible expense of an increase in cost of the db request - can't be sure, but I somehow doubt /jainfo requests are a significant chunk of load? recording events is likely more significant, and the net impact of being able to quickly skim a few pages of relevant events without going through sometimes 30+ pages of friendly/neutral "Entry" events should actually make it a net positive in terms of server load.

proposed syntax:

/jainfo [page# [ [] ] ]

This remains compatible with the familiar syntax, with expected behavior if and are omitted. Page number would be required if filtering, but this does not seem too burdensome. could be a keyword for any of the event types - ENTRY, PLACE, BREAK, USE, etc - or "ANY" to return all types. If is omitted, it would list all players.

examples:

list the first page of results, unfiltered - previously expected behavior /jainfo

list the 10th page of unfiltered results - again, previously expected behavior /jainfo 10

list the 2nd page of snitch events involving the player GopherAtl /jainfo 2 ANY GopherAtl

list the first page of recorded block breaking events. /jainfo 1 BREAK

ProgrammerDan commented 8 years ago

Solid spec, thanks!

waffle-stomper commented 7 years ago

Does anyone mind if I change the spec slightly?

The original spec was missing the censor flag. Also I think it would be easier to just make the event type optional. Here's what I propose:

/jainfo [<page number> or 'next'] [censor] [action=<event type>] [player=<username>]

e.g. If you want to see the first page of results, with coordinates censored for kill events:

/jainfo censor action=KILL

or if you want the next page of events for player ttk2:

/jainfo next player=ttk2

I'd also like to propose that the filters include partial matches.

e.g:

/jainfo action=break player=longname

Which would return break events for longname1337 and ihavealongname

ProgrammerDan commented 7 years ago

@waffle-stomper Can you augment the wiki here with a new page demonstrating these new features and how to use them? I'd love to have something like that to link to when I update to this.

waffle-stomper commented 7 years ago

@ProgrammerDan Done - https://github.com/Civcraft/JukeAlert/wiki#checking-snitches. Let me know if you think it needs any changes.