mirror of
https://github.com/filoghost/ChestCommands.git
synced 2025-02-21 22:11:21 +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()) {
|
if (data.hasCommands()) {
|
||||||
for (String command : data.getCommands()) {
|
for (String command : data.getCommands()) {
|
||||||
if (!command.isEmpty()) {
|
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);
|
commandsToMenuMap.put(command, iconMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,13 @@ import com.gmail.filoghost.chestcommands.internal.icon.IconCommand;
|
|||||||
|
|
||||||
public class ExtendedIconMenu extends IconMenu {
|
public class ExtendedIconMenu extends IconMenu {
|
||||||
|
|
||||||
|
private String fileName;
|
||||||
private String permission;
|
private String permission;
|
||||||
private List<IconCommand> openActions;
|
private List<IconCommand> openActions;
|
||||||
|
|
||||||
public ExtendedIconMenu(String title, int rows, String fileName) {
|
public ExtendedIconMenu(String title, int rows, String fileName) {
|
||||||
super(title, rows);
|
super(title, rows);
|
||||||
|
this.fileName = fileName;
|
||||||
this.permission = Permissions.OPEN_MENU_BASE + fileName;
|
this.permission = Permissions.OPEN_MENU_BASE + fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +33,10 @@ public class ExtendedIconMenu extends IconMenu {
|
|||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFileName() {
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open(Player player) {
|
public void open(Player player) {
|
||||||
if (openActions != null) {
|
if (openActions != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user