Player damage detector

Discussion in 'Plugin Development' started by joonius, Mar 23, 2020.

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

    joonius

    Hi. We need a plugin that executes the code segment below when the player takes damage in a bukkit server. We'd appreciate it if you send us the plugin folder. Thanks for your time.

    PS: please send us the plugin in source code form so we can make edits

    https://fazecast.github.io/jSerialComm/

    Code:
    import com.fazecast.jSerialComm.*;
    
    import java.io.IOException;
    
    public class main {
        public static void main(String[] args) throws IOException {
            Integer data = 49;
            SerialPort serial = SerialPort.getCommPort("/dev/cu.zapper-DevB");
            serial.setComPortParameters(9600, 8, 1, 0);
            serial.setComPortTimeouts(SerialPort.TIMEOUT_WRITE_BLOCKING, 0, 0);
            if (serial.openPort()) {
                System.out.println("Serial port is open");
                serial.getOutputStream().write(data.byteValue());
                serial.getOutputStream().flush();
            }
            else {
                System.out.println("Serial port is not open");
            }
        }
    }
     

    Attached Files:

  2. Offline

    Dai_Kunai

    If you're doing what I think you're doing, that's super cool.
     
  3. Offline

    EpicGodMC

    This should do it, i take it you know how to compile java plugins?
    also you did not specify a minecraft version but im confident that this will work on any version

    project folder
     
  4. Offline

    joonius

    what do you think i'm doing?

    sorry it's 1.15.2

    Anyways, thanks so much for your help. Never thought anyone would take their time to do this. Very kind of you.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Mar 24, 2020
  5. Offline

    EpicGodMC

    If you have any issues let me know, else mark this as filled

    Cheers
     
  6. Offline

    joonius

    Thanks for the offer! Actually, there is one problem. We implemented the program, compressed it into jar file, and ran it on a bukkit server. But there seems to be something wrong with the yml file. Here's the error message on the server console:
    Code:
    [12:09:49 ERROR]: Could not load 'plugins/DamageDetector2.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:158) ~[craftbukkit-1.15.2.jar:git-Bukkit-8160e29]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:138) [craftbukkit-1.15.2.jar:git-Bukkit-8160e29]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:349) [craftbukkit-1.15.2.jar:git-Bukkit-8160e29]
        at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:197) [craftbukkit-1.15.2.jar:git-Bukkit-8160e29]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:762) [craftbukkit-1.15.2.jar:git-Bukkit-8160e29]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
    Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
        ... 6 more
    
    Do you happen to know how to fix this?
     
  7. Offline

    timtower Administrator Administrator Moderator

    @joonius You did not export the plugin.yml
     
  8. Offline

    joonius

    I'm sure i exported plugin.yml
     
  9. Offline

    timtower Administrator Administrator Moderator

    Is it in the jar?
     
  10. Offline

    joonius

    yep
     
  11. Offline

    timtower Administrator Administrator Moderator

    Could you post a screenshot of that?
     
  12. Offline

    joonius

    ok here
     

    Attached Files:

  13. Offline

    timtower Administrator Administrator Moderator

    @joonius You don't know how to compile do you?
    Because that is not an exported plugin.
    That is a zipped project.
     
  14. Offline

    joonius

    well i just created a jar file and decompressed to take a screenshot
     
  15. Offline

    timtower Administrator Administrator Moderator

    How did you create the jar? Because normally you don't get a src, lib and resources folder.
     
  16. Offline

    joonius

    src was just there and i added lib when i installed a libarary
     
  17. Offline

    timtower Administrator Administrator Moderator

  18. Offline

    joonius

    i exported it in eclipse

    like this
     

    Attached Files:

  19. Offline

    timtower Administrator Administrator Moderator

    Project was made with intelij first though, could explain the issues.
    Eclipse and intelij use different structures to handle their things.
    Move the plugin.yml from the resources folder to the project root.

    Moved this to plugin development as the request is finished.
     
  20. Offline

    joonius

    ok
     
    Last edited: Mar 25, 2020
  21. Offline

    timtower Administrator Administrator Moderator

    @joonius Did the moving of the plugin.yml work?
     
  22. Offline

    joonius

    i don't think so i compressed my plugin with intellij

    and this is screenshot of my jar file
     

    Attached Files:

    Last edited: Mar 25, 2020
  23. Offline

    timtower Administrator Administrator Moderator

    @joonius I have no idea how intelij works, so can't help with that one.
    Why did you edited that away?
     
  24. Offline

    joonius

    because Thought i did something Wrong while compressing my plugin down

    anyway thank you so much for helping me out!!! ill find a way to fix this my self

    it works!!!

    ill post a video of it later!!!

    thank you so much guys!!!
    you guys helped a lot

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Mar 25, 2020
  25. Offline

    EpicGodMC

    This is a maven project from intellij, you should be able to open the file i uploaded as project and


    Screenshot_1.png


    Screenshot_2.png

    take these steps to compile into a jar file, jar file will apear inside the project in the "out" directory
     
Thread Status:
Not open for further replies.

Share This Page