Controlled Death Logger

Discussion in 'Plugin Requests' started by XxTimeSlinkyxX, Apr 25, 2018.

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

    XxTimeSlinkyxX

    Plugin category: Informational / Admin Tool

    Minecraft version: Spigot 1.9

    Suggested name: Death Log Simple

    What I want: I need a plugin to log a death inside of a YAML file. Im having a timed competition battle where I need to be able to see in an organized way who died first to who died last in a file. As about 50 people will be dying, many in the first couple minutes, I cannot write it down myself. I need a plugin to be able to write down the Player Name and put the in order with a number possibly. I would also like to be able to start and end the logging when the game starts and ends

    Ideas for commands: "/dl start" (dl being deathlogger) and "/dl end"


    Ideas for permissions: deathlog.admin (if you have this, you can start and stop the logger)

    When I'd like it by: The next week.


    Ive got a couple codes from a seperate forum, ive tried to make use of them in some plugin but I am very new to coding and was not able to make a plugin out of them. My only experiance is making a simple sign color listener that sends a message when you click it and an alternate "/fly" plugin for any gamemode. So im just learning...

    Code:
        public static void textLog(String message) {
            try { Files.write(Paths.get(getI().getDataFolder() + "log.txt"), message.getBytes()); } catch (IOException e) { e.printStackTrace(); }
        }
    
    Code:
    @EventHandler
    public void PlayerJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            String uuid = p.getUniqueId().toString();
            if(!getConfig.contains("Players." + uuid)) {
                 getConfig().set("Players." + uuid + ".Deaths", 0);
                 saveConfig();
            }
           
    }
    
    Code:
    @EventHandler
        public void PlayerDeath(PlayerDeathEvent e) {
                Player p = e.getEntity();
                if(p.getKiller() instanceof Player) {
                      //String playerdeath =  p.getUniqueId().toString(); (for uuid)
                     String playerdeath = p.getName();
                      int deaths = getConfig().getInt("Players." + playerdeath + ".Deaths");
                      getConfig().set("Players." + playerdeath + ".Deaths", deaths + 1);
               saveConfig();
                 
                }
        }
    
     
  2. I can make this for you,

    Just to clarify, once you run a command you'd like it to log to a file with everyones deaths and timestamps, with an id showing the order? and is there anything else it should log, like who killed them etc.?
     
  3. Offline

    XxTimeSlinkyxX

    Thank you, and yes. If i could explain with a situation it would be easier. So lets say the game is about to start where people will die and i need to see who dies when. for example ill use the survival games game as the game in which i want to see who dies when.

    I run command /dl start
    Survival games game starts
    log is created
    inside the log:
    Death rank (1 died first and 3 dies third), Player Name
    1, XxJimmyxX
    2, The_Cool_Crafter
    3, MCPlayer3923
    Game ends
    I run command /dl stop
    I write down the winner because I can see the person who won.
    Save the file to my computer from the FTP server (in case starting the logger again erases the file)
    Then repeat the process for the next game

    (One thing i will note, The winner of the game of course will not die but I will be able to write down who won because they of course will be the only one alive. So that is not an issue)

    I dont know if this makes a difference but I will be using this on a host-hoard server, just basic FTP files. Just thought I would mention it.​
     
  4. Offline

    XxTimeSlinkyxX

    Thank you so much Paul19988! You're a lifesave, im going to test it out now!
     
  5. Offline

    XxTimeSlinkyxX

    Hey Paul, Ive been using the plugin however, /dls end doesn't seem to reset the death log. I start the log, then the game begins, then the game ends and i end the log. Then i check it, and i delete it. The once i repeat the process the log still generates with the previous games stats as well as the new one. Could you add a command possibly to wipe the log? Other than that it works great!
     
  6. Last edited: Apr 29, 2018
  7. Offline

    XxTimeSlinkyxX

    Awesome! Thank you very much. I’ll test this out right when I get home tonight.
     
  8. Offline

    XxTimeSlinkyxX

    Hey Paul, One more thing if i could trouble you with it. The reset worked great, the file resets. However, when i reset it, the names go away but when another person dies, the number still goes up, the first time i killed someone to test it, they were given the number 0, then i stopped it, reset it, and then started it again and killed them. Then they were given the number 1, so i repeated it again and they were given the number 2? Is there some way to fix that possibly? The reset worked great for getting rid of the names, just it didn't reset the number values that were stored.
     
  9. Offline

    XxTimeSlinkyxX

    Thank you! You are seriously the best!
     
Thread Status:
Not open for further replies.

Share This Page