if (conflict != null && conflict.getLabel().equals(label)) { return false;
continue; HelpTopic original = getHelpTopic("/" + command.getLabel()); if (original != null) { for (String alias : command.getAliases()) { String pluginName = getCommandPluginName(command); if (pluginName != null) { HelpTopic topic = getHelpTopic("/" + command.getLabel()); if (topic != null) { if (!pluginIndexes.containsKey(pluginName)) {
@Override public String getLabel() { return cmd.getLabel(); }
/** * Get the command label (trim + lower case), include server commands [subject to change]. * @param alias * @param strict If to return null if no command is found. * @return The command label, if possible to find, or the alias itself (+ trim + lower-case). */ public static String getCommandLabel(final String alias, final boolean strict) { final Command command = getCommand(alias); if (command == null) { return strict ? null : alias.trim().toLowerCase(); } else { return command.getLabel().trim().toLowerCase(); } }
// ... your AddReview class public AddReview(String title, MainFoodie mf) { super(title); this.mf = mf; // without that you'll get NPE in changeSreen // ... } //... private void changeScreen(Alert a, Form f){ Display.getDisplay(mf).setCurrent(a, f); } public void commandAction(Command c, Displayable d) { if(c.getLabel().equals("Save")){ // how to show alert here: changeScreen(cfmAlert, this) }
Form myForm = new Form("Test form"); Command ok = new Command("OK",Command.OK,0); Command cancel = new Command("CANCEL",Command.CANCEL,1); myForm.addCommand(ok); myForm.addCommand(cancel); myForm.setCommandListener(new CommandListener(){ public void commandAction(Command c, Displayable d) { if(c.getLabel().equals("OK")){ //Do something... myForm.removeCommand(c);//remove the command ok } } });
if (conflict != null && conflict.getLabel().equals(label)) { return false;
/** * Gets all of the aliases known for the given command. * * <p>This will include the main label, as well as defined aliases, and * aliases including the fallback prefix added by Bukkit.</p> * * @param command the command * @return the aliases */ static Collection<String> getAliases(Command command) { Stream<String> aliasesStream = Stream.concat( Stream.of(command.getLabel()), command.getAliases().stream() ); if (command instanceof PluginCommand) { String fallbackPrefix = ((PluginCommand) command).getPlugin().getName().toLowerCase().trim(); aliasesStream = aliasesStream.flatMap(alias -> Stream.of( alias, fallbackPrefix + ":" + alias )); } return aliasesStream.distinct().collect(Collectors.toList()); }
// ... public void commandAction(Command c, Displayable d) { String label = c.getLabel(); // log the event details; note Displayable.getTitle is available since MIDP 2.0 log("command s [" + label + "], screen is [" + d.getTitle() + "]"); if(label.equals("ok")) { // log detection of the command log("command obtained, showing input"); showInput(); } } private void log(String message) { // show message in emulator console System.out.println(message); } // ...
String label = c.getLabel(); if(label.equals("Exit")){ destroyApp(true);
public void restore() { // (Don't skip resetting, as there could be fall-back aliases.) // Command registered = CommandUtil.getCommand(label); // if (registered == null || registered != command) return; if (!label.equalsIgnoreCase(command.getLabel().trim().toLowerCase())) { command.setLabel(label); } command.setPermission(permission); if (permission != null && permissionDefault != null) { Permission perm = Bukkit.getPluginManager().getPermission(permission); if (perm != null && perm.getDefault() != permissionDefault) { perm.setDefault(permissionDefault); } } command.setPermissionMessage(permissionMessage); } }
String label = c.getLabel(); if(label.equals("Exit")){ destroyApp(true);
String label = c.getLabel();
messageVars.add("/" + command.getLabel().toLowerCase() + (split.length > 1 ? (" " + split[1]) : ""));
final String lcLabel = command.getLabel().trim().toLowerCase(); if (checked.contains(lcLabel) || containsAnyAliases(checked, command)) { if (!invertIgnored) {