Пример #1
0
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (args.length > 0) {
      if (args[0].equalsIgnoreCase("reload")) {
        if (!FOPMR_Rank.isAdmin(sender)) {
          sender.sendMessage(ChatColor.RED + "Only admins can reload the FOPM: R config.");
          return true;
        }
        FreedomOpModRemastered.plugin.reloadConfig();
        FOPMR_DatabaseInterface.closeConnection(FOPMR_DatabaseInterface.getConnection());
      }
      return true;
    }
    sender.sendMessage(ChatColor.GREEN + "This is the FreedomOpMod Remastered!");
    sender.sendMessage(CUtils_Methods.randomChatColour() + "an all new form of All-Op management.");
    sender.sendMessage(
        CUtils_Methods.colour(
            "&-Created in the likes of the TFM but with more "
                + CUtils_Methods.randomChatColour()
                + "flexibility&- by "
                + CUtils_Methods.randomChatColour()
                + "Camzie99&-!"));

    return true;
  }
Пример #2
0
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length < 2) {
     return false;
   }
   Player player = FOPMR_Rank.getPlayer(args[0]);
   if (player == null) {
     sender.sendMessage(ChatColor.RED + "The player you listed: " + args[0] + " is not online...");
     return true;
   }
   try {
     String message = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
     FOPMR_DatabaseInterface.updateInTable(
         "UUID", player.getUniqueId().toString(), message, "LOGIN", "PLAYERS");
     sender.sendMessage(
         ChatColor.GREEN
             + "Set "
             + player.getName()
             + "'s login message to \""
             + CUtils_Methods.colour(message)
             + "\".");
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }
Пример #3
0
 @Override
 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
   if (args.length == 0) {
     return false;
   }
   if (!(sender instanceof Player)) {
     sender.sendMessage("This can only be used in-game.");
     return true;
   }
   Player player = (Player) sender;
   String nick = StringUtils.join(args, " ");
   int standard = 0;
   for (char Char : nick.toCharArray()) {
     if (standard >= 3) {
       continue;
     } else if (Char >= 'a' && Char <= 'z') {
       standard++;
     } else if (Char >= 'A' && Char <= 'Z') {
       standard++;
     } else if (Char >= '0' && Char <= '9') {
       standard++;
     } else {
       standard = 0;
     }
   }
   if (standard < 3) {
     sender.sendMessage(
         ChatColor.RED + "Your nick must have at least 3 alphanumeric characters consecutively.");
     return true;
   }
   player.sendMessage(
       ChatColor.GREEN
           + "Setting nick to "
           + CUtils_Methods.colour(StringUtils.join(args, " "))
           + ChatColor.GREEN
           + ".");
   try {
     Connection c = FOPMR_DatabaseInterface.getConnection();
     PreparedStatement statement =
         c.prepareStatement("UPDATE PLAYERS SET NICK = ? WHERE UUID = ?");
     statement.setString(1, nick + "&r");
     statement.setString(2, player.getUniqueId().toString());
     statement.executeUpdate();
     FOPMR_Rank.nicks.put(player.getName(), nick + "&r");
     c.commit();
   } catch (Exception ex) {
     FreedomOpModRemastered.plugin.handleException(ex);
   }
   return true;
 }