TriviaQuest ❓ In-Game Trivia Questions


#1

TriviaQuest - Developed by Simon_Flash (mcsimonflash@gmail.com)
Current Version: 1.3.0
Status: Suspended -> Updates limited to fixing bugs/issues

GitHub | Download | TriviaQuest Wiki | Support Discord


TriviaQuest allows players to answer trivia questions and receive rewards for being the first person to answer correctly. TriviaQuest loads pre-configured questions from its config file, which are randomly selected and broadcasted to the server. The first player to answer the question by typing the answer in chat is declared the winner and receives a random reward if specified in the config. Furthermore, TriviaQuest also includes an integrated trivia runner to ask trivia automatically on an interval specified (once again) in the config.

As of the latest version, players can also ask their own questions too and have some fun with things!

To help server owners organize and display trivia effectively, questions are segmented into trivia packs that contain groups of questions. These packs not only organize similar questions in the config but can also be enabled and disabled individually without deleting the questions from the config itself.


The majority of TriviaQuest features are completely controlled through the config file, and all questions must be entered in directly. The format is incredibly simple and shown in the default config, but it is important to understand the method for properly registering questions using the following format.

name="(Question),(Answer),(Answer)" -> There’s no limit on (Answer) tags, but they must be after the question.

The name of the question is up to you; it’s just for organizational purposes. The question/answer pair are encoded in a string together, making it much easier to edit. Lastly, note that some characters such as the double quote - " - are processed as part of the JSON format, so using them without being escaped (preceded by the backslash \ character) could cause issues.


While TriviaQuest does offer an integrated runner that’ll meet the basic requirements, if you’re looking for even more control you can use the /Trivia Post command with CmdCalendar.


Currently, TriviaQuest doesn’t any significant amount of preconfigured trivia questions, and I’d like some help building up a question repository. If you have a trivia pack that you’d be willing to open up to the public, please send me a message and you’ll be credited for your contribution. Thanks!


If you experience any issues with TriviaQuest, have a suggestion for a future update, or just want to provide some feedback, feel free to leave a message below or contact me directly - you’re always welcome to join the Support Discord linked above if you need assistance.


#2
  • To allow for answers with spaces in them, you may want to use GenericArguments.remainingJoinedStrings().
  • You’re assuming that the server doesn’t modify the chat format at all. Use getRawMessage to get the actual message, not the formatted chat.
  • You can use an event filter annotation instead of querying the Cause for the player.
  • Why does your Config class have @ConfigSerializable on it? You don’t actually use object-mapping.
  • You may want to static final your colored chat message prefix, and use append() to make new chat messages - prevents redundant construction and cleans up repeated code.
  • Don’t just blindly return CommandResult.success(). If a user did something wrong, CommandException is meant to be thrown; for an intended wrong, such as a wrong trivia answer, perhaps CommandResult.empty() would be a better fit.
  • Minor note - the naming convention for HOCON keys is dashed-lowercase, not TitleCase or camelCase.

#3

Is there a way to add multiple answers to a single question through the config? If there is, then how?

EDIT: Also how do i configure the rewards?
reward1=“give {player} minecraft:diamond”
thats not working
http://pastebin.com/HWzRgYFG
this happens when someone gives the right answer


#4

Well, since it’s an NPE, that means you’re trying to call a function in RunTrivia line 99 on a null object. In this case, almost definitely triviaQuestion.

And the first part is a question for you, not a question for me. How would you redesign the config? But if I were you, I’d start by splitting up question and answer into separate keys, and then changing the answer from a string to a string list.


#5

@pie_flavor
The GenericArguments.remainingJoinedStrings() is an oversight on my behalf, but most of the others are mainly because I don’t have a strong understand of Sponge and the docs, in my opinion, don’t help very much. In regards to returning CommandResult, I had a different understand of how each of them were to be returned from what I read. I’ll keep what you’ve said in mind and the quick changes will be in the hotfix tonight.

As for getRawMessage, I see no such method in MessageEvent, and the only case I’ve found with it in Sponge are from two years ago in MessageSinkEvent, which no longer exists.

@Tabish3304
I can implement multiple answers for the next update, so that shouldn’t be too much of an issue. I will have an update out tonight that fixes the above issue as well; it’s just a mistake in formatting on my behalf.


#6

Ah, you should be using MessageChannelEvent.Chat.


#7

All right, thanks!


#8

TriviaQuest v1.1.0: Simon_Flash (mcsimonflash@gmail.com)
Download: TriviaQuest v1.1.0

*Changed config format -> Question and Answer sections are now separated with () instead of {} and multiple format changes have been made. Configs from previous

Multiple answers are now supported
Prefix can be changed in config
Sponge reload no longer duplicates questions
Config rewards are registered correctly
Synchronous questions are now blocked
Miscellaneous format improvements

Issues should be reported with the version - [v1.1.0]


#9

Sorry, I have the version 1.1.0 installed and it tells me that “you do not have permission to use this command”.
I am owner of server and I have permission * and I am OP.
The players already have the permission triviaquest.answer.
I have tried with the permission triviaquest.* but neither.


#10

@CanariasCraftservido
Please be specific in issue reports otherwise there isn’t much I can do to help. From what you’ve provided, it seems more likely the issue relates to permissions more than TriviaQuest itself. If you still aren’t able to figure it out, please send me the command being used and a pastebin of the permission file that you’re working with.


#11

Sponge does not use .* wildcards. If you have foo.bar, then you have foo.bar.baz and foo.bar.flard.


