[GEN/INFO] DeathCounter v1.0.1 - Count your kills [1185]

Discussion in 'Inactive/Unsupported Plugins' started by krinsdeath, Jul 10, 2011.

  1. Offline

    krinsdeath

    Death Counter v1.0.1
    Count player and monster kills and rank them accordingly​
    V1.0: 1.0.1 - 1.0
    v0.3: 0.3.2 - 0.3.1 - 0.3.0
    v0.2: 0.2.2 - 0.2.1 - 0.2.0
    v0.1: 0.1.4 - 0.1.3 - 0.1.2 - 0.1.1 - 0.1.0
    Important!
    v1.0 adds some new functionality; searching /dc @playername will search for the stats of that player, and print out a list of all of their currently recorded kills.​
    Thanks @ltguide!​
    Also, as a way of lessening I/O operations on larger servers, I disabled updating SQLite on-the-fly for users as they kill mobs. I believe this was the issue (your disks were getting IO locked), and it should help dramatically. The result, however, is that you'll have to wait 30 minutes for updated rankings while using SQLite. YAML remains unaffected, but should also have improved in stability (I also updated the saving methods for YAML as well).​

    Important!: Version 0.2.0 makes the configuration file considerably less complex. It is shown in the config.yml spoiler.
    Important!: If you're upgrading from 0.1.1 to 0.1.2, there are a lot of new keys in the config. It's recommended that you delete your config (or, if you're comfortable editing YML files, copy the new keys from this post in the example config.yml) to get the updated keys.

    Note: Plugin was originally requested by @3ric in this thread.

    Description:
    Ever wanted to keep track of how many pigs you've slaughtered? With this plugin, you can! Permissions is not needed.
    note: I've tried to keep this plugin as lightweight as possible, and SQLite attempts to keep updated player records in memory to prevent writing to and reading from the DB for every kill. If you encounter some issues, let me know. I'm not terribly well versed with SQLite!

    Basic Usage:
    Drop DeathCounter.jar into your plugins directory, and it'll create a folder (DeathCounter) with a configuration file (config.yml), and a user database (currently users.yml). In the future, I will add MySQL. By default, it stores users in YAML, which will be quite sufficient if your server is small (~100 players). SQLite is now supported, and should be used for servers with more than 100 players.

    The config contains some information on how it actually works, as well as a very simple localization setup. It currently only supports the messages in the config, but if it's requested I can set up multiple localizations and persist them by user (without permissions)
    config.yml (open)

    Code:
    # There is really no need for Permissions support, but I will gladly enable it if you need it for whatever reason
    # Some variables can be parsed for the console logger, and are contained within <>
    # <version>         - plugin version
    # <shortname>       - plugin name
    # <fullname>        - plugin name + version
    # <author>          - my name
    settings:
        # if permissions is set to true, players will need the flag 'deathcounter.admin' to access '/deathcount reset [player]'
        permissions: false
        # if economy is set to true, players will earn money for each kill based on the values in this config
        economy: false
        # the time (in minutes) between full saves of the user database
        save_interval: 30
        # the amount of lines to display when a user types '/deathcount leaders' or '/deathcount [mob name]' without a number
        leaderboard: 5
        # the prepended message on log entries
        log: '[<fullname>] '
        # log_verbosity:
        # 0     - Logging will be disabled for everything but errors
        # 1     - Standard log messages will be output (onEnable, onDisable, errors) (default)
        # 2     - More messages (user database saving and user creation)
        # 3     - Absolutely everything will be logged
        log_verbosity: 1
        storage:
            # Currently only YAML and SQLite will work
            # Will add MySQL at some later date
            type: 'YAML'
            info:
                # this entry is used only for YAML. you can specify your own users file name if you wish.
                # note: if you want to specify a directory, please create it before hand, and do not supply a leading slash
                filename: 'users.yml'
                # The following information only applies to MySQL
                database: 'users'
                server: 'localhost'
                port: 3306
                username: 'username'
                password: 'password'
    
    economy:
        pig: 0.0
        sheep: 0.0
        cow: 0.0
        squid: 1.0
        chicken: 0.0
        spider: 5.0
        skeleton: 2.0
        zombie: 2.0
        creeper: 7.0
        ghast: 5.0
        pigzombie: 5.0
        wolf: 3.0
        slime: 1.0
        player: 10.0
    
    messages:
        header: 'Leaders -Top <num>- (<field>)'
        first_rank: '#<rank> - <name> (<kills>)'
        second_rank: '#<rank> - <name> (<kills>)'
        third_rank: '#<rank> - <name> (<kills>)'
        other_rank: '#<rank> - <name> (<kills>)'
        own_rank: '--- #<rank> - <name> (<kills>) ---'
    

    Permissions (open)

    This plugin uses the following permissions:
    • deathcounter.admin - Gives access to /deathcount reset [player]
    • deathcounter.users - Gives access to /deathcount leaders AND /deathcounter [mobname] - Defaults to true
    This plugin also defines the following nodes for convenience:
    • deathcounter.* - Gives access to everything. - Sets deathcounter.admin, deathcounter.users

    Screenshots (open)

    [​IMG]

    Commands:
    • /deathcount leaders [num] - Will display a message containing the top kill leaders up to [num], as well as your location in the leaderboard
    • /deathcount [mobname] [num] - Same as leaders, will display the top [num] kill leaders for the specified monster, as well as your location in the leaderboards.
    • admins: /deathcount reset [player] - Will delete a player from the database.
    Features:
    • Track player and monster kills
    • Leaderboards for total kills and individual monsters
    • SQLite and Flatfile database support
    • Permissions support! (optional)
    • iConomy support! (optional)
    TODO:
    • MySQL
    Versions:
    Version 1.0.1:
    • Removed deprecated EntityDamageByProjectileEvent
    Version 1.0:
    • Switched from Register to AllPay v3.0
    • Now supports iConomy 4/5/6, RealEconomy, MultiCurrency, BOSEconomy 6/7, Essentials Eco
    • Factored in pull request from ltguide to include @playername functionality for searches.
    • Moved plugin to load: startup to ensure economy hooking.
    • Additional bug and glitch fixes.
    Version 0.3.2:
    • Refactored com.nijikokun.register to net.krinsoft.register to prevent conflicts
    Version 0.3.1:
    • Switched from iConomy to Register; all major economies are now supported, including BOSE 6 & 7, iConomy 4 & 5, Essentials Economy, and Multi-currency
      • Register is included in the source code, and as such does not require any outside libraries. The plugin will attempt to hook the first economy plugin it finds.
    • Minor bugfix and code cleanup
    • Moved to maven
    Changelog(old) (open)

    Version 0.3.0:
    • Removed all dependencies on Permissions, the plugin uses Superperms now.
    • Permissions 2.x and 3.x (and possibly GM and PEX) will still work
    • /deathcount now has 2 aliases, /dc and /deathcounter, which (when used without parameters) will display the top 5 leaders. As such, /deathcount leaders is no longer necessary, but still works.
    0.2.2:
    • Added iConomy support
    • Lessened I/O operations for large servers, which I believe were getting IO locked
    0.2.1:
    • Fixed spiders not being tracked.
    • General code cleanup
    0.2.0:
    • Finished SQLite support
    • Added Permissions (optional). Flag is 'deathcounter.admin' (permissions is off by default)
    • Reorganized the entire project from scratch. It's more module-like, so I can add new features much more easily.
    0.1.4:
    • Added SQLite support
    0.1.3:
    • Added a hardcoded limit to the number of loops displayed by /deathcount leaders. It will not exceed 10 loops.
    • minor code cleanup
    • Added a configurable location for the users.yml (in fact, the name of the file can even be changed) in config.yml. Should allow for symlinking or any number of useful features
    0.1.2:
    • Added /deathcount reset for admins.
    • Added quiet_plugin field in config.yml - setting this to true will disable "You killed a [target]!" messages.
    • Cleaned up code.
    • More localization flags
    0.1.1:
    • Fixed a few bugs
    • Added support for EntityDamageByProjectileEvent
    • Players should now be tracked properly
    • Added quiet_save field in config.yml - setting this to true will disable log messages stating that the users.yml has been updated.
    0.1.0:
    • Initial release

    Special thanks to:

    3ric for his support
     
  2. Offline

    3ric

    Please add spiders lol

    Sent you a PM too.
     
  3. Offline

    krinsdeath

    I had spiders referenced throughout most of the code, I just forgot to add them to the saving methods. It's fixed now, and in 0.2.1.

    Enjoy~
     
  4. Offline

    spunkiie

    @krinsdeath

    Thank you for your time supporting this. I will wait a bit more development releases then try again on my server.
     
  5. Offline

    krinsdeath

    I appreciate your patience. It is probably frustrating trying builds and not working. I've changed down to Java 1.5.0_22, the build that Bukkit is actually being compiled on, and I'm looking into ways to minimize thread usage and make things a bit more stable.

    I can't guarantee anything (I have a tiny sample size of players, so I can only assume something works on a grand scale ~because~ it works on a small one), but I am working on it!
     
  6. Offline

    krinsdeath

    Version 0.2.2 is now released! I think I may have solved the problem you were having, spunkiie, although I can't guarantee anything. The result of the solution, however, is that you'll have to wait the specified number of minutes in your config ('settings.timer_interval') before updated leader rankings can be viewed.

    It also includes iConomy support (which is totally optional), and adds a few new things to the config file if you enable it. There are (as yet) no commands to modify the iConomy settings from in game, but I will gladly add some if it's requested enough.

    Happy hunting.
     
  7. Offline

    krinsdeath

    Version 0.3.0 is now released! It updates the plugin for Superperms, cleans up a lot of code, fixes some Nullpointers that could happen in odd circumstances, and generally makes the plugin more stable. I also believe I addressed the issue that @spunkiie was happening with the large database (IO locking).

    As always, if you encounter any bugs, be sure to let me know. I've done a fair amount of testing, and didn't notice any problems, but there may be some. Happy hunting!
     
  8. Offline

    iPhysX

    Nice, ill have to try this out. :)
     
  9. Offline

    Bdl2

    By the looks of things, this will be completely replacing the plugin I'm using right now to pay players for killing mobs, AND it has a log of how many kills each player has made *with* a leaderboard. This is win, sir.
     
  10. Offline

    Bdl2

    Scratch that, I just tried this, and I'm getting issues. First, the plugin doesn't reward players for killing sheep, despite that I defined it to in the config. Second, when using /deathcount the command fails and the console spits out an error.

    CB 953
    DeathCounter v0.3.0

    I'm upgrading to CB1k tonight, so we'll see if it still gives me errors then.
     
  11. Offline

    krinsdeath

    CB953 didn't fire EntityDeath events for Sheep. I could not fix that, and there was no work-around. CB1000 will fix that. As for errors, because I updated to CB1000 it requires Superperms, so the errors are likely due to that. I apologize, I should have made this more clear in my post.
     
  12. Offline

    Bdl2

    It's all good, I didn't intend to sound rude or upset before if I did. Upgraded to CB1000 and everything's working as it should. ;3
     
  13. Offline

    guruflex

    Can you try to get The Money to work on Essentials
     
  14. Offline

    Phantom Index

    Maybe a Website version showing the top leaderboard players. Be kool.
     
  15. Offline

    guruflex

    Essentials Please!!!
     
  16. Offline

    krinsdeath

    Version 0.3.1 moves from iConomy to Register, and now supports all major economies. As a result, the config file changed in a minor way. All of the keys previously named "iConomy" have been changed to "economy," so you can manually edit the config file and fix everything up. An example config.yml is provided in the top post.

    Happy hunting!
     
  17. Offline

    guruflex

    thanks so much i ask and you provided
     
  18. Offline

    JonasD

    Hi. Can u add /dc as shortcut :) ?
     
  19. Offline

    krinsdeath

    @JonasD - It already is. /dc should work the same as /deathcount or /deathcounter. I'm slowly putting together a v0.4.0 release, which will include the ability to search for individual players via /dc @playername (thanks @ltguide!)

    Until then, /dc should already work. If it doesn't, try updating to the latest version.
     
  20. Offline

    Ritsbits

    Hi, would it be possible to add the logging of who killed who and the coordinates they were killed in?
     
  21. Offline

    Wbjpen

    Could you possibly make a permissions node to stop certain players from participating? I'd rather my admins did not deprive other players from the top spot.
     
  22. Offline

    krinsdeath

    @Ritsbits - I suppose that would be possible, but I believe there are other plugins which do that already.

    @Wbjpen - I can! I'll add a deathcounter.exempt permission in 1.0, which I am working on slowly. Until then, you'll have to suffer without it. :(
     
    Ritsbits likes this.
  23. Offline

    krinsdeath

    Alrighty! Finally got it all updated to 1185+, should be peachy now.

    v1.0 includes the ability to search for players (via /dc @playername), and improves SQLite and YAML functionality a bit.
     
  24. Offline

    AinSophAur

    This isn't fully relevant to the plugin itself, but it deals with the code.

    For some reason when I add:
    in my code, I get an error where it crosses out
    saying that "The type EntityDamageByProjectileEvent is deprecated."

    But I noticed that after downloading the source for this, it doesn't seem to be the case for this plugin. Any clue why I get this problem in my code but it doesn't show up in yours?
     
  25. Offline

    DemonCraft

    This is cool, you should make a high scores website design along with the MySQL xD
     
  26. Offline

    krinsdeath

    @AinSophAur - Haha. I can't believe I forgot about that deprecation. I just fixed it, and I'll release a small patch as 1.0.1. As for your problem, I have no idea why it may be doing that, since it shows the deprecation fine for me.

    @DemonCraft - I have no intention of creating a website for high scores, but it would be trivial for someone to create if they wanted to (assuming I get MySQL support implemented in the near future).
     
  27. Offline

    DemonCraft

    Alrighty, it'd be cool to see.
    I'm just a Website/High Score type of person.
     
  28. Offline

    krinsdeath

    NOTICE

    In the future, I would appreciate it if any issues or bugs you find are posted on my BukkitDev Project Page.

    I will still watch this thread, of course, but the ticket tracker and forum make it much easier to manage issues and feature requests.

    Thanks a lot for all of your support!
     
  29. Offline

    AinSophAur

    Its ok, I just used the EntityDamageByEntity event and just played around with the projectile instance to basically get the same results EntityDamageByProjectileEvent.
     
  30. Offline

    Fob_Upset

    Can i use this plugin only to track Killing of Players not Killing of Mobs?
     
  31. Offline

    krinsdeath

    @Fob_Upset - I think there are other plugins that do that, but currently I haven't added any options to do so.
     

Share This Page