Inactive [DEV] LogBlockQuestioner v0.03 - So Many Questions [1.2]

Discussion in 'Inactive/Unsupported Plugins' started by DiddiZ, Jun 10, 2011.

  1. Offline

    DiddiZ

    LogBlockQuestioner - So Many Questions
    Version: 0.02 - Works with recommended build #935-1337

    LogBlockQuestioner provides an easy to use option to ask players some questions. It was originally written for LogBlock (therefore the name), but I thought some others might have a use for it, especially for confirmation questions. It accepts an unlimited count of specified answers, but more that five most likely wouldn't make much sense. Questions times out after 5 minutes. A question returns a string either containing one of the specified answers, "timed out" or "interrupted" (when server is shutting down).

    Features:

    • Ask a player a question with specified answers
    • It's optimized for speed (compares hashes instead of strings)
    Config/Commands/Permissions:
    none

    Download/Sourcecode:
    https://github.com/DiddiZ/LogBlockQuestioner/downloads

    Javadoc:
    http://diddiz.insane-architects.net/LogBlockQuestioner/doc/


    [​IMG]

    Example:
    Code:
    import de.diddiz.LogBlockQuestioner.LogBlockQuestioner;
    
    private final LogBlockQuestioner questioner;
    questioner = (LogBlockQuestioner)logblock.getServer().getPluginManager().getPlugin("LogBlockQuestioner")
    
    String answer = questioner.ask(player, "Are you there?", "yes", "no");
    if (answer.equals("yes")) {
        //Good luck, he's there :D
    } else {
         //We don't like idlers:
        player.kick();
    }
    
    Plugins using this:
    List of plugins (open)


    Changelog:

    • LogBlockQuestioner v0.02 (Jun. 11, 2011)
      Works with CraftBukkit recommended build #818
      • API changes
      • Fixed ConcurrentModificationException
    • LogBlockQuestioner v0.01 (Jun. 01, 2011)
      Works with CraftBukkit recommended build #818,
      • Initial release
    Future:
    • askAll() method (When there is a need for it)

    Added screenshot

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
    Valdifer, Mitsugaru, mario182 and 2 others like this.
  2. Offline

    PatrickFreed

    lol
    String aswer
     
  3. Offline

    DiddiZ

    Whoops :D
     
  4. Offline

    nicatronTg

    Ooh, nice. I was just about to write this myself, and I noticed the Jar sitting on my server, which lead me here. Thanks!

    Actually, I'm having an interesting bug where the answer sort of just doesn't get passed back. The entire server grinds to a halt, presumably because the answer didn't go through.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 16, 2016
  5. Offline

    DiddiZ

    Arg, forgot to mention that you can't ask in the server thread.
     
  6. Offline

    nicatronTg

    Well then. That's kind of... inconvenient.
     
  7. Offline

    DiddiZ

    Sure, but you can't let the entire server wait for the answer.
    I can add method where you provide the runnables to be executes on each answer, but in any case you need an extra class.
     
  8. Offline

    nicatronTg

    It's not that, it's inconvenient that by default commands aren't threaded.
     
  9. Offline

    DiddiZ

    Hm, would be a good feature for bukkit, and likely reduce some laggs.
     
  10. Offline

    woodzy

    i like this im "like"ing it
     
  11. Offline

    Valtos

    Please update for 953. I doesn't work for me.

    Server starts and load the Plugin:
    Code:
         [exec] 151 recipes
         [exec] 16 achievements
         [exec] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         [exec] 19:52:43 [INFO] Starting minecraft server version Beta 1.7.2
         [exec] 19:52:43 [WARNUNG] **** NOT ENOUGH RAM!
         [exec] 19:52:43 [WARNUNG] To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar"
         [exec] 19:52:43 [INFO] Loading properties
         [exec] 19:52:43 [INFO] Starting Minecraft server on *:25565
         [exec] 19:52:43 [WARNUNG] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
         [exec] 19:52:43 [WARNUNG] The server will make no attempt to authenticate usernames. Beware.
         [exec] 19:52:43 [WARNUNG] While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
         [exec] 19:52:43 [WARNUNG] To change this, set "online-mode" to "true" in the server.settings file.
         [exec] 19:52:43 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-904-g9277096-b953jnks (MC: 1.7.2)
         [exec] 19:52:43 [INFO] [Permissions] (Yeti) was initialized.
         [exec] 19:52:43 [INFO] [Permissions] version [3.1.6] (Yeti)  loaded
         [exec] 19:52:43 [INFO] Preparing level "Ny_World"
         [exec] 19:52:43 [INFO] Preparing start region for level 0 (Seed: -2563617655078104327)
         [exec] 19:52:44 [INFO] Preparing start region for level 1 (Seed: -2563617655078104327)
         [exec] 19:52:44 [INFO] Loading Config File...
         [exec] 19:52:45 [INFO] [mcMMO] Permissions enabled.
         [exec] 19:52:46 [INFO] mcMMO version 1.0.31 is enabled!
         [exec] 19:52:46 [INFO] [iConomy] Logging is currently disabled.
         [exec] 19:52:46 [INFO] [iConomy] v5.01 (Eruanna) loaded.
         [exec] 19:52:46 [INFO] [iConomy] Developed by: [Nijikokun]
         [exec] 19:52:46 [INFO] [iConomy] hooked into Permissions.
         [exec] 19:52:46 [INFO] [Towny] Database: [Load] flatfile [Save] flatfile
         [exec] 19:52:46 [INFO] [Towny] Using: Permissions3, iConomy
         [exec] 19:52:46 [INFO] [Towny] Version: 0.71 - Mod Enabled
         [exec] 19:52:46 [INFO] [Management] Loading configuration.
         [exec] 19:52:46 [INFO] [Management] Version 0.2b loaded.
         [exec] 19:52:46 [INFO] [Management] hooked into iConomy v5.01.
         [exec] 19:52:46 [INFO] [Management] hooked into Permissions v3.1.6.
         [exec] 19:52:46 [INFO] [Management] hooked into LogBlockQuestioner v0.02.
         [exec] 19:52:46 [INFO] [Permissions] SQL Interface enabled!
         [exec] 19:52:46 [INFO] LogBlockQuestioner v0.02 enabled
         [exec] 19:52:46 [INFO] Done (0.305s)! For help, type "help" or "?"
    All works fine on start.
    But if a Player joins, the server hangs up. The join of the User will be displayed in server log but after that nobody can join again. On Minecraft Client i become a "Connection lost" error.

    My Implementation of the Question on PlayerJoin-Event:
    Code:
    Management.questioner.ask(player, "Is this Minecraft-Server nice?", "yes", "no");
    If i outcomment this Line, it works all fine.

    Sry that i have no Exception or anything else.
     
  12. Offline

    DiddiZ

    You have to call the question async, or you freeze the server.
    Bukkit really should make the commands async to the man thread ...
     
  13. Offline

    Valtos

    öhm yeah. how i do this?
    Java is not my main programming language. I have no idea how to run threads and manage them in java. do you have a code snippet for me (and any other people with this plugin)?

    So, the Questions should be sended from a child thread. Also we need invokes to speak to the main thread.
    In that case i can build a Thread-Class that sends the Question, waitin for the answer and invokes a Callback in Mainthread like Questioner-PlugIn from Towny. Right?
     
  14. Offline

    DiddiZ

    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        scheduler.scheduleAsyncTask(new CommandIsServerNice((Player)sender);
    }
    
    class CommandIsServerNice {
        private Player player
    
        CommandIsServerNice(Player player) {
            this.player = player;
        }
    
        public void run() {
            if (Management.questioner.ask(player, "Is this Minecraft-Server nice?", "yes", "no"))
               Management.addLike(player.getName());
            else
                player.ban("You suck");
        }
    }
    
    Basically yes.
     
    Mitsugaru and Valtos like this.
  15. Offline

    suicidal_banana

    For some weird reason, /yes and /no are unknown commands?

    Any idea what would cause that?
    The only think i can think off is DefaultCommands, that has some command rename weirdness.

    Bukkit: #1060
    LogBlock: v1.26

    DefaultCommands: v3.5.0
     
  16. Offline

    DiddiZ

    You're right, it's DefaultCommands.
     
  17. Offline

    ibreaktoucher

    is it compatible with 1.0.0 ?
     
  18. Offline

    DiddiZ

  19. Offline

    Dy1an362

    Where do i get a free database? and how do i link it to my friends server? (i have console access)
     
  20. Offline

    DiddiZ

    db4free.net for testing purposes :D
     
  21. Offline

    Kanar

    I'm getting the same problem. The /yes and /no command give me an "unknown command". I have checked and I see nothing in DefaultCommands that mention /yes or /no. Questioner is a great tool that I don't want to have to disable.
     
  22. Offline

    AtreyuMarcs

    Any chance that an option could be added to allow us to set how long it waits before time out? 5 minutes is just a bit much in my opinion and would like to lower it to about 1 minute.
     
  23. Offline

    DiddiZ

    Config options seems resonable.
     
  24. Offline

    Multikillers

    can you not fix so you only need to be op to use the commands for logblock and rollback
     
  25. Offline

    DiddiZ

    No, I won't do that. There are reasons the permissions system is superior to op/non-op.
     
  26. Offline

    Imm0rt41

    in logblock config ive set Ask Redos to true, but logblock questioner doesnt ask if i want to redo stuff. or else im not getting what redos mean. can you tell me why its not asking, or else elaborate on what its talking about?
     
  27. Offline

    DiddiZ

    It will ask you "Are you sure?" when you use /lb redo [...]
     
  28. Offline

    Imm0rt41

    does /lb redo rollback a rollback?
     
  29. Offline

    DiddiZ

    Yup
     
  30. Offline

    Imm0rt41

    oh thank god, you DO have a command for rolling back rollbacks
     

Share This Page