001package com.ericlam.mc.groovier; 002 003import groovy.lang.GroovyClassLoader; 004 005/** 006 * a script loader interface 007 */ 008public interface ScriptLoader extends Comparable<ScriptLoader> { 009 010 /** 011 * do when unloading scripts 012 */ 013 void unload(); 014 015 /** 016 * do when loading scripts 017 * @param classLoader groovy class loader 018 */ 019 void load(GroovyClassLoader classLoader); 020 021 /** 022 * do after loading scripts 023 */ 024 default void afterLoad() { 025 } 026 027 /** 028 * priority of script loading order 029 * @return priority 030 */ 031 default int getPriority() { 032 return 10; 033 } 034 035 @Override 036 default int compareTo(ScriptLoader o) { 037 return Integer.compare(getPriority(), o.getPriority()); 038 } 039}