mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-13 19:01:28 +01:00
Require panel to have a world.
This commit is contained in:
parent
4bfbe41956
commit
cc7b1eba4c
@ -33,7 +33,7 @@ public class WorldToggleClick implements ClickHandler {
|
||||
|
||||
@Override
|
||||
public boolean onClick(Panel panel, User user, ClickType click, int slot) {
|
||||
World world = panel.getWorld().orElse(null);
|
||||
World world = panel.getWorld().orElseThrow(); // The panel must have a world
|
||||
String reqPerm = plugin.getIWM().getPermissionPrefix(world) + "admin.world.settings." + id;
|
||||
if (!user.hasPermission(reqPerm)) {
|
||||
user.sendMessage("general.errors.no-permission", TextVariables.PERMISSION, reqPerm);
|
||||
|
@ -77,6 +77,7 @@ public class WorldToggleClickTest {
|
||||
|
||||
// Panel
|
||||
when(panel.getInventory()).thenReturn(mock(Inventory.class));
|
||||
when(panel.getWorld()).thenReturn(Optional.of(world));
|
||||
|
||||
// User
|
||||
// Sometimes use Mockito.withSettings().verboseLogging()
|
||||
|
Loading…
Reference in New Issue
Block a user