Skip to content
This repository was archived by the owner on Jan 14, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ $RECYCLE.BIN/

# IntelliJ
/out/
.idea/

# mpeltonen/sbt-idea plugin
.idea_modules/
Expand Down
72 changes: 26 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'http://maven.ferenyr.info/artifactory/plugins-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"
}
}

repositories {
mavenCentral()
maven {
url = 'https://oss.sonatype.org/content/repositories/releases/'
}
maven {
url "http://files.minecraftforgefrance.fr/maven/"
}
maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
mavenCentral()
maven {
url = 'https://oss.sonatype.org/content/repositories/releases/'
}
maven {
url "http://files.minecraftforgefrance.fr/maven/"
}
maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name = "leviathan"
url = "http://maven.ferenyr.info/artifactory/Leviathan/"
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

group = "com.leviathanstudio.mineide"
archivesBaseName = 'MineIDE-Compiler'
archivesBaseName = 'MineIDE-UI'
version = '0.0.1'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = 1.8
Expand All @@ -51,34 +46,19 @@ sourceSets {
}

dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.5'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.5'
compile group: 'com.leviathanstudio.mineide', name: 'MineIDE-Compiler', version: '0.0.1'
compile 'com.google.code.gson:gson:2.7'
compile 'de.jensd:fontawesomefx:8.9'
compile 'com.jfoenix:jfoenix:0.0.0-SNAPSHOT'
compile 'utybo:minkj:1.0'
compile 'com.squareup:javapoet:1.7.0'
compile 'org.reflections:reflections:0.9.10'

compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.7'
}

task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}

apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'

artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'Leviathan'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
32 changes: 32 additions & 0 deletions runtime/TestGroovyPlugin.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import com.leviathanstudio.plugin.MineIDEPlugin
import com.leviathanstudio.plugin.PluginInfos

class TestGroovyPlugin extends MineIDEPlugin {
@Override
void populateInfos(PluginInfos infos) {
infos.authors = {"jglrxavpok"}
infos.credits = {"jglrxavpok"}
infos.description = "A test plugin made in Groovy"
infos.name = {"Groovy Test Plugin"}
}

@Override
void onPrePluginInit() {
logger.info("Hi from pre-init in Groovy!")
}

@Override
void onPluginInit() {
logger.info("Hi from init in Groovy!")
}

@Override
void onPostPluginInit() {
logger.info("Hi from post-init in Groovy!")
}

@Override
String getID() {
return "test_groovy"
}
}
173 changes: 58 additions & 115 deletions src/main/java/com/leviathanstudio/plugin/MineIDEPlugin.java
Original file line number Diff line number Diff line change
@@ -1,127 +1,70 @@
package com.leviathanstudio.plugin;

import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.List;

/**
* Represents a MineIDE plugin. Loaded at the launch of the {@link PluginSystem Plugin System}.<br/>
* Starting point of any plugin.<br/><br/>
* <b>WARNING:</b> In order for your plugin to be loaded, its core class must extend with one.
*
*/
public abstract class MineIDEPlugin
{
private String pluginName, pluginDescription, pluginAuthor, pluginCredits;
private List<String> nullPluginList = new ArrayList<String>();
private boolean informationIncomplete;

public String getPluginName()
{
return pluginName;
}

public void setPluginName(String pluginName)
{
this.pluginName = pluginName;
}

public String getPluginDescription()
{
return pluginDescription;
}

public void setPluginDescription(String pluginDescription)
{
this.pluginDescription = pluginDescription;
}

public String getPluginAuthor()
{
return pluginAuthor;
}

public void setPluginAuthor(String pluginAuthor)
{
this.pluginAuthor = pluginAuthor;
}

public String getPluginCredits()
{
return pluginCredits;
}

public void setPluginCredits(String pluginCredits)
{
this.pluginCredits = pluginCredits;
}

public boolean isInformationIncomplete()
{
return informationIncomplete;
}

public void setInformationIncomplete(boolean informationIncomplete)
{
this.informationIncomplete = informationIncomplete;
}

public abstract void preInitPlugin();

public abstract void initPlugin();

public abstract void initPlugin(String[] args);

public void executePlugin()
{
this.preInitPlugin();
this.checkPluginInformation();

if(!this.isInformationIncomplete())
{
this.initPlugin();
}
else
{
System.err.println("[MineIDE-Plugin] Incomplete Plugin Information {");
for(int i = 0; i < nullPluginList.size(); i++)
System.err.println(nullPluginList.get(i));

System.err.println("}");
}
}

public void executePlugin(String[] args)
/**
* The informations about the plugin, filled at pre-initialization and by {@link #populateInfos(PluginInfos)}
*/
protected PluginInfos infos;

/**
* The logger dedicated to this plugin, assigned at loading
*/
protected Logger logger;

public MineIDEPlugin()
{
this.preInitPlugin();
this.checkPluginInformation();

if(!this.isInformationIncomplete())
this.initPlugin(args);
else
{
System.err.println("[MineIDE-Plugin] Incomplete Plugin Information {");
for(int i = 0; i < nullPluginList.size(); i++)
System.err.println(nullPluginList.get(i));

System.err.println("}");
}

}

private void checkPluginInformation()

/**
* Populate the <code>infos</code> object with informations about this mod.
* @param infos
* The object storing the informations
*/
public abstract void populateInfos(PluginInfos infos);

/**
* Called before all plugins are initialized
*/
public abstract void onPrePluginInit();

/**
* Called when the plugin needs to initialize
*/
public abstract void onPluginInit();

/**
* Called after all plugins have been initialized
*/
public abstract void onPostPluginInit();

/**
* Returns the ID of this mod.<br/>
* To be consistent across plugins, follow the snake case naming convention (e.g. "test_plugin", "my_super_duper_awesome_plugin", etc.)
* @return
* The ID of this mod
*/
public abstract String getID();

/**
* Called when an exception is raised because of this mod, prints the error message by default
* @param e
* The exception
*/
public void onPluginException(Exception e)
{
if(this.getPluginName() == null || this.getPluginName().isEmpty())
{
nullPluginList.add("Plugin Name is null or empty");
this.setInformationIncomplete(true);
}
else if(this.getPluginAuthor() == null || this.getPluginAuthor().isEmpty())
{
nullPluginList.add("Plugin Author is null or empty");
this.setInformationIncomplete(true);
}
else if(this.getPluginDescription() == null || this.getPluginDescription().isEmpty())
{
nullPluginList.add("Plugin Description is null or empty");
this.setInformationIncomplete(true);
}
else if(this.getPluginCredits() == null || this.getPluginCredits().isEmpty())
{
nullPluginList.add("Plugin Credits is null or empty");
this.setInformationIncomplete(true);
}
logger.error("Plugin crashed, ask the developer(s):", e);
}
}
Loading