[1.17+] PlaytimeRewards icon

[1.17+] PlaytimeRewards -----

Reward your Players for their Playtime!



PAPI Support | AFK-System | /pttop | /pt <offlineplayer> | ...
Update Time, it is!

Let's get right into it:

PlaceholderAPI Support!

This Plugin supports now the PlaceholderAPI. This means in every customizable Message involving a Player you can use PAPI-Placeholders!

This Update also adds the following PAPI-Placeholders for you to use:
Code (Text):
- %ptr_playtime% -> Returns the Playtime for the Player, the message format is defined as 'EXT_PAPI_TIME_FORMAT'
- %ptr_sessiontime% -> Returns the Sessiontime for the Player, the message format is defined as 'EXT_PAPI_TIME_FORMAT'
Everything will get set-up automatically if you're running this Update and PAPI on your Server. You'll also get a Notification Message in your Console if it detects PAPI is installed.

AFK-System:

This Plugin comes now with an AFK-System. This means AFK-flagged Players no longer earn Rewards. If a Player returns from being afk (or leaves the Server), his AFK-Time will get subtracted from his Playtime.
This means if other Plugins use Minecrafts Playtimecounter, they will also get the correct values without a Players AFK-Time.

The "You're flagged as AFK" and "Welcome Back" Messages ( NOTIF_AFK_USER_WENT_AFK & NOTIF_AFK_USER_CAME_BACK) can get customized in the lang.yml File.

Players with the Permission ' playtimerewards.afk.ignore' will never get flagged as afk.

You can enable/disable and configure it in the config.yml File
(This was btw a suggested Feature by @NDTurtle )

Overall Commands:
Tab-Completion has been added for all commands.

New Command /playtimetop (/pttop):

This Command shows the top 10 (Amount configurable in the Config) Players with the most Playtime on the Server. It needs the new Permission ' playtimerewards.cmd.playtimetop' to be executed. You can specify the output Messages ( CMD_SUC_PTTOP_HEADER & CMD_SUC_PTTOP_ENTRY) in the lang.yml.

New Command /playtimerewards (/ptr list|reload):

This Command comes with two possible parameters: list & reload.
/ptr list lists all registered Rewards. It needs the Permission ' playtimerewards.cmd.playtimerewards.list'. You can configure the output Messages ( CMD_SUC_PTR_LIST_HEADER & CMD_SUC_PTR_LIST_ENTRY) in the lang.yml.

/ptr reload reloads all Plugin data - e.g. the config.yml, the lang.yml and the rewards.yml. It needs the new Permission ' playtimerewards.cmd.playtimerewards.reload' and the output Message ( CMD_SUC_PTR_RELOAD_SUCCESS) can be configured in the lang.yml.

The new Permission ' playtimerewards.cmd.playtimerewards.*' grants access to all subcommands of /playtimerewards.

/Playtime <Offlineplayer>

The /Playtime command supports now the reading of a Players Playtime even if the specified Player is offline (This is limited to one Request every 10 Seconds per Player). You need the new Permission ' playtimerewards.cmd.playtime.other.offline' to execute it.

Reward Actionbar

Added the Value Display.ActionbarMessage. If this Values is specified, the Message get's sent to the Players Actionbar upon earning the Reward.

Now we're talking Files:
If you're running a Minecraft Server with Version 1.18 or later, Comments from your yaml Files will no longer get overwritten (applies both to the config.yml and to the lang.yml).


The Config.yml:
The Config.yml got a new "Layout" - nicer looking Comments etc.
A new Section for the AFK-System got added, as well as the Values
"AllowAutoUpdate <boolean>" and "PlaytimeTopAmount <int>".
Take a look at it:
Code (YAML):
#This Option downloads the latest Version of the Plugin and installs it upon a reboot.
AllowAutoUpdate
: false

#The Amount of Players that get displayed by the Playtimetop-Command
PlaytimeTopAmount
: 10

#AFK-Block
AFK
:
  #Enables or Disables the whole AFK-System.
  #When set to false, no other AFK-Value does anything.
  Enable
: false

  #Here you can define, how much time needs to pass without an Action from the Player,
  #to flag the Player as AFK.
  Time
: '10m'

  #Defines whether a Player Movement resets his AFK-Status
  CancelOnMove
: true

  #Defines if a Players AFK-Status is reset by looking around
  CancelOnLook
: true

  #Defines whether a Player Interaction resets his AFK-Status
  #(Interaction is any Sort of Right or Left Mouse Button Click)
  CancelOnInteract
: true

  #Defines if Chatting resets the AFK-Status
  CancelOnChat
: true

  #Defines if executing Commands resets the AFK-Status
  CancelOnCommand
: true
As always, these new Values will appear in your Config FIle once youre running the new Version of the Plugin.

The last thing we're talking about are the Messages - the lang.yml File.

