ActivityAutoCheck

Discussion in 'Plugin Requests' started by Chromify, Sep 26, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Chromify

    What does this do: When a player is a staff member for your server, let's say moderator, I would assume you want them to be active a lot right? Well I came up with the idea of this plugin that automatically tracks players down if they are inactive or not, so I decided to request this plugin since I don't have a developer (coder).

    Commands: /aac set <player> - Sets a player's activity to this server.
    /aac settime <player> <timeinminutes> - Sets a player's time to play on this specific server. Let's say for example Bob was a moderator and he had to play on the server for 30 minutes every day. So you would do /aac set Bob, then /aac settime Bob 30. This would technically make Bob play on the server for a total of 30 minutes daily and if he does not play on the server for 30 minutes daily, he will be moved to the default group. And on join, a message will appear: "&7You have been moved to default for inactivity!".
    /aac reload - Reloads config

    Perms: aac.admin - All commands from above

    I need this by October 3rd if possible.

    Config:

    SetPlayerMessage: "&f{PLAYER} will now have to play a certain amount of time on this server! Choose with /aac settime {PLAYER} <timeinminutes>"
    SetTimeMessage: "&fAwesome! {PLAYER} will now have to play a total of {TIME} minutes every day in order to keep their rank!"
    NoPlayerFoundForSet: "&fOops! I can''t find that player!"
    InvalidTimeMessage: "&fThat time is either typo''d, mistyped, or something that I don''t know is wrong!"
    NoPermForAnything: "&7Sorry, no perms, {NAME} #name is the name of the player doing the command"

    EDIT: Also, can you please make the "move to default" command executable by console and also changable in the config too? Thanks!

    Please make all of the messages and options changable in a config file!
     
    Last edited: Sep 26, 2015
  2. Offline

    CaveBoy36

    Sounds fun to make! I'll try! I do need to know what group plugin you are using? i.g. Group Manger, Pex, bPermissions, ect.
     
  3. Offline

    Chromify

    That would be PermissionsEx. And thank you!
     
  4. Online

    timtower Administrator Administrator Moderator

    Hook into Vault, then you cover them all
     
  5. Offline

    CaveBoy36

  6. Offline

    Chromify

  7. Offline

    Chromify

    Done?
     
  8. Offline

    CaveBoy36

    @Chromify You're going to have to have someone else do it. I've gotten stuck on a part and I just don't have time. If you get someone good like @teej107 they could have it done sooner than I could.

    Not to put @teej107 on the spot
     
  9. Offline

    Chromify

    So I've basically waited a week for nothing? Thanks

    Anyone else that could do this?
     
  10. Offline

    EndureBlackout

    I'm sorry if this is a bit off topic but @Chromify people can't always have time to make you a plugin or have the skills to make it. They could be busy with Real world stuff such as family and you have to respect that.
     
  11. Offline

    Chromify

    Sorry. I was just a little mad the fact that the plugin was made. I know, I apologize. :)
     
  12. Offline

    Chromify

  13. @Chromify
    Hey there! I've started working on this plugin. Before I upload it to a file hosting website for you to download, I need to do some testing first to make sure the plugins works fine. I'll keep this post updated as I make progress.
     
    Chromify likes this.
  14. Offline

    Chromify

    Thank you! Also, instead of putting on forums, PM me the link to the download. :)
     
  15. @Chromify
    I'm not sure if this rule still exists (or if it ever was a rule), but I believe private plugins in the Plugin Requests section are not allowed, or are discouraged. If I create something here, it should be available to everyone. This is my personal opinion though.

    Edit:
    (Tagging so you get a notification @Chromify )
    I've stumbled upon a problem. When would you like to run the automatic check to see if your staff has played enough that day?

    Currently I have a task running every minute to see if the day (in real life) has changed, and then it runs a check and adds every inactive player to a queue, they will then be demoted when they join next time (I'm not sure if I can set their group using Vault when they are offline).

    My problem is that if your server isn't online 24/7, for example, if you start the server 11:50pm and the daily time a player has to be online would be 30 minutes, then the plugin would consider them inactive since 10 minutes later the day has changed.

    How should I tackle this? What should I change?
     
    Last edited: Oct 10, 2015
  16. Offline

    Chromify

    You're allowed to, I've had lots of plugins that were made private without request. I'll be surprised to hear it from a moderator if it's not permitted.

    1. Yes, I would like any alerts.
    2. I never ever restart my server unless we have an internal error or if I need to get a plugin. If you can, make it so when the server stops, it counts how long the player still has to play, keep that in a log (temporarily) and then use the paused time for when the server starts back up again.
     
  17. I don't think I quite understand what you mean.

    Anyways, I've now made it so if the server was started a bit (configurable time) before midnight, no one will be demoted since they may have not been able to play earlier. This will also be configurable so you can turn it on and off if you wish.

    It's 3am here so I'll be going to bed now. I'll finish the plugin tomorrow.
     
  18. Online

    timtower Administrator Administrator Moderator

  19. Offline

    Chromify

    Scenario:

    Bob is trying to play on the server so he can be active and not be demoted. The server stops for some strange reason, his timings have saved, then the server starts his timings again (before the server shut down) and his timings are restored. So if Bob played for 12 minutes before it shut down, it would still count 12 minutes when the server starts back up and he will have to play for the remaining 18 to keep his rank.
     
  20. @Chromify
    Oh, that was one of the first things I did :p Every time the player leaves the server or the server is shut down, the time will be saved into a file and restored once the server starts up again.

    My problem is that when I run the check to see if they've been inactive, I obviously have to reset everyone's times after that. However if the server has been offline for let's say a full day, and starts up at 11:50pm, the plugin will detect that the day since last check has changed and will run the check to find inactive players. 10 minutes later when clock hits midnight, the day has changed again and same thing happens. However this time, since the plugin resets everyone's time after the check, they will have only a maximum of 10 minutes of activity.

    I hope you understand what I mean. I may have come up with a simple solution though: When the plugin runs the check to find inactive players, the current time will be saved somewhere. Next time the check happens, it will only demote players if the time between this check and last check (could be 24 hours or less than a minute) is more than the players daily required activity.

    Anyways. I was unable to finish the plugin yesterday, mostly because I was playing League of Legends all day. I'll try to finish it today. The plugin should be pretty much done assuming that my code is flawless (never is), but I'll run some tests on my server first.

    Edit: I believe it's done. I'm unable to fully test the plugin since I don't wanna stay up till midnight, but theoretically it should work. Download | Source

    Vault is required to run this plugin. You will also need a permissions plugin of some sort that is supported by Vault.

    Commands
    Note: /aac works as an alias for /activityautocheck

    /activityautocheck
    • Permission: No permission
    • What does it do: Displays basic information (basically just version and my name) about the plugin.

    /activityautocheck track <player> <staffgroup>
    • Permission: aac.track
    • What does it do: Enables the tracking of activity for specified player. The staffgroup is their group that they are moved out of into the default group (defined in config) if they are inactive. You have to specify this because the plugin won't know if they are an admin, moderator etc.
    /activityautocheck settime <player> <time in minutes>
    • Permission: aac.settime
    • What does it do: Sets the daily required activity for a player.
    /activityautocheck check
    • Permission: aac.check
    • What does it do: Shows you a list of players and their currently activity on the server. For example: "Bob: 10/30 minutes".
    /activityautocheck run
    • Permission: aac.run
    • What does it do: Manually runs the check to find and demote inactive players. This would normally happen at midnight.

    Config
    I like to make everything as configurable as possible.
    Code:
    # Whether the plugin should automatically demote inactive players.
    autoDemote: true
    
    # Default group used by your permissions plugin. This is the group that players will be demoted to if they are found to be inactive.
    defaultGroup: 'default'
    
    # Default daily required activity. This value will be used if activity is tracked for a player but no time has been set.
    defaultRequiredActivity: 1800000
    
    # The message player would receive if they don't have the required permission for an AAC command.
    noPermissionMessage: "&cYou don't have permission to use that command."
    
    # The message player would receive if the target player of an AAC command is not found.
    playerNotFoundMessage: "&cOops! I can't find that player!"
    
    # The message player would receive when they enable activity tracking for another player.
    trackPlayerMessage: "&2{player} &awill now have to play a certain amount of time on this server! Choose with &2/aac settime <player> <time>"
    
    # The message player would receive if the time given in "settime" command is invalid.
    invalidTimeMessage: "&fThat time is either typo'd, mistyped, or something that I don't know is wrong!"
    
    # The message player would receive when they set the required activity time for another player.
    setTimeMessage: "&2{player} &awill now have to play for &2{time} &aminutes each day to not be flagged as inactive!"
    
    # The message player would receive when they are demoted for inactivity. {group} is the "defaultGroup" defined above.
    demoteMessage: "&7You have been moved to {group} for inactivity!"

    Also: The times you will see in the player file and in config are in game ticks (20 ticks = 1 second). I can change this to be minutes so you can read it easily.
     
    Last edited: Oct 14, 2015
    Chromify likes this.
Thread Status:
Not open for further replies.

Share This Page