@@ -62,7 +62,7 @@ public CycleClick(String id, int minRank, int maxRank) {
6262 public boolean onClick (Panel panel , User user2 , ClickType click , int slot ) {
6363 if (panel .getWorld ().isEmpty ()) {
6464 plugin .logError ("Panel " + panel .getName ()
65- + " has no world associated with it. Please report this bug to the author." );
65+ + " has no world associated with it. Please report this bug to the author." );
6666 return true ;
6767 }
6868 // This click listener is used with TabbedPanel and SettingsTabs only
@@ -73,14 +73,17 @@ public boolean onClick(Panel panel, User user2, ClickType click, int slot) {
7373 this .user = user2 ;
7474 changeOccurred = false ;
7575 // Permission prefix
76- String prefix = plugin .getIWM ().getPermissionPrefix (Util .getWorld (panel .getWorld ().get ()));
77- String reqPerm = prefix + "settings." + id ;
78- String allPerms = prefix + "settings.*" ;
79- if (!user .hasPermission (reqPerm ) && !user .hasPermission (allPerms )
80- && !user .isOp () && !user .hasPermission (prefix + "admin.settings" )) {
81- user .sendMessage ("general.errors.no-permission" , TextVariables .PERMISSION , reqPerm );
82- user .getPlayer ().playSound (user .getLocation (), Sound .BLOCK_METAL_HIT , 1F , 1F );
83- return true ;
76+ String prefix = "" ;
77+ if (panel .getWorld ().isPresent ()) {
78+ prefix = plugin .getIWM ().getPermissionPrefix (Util .getWorld (panel .getWorld ().get ()));
79+ String reqPerm = prefix + "settings." + id ;
80+ String allPerms = prefix + "settings.*" ;
81+ if (!user .hasPermission (reqPerm ) && !user .hasPermission (allPerms )
82+ && !user .isOp () && !user .hasPermission (prefix + "admin.settings" )) {
83+ user .sendMessage ("general.errors.no-permission" , TextVariables .PERMISSION , reqPerm );
84+ user .getPlayer ().playSound (user .getLocation (), Sound .BLOCK_METAL_HIT , 1F , 1F );
85+ return true ;
86+ }
8487 }
8588 // Left-clicking increases the rank required
8689 // Right-clicking decreases the rank required
0 commit comments