The Message System got a full rewrite (i used an older, messier System from another Project until now). You shouldn't really notice a thing except a cleaner looking lang.yml if your using MC1.18+.

I also added the following Messages:
Code (YAML):
# The Return Message from the /playtime <offlineplayer> Command
CMD_SUC_PT_OTHER_OFFLINE
: §6 %[0]§a's Playtime is %[1]d %[2]h %[3]m %[4]s

# The First Part of the /Playtimetop Command
CMD_SUC_PTTOP_HEADER
: '§7Listing the top §b %[0] §7Playtimes:'

# This Message gets printed once for each Entry from the /Playtimetop Command
CMD_SUC_PTTOP_ENTRY
: '§6 %[0]§7: §b%[1]§7 - has played %[2]d %[3]h %[4]m and %[5]s'

# The first Part of the /Playtimerewards list Command
CMD_SUC_PTR_LIST_HEADER
: |-
  §7Listing all §b %[0]§7 Rewards:
  §8Internal Name -- DisplayName -- CountType

# This Message gets printed once for each Entry from the /Playtimerewards list Command
CMD_SUC_PTR_LIST_ENTRY
: §3 %[0] §8-- §1%[1] §8-- §7%[2]

# The Return Message from the /Playtimerewards reload Command
CMD_SUC_PTR_RELOAD_SUCCESS
: §aSuccessfully reloaded the external Data!

# A Error Message when too many Requests are sent from a Player using /pt <offlineplayer>
CMD_ERR_TOO_MANY_REQUESTS
: §4You can't do that right now. Try again later!

# The Message sent to Players who get flagged as afk
NOTIF_AFK_USER_WENT_AS_AFK
: §7You are now flagged as AFK

# The Message sent to Players when coming back
NOTIF_AFK_USER_CAME_BACK
: §7You are no longer flagged as AFK

