Server Stats

Discussion in 'Spigot Plugin Help' started by BabyxSparklez., Mar 30, 2019.

  1. Hi!

    I am seeking a plugin that will count how many players clicked a link from a broadcast message, or how many players typed a command such as /website.

    I need statistics for how many players go to the server website from using a link or command on the server.
     
  2. The command statistics can easily be done.

    The hard part is finding a plugin that sends out a
    custom json broadcast then on click execute the command.

    Then there's the question on where you want to save the statistics data.
    Flat file or database?

    The config format will be:

    Code (Text):

    broadcast_interval: 120

    broadcast_message1:
      permission: 'custom.permission'
      clickLinkDisplay: '&4&lClick this link to view our vote sites'
      command: '/vote'

    broadcast_message2:
      permission: 'custom.permission'
      clickLinkDisplay: '&4&lClick this link to view our official website'
      command: '/website'
     
    now whenever a player clicks on the json links the player will execute a command.
    now this command will be logged as statistics.

    Hope this guideline helps
     
  3. I have essentialsx, dont need json for clickable links.

    My broadcast has the link in it, like: Check out our website www.test.com
    Players can click it and it work.

    But I would like to know how many players click it.

    I did not say anything about permissions and config formats
     
  4. lol ok let me explain this more clearly
    I know if you send the link in chat with or without any plugins,
    players can click on it and they will be ask if they want to be forwarded to the said link.

    Now your dilemma here is you want to actually record the clicked link as command statistics.

    To accomplish this the player client needs to inform the server that the player has clicked a link.

    This is what my explanation on my previous post is for.

    There is a feature in the spigot API made by md5 to do this sort of thing.

    The permission in the config is for your server security. and optional if you want only certain players to be able to click the link
    or maybe just a special perk.

    Now I understand you just need the plugin. Without the complicated details.

    Remind me again in the future not to do this. ;)
     
  5. Uh.. you just rephrased my question, thats what im asking for is a plugin that can do that.

    If you know the code for it I could add that if that needs to happen.
    Code wise I can make doing /website add +1 to a playerdata, but not sure about total count.
     
  6. Now this is a proper conversation

    As I know you know how to code you can start by looking here
    https://www.spigotmc.org/wiki/the-chat-component-api/

    Look for the event parts of the api
    there is a part where it says onClickEvent and execute command.

    Then make a listener class for command event.
    make a player command statistics data class to
    store the command statistics on player logout
    save the statistics.

    Now you do not have to find a plugin.
    You just need to create it your self.

    Cheers
     
  7. Yea I use json chat components on one of my plugins.
    Ill think about that.

    Keeping this open in case anyone has a idea on a existing plugin.
     
  8. Not a plugin, but you could use a bit.ly link shortener to see how many people clicked the link, although you'd have to make sure that link is only on the broadcast, and hope people don't paste it in discord etc.
     
  9. Definitely on to something there, but also true, id risk 3k discord users xd

    I just need stats at the end of the week saying this week 500 clicked the link, then next week see 600 clicked it.

    bitly has virus links so it may cause trouble, I need it to be straight link to the website. So I figure record the command /website, /discord, and clicked links.

    Unfortunate that there is no plugin, ill have to look into making one.
     
  10. What do you mean bit.ly has virus links? As long as the bit.ly link is safe and secure (either you know it is, or in this case you crated it, so you know where it leads) then there's no chance of a virus?