Package com.kellerkindt.scs.interfaces

Examples of com.kellerkindt.scs.interfaces.ShopHandler


        if(errorCheck())
            return true;
       
        //Purge command will empty the mini file, and then replace with whatever is loaded.
        //
        ShopHandler     sh       = scs.getShopHandler();
        StorageHandler    storage    = scs.getStorageHandler();
       
        try {
                Messaging.send(cs, Term.PRUNE.get());
                ShowCaseStandalone.slog(Level.INFO, "Backup.");
                List<Shop>  shops  = new ArrayList<Shop>();
                for (Shop p : sh)
                  shops.add(p);
               
                ShowCaseStandalone.slog(Level.INFO, "Remove all shops from storage.");
                sh.removeAll();
               
                ShowCaseStandalone.slog(Level.INFO, "Add backuped shops.");
                sh.addAll(shops);

                ShowCaseStandalone.slog(Level.INFO, "Saving all currently loaded shops.");
                storage.save(sh);
               
      } catch (Exception ioe) {
View Full Code Here


    public boolean execute() throws MissingOrIncorrectArgumentException, InsufficientPermissionException {
        if(errorCheck())
            return true;
                   
       
        ShopHandler sHandler = scs.getShopHandler();
       
        // import from showcase
        if(args[1].equalsIgnoreCase("showcase")){
            ShowCaseStandalone.slog(Level.INFO, "Import Showcase shops.");
           
           
            ShowCaseImport si = new ShowCaseImport(scs);
           
            if(!si.fileExists()){
                Messaging.send(cs, "Could not attach to showcases.csv.  Is it in your ShowCaseStandalone data folder?");
                return true;
            }
           
            // load
            load(sHandler, si);
        }
       
       
        // import from ffss
        else if (args[1].equalsIgnoreCase("ffss")) {
          try {
            ShowCaseStandalone.slog(Level.INFO, "Import FastFileShopStorage.");
            load(sHandler, new FastFileShopStorage(scs));
          } catch (Throwable t) {
            t.printStackTrace();
          }
        }

        // import from sql - bukkit configuration
        else if (args[1].equalsIgnoreCase("sql_bukkit")) {
          try {
           
            int       count   = sHandler.size();
            StorageHandler  storage  = scs.getSQLShopStorageBukkit();
           
            storage.load(sHandler);
            Messaging.send(cs, "Imported: "+(sHandler.size() - count));
           
          } catch (Exception e) {
            Messaging.send(cs, Term.ERROR_IMPORT.get("sql_bukkit"));
          }
        }
       
       
        // import from sql - my configuration
        else if (args[1].equalsIgnoreCase("sql_scs")) {
          try {
           
            int       count   = sHandler.size();
            StorageHandler  storage  = scs.getSQLShopStorageThis();
           
            storage.load(sHandler);
            Messaging.send(cs, "Imported: "+(sHandler.size() - count));
           
          } catch (Exception e) {
            Messaging.send(cs, Term.ERROR_IMPORT.get("sql_scs"));
          }
        }
View Full Code Here

    public boolean execute() throws MissingOrIncorrectArgumentException, InsufficientPermissionException {
        if(errorCheck())
            return true;
       
        //Disable first, then reload, then re-enable.
        ShopHandler     sh     = scs.getShopHandler();
        StorageHandler    storage  = scs.getStorageHandler();
       
        try {
         
          Messaging.send(cs, Term.MESSAGE_RELOADING.get("config"));
            scs.reloadConfig();
            scs.loadSCSConfig(scs.getConfig());
           
            Messaging.send(cs, Term.MESSAGE_RELOADING.get("SCS"));
           
            ShowCaseStandalone.slog(Level.INFO, "Reloading SCS (command from " + cs.getName());
            ShowCaseStandalone.slog(Level.INFO, "Stopping shop update task.");
            sh.stop();
           
            ShowCaseStandalone.slog(Level.INFO, "Removing display items.");
        sh.hideAll();
       
        ShowCaseStandalone.slog(Level.INFO, "Writing changes to disk");
        storage.save(sh);
               
            ShowCaseStandalone.slog(Level.INFO, "Reloading shops from storage.");
            storage.load(sh);
           
            ShowCaseStandalone.slog(Level.INFO, "Starting shop update task.");
            sh.start();
           
            ShowCaseStandalone.slog(Level.INFO, "Showing display items in loaded chunks.");
            sh.showAll();
           
      } catch (Exception ioe) {
        ShowCaseStandalone.slog(Level.WARNING, "Exception on reload: " + ioe.getLocalizedMessage());
        Messaging.send(cs, Term.ERROR_GENERAL.get("reloading") +ioe.getLocalizedMessage());
      }
View Full Code Here

TOP

Related Classes of com.kellerkindt.scs.interfaces.ShopHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.