File tree Expand file tree Collapse file tree
src/main/java/me/kodysimpson/simpapi/menu Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111import java .lang .reflect .InvocationTargetException ;
1212import java .util .HashMap ;
13+ import java .util .UUID ;
1314
1415/**
1516 * Used to interface with the Menu Manager API
1617 */
1718public class MenuManager {
1819
1920 //each player will be assigned their own PlayerMenuUtility object
20- private static final HashMap <Player , PlayerMenuUtility > playerMenuUtilityMap = new HashMap <>();
21+ private static final HashMap <UUID , PlayerMenuUtility > playerMenuUtilityMap = new HashMap <>();
2122 private static boolean isSetup = false ;
2223
2324 private static void registerMenuListener (Server server , Plugin plugin ) {
@@ -70,15 +71,15 @@ public static PlayerMenuUtility getPlayerMenuUtility(Player p) throws MenuManage
7071 }
7172
7273 PlayerMenuUtility playerMenuUtility ;
73- if (!(playerMenuUtilityMap .containsKey (p ))) { //See if the player has a pmu "saved" for them
74+ if (!(playerMenuUtilityMap .containsKey (p . getUniqueId () ))) { //See if the player has a pmu "saved" for them
7475
7576 //Construct PMU
7677 playerMenuUtility = new PlayerMenuUtility (p );
77- playerMenuUtilityMap .put (p , playerMenuUtility );
78+ playerMenuUtilityMap .put (p . getUniqueId () , playerMenuUtility );
7879
7980 return playerMenuUtility ;
8081 } else {
81- return playerMenuUtilityMap .get (p ); //Return the object by using the provided player
82+ return playerMenuUtilityMap .get (p . getUniqueId () ); //Return the object by using the provided player
8283 }
8384 }
8485
Original file line number Diff line number Diff line change 77 Each player has one of these objects, and only one.
88 */
99
10+ import org .bukkit .Bukkit ;
1011import org .bukkit .entity .Player ;
1112
1213import java .util .HashMap ;
1314import java .util .Stack ;
15+ import java .util .UUID ;
1416
1517public class PlayerMenuUtility {
1618
17- private final Player owner ;
19+ private final UUID owner ;
1820 private final HashMap <String , Object > dataMap = new HashMap <>();
1921 private final Stack <Menu > history = new Stack <>();
2022
2123 public PlayerMenuUtility (Player p ) {
22- this .owner = p ;
24+ this .owner = p . getUniqueId () ;
2325 }
2426
2527 public Player getOwner () {
26- return owner ;
28+ return Bukkit . getPlayer ( owner ) ;
2729 }
2830
2931 /**
You can’t perform that action at this time.
0 commit comments