Asking for some basic concept related to InventoryClick

Discussion in 'Plugin Development' started by i998979, Jan 23, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    i998979

    So what I am going to ask is about "relationship between variable and player"
    Assume that I have the code like this

    Code:
    public class HelloWorld{
        int page 1;
        @EventHandler
        public void onInventoryClick(InventoryClickEvent event) {
            if (#Some conditions#) page++;
        }
    }
    
    Also assume I have 2 players named "Steve" and "Alex"
    When "Steve" trigger the event ONCE, variable "page" will add 1 for sure
    But when "Alex" trigger the event ONCE and right after "Steve" trigger it, variable "page" will add 1 more

    What I'm going to ask is:
    How to code that 2 players have different variable value of "page" without setting player's metadata?
    Also it will be cleared when player close inventory/server restart/player left/whatever...?
    (Or I can initialize the variable for player when they open the inventory again)

    Thank you.

    (I'm coding a multi-page item display tbh. It's harder than I think...)
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    i998979

    Oh that's right! You've reminded me
    I'll give it a shot :D
     
Thread Status:
Not open for further replies.

Share This Page