mirror of
https://github.com/filoghost/ChestCommands.git
synced 2025-02-19 04:51:23 +01:00
Warning about multiple menus using the same command.
This commit is contained in:
parent
fef2b40250
commit
4108ddc917
@ -201,6 +201,9 @@ public class ChestCommands extends JavaPlugin {
|
||||
if (data.hasCommands()) {
|
||||
for (String command : data.getCommands()) {
|
||||
if (!command.isEmpty()) {
|
||||
if (commandsToMenuMap.containsKey(command)) {
|
||||
errorLogger.addError("The menus \"" + commandsToMenuMap.get(command).getFileName() + "\" and \"" + menuConfig.getFileName() + "\" have the same command \"" + command + "\". Only one will be opened.");
|
||||
}
|
||||
commandsToMenuMap.put(command, iconMenu);
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,13 @@ import com.gmail.filoghost.chestcommands.internal.icon.IconCommand;
|
||||
|
||||
public class ExtendedIconMenu extends IconMenu {
|
||||
|
||||
private String fileName;
|
||||
private String permission;
|
||||
private List<IconCommand> openActions;
|
||||
|
||||
public ExtendedIconMenu(String title, int rows, String fileName) {
|
||||
super(title, rows);
|
||||
this.fileName = fileName;
|
||||
this.permission = Permissions.OPEN_MENU_BASE + fileName;
|
||||
}
|
||||
|
||||
@ -31,6 +33,10 @@ public class ExtendedIconMenu extends IconMenu {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open(Player player) {
|
||||
if (openActions != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user