Getting information from a chat message

Discussion in 'Plugin Development' started by Mr. Sandwich, Oct 18, 2016.

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

    Mr. Sandwich

    So I need a way of getting the string of a chat message that was sent by another plugin, is there a way to do that? thanks in advance
     
  2. @Mr. Sandwich
    The easiest way I can think if is just to listen for chat packets. Are you sure there isn't an API for the plugin, though?
     
  3. Offline

    Zombie_Striker

    @Mr. Sandwich
    You have three options:
    1. Listen for the chat packets that are sent outwards, and check if the message sent is equal to the one the plugin sent.
    2. If the plugin is an API, try to access the messages sent/ methods that control the message.
    3. Decompile that plugin, edit the message, and export that new plugin.
     
  4. Offline

    Mr. Sandwich

    1. It has no API
    2. Cant edit the other plugin because its a plugin that a lot of servers have and I cant just go to each one and edit it
    3. Can you tell me where I can learn more about those chat packets and how to use them?
     
  5. Offline

    mythbusterma

    @Mr. Sandwich

    But you could edit it for your plugin? I assume you're only going to use this plugin on your sever.

    Can you tell us what you're trying to do so we can actually be specific?
     
  6. Offline

    Zombie_Striker

    https://gist.github.com/aadnk/4123276
    This is an example of taking in a packet sent from a player. Just change the Connection Side to be from the server. (Remember, this requires ProtocolLib. There is no other way to detect packets without PL.)
     
  7. Offline

    Mr. Sandwich

    No I am planning on publishing this but in short the other plugin sends a message to a specific player and I need to get that message in my plugin and extract an int out of it.
    It doesnt work for some reason, there's no error message it just doesnt understand I said shit or fuck also
     
  8. Offline

    timtower Administrator Administrator Moderator

    @Mr. Sandwich From where are you trying to get the message, and what is in that message?
     
  9. Offline

    Mr. Sandwich

    Now I actually checked the console and apparently the plugin didnt even load it said
    Code:
    Caused by: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
            at java.lang.Class.forName0(Native Method) ~[?:1.8.0_101]
            at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_101]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:189) ~[PluginClassLoader.class:KCauldron-1.7.10-4.1403.65]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[JavaPluginLoader.class:KCauldron-1.7.10-4.1403.65]
            ... 11 more
    
    EDIT: To timtower> There's a plugin that is needed and when a player executes a command it sends them a value in a message and I need my plugin to read this message and extract this value
     
  10. @Mr. Sandwich
    1. Did you even have ProtocolLib installed?
    2. Did you softdepend on it in your plugin.yml?
     
  11. Offline

    timtower Administrator Administrator Moderator

    @Mr. Sandwich And could you tell which plugin that is?
    I know some dirty hacks that might allow you to get around that chat message, even without an API
     
  12. Offline

    Mr. Sandwich

    1. Yes
    2. I forgot and now you reminded me but now it gives another error...
    Code:
    [14:10:39 ERROR]: Could not load 'plugins\PLUGINNAME.jar' in folder 'plugins'
    org.bukkit.plugin.UnknownDependencyException: ProtocolLib
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:221) [SimplePluginManager.class:KCauldron-1.7.10-4.1403.65]
            at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugins(CraftServer.java:320) [CraftServer.class:KCauldron-1.7.10-4.1403.65]
            at net.minecraft.world.storage.SaveHandler.initBukkitData(SaveHandler.java:461) [ayq.class:?]
            at net.minecraft.world.storage.SaveHandler.func_75757_d(SaveHandler.java:137) [ayq.class:?]
            at net.minecraft.world.World.<init>(World.java:360) [ahb.class:?]
            at net.minecraft.world.WorldServer.<init>(WorldServer.java:153) [mt.class:?]
            at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:356) [MinecraftServer.class:?]
            at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:335) [lt.class:?]
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:620) [MinecraftServer.class:?]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]
    
    EDIT: Oh and timtower I cant say the plugin isnt out yet and I was told cant say too much about it
     
  13. Offline

    timtower Administrator Administrator Moderator

    @Mr. Sandwich If it isn't out yet then ask the developers to add an API to talk against.
     
  14. Offline

    Lordloss

    Wow this must be an amazing plugin that you have to keep it this secret. No seriously, everyone is gonna steal it if you tell us its purpose!
     
  15. Offline

    Zombie_Striker

    The exception is thrown when the server cannot find protocol lib. From what I can tell, you get this exception when either you do not have PL installed in the /plugins/ dir, or there is an issue with the way you set up the plugin.yml. Since it would be too obvious if it was not in the /plugins/ dir, I think this may be an issue with the way you added the soft depend. Please post the plugin.yml.
    So, your project it is so secret you have the jar's name set to "PLUGINNAME" because you can not even post the name of it. Somehow, I highly doubt this needs to be as secret as you're making it out to be.
     
    RenditionsRule and timtower like this.
  16. Offline

    Mr. Sandwich

    I was just told to not say anything and I asked the creators for API and they said they dont have time to also the plugin's name is PLUGINNAME because I didnt decide the name yet also this is my plugin.yml
    Code:
    name: PLUGINNAME
    version: 1.0
    depend: [ProtocolLib]
    main: me.xXMrSandwichXx.NAME.Main
    author: xXMrSandwichXx
    
     
Thread Status:
Not open for further replies.

Share This Page