zellfrey / Voting

Minecraft hook for voting APIs
https://minecraft.curseforge.com/projects/293830
Other
1 stars 2 forks source link

Multiple Vote text and links for /vote #7

Closed freaki2010 closed 4 years ago

freaki2010 commented 4 years ago

Hello i want to know if i can set multiple vote texts and links for the /vote command. We have 5 Votelinks for our server and i want to list them all with /vote. i tried it with following but it wont work: https://haste.gafert.org/ciciduxife.bash

Thanks for your help!

zellfrey commented 4 years ago

Hey @freaki2010 just had a look at your file, the reason why it will not work is due to .cfg format being line sensitive.

"text":"Vote on minecraft-server.eu!", "hoverEvent":{

For example these 2 lines here will be treated separately when forge looks through the config file.

To solve this you will need to remove every newline that is apparent in your json formatted block. Don't worry I've already done it:

"vote command text":[ { "text":"Vote on minecraft-server.eu!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"minecraft-server.eu", "color":"aqua" } ] }, "clickEvent":{ "action":"open_url", "value":"https://minecraft-server.eu/vote/index/2150F" } }, { "text":"Vote on minecraft-mp.com!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"minecraft-mp.com", "color":"green" } ] }, "clickEvent":{ "action":"open_url", "value":"https://minecraft-mp.com/server/253606/vote/" } }, { "text":"Vote on minecraft-server-list.com!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"minecraft-server-list.com", "color":"aqua" } ] }, "clickEvent":{ "action":"open_url", "value":"https://minecraft-server-list.com/server/457983/vote/" } }, { "text":"Vote on serverliste.net!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"serverliste.net", "color":"green" } ] }, "clickEvent":{ "action":"open_url", "value":"https://www.serverliste.net/vote/3355" } }, { "text":"Vote on topg.org!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"topg.org", "color":"aqua" } ] }, "clickEvent":{ "action":"open_url", "value":"https://topg.org/Minecraft/in-602557" } }, { "text":"Vote on mineservers.com!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"mineservers.com", "color":"green" } ] }, "clickEvent":{ "action":"open_url", "value":"https://mineservers.com/server/0mzwon46/vote" } } ]

However this looks pretty ugly as it just shows a block of text when a player runs the command /vote

I've added some newline breaks in between each voting link:

[ { "text":"Vote on minecraft-server.eu!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"minecraft-server.eu", "color":"aqua" } ] }, "clickEvent":{ "action":"open_url", "value":"https://minecraft-server.eu/vote/index/2150F" } },{"text":"\n"}, { "text":"Vote on minecraft-mp.com!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"minecraft-mp.com", "color":"green" } ] }, "clickEvent":{ "action":"open_url", "value":"https://minecraft-mp.com/server/253606/vote/" } },{"text":"\n"}, { "text":"Vote on minecraft-server-list.com!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"minecraft-server-list.com", "color":"aqua" } ] }, "clickEvent":{ "action":"open_url", "value":"https://minecraft-server-list.com/server/457983/vote/" } },{"text":"\n"}, { "text":"Vote on serverliste.net!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"serverliste.net", "color":"green" } ] }, "clickEvent":{ "action":"open_url", "value":"https://www.serverliste.net/vote/3355" } }, {"text":"\n"},{ "text":"Vote on topg.org!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"topg.org", "color":"aqua" } ] }, "clickEvent":{ "action":"open_url", "value":"https://topg.org/Minecraft/in-602557" } }, {"text":"\n"},{ "text":"Vote on mineservers.com!", "hoverEvent":{ "action":"show_text", "value":[ { "text":"mineservers.com", "color":"green" } ] }, "clickEvent":{ "action":"open_url", "value":"https://mineservers.com/server/0mzwon46/vote" } } ]

If you want to do this yourself, you can simply find a website that is able to remove all newlines with a click of a button. I used this site : https://www.textfixer.com/tools/remove-line-breaks.php

Hope this fixes the issue, if you have any other questions feel free to ask.

P.S The current method for adding voting links its quiet frankly ugly and illegible. Lockdown has arrived in London and my motivation for minecraft is getting better so I may take a good look at the mod again. Thanks for reading

freaki2010 commented 4 years ago

Hey sry for the late response. I'll try your method in a few minutes. In Germany, we have also had a lockdown for the last week and a half. I hope you stay healthy and thank you for the quick and comprehensive answer!