# The Format in which all Times get sent to the PlaceholderAPI
EXT_PAPI_TIME_FORMAT
: ' %[0]d %[1]h %[2]m %[3]s'
Thanks for reading this!
If you want, there is an even more detailed changelog:
Code (Text):
Changelog Version 0.1.3:
    - Removed compiled Stuff from the final jar(s):
        - Removed internal, unneeded resources from being packed into the final Jar
        - Removed older classes, that weren't used anymore from the project

    - Created a MojangAPI Utility Class
            - Allows to lookup Player UUIDs from their Name
            - This Allows the Plugin to retrieve Playtime from Offline Players
            - This is currently limited to 6 Requests per Minute per Player

    - Rewrote the whole Message System. It is now based on Enums instead of plain Strings
        - Messages can now be hidden in the lang.yml file
            ->  This means they aren't in the File by default, but they exist in the Plugin.
                One could add them on his own to the File, and the Plugin would recognize and use them
        - The lang.yml File gets dynamically updated upon Missing Values
            -> In all Versions since MC1.18 Comments also get written into the File
        - No Real Change to the End-User, this was only an internal Change.

    - Added a bunch of new Messages:
        - CMD_SUC_PT_OTHER_OFFLINE -> The Message returned upon requesting the Playtime of an Offline Player
        - CMD_ERR_TOO_MANY_REQUESTS -> The Message when a user tries to send too many API-Requests
        - CMD_SUC_PTTOP_HEADER -> Defines the Header of the /Playtimetop Command
        - CMD_SUC_PTTOP_ENTRY -> Defines each Data-Entry of the /Playtimetop Command

        - CMD_SUC_PTR_LIST_HEADER -> Defines the Header of the /Playtimerewards list Command
        - CMD_SUC_PTR_LIST_ENTRY -> Defines each Data-Entry of the /Playtimerewards list Command
        - CMD_SUC_PTR_RELOAD_SUCCESS -> The /Playtimereward reload success Message

        - NOTIF_AFK_USER_WENT_AFK -> The Message to inform the User that he is flagged as afk.
        - NOTIF_AFK_USER_CAME_BACK -> The "Welcome-Back" Message

        - EXT_PAPI_TIME_FORMAT -> Defines the Time Format for the PlaceholderAPI's placeholders from this Plugin.

        - Added even more messages, which are unused and hidden in v0.1.3:

            - CMD_WARN_PTR_RELOAD -> The warning Message that Rewards dont get reloaded, as some Rewards are in Edit-Mode

            - GUI_EDIT_REWARD_WINDOWNAME -> The Windowname of the Edit-Reward GUI
            - GUI_EDIT_REWARD_EXIT_NOSAVE_NAME -> The Name of the Exit-without-Saving-Reward-GUI Item
            - GUI_EDIT_REWARD_EXIT_NOSAVE_LORE -> The Lore of the Exit-without-Saving-Reward-GUI Item
            - GUI_EDIT_REWARD_EXIT_SAVE_NAME -> The Name of the Exit-with-Saving-Reward-GUI Item
            - GUI_EDIT_REWARD_EXIT_SAVE_LORE -> The Lore of the Exit-with-Saving-Reward-GUI Item

            - The following Messages all define the different editable fields of a reward
            - GUI_EDIT_TRANSL_DISPLAYNAME
            - GUI_EDIT_TRANSL_ISREPEATING
            - GUI_EDIT_TRANSL_GRANTFIRST
            - GUI_EDIT_TRANSL_CONSOLECOMMANDS
            - GUI_EDIT_TRANSL_PLAYERMESSAGES
            - GUI_EDIT_TRANSL_GLOBALMESSAGES
            - GUI_EDIT_TRANSL_ACTIONBARMESSAGE
            - GUI_EDIT_TRANSL_PERMISSIONNEEDED
            - GUI_EDIT_TRANSL_PARTICLES
            - GUI_EDIT_TRANSL_SOUNDS


    - New Permissions:
        - playtimerewards.cmd.playtime.other.offline -> Allows the Player to see Offline Players Playtime
        - playtimerewards.cmd.playtimetop -> Allows access to the /playtimetop command
        - playtimerewards.cmd.playtimerewards.list -> Allows access to the /playtimerewards list command
        - playtimerewards.cmd.playtimerewards.reload -> Allows access to the /playtimerewards reload command
        - playtimerewards.cmd.playtimerewards.editreward -> Allows access to the /playtimerewards editreward command
        - playtimerewards.cmd.playtimerewards.* -> Allows access to all /playtimerewards commands
        - playtimerewards.afk.ignore -> Bypasses the afk system

    - New Commands:
        - /playtime [player] can now look up data from Players that aren't online
            - Needs the new Permission 'playtimerewards.cmd.playtime.other.offline'
        - /playtimetop (or /pttop)
            - Lists the top x(amount specified in config.yml) players with the highest playtime
            - Needs the new Permission 'playtimerewards.cmd.playtimetop'
        - /playtimerewards list (/ptr list)
            - Lists all registered Rewards
            - Needs the new Permission 'playtimerewards.cmd.playtimerewards.list'
        - /playtimerewards reload (/ptr reload)
            - Reloads all Plugin Congifuration data
            - Needs the new Permission 'playtimerewards.cmd.playtimerewards.reload'
        - Internal, disabled /playtimerewards editreward <reward>
            - Opens the Edit-GUI for the specified Reward
            - Needs the new Permission 'playtimerewards.cmd.playtimerewards.editreward'

    - Config Values:
        - Value "AllowAutoUpdate" (boolean) allows to Automatically download the newest Plugin Version and install at the next server restart
        - Hidden Value "AllowMetrics" (boolean) allows the user to disable bstats for this plugin. Default is true.
        - Non-Hidden Values now get copied over into the config.yml -> support for updates
        - In Versions since 1.18.* the Comments of Config Files now don't get overwritten anymore. This System can be used by all
            types of embedded yml Files, although it is only used by the config.yml File here.
        - Section "AFK":
            - Value "AFK.Enable" (boolean) enables or disables the AFK-System
            - Value "AFK.Time" (timeString) sets the Time until a Player gets flagged as AFK
            - Value "AFK.CancelOnMove" (boolean) defines if a Player Movement surpresses getting flagged as afk
            - Value "AFK.CancelOnLook" (boolean) defines if a Change in the Players View (e.g. Mouse moved) surpresses getting flagged as afk
            - Value "AFK.CancelOnInteract" (boolean) defines if a Interaction (Right/Left Click) surpresses getting flagged as afk
            - Value "AFK.CancelOnChat" (boolean) defines if Chatting surpresses getting flagged as afk
            - Value "AFK.CancelOnCommand" (boolean) defines if executing Commands surpresses getting flagged as afk

    - PlaceholderAPI Support:
        - Added the following Placeholders:
            - %ptr_playtime% -> Returns the Playtime for the Player, the message format is defined as 'EXT_PAPI_TIME_FORMAT'
            - %ptr_sessiontime% -> Returns the Sessiontime for the Player, the message format is defined as 'EXT_PAPI_TIME_FORMAT'
        - All custom Lang Messages can now use PlaceholderAPI's Placeholders.

    - AFK-System:
        - Players get flagged when going AFK.
            - When Players Return their Playtime gets decreased by the lenght of their afk-time
            - When a Player is flagged can be configured (AFK-Reset by Moving, Looking, Interacting, Chatting, use Command)
        - Added a AFK_TIME RewardType, but for now it only serves an internal use to prevent AFK-Players to earn Rewards.

    - Rewards:
        - Added the Reward Value Display.ActionbarMessage (String)
            -> if specified, the String gets sent to the Players Action Bar

Have a nice day!
----------, Mar 17, 2022
Resource Information
Author:
----------
Total Downloads: 4,976
First Release: Feb 22, 2022
Last Update: Jan 15, 2023
Category: ---------------
All-Time Rating:
11 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings