Filled SkylaskSpy

Discussion in 'Plugin Requests' started by Skrubzy, Nov 4, 2016.

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


    Plugin category: Administrative

    Minecraft version: Spigot 1.9.4

    Suggested name: SkylaskSpy

    What I want: I need a plugin much like Essential's social spy feature but it has to have support for certain players. Meaning that if someone were to type /spy <player name> it'll show them all the commands that the player executes - Until the command "/spy <player name>" is typed again.

    Multiple players can be spied on by adding commas:
    /spy BillyBob321, BobbyEatsTacos, FrankThe10YearOld
    Or they can be added to an already existing spy-list:
    /spy BillyBob321
    /spy BobbyEatsTacos
    /spy FrankThe10YearOld
    A list of players you are currently spying on will be displayed when the player types /spylist:
    &aYou are currently spying on:
    &7- BillyBob321
    &7- BobbyEatsTacos
    &7- FrankThe10YearOld
    Only 5 players are shown in each spy list.
    If you are spying on more than 5 players, you'll have to type /spylist <number> to view them.
    You can toggle spying on the player by clicking on their name in the spy list.

    If no player is defined when typing /spy, it'll default to every player on the server.

    In config.yml
    There should be 2 lists of commands to spy on.
    One list for the whole server, and another list for just the defined players.
    - /fly
    - /warp
    - /home
    - /spawn
    - /msg
    - /reply
    - /msg
    - /reply
    If you are spying on a certain player and you log out, you will automatically "unspy" from that player's commands.
    (This does not apply if you are spying on the whole server's commands)

    If a player types "/r" (Or any other message-reply command) It'll show the player they are talking to when you hover over the "/r" part of the message. If you click it, you'll start spying on that player too.

    All chat messages should be configurable in the config.yml (Or an english.yml file)
    New-Spy: &cSpy: You are now spying on %player%.
    UnSpy: &cSpy: You are no longer spying on %player%.
    SpyServer: &cSpy: You are now spying on the whole server.
    (Plus a lot more, this is just an example) 

    Ideas for commands:
    /spy help - Displays the help menu for this plugin (Configurable in the english.yml file)
    /spy - Toggles spying on the whole server
    /spy <player> - Toggles spying on the defined player
    /spylist - Shows a list of players you are currently spying on // If you're not spying on a certain player, it'll just say:
    &aYou are currently spying on:
    &7- No One
    But if you are spying on the whole server, it'll say:
    &aYou are currently spying on:
    &7- The Whole Server
    /spy | /socialspy | /social
    /spylist | /spied | /spyed | /spying

    Ideas for permissions:
    skylaskspy.spyserver - Allows the player to spy on the whole server
    skylaskspy.spyplayer - Allows the player to spy on a certain player
    skylaskspy.spylist - Allows the player to view the spylist - Allows the player to view the help menu

    When I'd like it by: ASAP
    Last edited: Nov 7, 2016
  2. Offline


    I've started working on this, I have no idea when I'll get time to finish it though.
  3. Offline


    Take your time, my server won't be done and ready to release for another few months or so
  4. Offline


    It won't take that long to finish the plugin, I just need to setup the config and language.yml (or english.yml).

    @Skrubzy Alright, here's version 1. Try it out, and tell me what you think.


    Edit: There is no way to get which player someone is replying to with /r, so I couldn't add that feature. And I forgot to limit /spylist to 5 names per list. (Ill fix this tomorrow).

    Edit 2: I will also add clickable text related stuff tomorrow.

    Edit 3: @Skrubzy Here's version 2.0.
    /spylist is done, and you can click names in the list to toggle Spying on them.


    Note: This will only work on Spigot/PaperSpigot.
    Last edited: Nov 13, 2016
  5. Offline


    I was just able to test it with another player and I have a few issues:

    When the player types "/r" (Or any other message-reply command)
    You can't hover over & click the "/r" part of the message as requested

    Also, could you please make it so the spy-message format is configurable?
    Like the color and stuff - Right now it's really plain and non-appealing.

    I have only been able to test with 1 other person so far, so there might be some more issues I haven't discovered yet.
  6. Offline


    @Skrubzy Like I said before, there is no way to get which player someone is replying to (unless I know the plugin that handles the messages).

    As for making the message configurable, I can do that.
  7. Offline


    I'm using Essentials for the messages
    EDIT: For the configurable messages, I was thinking something like this:
    '&c&l(!) &r&c%player% &c- &c%command% &c- &c%message%'
    The message is whatever is written after the command - So a message to "Player2" would look like this:
    (!) Skrubzy - /msg Player2 - I'm hacking bud
    And if they type a reply command (/r) The %command% section will automatically add the other player's username:
    (!) Player2 - /r Skrubzy - I'm reporting you
    It will add Skrubzy's name even if Player2 didn't type it:
    Skrubzy: /msg Player2 I'm hacking bud
    Player2: /r I'm reporting you
    For staff, they see this if they're spying on the players:
    (!) Skrubzy - /msg Player2 - I'm hacking bud
    (!) Player2 - /r Skrubzy - I'm reporting you
    Then if the staff member opens chat and clicks on the "/r Skrubzy" part of the message, they'll start spying on Skrubzy too (Needs to work in public chat; if they click on a player talking in chat, they'll start spying on them)

    If they don't click but hover over that part, a "dialogue box" (I don't know what it's called) will appear saying a configurable message:
    Click-Box-Start: &cClick this message to start spying on %player%&c!
    Click-Box-Stop: &cClick this message to stop spying on %player%&c!
    Last edited: Nov 19, 2016
  8. Offline


    @Skrubzy Unfortunately, it's not exactly possible to create clickable/hoverable text and also allow it to be configurable. Also you cannot change a message once it's been sent, so if the Click-Box-Start message is set to the text, it won't change to the Click-Box-Stop once the text has been clicked.
    Last edited: Nov 20, 2016
  9. Offline

    I Al Istannen

    Just add a tooltip AND a click event. You can use Fanciful, Rayzr JsonMessage or spigot's TextComponent for generating the custom message.

    If you feel really brave and do not want to limit yourself to essentials, you could let the user define a regex which extracts the name of the user you are replying to.
    Skrubzy likes this.
  10. Offline


    I still don't really understand what a regex is...
    Would this solve both of the issues/limitations he said here, or just the first/second one?
  11. Offline


    @I Al Istannen I had edited my post to remove all suggestions about using raw JSON as the plugin would require updating every time the server protocol changed. I understand @Skrubzy probably isn't going to update their server version in a while but if they ever do, I won't be around to edit the plugin for a newer/older version.

    I already am using the TextComponent API, but if you can please find any way at all that allows me to replace a String with a TextComponent, I'd love to hear it...

    The point of a config isn't to make things unnecessary complicated for the user..
    Last edited: Nov 20, 2016
  12. Offline

    I Al Istannen

    player.spigot().sendMessage or something send a TextComponent.
    You do not need to replace a String, as you have full control over any message that needs to be send.

    That depends on the config. This kind of config is harder on the user but allows for a far more flexible plugin. You need to choose what you want.
  13. Offline


    @I Al Istannen I mean user defined varibles. @Skrubzy wants %COMMAND% to be replaced with a TextComponent. The rest of the message is to stay as a normal String.

    Edit: Actually, it might be possible to split the string at %COMMAND% and make up a text component like that.
  14. Offline


    I have no idea what you guys are talking about lol I just know how to setup config.yml...I know nothing about coding
    EDIT: @TheMrJezza If it's not possible to change it in the config.yml (I think that's what you're talking about) Do you think you could send me the source code so I can edit the message straight from the code? Would that solve this issue?
  15. Offline


    @Skrubzy I might have found a way to make everything work, so theres no need to worry about me leaving you with a half finished job. Im also going to give you the code anyway when its done.
    Skrubzy likes this.
  16. Offline

    I Al Istannen

    A simple way for a semi-nice parser:
    1. val input = "&c&lThis is a message</me is cool!>&c.&r Normal text.<> &6A command</me is very cool>"
    3. val message = JSONMessage.create()
    5. var lastPart = StringBuilder()
    7. for(pos in 0..input.lastIndex) {
    8. val character = input.codePointAt(pos).toChar()
    9. if (character == '<') {
    10. message.then(TextUtils.colorize(lastPart.toString()))
    11. lastPart = StringBuilder()
    12. } else if (character == '>') {
    13. if (!lastPart.isBlank()) {
    14. message.runCommand(lastPart.toString())
    15. message.tooltip(TextUtils.colorize("&6Runs: '&a$lastPart&6'"))
    16. }
    18. lastPart = StringBuilder()
    19. } else {
    20. lastPart.append(character)
    21. }
    22. }
    23. message.then(TextUtils.colorize(lastPart.toString()))
    25. message.send(player)

    EDIT: Changed code to be not utterly retarded. I should have slept before xD

    Hover over "This is a message"

    Hover over "Normal text":
    Hover over "A command:
    Last edited: Nov 21, 2016
    TheMrJezza and Skrubzy like this.
  17. Offline


    You guys are always amazing me with your coding talents lol it makes me feel so useless - But in the good way...cause it's so good...I'm bad at explaining
  18. Offline


    @I Al Istannen Thank you very much. I'll have the plugin finished a lot sooner now.

    Edit: Version 3.0 DOWNLOAD

    @Skrubzy Here's Version 3.0. Try it out, see what you think. There's a lot of stuff in the plugin, although I'm fairly sure I removed everything I had added for debugging, if you see any random messages in chat, just let me know.


    Note: This version can be used on CraftBukkit as well. So you're no longer limited to Spigot/Paper.
    Last edited: Nov 22, 2016
    I Al Istannen likes this.
Thread Status:
Not open for further replies.

Share This Page