1. These forums are still being retired! Please use GitHub discussions or Discord. You cannot create new threads or new accounts now. If you need to contact some user of the forums, you should do it sooner, rather than later. This notice was last updated on May 30th, 2021.

ChestLimiter - User-based chest limits 1.1.1

Limits the amount of chests a player can place.

  1. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    ChestLimiter
    Limits the amount of chests a player can place.
    [​IMG]

    ApiVersion: 1.16
    Terraria Version: 1.2.4.1
    Plugin Version: 1.0.1.1102

    Author: Enerdy

    Disclaimer: This plugin is currently hosted under Plugin Submissions, which means it may contain bugs! If you're willing to go for a bug hunt, go ahead and report back everything you might find!

    This is an attempt at enforcing the management of chests in servers not running Infinite Chests - this might become painful as a lot of players love to lay down chests and ruin other player's experience as the limit is achieved.

    Features:
    • Everytime an user places down a chest, it'll be added to their list of chests.
    • If an user has reached their chest cap and tries to place down a new chest, it will be removed and the user will be warned (similar to region protection).
    • Dynamic user-based cap which can be increased by admins (the default is 5, which by itself is configurable).
    • Can exempt user groups or set an user's limit to * (unlimited).
    • Will also help keeping track of who owns which chest!
    Config:
    This plugin uses a JSON-encoded config, which is kept at /tshock/ChestLimiter/. One will be generated upon first run, and every time it is not found on its corresponding folder at startup. Check jsonlint for validation. It has the following configurable values:
    • AnnounceOnPlacement [string/null] - A message to be sent to a player everytime they place down a chest. If it is null or empty(""), no message will be sent.
      • You may use {0} to represent an user's chest count.
      • You may use {1} to represent an user's chest limit.
    • BaseLimit [number] - The default limit which will be set on every user. This can be increased through commands.
    • StorageType [sqlite/mysql] - A string, which should be either 'sqlite' or 'mysql'; represents the storage type for the user limit database. If you choose mysql, use the configuration settings below to set up your database.
    • MySqlHost [host:n] - The MySql host.
    • MySqlDbName [string] - The MySql database name.
    • MySqlUsername [string] - The MySql username; used when connecting to the database.
    • MySqlPassword [string] - The MySql password; used when connecting to the database.
    Permissions:
    • chestlimiter.check.self - Permission required to use the '/climit' command with no parameters.
    • chestlimiter.check.others - Permission required to use the '/climit' command on others.
    • chestlimiter.modify - Permission required to use the '/climit' command to modify user limits.
    • chestlimiter.exempt - Groups with this permission will be exempted from the limit system.
    • chestlimiter.owner - Permission required to use the '/cowner' command.
    • chestlimiter.prune - Permission required to use the '/cprune' command.
    Commands:
    • /climit <user name> [* | +-value] - The main command. Can be used to check your own limit and how many chests you have placed. If a name is provided, it will display the entered user's limit, if possible. In addition, you may provide a named parameter to affect target user's limit:
      • number : will set their limit to the number specified;
      • * : will set their limit to unlimited (user exempt);
      • + / - : may be used before a number - will either increase or decrease the current limit by the provided amount.
    • /cowner - Open a chest after using this command; Will display a chest's coordinates, along with its owner, if possible.
    • /cprune - Prunes any non-existant chest present in the database. This helps fixing the "holes" left when removing chests through a command (such as WorldRefill's /genchests).
    Changelog:
    Version numbering follows rules included here.

    1.0.1.1102
    • Added /cprune.
    • Placing a chest should now remove ownership from any previous owners (protection against multiple users "owning" the same chest in the database).
    1.0.0.1021
    • Source is now fully uploaded! (Missed the most important piece of information... I blame VS2013 Source Control).
    • Fixed the exempt permission and unlimited limits failing to effectively work.
    • /climit now displays an exempted/unlimited user's chest count.
    1.0.0.1019
    • Initial commit.
    A commit-based change log can be found here.

    Links:
     
    • Like Like x 5
  2. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    ChestLimiter v1.0.0.1021:
    [c] Exempted/unlimited users should now effectively dodge chest limitation rules with the use of shadow arts.
    [+] Uploaded ChestLimiter.cs to Github.
    [+] /climit has evolved and will now display an exempted/unlimited user's chest count for statistical purposes.

    Should be good for testing now!
     
  3. hiarni

    Plugin Developer

    Joined:
    Mar 14, 2014
    Messages:
    127
    Nice work! :)

    btw... "superadmin" is not exluded from the limit? intention?
    everything else seems to be working without any issue at the moment...

    also is it compatible with "World Refill"?
    as example - user placed 6 chests out of 10 and 4 are empty of them
    did /genchests 2 etc. remove them from the database/world?

    It's interesting :>
     
  4. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Superadmin should work. I'm using TSPlayer.Group.HasPermission for exempt which should automatically return true as superadmin. Update to 1021 as those weren't working before this version and report back.

    I forgot about "uprooting". I'll see what I can do, but yeah: shouldn't be working with WorldRefill's /genchests 0 atm :/.
     
    • Like Like x 1
  5. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,598
    Why does the config require SQL setup?
     
  6. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    @WhiteX
    So that you can set up a MySql db separate from TShock if you want.. not a lot of plugins allow this.
     
  7. Wight

    Wight Administrator
    TShock Admin TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    May 20, 2012
    Messages:
    1,598
    Why would they need to?
     
  8. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Why not? You can just copy the stuff in your TShock's config if you don't want to use a different one.
     
  9. Bandalf Le Gland

    Joined:
    Jun 30, 2014
    Messages:
    59
    Hi Enerdy :)
    The plugin is great !

    We encounter this issue : players started complaining about mod telling them they reached the limit (example 5/5) where they just put one chest, or slightly more. I checked in infinite chest database, and yes, they're far from limit. Any clue ? :)
     
  10. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    This wasn't made to work with Infinite Chests.

    Since InfiniteChests' Order is the same as this plugin, it will follow the name order. ChestLimiter will load first, but since hook order is the opposite of the load order, InfiniteChests will handle things before ChestLimiter, which can lead to issues. I will change ChestLimiter's order to 2 and hope it works.

    EDIT: InfiniteChests users, please test this version. Let me know if it works. (I also suggest you to delete your ChestLimiter/Database.sqlite or the MySql db for it as it's obviously faulted and will need to be recreated.
     
    • Like Like x 1
  11. Bandalf Le Gland

    Joined:
    Jun 30, 2014
    Messages:
    59
    I'll test it right away :) thanks !
     
  12. OFF

    OFF
    Account Probation Banned Rating Banned

    Joined:
    Nov 28, 2013
    Messages:
    208
    Le works?
     
  13. Bandalf Le Gland

    Joined:
    Jun 30, 2014
    Messages:
    59
    after some test, it worked for some, stayed buggy for some others. I think I have to get rid of infinite chests, or this one. I don't know, both features are amazing :)
     
  14. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Truth to be told, I thought InfiniteChests already had its own limiting feature, but after a quick peek it seems to be part of its bank chests feature only.

    If you're using InfiniteChests and haven't had any issues, you should just keep using it. This was made mostly for those not using it to help managing their world more efficiently (we eventually ran out of empty chests to uproot!).

    Buggy as in, Bandalf? Can you provide more details?
     
  15. Bandalf Le Gland

    Joined:
    Jun 30, 2014
    Messages:
    59
    buggy is a big word, sorry. There is no error messages or whatever, just than some people are told that they reached limit without reaching it, some not :)
    I mostly use inf chest for the chest refill feature, but I'd love to get rid of it :)
     
  16. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    Do you use WorldRefill's genchests to clear empty chests? Because as of current, that bugs with ChestLimiter by not removing the chests from the chest limiter database.

    Can I have a copy of your Chest Limiter database? I might help me fix this issue.
     
  17. Bandalf Le Gland

    Joined:
    Jun 30, 2014
    Messages:
    59
  18. Bandalf Le Gland

    Joined:
    Jun 30, 2014
    Messages:
    59
    Hi :)
    Got this one on server load :

    [​IMG]
     
  19. Enerdy

    Enerdy Satellite Admin
    TShock Mod Plugin Developer Zero Day Plugin Author

    Joined:
    Nov 14, 2012
    Messages:
    506
    ChestLimiter v1.0.1.1102
    [+] Added /cprune!
    [c] Fixed a bug where multiple users could own the same chest, database-wise.

    NOTE: Do not abuse /cprune. It might take some time as it has to go through a lot for a single user. Now imagine a server with +300 registered users in the ChestLimiter database. I'd have considered making it async, if not for the fact that it'd force people to have .NET 4.5 installed to use this.
     
  20. hiarni

    Plugin Developer

    Joined:
    Mar 14, 2014
    Messages:
    127
    Still the same warning on server load ~sometimes (should we just ignore it?)