[INACTIVE][FUN] Trivia v1.5 [477]

Discussion in 'Inactive/Unsupported Plugins' started by blaatz0r, Jan 22, 2011.

  1. Offline

    blaatz0r

    Current release: 1.5

    Old releases: 1.3 | 1.21 | 1.2 | 1.11 | 1.1 | 1.0

    Description:
    This is my first plugin, I made it to get a basic understanding of Bukkit and to refresh my Java skills a bit.

    Trivia is quiz game where players can answer questions by typing in the answer to a question.
    The player receives points for each correct answer and/or optionally a random item.
    Every 15 seconds or so a hint is given to make it a bit easier, but the answer will be worth less points for each hint!

    Trivia.jpg

    Features:
    - Support for Permissions plugin.
    - Fully automatic question system. Trivia reads all questions from text files when the plugin is enabled and randomly selects a new question when needed. Easy to make new questions!
    - Award points or random items to players for answering questions.
    - Shows how fast a player answered the question.
    - A player ranking is stored in a SQLite database.
    - Allows players to ask hints and skip questions.
    - Players can enable or disable Trivia messages whenever they want.
    - Players can vote to skip the current question (majority vote)
    - Super sexy command handling
    - Ops can load question files in game
    - Everything is configurable through a config file.

    Installation:
    - Install the Permissions plugin.
    - Download Trivia here and put it in your /plugins/ directory.
    - Create a folder called 'lib' in your craftbukkit directory (so it looks like this) and put this file in it (this is the database driver).

    If you run Trivia now, the console will tell you that you don't have any questions yet.
    Put your questions files in the /plugins/Trivia/questions/ directory (by default) and from within Minecraft, use the commands /trivia load to load the questions and /trivia start to start playing (op status required).

    See the section below on how to make question files. Two example files can be found here:
    - questions.txt (5000 general questions)
    - scramble.txt (800 scramble words, see below)

    A configuration file was also generated at /plugins/Trivia/Trivia.yml. Edit the settings to your liking. See the section on configuration below for options.

    Commands:
    Code:
    /trivia - enables or disabled Trivia messages for you
    /trivia help - shows the Trivia help menu
    /trivia top - shows the top 5 player scores
    /trivia rank - shows your player rank and score
    /votenext - calls a vote to skip the current question, requires majority vote
    /next - skips to the next question (need permission or be op)
    /hint - shows another hint
    
    Ops only:
    /trivia admin - shows you all admin commands
    /trivia start - starts Trivia
    /trivia stop - stops Trivia
    /trivia restart - stops and then starts Trivia
    /trivia load - reloads all files in Trivia/questions directory
    /trivia add [file] - adds the file to the questions
    Configuration:
    Nearly everything can be configured in Trivia.yml:
    Code:
    timer - the amount of time between two hints
    time-out - the amount of time between two questions, if the answer was not given
    max-hints - the maximum number of hints for a question
    reward-points - (true|false) - specify whether you want players to receive points for correct answers
    reward-items - (true|false) - specify whether you want players to receive a random item for correct answers (see items)
    points - the number of points awarded for each correct answer
    decrease - the number of points deducted per hint from the points reward
    items - list of item ID's, one of these items is randomly given to the player for a correct answer (if reward-items is true)
    db-name - the name of the database file
    questions-dir - the directory that contains your Trivia questions
    letters-per-hint - one letter will be revealed per hint for this many letters in the answer
    
    Permission nodes:
    Add the following to your plugins/Permissions/config.yml:

    Default:
    Code:
    - 'Trivia.play'
    - 'Trivia.hint'
    - 'Trivia.top'
    - 'Trivia.rank'
    - 'Trivia.vote'
    - 'Trivia.startvote'
    Admin (no need to add this, only if you want to give admin rights to individual users):
    Code:
    - 'Trivia.next'
    - 'Trivia.admin.help'
    - 'Trivia.admin.add'
    - 'Trivia.admin.load'
    - 'Trivia.admin.start'
    - 'Trivia.admin.stop'
    - 'Trivia.admin.restart'
    Adding questions:
    You can manually add questions to Trivia by editing the text files in your plugins/Trivia/questions directory. Trivia will read all files in this directory on start-up.

    You should add one question per line, in the form of:

    Code:
    Question*Answer
    So for example:

    Code:
    What is the average air speed velocity of an unladen swallow?*9001
    Answers are not case sensitive.

    Get extra questions here: M1sT3rM4n

    Scramble questions:
    A special type of question is the Scramble question: the letters of a word a scrambled and the player has to figure out the original word. Trivia randomizes the answer for you, so you don't have to provide the question. Scramble question have a special syntax:

    Code:
    Scramble*Answer
    See scramble.txt for examples.

    Known bugs:
    - Sometimes gives an error 'String Index out Of Range 72' or something alike. Working on it..
    - Ranking is bugged if you are not in the database yet

    To do:
    - Fix index out of range bug
    - Add in game loading of questions
    - Add permissions
    - Integrate with iConomy

    Source:
    Github


    Changelog:
    01/03/11: v1.5
    • Working with latest Craftbukkit: updated package structure and commands execution.
    • Source now available on GitHub!
    27/01/11: v1.3
    • Permissions support - check section on Permissions above for configuration. Old Trivia.yml file should still work.
    26/01/11: v1.21
    • Changed messages a bit, now hopefully the client breaks less often.
    25/01/11: v1.2
    • Important for new installations: From now on, the downloadable versions of Trivia only include the JAR file. Question files should be downloaded and added manually when you 're doing a fresh installation. Old versions still work as they used to.
    • Trivia is now way more robust!
      • The console will show warnings and instructions when you try to start Trivia without questions available.
      • Recoded a lot of stuff internally, better handling of questions
    • Ops can use /trivia stop and /trivia stop from within Minecraft to pause Trivia. When Trivia is not running, players can still use all commands (help, rank, top) but not /next or /votenext
    24/01/11: v1.11
    • Tried fixing chat event monitors which caused Trivia to break because of other plugins.
    • You need to download this file and put it in a directory called 'lib' in your craftbukkit folder.
    23/01/11: v1.1
    • Super sexy command handling thx to Zenexer
    • Added vote to skip question
    • Added in game question file loading
    • Added commands /trivia load, /trivia add, /votenext
    • Added op permissions to /next, /load
    • Fixed questions.txt, now all questions have correct syntax
    22/01/11: v1.0
     
    Dutchy and M1sT3rM4n like this.
  2. Offline

    M1sT3rM4n

    Will you add the Nijk's Permission plugin integration into this?
     
  3. Offline

    blaatz0r

    Haven't really figured out how to do that yet. I might, if I see the benefits of it.
     
  4. Offline

    M1sT3rM4n

    Ah. It just seems more intuitive than adding names in the Op since you have a greater control over who gets to do what.
    --- merged: Jan 26, 2011 5:29 AM ---
    Bumpin for support!
     
  5. Offline

    Chosen

    //sry for English

    or I don't know as to do this or this Trivia is for one player
    How or U can use 1 question for all players in server...??
    and who will answer first then he will get the prize

    respect
    THX
     
  6. Offline

    M1sT3rM4n

    Bug:

    Sometimes, when players answer a question correctly it crashes their client. It seems to be related to some of the MC items, for example, when I get flint I crash, or paper. Not sure about other items.
     
  7. Offline

    ledhead900

    Is it possible to get this working with Niji's permission plugin for group permission support?
    I really love the idea of thing.
     
  8. Offline

    M1sT3rM4n

    I am still having problems with the plugin crashing the client when I answer a question correctly regardless of whether I am awarding random items. Bug?
     
  9. Offline

    blaatz0r

    Any errors in the console? Can you find the questions on which it breaks?

    Sorry, I don't understand. The server selects a questions and sends this question to all players. The player that answers first gets the reward. So yes, it is using one question for all players, if that is what you mean.
     
  10. Offline

    M1sT3rM4n

    There are no errors on the console. It just crashes the client.
     
  11. Offline

    blaatz0r

    Found the bug, colour codes are causing the crash because the line of text is too long (then the colour code gets split up over two lines and the client breaks). It's not my fault, but I will try to work around it. :)

    Does this help?
     
  12. Offline

    M1sT3rM4n

    I will try the fix when I get home later tonight. Thanks for catching the issue :D Also, is this a temp fix or permanent fix?
     
  13. Offline

    Slims_240

    To whom it may concern,

    A friend and i are using this awesome plugin on our server. Sometimes users will get kicked after answering a question correctly. here is the error we are getting:

    --- BEGIN ERROR REPORT a1dce528 --------
    Generated 1/26/11 4:51 PM

    Minecraft: Minecraft Beta 1.2_02
    OS: Windows 7 (amd64) version 6.1
    Java: 1.6.0_18-ea, Sun Microsystems Inc.
    VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Sun Microsystems Inc.
    LWJGL: 2.4.2
    OpenGL: ATI Radeon HD 5770 version 4.0.10207 Compatibility Profile Context, ATI Technologies Inc.

    java.lang.StringIndexOutOfBoundsException: String index out of range: 74
    at java.lang.String.charAt(Unknown Source)
    at nh.a(SourceFile:152)
    at nh.a(SourceFile:119)
    at pe.a(SourceFile:238)
    at ll.b(SourceFile:346)
    at net.minecraft.client.Minecraft.run(SourceFile:668)
    at java.lang.Thread.run(Unknown Source)
    --- END ERROR REPORT ea97e9cd ----------

    If you get a chance could you please try and fix this error or let me know if it is something that we did?

    Thank you,
    Slims_240
     
  14. Offline

    Cosmic Break

    if you logoff while having trivia on and log back in, you have to type /trivia 2 times in order for it to show again.
     
  15. Offline

    blaatz0r

    Try the newest version, see if it still bugs. I'm quite sure it has to do with the colour codes breaking the client. If the problem remains, I will remove colour from those messages completely and see if that resolves it.

    I'll be cautious with using chatcolor in messages from now on, until it gets properly fixed in bukkit.
    I do my best ;)
     
  16. Offline

    Slims_240


    Sir,

    Thank you. I will have the main server admin update and see if that helps. ill let you know what we find out.

    Regards,
    Slims_240
     
  17. Offline

    M1sT3rM4n

    Can't you just divide up the colors? I mean the entire sentence doesn't have to be colored, just the prefixes.
     
  18. Offline

    blaatz0r

    I'm trying to do that now. In a situation like this...

    Well done blaatz0r! The answer was Minecraft is an awesome game.

    ... the risk of breaking is high, because there is a color code at the end of the sentence for the period. So I just moved it over a bit to reduce the risk of breaking (I hope!). Let me know if 1.21 works
     
  19. Offline

    M1sT3rM4n

    Why not just

    [Trivia] What is 1+1?
    [Trivia] Hint: 1 / 2
    [Trivia] The answer was: 3!
    [Trivia] Well done blaatzor! You've received a <prize item name> for a prize!

    It makes everything stand out and takes little colors to code. At least that was the colors I used for my mIRC trivia script :p
     
  20. Offline

    blaatz0r

    The problem is, if you use orange and you want black text after it, you need to use a color code for black again.
    It's not the amount of color codes, it's the fact that a client can break if the color code is split over two lines. So I just want to avoid color codes at line endings.
     
  21. Offline

    M1sT3rM4n

    Oops. I had meant white text :D but didn't use it because well... you can't see it on here :D

    SO:

    Black = white.

    [Trivia] What is 1+1?
    [Trivia] Hint: 1 / 2
    [Trivia] The answer was: 3!
    [Trivia] Well done blaatzor! You've received a <prize item name> for a prize!
    --- merged: Jan 27, 2011 2:33 PM ---
    Bumpin for awesome!
     
  22. Offline

    blaatz0r

    Added Permissions support. I'll leave the messages like this for a while.
     
  23. Offline

    M1sT3rM4n

    Will test it again today to see if the colors crashes the server :\
     
  24. Offline

    Chosen

    I can do this:
    If admin say /trivia or something
    all player see trivia msg?

    or only every one separately must write /trivia ? :(
    to see msg?
     
  25. Offline

    Cosmic Break

  26. Offline

    Jeremy Stuck

    Getting
    [Trivia] Error: null
    on every command.

    On the load up it seems to load fine saying it loaded questions.txt:
    2011-01-28 02:45:45 [INFO] Trivia 1.3 enabled
    2011-01-28 02:45:45 [INFO] [Trivia] loaded questions from [questions.txt]
     
  27. Offline

    M1sT3rM4n

  28. Offline

    Xemnas33

    Ah you just say it :D
     
  29. Offline

    Slims_240

    Problem was solved when we updated to 1.3. Thank you for all your hard work
     
  30. Offline

    M1sT3rM4n

    Will be testing this later today.
    --- merged: Jan 29, 2011 7:18 PM ---
    The client crash bug seem to be fixed, but the timer's off sometimes in terms of how long it takes people to answer
     
  31. Offline

    Lolmewn Retired Staff

    It seems to not work with Craftbukkit 168. What I tried:
    Code:
    2011-01-30 10:49:55 [INFO] [PLAYER_COMMAND] Lolmewn: /trivia load
    2011-01-30 10:49:55 [INFO] Lolmewn issued server command: trivia load
    2011-01-30 10:49:55 [INFO] Unknown console command. Type "help" for help.
    2011-01-30 10:49:57 [INFO] [PLAYER_COMMAND] Lolmewn: /trivia start
    2011-01-30 10:49:57 [INFO] Lolmewn issued server command: trivia start
    2011-01-30 10:49:57 [INFO] Unknown console command. Type "help" for help.
    Edit: I put the thingy in the lib folder, added questions, so it Should work.
    Edit2: Wow i'm stupid. Don't have the trivia.jar
    --- merged: Jan 30, 2011 9:56 AM ---
    Hmm, downloaded, /trivia load works, but get some errors on other commands.
    Code:
    2011-01-30 10:54:54 [INFO] [PLAYER_COMMAND] Lolmewn: /trivia top
    java.sql.SQLException: no such table: scores
            at org.sqlite.DB.throwex(DB.java:288)
            at org.sqlite.NestedDB.prepare(NestedDB.java:115)
            at org.sqlite.DB.prepare(DB.java:114)
            at org.sqlite.Stmt.executeQuery(Stmt.java:89)
            at com.bukkit.blaatz0r.Trivia.Trivia.sendTop(Trivia.java:440)
            at com.bukkit.blaatz0r.Trivia.TriviaPlayerListener.onPlayerCommand(TriviaPlayerListener.java:133)
            at org.bukkit.plugin.java.JavaPluginLoader$3.execute(JavaPluginLoader.java:132)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:60)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:213)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:554)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:528)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:265)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:201)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    2011-01-30 10:54:54 [INFO] Lolmewn issued command: /trivia top
    2011-01-30 10:55:02 [INFO] [PLAYER_COMMAND] Lolmewn: /trivia rank
    java.sql.SQLException: no such table: scores
            at org.sqlite.DB.throwex(DB.java:288)
            at org.sqlite.NestedDB.prepare(NestedDB.java:115)
            at org.sqlite.DB.prepare(DB.java:114)
            at org.sqlite.Stmt.executeQuery(Stmt.java:89)
            at com.bukkit.blaatz0r.Trivia.Trivia.sendRanking(Trivia.java:458)
            at com.bukkit.blaatz0r.Trivia.TriviaPlayerListener.onPlayerCommand(TriviaPlayerListener.java:139)
            at org.bukkit.plugin.java.JavaPluginLoader$3.execute(JavaPluginLoader.java:132)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:60)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:213)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:554)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:528)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:265)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:201)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    2011-01-30 10:55:02 [INFO] Lolmewn issued command: /trivia rank
    Also, I can't get it to start.
     

Share This Page