示例#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;
  }
 public static Connection getConnection() {
   queries++;
   if (connection != null) {
     if (queries >= 2000) {
       closeConnection(connection);
       queries = 0;
       connection = null;
       return getConnection();
     }
     try {
       if (connection.isClosed()) {
         connection = null;
         return getConnection();
       }
       connection.setAutoCommit(false);
       return connection;
     } catch (SQLException ex) {
       FreedomOpModRemastered.plugin.handleException(ex);
     }
   } else {
     try {
       connection =
           DriverManager.getConnection(
               "jdbc:sqlite:"
                   + FreedomOpModRemastered.plugin.getDataFolder().getAbsolutePath()
                   + "/FOPMRData.db");
       connection.setAutoCommit(false);
       return connection;
     } catch (SQLException ex) {
       FreedomOpModRemastered.plugin.handleException(ex);
     }
   }
   return connection;
 }