Package ch.njol.skript.log

Examples of ch.njol.skript.log.LogHandler


       
        if (logNormal())
          info("Loading variables...");
        final long vls = System.currentTimeMillis();
       
        final LogHandler h = SkriptLogger.startLogHandler(new ErrorDescLogHandler() {
          private final List<LogEntry> log = new ArrayList<LogEntry>();
         
          @Override
          public LogResult log(final LogEntry entry) {
            super.log(entry);
            if (entry.level.intValue() >= Level.SEVERE.intValue()) {
              logEx(entry.message); // no [Skript] prefix
              return LogResult.DONT_LOG;
            } else {
              log.add(entry);
              return LogResult.CACHED;
            }
          }
         
          @Override
          protected void beforeErrors() {
            logEx();
            logEx("===!!!=== Skript variable load error ===!!!===");
            logEx("Unable to load (all) variables:");
          }
         
          @Override
          protected void afterErrors() {
            logEx();
            logEx("Skript will work properly, but old variables might not be available at all and new ones may or may not be saved until Skript is able to create a backup of the old file and/or is able to connect to the database (which requires a restart of Skript)!");
            logEx();
          }
         
          @Override
          protected void onStop() {
            super.onStop();
            SkriptLogger.logAll(log);
          }
        });
        final CountingLogHandler c = SkriptLogger.startLogHandler(new CountingLogHandler(SkriptLogger.SEVERE));
        try {
          if (!Variables.load())
            if (c.getCount() == 0)
              error("(no information available)");
        } finally {
          c.stop();
          h.stop();
        }
       
        final long vld = System.currentTimeMillis() - vls;
        if (logNormal())
          info("Loaded " + Variables.numVariables() + " variables in " + ((vld / 100) / 10.) + " seconds");
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public boolean isLoopOf(final String s) {
    if (!(types instanceof Literal<?>))
      return false;
    final LogHandler h = SkriptLogger.startLogHandler(new BlockingLogHandler());
    try {
      final EntityData<?> d = EntityData.parseWithoutIndefiniteArticle(s);
      if (d != null) {
        for (final EntityData<?> t : ((Literal<EntityData<?>>) types).getAll()) {
          assert t != null;
          if (!d.isSupertypeOf(t))
            return false;
        }
        return true;
      }
    } finally {
      h.stop();
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of ch.njol.skript.log.LogHandler

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.