PlayTimeCounter - Counts players' playtime

This is a discussion topic for the Ore project, PlayTimeCounter. View the full project on Ore for downloads and more information.


PlayTimeCounter

Sponge plugin that counts players’ playtime. At the moment, it works only with MySQL!

Setup

  1. First of all you should set SQL alias in config/sponge/global.conf. Open it and find section “aliases” in section “sql”.
    Set the alias in the following format: alias_name"="jdbc:mysql://username:[email protected]/database_name.
  2. Drop .jar file into the mods folder.
  3. Restart the server.
  4. Configure plugin configuration file and reload it by the command “/sponge plugins reload”.

Commands and perms

  • /playtimecounter [playerName] - Displays playerName’s playing time. If argument isn’t specified, displays playing time of command sender.

    • Aliases: /playtime, /ptc
    • Permissions:
      • playtimecounter.cmd.playtime.base - Giving access to the command
      • playtimecounter.cmd.playtime.others - Giving possibility to see playing time of other player
  • /playtimetop - Displays top by playing time.

    • Aliases: /topplaytime, /ptctop
    • Permission: playtimecounter.cmd.playtimetop.base
  • /ptcreload - Reloads configuration file.

    • Permission: playtimecounter.cmd.reload.base

Feedback

If you face any problems, feel free to create an issue at the GitHub repository: click. Thank you.

A new version has been released for PlayTimeCounter, it is available for download here.


PlayTimeCounter

Sponge plugin that counts players’ playtime.

Setup

Plugin tested with SQLite and MySQL, but may be it works with something another.

  1. First of all you should set SQL alias in config/sponge/global.conf. Open it and find section “aliases” in section “sql”.
    If you want to use MySQL, set alias in that format: “alias_name”=“jdbc:mysql://username:[email protected]/database_name”.
    If you want to use SQLite, set alias in that format: “alias_name”=“jdbc:sqlite:path_to_file.db”.
  2. Drop .jar file into the mods folder.
  3. Restart the server.
  4. Configure plugin configuration file and reload it by the command “/sponge plugins reload”.

Commands and perms

  • /playtimecounter [playerName] - Displays playerName’s playing time. If argument isn’t specified, displays playing time of command sender.
    • Aliases: /playtime, /ptc
    • Permissions:
      • playtimecounter.cmd.playtime.base - Giving access to the command
      • playtimecounter.cmd.playtime.others - Giving possibility to see playing time of other player

A new version has been released for PlayTimeCounter, it is available for download here.


  • Added command /playtime [playerName], displaying playing time of the player.
    • Aliases: /playtimecounter, /ptc
    • Perms:
      playtimecounter.cmd.playtime.base - Giving access to the command
      playtimecounter.cmd.playtime.others - Giving access to view other’s playtime
  • Now plugin will count player’s playtime only if he isn’t afk (disabled as default, can be enabled in config file(requires Nucleus))
  • For new players their ‘time played’ is taken from statistic. (btw If countAFKTime = true for players that already exists in database their ‘time played’ will taken from statistic too instead of increment (idk why did i do it so maybe it will be removed)

A new version has been released for PlayTimeCounter, it is available for download here.


  • Added command /playtimetop that displaying top-x players by playing time.
    • Aliases: /topplaytime, ptctop
    • Perm: playtimecounter.cmd.playtimetop.base - Giving access to the command
  • Added command /ptcreload that reloading plugin configuration.
    • Perm: playtimecounter.cmd.reload.base
  • Minor fixes, small refactoring

Hello Author!
Can you update a playtimecounter papi?
i want to combine with VC

Hi _1232,

Can you please clarify what is papi and VC? Thank you in advance.

Hey! author.
Sorry i didn’t describe clearly. :grinning:
my mean is: Hope you can make a papi, such as %player_playtime% (is can show player’s playtime).
and i want to use this papi to Virtual Chest. :grinning:
So i can give player some moeny and prise .

Unfortunately, for now I don’t know how to implement functionality that you have described. But I can implement another thing: some kind of reward system. When some player reaches N minutes of playing time, the command which you will specify in the config will be invoked (using this you can reward your players with items/money/etc. for playing time). I guess it solves your problem.

What do you think about this?

Also I have to rewrite this plugin, because its code is not good at all :slight_smile:

There is a placeholder API for these things already. (Either as standalone plugin pre API7.3 or built into sponge).

All you have to do is register a placeholder and a way to parse it with actual info.

Your idea wouldn’t quite solve their problem as the player wants to display their users playtime in a GUI (with the virtual chest plugin).

1 Like

my mean is @J2lackSpirit 's mean :grinning:

1 Like

Ok, got it, thank you for the explanation.
I will try to implement this feature on the weekend (or earlier/later a little bit :p)

A new version has been released for PlayTimeCounter, it is available for download here.


Fix the issue with Nucleus: Player with specified name not found/No play time data stored at all. · Issue #5 · TheBrokenDown/PlayTimeCounter · GitHub

Я так понимаю что часы в игре это по нашему минуты верно? я просто не пойму как оно работает, на сайте через вывод playtime через data() функцию php выдает 6 минут 45 секунд (405)

Да, в базе хранится количество отыгранных минут, насколько я помню