Warning about multiple menus using the same command.

This commit is contained in:
filoghost 2014-11-01 11:40:21 +01:00
parent fef2b40250
commit 4108ddc917
2 changed files with 9 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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) {