1.14.4 [HELP] MySQL Data Caching

Discussion in 'Spigot Plugin Development' started by DragonLord__, Jan 27, 2020.

  1. Okay so, I want to create the following:
    MySQL Table with:
    GroupName | Prefix | Suffix | ChatColor | Permission | Priority Level
    Owner | &4Owner | None | None | vc.owner | 1
    Admin | &cAdmin | None | None | vc.admin | 2
    So, when player sends a message, I need to check if player has permission (either vc.owner, or vc.admin, but both of them are changeable so I cannot just go like: if(p.hasPermission(vc.owner)) {...})
    If player for example has vc.owner I need to pickup data from prefix, suffix and chatcolor section and priority level.
    And if that's the only one then just display it (easy)
    But if player has vc.owner AND vc.admin, I need to check their priorities, so who has higher priority then use prefix suffix and chatcolor from that group.
    Now, I came up with an idea that I have auto incremental ID (ID | GroupName | Prefix | Suffix | ChatColor | Permission | Priority Level) (Notification, I cannot just stop at the first one from top (for example owner here) because priority level is also changeable, so if I put pr. level to 3 and admin has 2 then it would pick owner instead of admin even tho admin has higher priority level (lower = higher xD)
    So, I would go from ID 1 to ID X and
    when I come to the lowest pr level with players permissions then just go back to that ID and copy everything from there.
    So, is there a better way of doing it?
  2. Nothing wrong with that approach imo. Why do you need an extra ID thou, I have the feeling that your priority already does the trick; in other words couldn‘t you just use that as ID?
  3. I want to make priority changeable (so, priority can jump from 1 to 5 by cmd). I want to implement ID that cannot be changed but is there a more efficient way?