Command query

Discussion in 'Archived: Plugin Requests' started by D.Joe, May 23, 2013.

  1. Offline

    D.Joe

    Hello, it would be great if there would be a plugin that connects to a database and runs a query, displayed on a command, like this:
    command1:
    command: /topkills
    query: "SELECT * FROM pvpstats WHERE name='%player%' ORDER BY kills LIMIT 0, 10"
    variable:
    name: row_name
    kills: row_kills
    deaths: row_deaths
    message: "Hello, %player%, here is the top kills:
    %name% - %row_kills% kills, %row_deaths% deaths"
    And when /topkills is executed:

    DJoe - 55 kills, 12 deaths.
    SomeOtherPlayer - 32 kills, 57 deaths.
    CoolPlayer - 28 kills, 17 deaths.
    etc

    Can this be acomplished? it would be really useful to create commands like /stats customized by you
    But i do not want a plugin that shows me top kills, i want a plugin that allows me to create a query and make my own command
     
  2. Offline

    D.Joe

    No replies? No one is able to do this?
     
  3. Offline

    jokie666

    I am not going to take advantage of this plugin because I am busy with the grand exchange,
    I can only tell you that you can't use the standard sql query's anymore in java,
    you need to make getters and setters. Do you know how to write a little plugin, if you know that you can make this by yourself easily if you wanna make a try.
     
  4. Offline

    D.Joe

    jokie666
    I do not know how to write a plugin, otherwise i wouldn't be posting here asking for help, and i will start , but i do not know. This plugin would be very useful if someone did it.
     
  5. Offline

    D.Joe

    BUMP!
    C'MON!
     
  6. Offline

    timtower Administrator Administrator Moderator

    D.Joe What kind of database is it? MySQL? Sql server? The build in database?
     
  7. Offline

    D.Joe

    MySQL, it would be nice if i could create my own query, and display the result, the commands could be /cq command1 or something like this, but it would be great to make my querys on commands like /tops or /stats. And this plugin would be really useful for everyone.
     
  8. Offline

    D.Joe

  9. Offline

    timtower Administrator Administrator Moderator

    D.Joe Still here, just thinking about how I am going to create this
     
  10. Offline

    timtower Administrator Administrator Moderator

    D.Joe Able to execute an hard code query
     
  11. Offline

    timtower Administrator Administrator Moderator

    D.Joe Config will be like this:
    Code:
    url: jdbc:<server url here>:<port here>
    user: <username for database>
    password: <password for database, leave blank for none>
    Commands:
      Command1:
        query: '<your select statement>'
        message: 'Hello, %colomn name1% kills and %colomn name 2% deaths'
     
  12. Offline

    timtower Administrator Administrator Moderator

  13. Offline

    D.Joe

    timtower hey, can you update this plugin to 1.7.2? or it works on any version?
     
  14. Offline

    timtower Administrator Administrator Moderator

    Should work on any version
     
  15. Offline

    D.Joe

    timtower Command1: will execute on server as /Command1 ?
     
  16. Offline

    timtower Administrator Administrator Moderator

    Yes
     
  17. Offline

    D.Joe

    timtower and the player will be %player%?

    Code:
    url: jdbc:<server url here>:<port here>
    user: <username for database>
    password: <password for database, leave blank for none>
    Commands:
      kills:
        query: 'SELECT * FROM stats WHERE user=\'%player%\''
        message: 'You have, %kills% kills '
    Will this be correct?
     
  18. Offline

    timtower Administrator Administrator Moderator

    D.Joe $player$ is the right variable
     
  19. Offline

    D.Joe

    timtower If i want to display top 5 kills, how should i proceed?
     
  20. Offline

    timtower Administrator Administrator Moderator

    D.Joe
    Code:
    SELECT * FROM stats ORDERBY kills DESC LIMIT 5
     
  21. Offline

    D.Joe

    timtower i know the query, but the message, will it display 5 rows of data?
     
  22. Offline

    timtower Administrator Administrator Moderator

    I believe it should do that yes
     
  23. Offline

    D.Joe

    timtower works, but i made this

    Code:
    Commands:
      topkills:
        query: SELECT * FROM Stats_kill WHERE type='Player' ORDER BY amount DESC
        firstmessage: Hmm
        message: '%player%: %amount%'
    
    but the command /topkills does not work

    Edit: it works with /mysql topkills, and it displays
    Code:
    Hmm
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    bobscanfy: 190
    Couldn't fetch data rows
     
  24. Offline

    timtower Administrator Administrator Moderator

    D.Joe There never was a /topkills, try /mysql topkills instead
     
  25. Offline

    D.Joe

    timtower
    Instead of displaying all resulted columns in a query, it displays only the first for more how much i asked

    SELECT * FROM Stats_kill WHERE type='Player' ORDER BY amount DESC LIMIT 0, 5 will result
    Bobscanfly: 190
    Bobscanfly: 190
    Bobscanfly: 190
    Bobscanfly: 190
    Bobscanfly: 190
    , instead of resulting
    Bobscanfly: 190
    Sabyn: 88
    YaziRainbow: 75
    Darber: 70
    Midnight: 69

    Also, please add a plugin reload feature
     
  26. Offline

    timtower Administrator Administrator Moderator

  27. Offline

    D.Joe

  28. Offline

    timtower Administrator Administrator Moderator

    It is more work for me and I don't like being a 24/7 developer.
     
  29. Offline

    D.Joe

    timtower scoreboard can be put in the middle? if so, you could make a scoreboard with the data withdrawn from mysql, and it would be awesome
     
  30. Offline

    timtower Administrator Administrator Moderator

    D.Joe Put more spacebars in the message?
    And won't add scoreboard support, would require continues updates.
    You have a plugin that puts the score in the database already, they have the values stored in the plugin already. Ask that developer to add scoreboard support.
     

Share This Page