kangarko / ChatControl-Red

Issue tracker and documentation for the next generation ChatControl Red, the most advanced chat management plugin.
49 stars 23 forks source link

1.16.5: Chat Variables #943

Closed Rongel92 closed 3 years ago

Rongel92 commented 3 years ago

Minecraft Version: 1.16.5 MySQL: false BungeeCord: false

Hi, I'm trying to make 2 variables for the chat and failing at getting it to work I need help on how to make them work one is [inv] to show the players inventory when you hover above. The second is [tp] once you click u send a teleport request to the player that posted it.

TheIntolerant commented 3 years ago

I'm not sure about the [inv]

but this will work for the [tp]

# Where should this variable be used?
#
# FORMAT = used in your formats with {syntax}, players cannot use it
# MESSAGE = players can use it with [syntax] in their chat messages
Type: MESSAGE

# The key we look for in the chat surrounded by [] brackets, example:
# chat message: "Hello everyone, [tp] and come check out my building"
Key: tp

# The value the key will be replaced to.
# This uses JavaScript and must return a boolean value.
Value: '"{sender_is_player}" == "true" ? "&a[TP]" : ""'

# What JavaScript condition must return true for this variable to show?
# You can put variables in here to get replaced.
Sender_Condition: ''

# What permission must the message sender have in order for this variable to display to him?
Sender_Permission: ''

# See Sender_Condition, except that we evaluate the JavaScript for each chat message receiver
# and only show the message to those receivers for which the condition returns true.
Receiver_Condition: ''

# What permission must the message receiver have in order for this variable to display to them?
Receiver_Permission: ''

Hover: '&fClick here to send tp request'

Run_Command: "/tpa {player}"
TheIntolerant commented 3 years ago

FYI, I edited: Value: '"{sender_is_player}" == "true" ? "&a[TP]" : "&c[Error]"' and changed it to: Value: '"{sender_is_player}" == "true" ? "&a[TP]" : ""', so that [tp] wouldn't show up with [Error] or anything for that matter, if the sender wasn't a player e.g. if the message was sent from discord or the console.

of course, you could keep the [error] but make it clearer, such as Value: '"{sender_is_player}" == "true" ? "&a[TP]" : "&c[TP-Error]"'

Hopefully, that explains what the [Error] part is for.

kangarko commented 3 years ago

Thanks so much gone-incognito!

Not sure about the [inv], can you please give us an example of how you want this to look like?

ElBananaa commented 3 years ago

Thanks so much gone-incognito!

Not sure about the [inv], can you please give us an example of how you want this to look like?

A lot of plugins actually do this. Basically, the player will type [inv], and when clicking on it, it'll open a GUI with the player inventory. Kinda like the /invsee command from essentials, but assigned to a clickable text.

Rongel92 commented 3 years ago

thanks a lot for the tp gone-incognito :) and yes elbananaa is right its like inv see when u click on it but u cant change or take any items out

TheIntolerant commented 3 years ago

This would be amazing to have [inv], if it can be done, can I suggest it be added as a default variable in the variables folder, when you first generate chatcontrol files.

ElBananaa commented 3 years ago

This would be amazing to have [inv], if it can be done, can I suggest it be added as a default variable in the variables folder, when you first generate chatcontrol files.

Completely agree with you. However, due to the fact that this isn't a simple script, I guess Kangarko would probably have to make some internal modifications to the plugin in order to create a such variable.

Rongel92 commented 3 years ago

same thing for enderchest if possible but i guess once the inv is done its a simple change to get a enderchest one aswell

kangarko commented 3 years ago

Thanks, but we're a chat plugin, not trying to be an all-in-one doing everything but buggy plugin. You can just use a third party plugin that has /invsee {player} and then link this using our variable system.

Heres an example of [inv] that triggers /invsee {player}: https://pastebin.com/a0BhNWsg