Advertisement
broken-arrow

Untitled

Nov 26th, 2021
1,326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. package org.brokenarrow.storage.menus.redone;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5.  
  6. public class MenuCache {
  7.  
  8.     private static final MenuCache instance = new MenuCache();
  9.  
  10.  
  11.     private Map<Object, MenuHolderTest> menusChached = new HashMap<>();
  12.  
  13.     public void setMenusChached(Object object, MenuHolderTest menusChached) {
  14.         this.menusChached.put(object, menusChached);
  15.  
  16.     }
  17.  
  18.     /**
  19.      * You can get a menu with {@link org.bukkit.entity.Player} or
  20.      * custom methods like location and/or clazz you exstend from.
  21.      * format look like this.
  22.      * <p>
  23.      * player + "*__*" + clazz
  24.      * location + "*__*" + clazz
  25.      *
  26.      * @param object use player name or the custom methods abow.
  27.      * @return a cached menu.
  28.      */
  29.  
  30.     public MenuHolderTest getMenuInCache(Object object) {
  31.         return this.menusChached.get(object);
  32.     }
  33.  
  34.     public Map<Object, MenuHolderTest> getMenusCached() {
  35.         return menusChached;
  36.     }
  37.  
  38.     public static MenuCache getInstance() {
  39.         return instance;
  40.     }
  41.  
  42.  
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement