DNAmaster10 / httpRequests

A Spigot plugin which allows player to send HTTP requests to a web server from an ingame command
MIT License
14 stars 3 forks source link

Integrate "@a", "@p" e.t.c in values section of the httpsend command #8

Open DNAmaster10 opened 1 year ago

DNAmaster10 commented 1 year ago

@a should insert a list of online players into the values section of the httpsend command.

@p should insert the name of the closest player to the sender (e.g a command block) into the value section.

Dinty1 commented 1 year ago

There is slightly more to this. Ideally arguments would also be supported within these selectors, for which there would hopefully be a library already in existence. https://minecraft.fandom.com/wiki/Target_selectors

DNAmaster10 commented 11 months ago

I've started implementing some basic selector features. Currently, @a should be possible for display names, actual names and UUIDs. Will publish and update documentation when completed.

DNAmaster10 commented 10 months ago

The general idea for how this will work is users will insert a special selector with parameters into their command. This will look something like this:

/httpsend POST https://10.8.1.1:80 data=Hey!-#-Players:-#-|@a:displayNames|

Upon execution, the plugin will first replace all the space characters, so the data string will look like this: data=Hey! Players: |@a:displayNames|

Then, anything between the "|" symbols will be replaced with whatever it's asking for. The above will be an @a selector which returns all player display names separated by a comma.

So following the selectors being replaced, it might look like: data=Hey! Players: jim_bob,notch

It will also be possible to escape the "|" symbols by adding a "\".