Skip to content

Commit

Permalink
#4) Start the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
magiclu550 committed Jan 26, 2020
1 parent 36cc51e commit 892cf5b
Show file tree
Hide file tree
Showing 11 changed files with 303 additions and 122 deletions.
13 changes: 13 additions & 0 deletions .idea/libraries/Maven__junit_junit_dep_4_9.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_codehaus_groovy_groovy_all_2_3_11.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Michel.iml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
<orderEntry type="library" name="Maven: org.jline:jline-terminal-jna:3.9.0" level="project" />
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:4.2.2" level="project" />
<orderEntry type="library" name="Maven: org.jline:jline-reader:3.9.0" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy-all:2.3.11" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.spockframework:spock-core:0.6-groovy-1.8" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit-dep:4.9" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.2" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.47" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang:scala-library:2.13.0" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang:scala-compiler:2.13.0" level="project" />
<orderEntry type="library" name="Maven: jline:jline:2.14.6" level="project" />
<orderEntry type="library" name="Maven: org.scala-lang:scala-reflect:2.13.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
190 changes: 77 additions & 113 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@
<version>${jline.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.3.11</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.6-groovy-1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
Expand Down Expand Up @@ -100,6 +122,49 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cn.wenyan.compiler.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<executions>

<execution>
<goals>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>

<configuration>
<debug>true</debug>
<verbose>true</verbose>
<stacktrace>true</stacktrace>
<defaultScriptExtension>.groovy</defaultScriptExtension>
<providerSelection>1.7</providerSelection>
</configuration>
</execution>

</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -140,128 +205,27 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.1-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence />
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<dependencies>
<!-- for 2.8.0-01 and later you must have an explicit dependency on groovy-eclipse-batch -->
<dependency>
<groupId>com.github.edwgiz</groupId>
<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
<version>2.8.1</version>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.3.7-01</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/versions/9/module-info.class</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>cn.michel.Michel</mainClass>
</transformer>
<transformer
implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer">
</transformer>
</transformers>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>

<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<prefix>git</prefix>
<dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
<dateFormatTimeZone>${user.timezone}</dateFormatTimeZone>
<verbose>true</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
<format>properties</format>
<skipPoms>true</skipPoms>
<injectAllReactorProjects>false</injectAllReactorProjects>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<skip>false</skip>
<runOnlyOnce>true</runOnlyOnce>
<excludeProperties>
<excludeProperty>git.user.*</excludeProperty>
</excludeProperties>
<includeOnlyProperties>
</includeOnlyProperties>
<useNativeGit>false</useNativeGit>
<abbrevLength>7</abbrevLength>
<commitIdGenerationMode>flat</commitIdGenerationMode>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<match>*</match>
<tags>false</tags>
<forceLongFormat>false</forceLongFormat>
</gitDescribe>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
62 changes: 61 additions & 1 deletion src/main/java/cn/michel/plugin/Plugin.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,64 @@
package cn.michel.plugin;

public interface Plugin {


import cn.michel.Server;
import cn.michel.utils.config.Config;
import cn.michel.utils.log.PluginLogger;

import java.io.File;
import java.io.InputStream;


public interface Plugin {

void onLoad();


void onEnable();


boolean isEnabled();


void onDisable();


boolean isDisabled();


File getDataFolder();

PluginDescription getDescription();

InputStream getResource(String filename);

boolean saveResource(String filename);

boolean saveResource(String filename, boolean replace);

boolean saveResource(String filename, String outputName, boolean replace);


Config getConfig();


void saveConfig();


void saveDefaultConfig();


void reloadConfig();


Server getServer();

String getName();


PluginLogger getLogger();

PluginLoader getPluginLoader();

}
Loading

0 comments on commit 892cf5b

Please sign in to comment.