#12

@pie_flavor @CanariasCraftservido
That’s true, though there are some permissions plugins that still support it. However, triviaquest.answer is the only permission node required to answer trivia questions, so the .* issue wouldn’t really apply. If the player with triviaquest.answer does not have access to /trivia answer, check your permissions tree and then send me a message if you still need assistance.

In other news, there will be an update for TriviaQuest within the next week and I will be officially releasing another plugin here shortly. Stay tuned!


#13

29 days later isn’t quite a month, at least for April.

After spending some time with some others areas of development, it seems like we’re due for another update to TriviaQuest! Version 1.2.0 has been released, which has the huge new feature of being able to enable or disable trivia packs in-game - about time!

Additionally, there have been a variety of optimizations made as well as some config reforming, so be sure to make the required changes. Lastly, the config option config:check_messages is now available to prevent TriviaQuest from snooping on all your players chat. Huzzah!

If you have any issues, suggestions, or anything else related to TriviaQuest, join the Support Discord - it’s the fastest way to get ahold of me. Enjoy!

Issues should be reported with the version - [v1.2.0]


#14

Updates are starting to roll out faster! Version 1.2.1 has added to option to hide answers from being displayed after questions (thanks @Elementdragon0 for the suggestion!). Additionally, I’ve fixed the help menu to include reference links and finally match the plugin’s theme - about time!

If you have any suggestions for future updates, feel free to send me a message - Discord is likely the fastest way to get ahold of me.

Issues should be reported with the version - [v1.2.1]


#15

Seems like this bug seemed to slip through testing! Certain scenarios that should have activated a reward command were instead skipping over it, so that’s been addressed in version 1.2.2. Additionally, I’ve been working on putting together a trivia repository available publicly, so if you’d be interested in contributing questions please let me know!

Hotfix Update: v1.2.2 fixes trivia rewards.


#16

It’s time for another update, and this one brings in a feature I’ve been meaning to do for a long time!

Players with the permission triviaquest.ask are now able to ask their own questions through /TriviaQuest AskTrivia (or /tq ask for short). Additionally, two config options have been added - player_questions=boolean (true/false), which enables player questions, and player_delay=int (in seconds) The format for this uses the pattern below, followed by a few examples -

  • [Question] ans:[Answer1],[Answer2]
  • Aren’t player questions awesome? ans:Yes!
  • What’s the square root of 49? ans:7,-7

I’ve done some pretty thorough testing to make sure player questions don’t interfere with the integrated runner, but it is possible there’s still some scenarios I might have missed. If you notice anything odd occurring, please let me know.

Additionally. note that player questions do not have any reward attached to them; they’re just for fun. ^^

Issues should be reported with the version: [v1.3.0]


#17

Wow, has it really been over two months? Seems like that time has gone by in a flash.

Moreover to the point, I introduce you to TriviaQuest 2.0.0 - my first plugin to reach a new major version, as a matter of fact. I’ve taken the feedback I’ve gathered from the community, mixed in 10 more weeks of experience, and added just a touch of new features and ideas to bring you all this concoction. Version 2.0.0 does away with some of the unnecessary or poorly implemented features of previous versions, and focuses on improving what makes TriviaQuest, well, TriviaQuest.

I’ve taken the first step in allowing for packs to be more dynamic by improving their configuration, not to mention two new additional types. On top of that, I’d also like to start working towards creating a Pack Repository where community trivia packs can be stored. To help initiate that, I’m offering one of my own - Generation I Pokedex trivia (based on OmegaRuby’s Pokedex). If you’d like to use it, all you have to do is copy the contents into a pack of your choice.

GenI Pack: https://gist.github.com/SimonFlash/de14f02afffb3f61645ea3ac90d1b977

Changelog:

  • Updated to SpongeAPI 6 (API 5 should still work fine)
  • Added Scramble and Completion type trivia
  • Completely rewrote the trivia runner to be cleaner and more effective
  • Made significant changes to the configuration system, available options, and how questions/packs are stored
  • Removed AskTrivia, CancelTrivia, DisablePack, EnablePack, ReloadTrivia, StopTrivia, and StartTrivia (refactored to ToggleTrivia)
  • Added a legacy conversion system for old configs

Issues should be reported with the version - [v2.0.0]


#18

Simple little update today to add in a config option to display the answer to the trivia when the question ends. Don’t know how that one slipped past me!

Changelog:

  • Added config option to show trivia answers (config -> show-answers)
  • Removed legacy conversion (update to 2.0.0 first if needed)
  • Small internal changes.

Issues should be reported with the version - [v2.0.1]


#19

Hey Simon,

I was wondering if you still update this. For the word scrambling feature, is it possible that it scrambles the word itself instead of having to input a fixed scrambled word in the config? That would be cool to have.


#20

I read this, received a phone call from my doctor, and completely forgot about it afterward. Whoops!

Having an auto-scramble system is something I initially planned for the 2.0.0 release, but I ran into a few problems that caused me to forgo it for that release.

  • How do I ensure a word is “well scrambled” and not similar to the base word?
  • How do I prevent inappropriate words from appearing in the scramble (fire truck -> …)
  • What happens if I’m unable to find a valid scramble?

I have somewhat decent solutions for all of these but didn’t have enough time to properly implement them all (especially the first one). If you could tell me what you’d expect to occur from a user’s perspective that’d be a huge step for making sure I’m in the right direction and avoiding any issues down the road.