2.1 Protector 1.7.0

Protects chests, signs, switches and other objects.

  1. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    CoderCow submitted a new resource:

    Protector - Protects chests, signs, switches and other objects.

    Read more about this resource...
     
  2. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    108
    Could be a perfect replacemen to infinite chest plugin, is there anyway to only allow users to protect chest? I really don't them to set protect on useless crap and fill up database with it...
     
  3. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    Just configure "ManuallyProtectableTiles" and "AutoProtectedTiles" accordingly by setting the TileIDs for chests only.
     
    • Like Like x 1
  4. bippity

    Plugin Developer

    Joined:
    Jan 14, 2012
    Messages:
    292
    I believe I got this error after updating HouseRegions, is this because of the new json reference or something else?
    Code:
    2017-05-09 14:16:52 - PluginTrace: ERROR: [Protector] Reading a metadata file failed. Exception details:
    System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
       at Terraria.Plugins.CoderCow.Protector.WorldMetadata.Read(String filePath)
       at Terraria.Plugins.CoderCow.Protector.WorldMetadataHandler.ReadMetadataFromFile(String filePath)
       at Terraria.Plugins.Common.MetadataHandlerBase.InitOrReadMetdata()
    2017-05-09 14:16:52 - PluginTrace: ERROR: [Protector] Failed initializing or reading metdata or its backup. This plugin will be disabled. Exception details:
    System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
       at Terraria.Plugins.CoderCow.Protector.WorldMetadata.Read(String filePath)
       at Terraria.Plugins.CoderCow.Protector.WorldMetadataHandler.ReadMetadataFromFile(String filePath)
       at Terraria.Plugins.Common.MetadataHandlerBase.InitOrReadMetdata()
       at Terraria.Plugins.CoderCow.Protector.ProtectorPlugin.InitWorldMetdataHandler()
    2017-05-09 14:16:52 - PluginTrace: ERROR: [Protector] THIS PLUGIN IS DISABLED, EVERYTHING IS UNPROTECTED!
     
    • Agree Agree x 1
  5. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    108
    Thank you. One more question, is it able to summon Crimson/Corrupt Mimic by put a Key of Night inside an empty chest using this plugin? Because it's not possible in Infinite Chests...
    Also, this does not support chest import from Infinite Chests V2?
     
  6. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    • Like Like x 1
  7. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    108
    Same here, dunno why lol...
     
  8. bippity

    Plugin Developer

    Joined:
    Jan 14, 2012
    Messages:
    292
    Looks like the recent update fixed it :)
     
  9. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    Most likely. I didn't check the changelog of Newtonsoft.Json, they may have changed the way some arrays are serialized / deserialized. Make sure your metadata is intact, all protections are stored in it. While migrating to the new version you may have to edit the metadata file on your own to make it compatible. If you don't know what must be changed, send me a copy and I'll analyze it.

    No, but I can add that. (https://github.com/CoderCow/Protector-Plugin/issues/53)

    Yes it doesn't. Only Infinite Chest V1 is supported. I believe V2 has a reconversion feature though.
     
    • Like Like x 1
    • Winner Winner x 1
  10. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    108
    I have no clue what is wrong with my data, can you take a look at it for me?
    Code:
    {
      "Version": "1.4",
      "Protections": {
        "4358, 347": {
          "Owner": 259,
          "TileLocation": "4358, 347",
          "BlockType": 21,
          "TimeOfCreation": 1494382780,
          "IsSharedWithEveryone": false,
          "SharedUsers": null,
          "SharedGroups": null,
          "BankChestKey": "0, 0",
          "RefillChestData": null,
          "TradeChestData": null
        },
        "4360, 347": {
          "Owner": 259,
          "TileLocation": "4360, 347",
          "BlockType": 21,
          "TimeOfCreation": 1494382797,
          "IsSharedWithEveryone": false,
          "SharedUsers": null,
          "SharedGroups": null,
          "BankChestKey": "0, 0",
          "RefillChestData": null,
          "TradeChestData": null
        },
        "5344, 419": {
          "Owner": 199,
          "TileLocation": "5344, 419",
          "BlockType": 21,
          "TimeOfCreation": 1494384279,
          "IsSharedWithEveryone": false,
          "SharedUsers": null,
          "SharedGroups": null,
          "BankChestKey": "0, 0",
          "RefillChestData": null,
          "TradeChestData": null
        },
        "5346, 419": {
          "Owner": 199,
          "TileLocation": "5346, 419",
          "BlockType": 21,
          "TimeOfCreation": 1494384292,
          "IsSharedWithEveryone": false,
          "SharedUsers": null,
          "SharedGroups": null,
          "BankChestKey": "0, 0",
          "RefillChestData": null,
          "TradeChestData": null
        },
        "5348, 419": {
          "Owner": 199,
          "TileLocation": "5348, 419",
          "BlockType": 21,
          "TimeOfCreation": 1494384429,
          "IsSharedWithEveryone": false,
          "SharedUsers": null,
          "SharedGroups": null,
          "BankChestKey": "0, 0",
          "RefillChestData": null,
          "TradeChestData": null
        }
      },
      "ProtectorChests": {}
    }
    Also, would you consider to use sqlite instead of json to store this type of data? It's easier to manage.
     
  11. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    Hmm, looks fine and I can't reproduce the ArrayTypeMismatchException using Newtonsoft.Json.dll 9.0.1

    You do not usually edit this data by hand, so the format isn't very important.
     
    • Like Like x 1
  12. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    • Like Like x 1
  13. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    CoderCow updated Protector with a new update entry:

    1.6.3 Update

    Read the rest of this update entry...
     
  14. mrbaggins

    mrbaggins Level 0

    Joined:
    Jul 22, 2014
    Messages:
    2
    Trying to convert an older world and server from InfiniteChests up to Protector.

    But the command fails both in game and in server terminal with

    2017-05-19 10:59:45 - Utils: INFO: Gandolf executed: /protector importinfinitechests.
    2017-05-19 10:59:45 - PluginTrace: INFO: [Protector] Importing InfiniteChests data...
    2017-05-19 10:59:45 - Command: ERROR: System.NullReferenceException: Object reference not set to an instance of an object.
    at Terraria.Plugins.CoderCow.Protector.PluginCooperationHandler.InfiniteChests_ChestDataImport(ChestManager chestManager, ProtectionManager protectionManager, Int32& importedChests, Int32& protectFailures)
    at Terraria.Plugins.CoderCow.Protector.UserInteractionHandler.TryExecuteSubCommand(String commandNameLC, CommandArgs args)
    at Terraria.Plugins.CoderCow.Protector.UserInteractionHandler.RootCommand_Exec(CommandArgs args)
    at Terraria.Plugins.Common.UserInteractionHandlerBase.<>c__DisplayClass12_0.<RegisterCommand>b__0(CommandArgs args)
    at TShockAPI.Command.Run(String msg, Boolean silent, TSPlayer ply, List`1 parms)

    I REALLY want to avoid trying to rconvChests in infinite chests, as I've set all default world chests to auto refill, and I did that via SQL in the database itself, which I can't do now, as there's no easy way to tell which chests are people's and which are worldgen.

    Any ideas on how I can get the chests across?

    I've taken the chests file and put it in the same folder as the tshock config.json file. Is that the wrong place?
     
  15. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    108
    Can you make this plugin respect the /antibuild command? Currently it just ignore that command and let's everyone loot chest even when antibuild is on.
     
  16. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    CoderCow updated Protector with a new update entry:

    1.6.4 Update

    Read the rest of this update entry...
     
  17. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    108
    I got this error when I tried to set up a trade chest:
    Code:
    [Protector] Error One ChestGetContents event handler has thrown an unexpected exception. Exception details:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Terraria.Plugins.CoderCow.Protector.ChestManager.SetUpTradeChest(TSPlayer player, Point tileLocation, Int32 sellAmount, Int32 sellItemId, Int32 payAmount, Object payItemIdOrGroup, Int32 lootLimit, Boolean checkPermissions)
       at Terraria.Plugins.CoderCow.Protector.UserInteractionHandler.TrySetUpTradeChest(TSPlayer player, Point tileLocation, Int32 sellAmount, Int32 sellItemId, Int32 payAmount, Object payItemIdOrGroup, Int32 lootLimit, Boolean sendMessages)
       at Terraria.Plugins.CoderCow.Protector.UserInteractionHandler.<>c__DisplayClass67_0.<TradeChestCommand_Exec>b__1(TSPlayer playerLocal, Point location)
       at Terraria.Plugins.Common.UserInteractionHandlerBase.HandleChestGetContents(TSPlayer player, Point location)
       at Terraria.Plugins.CoderCow.Protector.UserInteractionHandler.HandleChestGetContents(TSPlayer player, Point location, Boolean skipInteractions)
       at Terraria.Plugins.CoderCow.Protector.UserInteractionHandler.HandleChestGetContents(TSPlayer player, Point location)
       at Terraria.Plugins.CoderCow.Protector.ProtectorPlugin.Net_ChestGetContents(Object sender, TileLocationEventArgs e)
       at Terraria.Plugins.Common.Hooks.GetDataHookHandler.OnChestGetContents(TileLocationEventArgs e)
    Also, can you add the ability to trade item for Seconomy Coin?
     
  18. Colonial

    Colonial Level 1

    Joined:
    May 29, 2017
    Messages:
    6
    Whenever I try to set up a bank chest it says it needs to be protected but then it says the chest can't be protected.
     
  19. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150
    Make sure the tile id for chests is present in your configuration file (or just use the default config file).
     
  20. CoderCow

    CoderCow Level 6

    Joined:
    Aug 23, 2012
    Messages:
    150