Suggestion for a LockSystem plugin

Discussion in 'Spigot Plugin Development' started by MrLiam2614, Jan 8, 2020.

  1. Hey,.. Ehm I'm just creating a plugin that allows you to lock your chest, your doors, your beacon and,.. You know, everything has an inventory, but I had a flash right now, I explain.

    You can simply lock your chest by using a simple command and then add players to a "whitelist" this Player can destroy or place block on the top or the bottom of your chest, or simply open it (Player not whitelist cannot do that)
    But I wanted to add something like an hacking system (that you can enable or disable by the config) but the question is..
    How can you "gain" hacking ability, for example, I have "locking ability" to 6 and a Player has "hacking ability" to 5, and cannot open or destroy your chest, but if his ability is 7 e can, now.. I Redo the question.. How do you wants your Player gain ability of hacking and looking? (two different ability that by the config you can use a unique one if you want, something like "hackLocking skills"
    I hope you like this idea, let me know here, I will appreciate your help and suggest.

    And also sorry for my bad English :)
    Thank You!!
    #1 MrLiam2614, Jan 8, 2020
    Last edited: Jan 9, 2020
  2. Hi!

    That is interest idea. I`m sorry for my english but i try to explain what i think about that.

    So, start with choosing the plan "how that must work"
    I think that may be like "per-player" file in which will stored:
    1) Player level
    2) All blocks and whitelisted players.

    So.. with PlayerInteractEvent (if i not misstake that event is called when clicking) you may work.
    But in that method is problem what i doesn`t solved. That is how plugin get owner of block. Load all configs and read it for all blocks... may be lagged.
    I in that situation create "LockedBlock" class with parametres with "Player owner, Location block_location, Material blocktype, int player_level" and load all that data in Enable process.

    I create mini-example of second situation but without IDE so may be some problems.

    Code (Java):
    public class LockedBlock  {
    private Player owner;
    private Location block_location;
    private Material blocktype;
    private int player_level;

    public LockedBlock(Player owner, Location block_location, Material blocktype, int player_level){
      //all duplicate like this.owner = owner;... this.player_level = level;

    And all "get.." like
    public getOwner(){
    return owner;
    In Enable process you must load all per-player config in which load all blocks like LockedBlock, in load process add "new LockedBlock(owner, block_location, blocktype, player_level).
  3. I already have builded the plugin, and it's already working for "simple" locking method, i just wanted to know if it's a good idea to add the feature of the "skills", if I see a lot of people want it I will add this feature, othervise i will do it on a future update.
  4. All features is great if they may be disabled or enabled and doesn`t produce lags in my opinion
    • Useful Useful x 1
  5. Maybe for hacking you need to try to hack multiple things and there's a "mini-challenge" to success. If you success, you gain points for the hacking ability, if not, you lose a little amount.

    Mini-challenge example: you try to hack a chest that is locked, an inventory appear and you have 3 secondes to click on all the diamond (theres 5 diamonds randomly places and also cyan wools to confuse the player.

    For the locking ability ability, the more stuff you lock the higher the point, but if you unlock somehting (block break for example) then you love a little amount of ability.
    • Useful Useful x 1
  6. Oh that's a great idea, thank you!