示例#1
0
  @Override
  public boolean run(CommandSender sender, List<String> args) {
    if (args.size() != 1) return false;

    if (sender instanceof Player == false) {
      Chat.sendMessage(getMessage(Text.MUST_BE_PLAYER, sender));
      return true;
    }

    Language lang = Language.getLanguage(args.get(0));
    if (lang == null) {
      if (args.get(0).equalsIgnoreCase("english")) {
        PlayerRep.getPlayerRep((Player) sender).setLanguage(null);
        Chat.sendMessage(getMessage(Text.LANGUAGE_SUCCESS, sender).put("lang", args.get(0)));
      } else Chat.sendMessage(getMessage(Text.LANGUAGE_UNKNOWN, sender).put("lang", args.get(0)));
    } else {
      PlayerRep.getPlayerRep((Player) sender).setLanguage(lang);
      Chat.sendMessage(getMessage(Text.LANGUAGE_SUCCESS, sender).put("lang", lang));
    }
    return true;
  }
示例#2
0
 @Override
 public Message example(CommandSender sender) {
   String lang = Utils.random(Language.allLanguages());
   lang = lang == null ? "mylang" : lang;
   return getMessage(Text.LANGUAGE_EXAMPLE, sender).put("example", lang);
 }
示例#3
0
 @Override
 public List<String> options(CommandSender sender, List<String> args) {
   return Language.allLanguages();
 }