Hover Over Name to get Info On Player (Chat Plugin) TWO IN ONE

Discussion in 'Archived: Plugin Requests' started by ThatOtherGuyLax, Feb 13, 2014.

  1. Offline

    ThatOtherGuyLax

    Plugin category: Chat Related

    Suggested name: PlayerHover

    What I want: I would love a plugin that does the following. 1) Players can hover over a player's name to see a custom box "popup." I believe it is called a custom GUI(?). Have you ever earned an achievement like the "Earned the Achievement of Inventory?" Whenever you hover over the green part of the achievement, a custom box (from now on I will call it a custom GUI, sorry if I am wrong) pops up. I find it very cool. I have played on a prison server that had it. You could also shift+right click on a player, and it would bring up a chest GUI. You could hover over an item and it would bring up certain information. In the config, if you decide to make this wonderful plugin, you could have @{action}. For example, @rank would bring up the rank or @timep would show the time played on the server. There is an ever-so-long list, but I believe that the developer could possibly list more powerful and useful options.

    Ideas for commands: /ph remove p- removes the hovering ability to the player groups. /ph remove m- removes the hovering ability to moderators group. /ph remove a- removes the hovering ability to admins. /ph remove all- removes the hovering ability to everyone.

    Ideas for permissions: playerhover.admin- allows admins to see certain info including: money, and anything else you believe fits admins (admins also should have the ability to do /ph remove <rank>). playerhover.player: allows players to see: rank, time played on server, clan, etc. playerhover.mod- same as admin, just so it corresponds with the plugin commands.

    When I'd like it by: Whenever, just not in a year :p/
     
  2. Offline

    thesbros

    It is possible to make hover text, but there is basically no way to do it in this kind of way, because the message would have to be specially made, for instance if you are using Essentials and it says a player's name, when you hover over it, it will do nothing because Essentials doesn't support that, you could make it work, per se, if someone says a player's name in chat, or if it's a message from this plugin, but not with messages from other plugins (unless you make an API other plugins can hook into, but even then it's not likely much plugins will use it).
     
  3. Offline

    timtower Administrator Administrator Moderator

  4. Offline

    ThatOtherGuyLax

    Packets? Do you mind explaining? I am fairly knew to developing Bukkit plugins.

    <Removed advertising - Necrodoom> Custom coded plugins. I really enjoy it. I have already tried to copy the code from the minecraft.jar, but I just cannot seem to find it.

    Here's a photo of what I am looking for: http://www.mvdw-software.be/wp-content/uploads/2014/01/sc_original.png
     
  5. Offline

    timtower Administrator Administrator Moderator

    ThatOtherGuyLax Packets are the messages send between the server and client.
    The plugin in the image is sending messages in the tellraw format. Since you want to modify messages: protocollib with enough knowledge to modify the json messages
     
  6. Offline

    Garris0n

    Things like Fanciful make it very easy to do in code, but a good way to allow normal players to do it is something I can't really imagine. I suppose Mojang has really implemented it in the form of the original JSON chat system, so you should use that for whatever you're doing.
     
  7. Offline

    ThatOtherGuyLax

    Oh, well, I guess I will abandon the idea of the plugin. I have very little time to do anything these days :( Thank you for your help, it really means a lot :D
     
    timtower likes this.
  8. Offline

    Garris0n

    It's not that hard, there's a lovely set of classes in the resources section called Fanciful that makes it very easy to make and send such messages. It has the packet sending built into itself so you just have to call a method.
     
  9. Offline

    thesbros

    Yeah, it is pretty easy to do with ProtocolLib, but what I was saying is you couldn't make it so it happens when you hover over a player's name because you would have to edit every plugin to make it support it, you could make it work with just normal chat messages, but not messages from plugins.
     
  10. Offline

    timtower Administrator Administrator Moderator

    Packets are packets :p
     
  11. Offline

    thesbros

    I guess if you listened to every outgoing chat packet and modified it that would work, I might actually try doing that.
     
    timtower likes this.
  12. Offline

    ThatOtherGuyLax

    Nice :p Have fun xD

    timtower Garris0n thesbros, sorry for "tahging" you all, but I have encountered a problem on my server. I have to prefixes. I know it's not EssentialsChat or Multiverse. I am almost certain that it's from this SkyWars plugin: http://dev.bukkit.org/bukkit-plugins/skywars-plugin. I do not know what has happened. On my server, it says:
    Would any of you kind gentlemen tell me how to fix this? I have checked everything. I have removed almost every plugin individually and reloaded it. I know for a fact that it is http://dev.bukkit.org/bukkit-plugins/skywars-plugin

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  13. Offline

    timtower Administrator Administrator Moderator

  14. Offline

    ThatOtherGuyLax

    Ok, thanks

    timtower, would you happen to know how to get the special box characters into the (▁ ▂ ▃ ▄ ▅ ▆ ▇ ▇ ▆ ▅ ▄ ▃ ▂ ▁) into the server message in the server.properties? I have seen it on multiple servers. I was told I had to pay for it(?)...

    Nevermind, I found it xD

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  15. Offline

    timtower Administrator Administrator Moderator

    Paying for special characters? Any character that you can get in notepad you can get in the server
     
  16. Offline

    Garris0n

    Probably somebody trying to sell a plugin...

    It's very easy to do without ProtocolLib.
    Code:
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(ChatSerializer.a(yourJsonMessage)));
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  17. Offline

    thesbros

    Yes, but that uses NMS and OBC. And I am working on a plugin that will work for all messages, by listening for chat packets, and that is really easy to do with ProtocolLib.
     
  18. Offline

    Garris0n

    What I was originally talking about was using Fanciful, which does indeed use NMS, but it's already there, you just have to depend on the lib with maven. You mentioned it being easy to do with ProtocolLib, so I mentioned it was also easy to do without ProtocolLib. I would still recommend using ProtocolLib unless you're experienced in NMS/OBC, but I was just pointing out that it was simple.
     
  19. Offline

    MordorKing78

    RedstonePVP
     
  20. Offline

    Traks

    thesbros Garris0n Here's one I made the other day which doesn't use NMS imports and doesn't use protocol lib, for 1.7.2
    Code:java
    1. Class<?> chatpacket = Util.getNmsClass("PacketPlayOutChat");
    2. Object ichatbase = Util.getNmsClass("ChatSerializer").getMethod("a", String.class).invoke(null, toString());
    3.  
    4. Object nmsplayer = Util.getMethod(player.getClass(), "getHandle").invoke(player);
    5. Object connection = nmsplayer.getClass().getField("playerConnection").get(nmsplayer);
    6.  
    7. Util.getMethod(connection.getClass(), "sendPacket").invoke(connection,
    8. chatpacket.getConstructor(Util.getNmsClass("IChatBaseComponent")).newInstance(ichatbase));

    Util class
    Code:java
    1. public static Class<?> getNmsClass(String name) {
    2. try {
    3. String version = Bukkit.getServer().getClass().getName().split("\\.")[3];
    4. return Class.forName("net.minecraft.server." + version + "." + name);
    5. }
    6. catch(Exception e) {
    7. e.printStackTrace();
    8. }
    9. return null;
    10. }
    11.  
    12. public static Method getMethod(Class<?> c, String method) {
    13. try {
    14. for(Method m : c.getDeclaredMethods()) {
    15. if(m.getName().equals(method)) {
    16. m.setAccessible(true);
    17. return m;
    18. }
    19. }
    20. }
    21. catch(Exception e) {
    22. e.printStackTrace();
    23. }
    24. return null;
    25. }

    But yes, you can't alter the chat message in the chat event or the player's name to make this work. You'd probably end up cancelling the event and sending a custom message with this method instead
     
    Windy Day likes this.
  21. Offline

    thesbros

    I am using protocollib and listening to chat packets and then modifying the message before it is sent to add all of the info.
     
  22. Offline

    DevRosemberg

    Did anyone ever get this working?
     

Share This Page