Solved What is the best way to store clan data ? SQLITE

Discussion in 'Spigot Plugin Development' started by irvinglink, Mar 17, 2020.

  1. I'm developing a Clan plugin that uses SQLite as a storage method. But I have an issue I don't know what is the best way to store all the data. I can make for each clan a table, or make only one table with the player data for example:

    --------------------------------------
    player_name | clan | role |
     
  2. Example from my clans plugin

    my nations.json file
    Code (Text):
      {
        "nationName": "Krypto",
        "baseLocation": null,
        "nationLeaderUUID": "e5d848f1-fa73-48b0-b75b-67a2d2045fe7",
        "nationUUID": "72b55138-7e85-4ef0-bd69-f1555f39a5ca",
        "peaceful": false,
        "open": false,
        "morale": 40,
        "createdMillis": 1584052550900,
        "invited": [],
        "allies": [
          "c93da9c4-5569-4cb9-9b76-32d3bcfb2d4d"
        ],
        "enemies": []
      },
    my players.json file
    Code (Text):
      {
        "playerName": "Squallz",
        "playerUUID": "e42b60b0-c35a-462f-a2b4-b1a9980f399e",
        "nationUUID": null,
        "hasNation": false,
        "nationRole": "NATIONLESS",
        "nationChat": false
      },
    (example of each)
     
    • Like Like x 1
  3. MrGeneralQ

    MrGeneralQ Previously qintinator
    Supporter

    This is all about normalization. A table should only be created if your object has a specific usage. So I would absolutely say no. Create one table for all clans, and create a field "type" to distinguish the logic and functionality in your plugin
     
    • Like Like x 1
  4. Thanks for all you support I will keep in mind.