Skip to content

Commit

Permalink
update for eld v2.0.4-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed May 21, 2022
1 parent 69e1871 commit ea520d0
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
java-version: 18
pre-release: true
body: test
upload-module: './PluginModule'
upload-module: './example-tutorial-plugin'
- name: 'Update javadocs'
id: update-javadoc
uses: eric2788/push-javadoc-branch@main
Expand Down
19 changes: 0 additions & 19 deletions PluginModule/src/main/java/tutorial/showcase/TutorialRegistry.java

This file was deleted.

17 changes: 0 additions & 17 deletions PluginModule/src/test/java/how/to/use/in/external/Registry.java

This file was deleted.

4 changes: 2 additions & 2 deletions APIModule/pom.xml → example-tutorial-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Template-For-ELDependenci-Addon</artifactId>
<artifactId>example-tutorial-addon</artifactId>
<groupId>org.eldependenci</groupId>
<version>0.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>APIModule</artifactId>
<artifactId>example-tutorial-api</artifactId>

<build>
<resources>
Expand Down
8 changes: 4 additions & 4 deletions PluginModule/pom.xml → example-tutorial-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Template-For-ELDependenci-Addon</artifactId>
<artifactId>example-tutorial-addon</artifactId>
<groupId>org.eldependenci</groupId>
<version>0.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>PluginModule</artifactId>
<artifactId>example-tutorial-plugin</artifactId>

<dependencies>
<dependency>
<groupId>org.eldependenci</groupId>
<artifactId>APIModule</artifactId>
<artifactId>example-tutorial-api</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eldependenci</groupId>
<artifactId>eldependenci-framework</artifactId>
<artifactId>eldependenci-bukkit</artifactId>
</dependency>
<dependency>
<groupId>org.eldependenci</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tutorial.showcase;

import com.ericlam.mc.eld.ELDLifeCycle;
import com.ericlam.mc.eld.bukkit.ELDLifeCycle;
import org.bukkit.plugin.java.JavaPlugin;

import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
package tutorial.showcase;

import com.ericlam.mc.eld.AddonManager;
import com.ericlam.mc.eld.ELDBukkitAddon;
import com.ericlam.mc.eld.ManagerProvider;
import com.ericlam.mc.eld.ServiceCollection;
import com.ericlam.mc.eld.annotations.ELDPlugin;
import com.ericlam.mc.eld.*;

@ELDPlugin(
@ELDBukkit(
lifeCycle = TutorialLifeCycle.class,
registry = TutorialRegistry.class
)
public class TutorialPlugin extends ELDBukkitAddon {
public class TutorialPlugin extends ELDBukkitPlugin {

@Override
protected void bindServices(ServiceCollection serviceCollection) {
public void bindServices(ServiceCollection serviceCollection) {
serviceCollection.bindService(ExampleService.class, ExampleServiceImpl.class);
}

AddonInstallation addonManager = serviceCollection.getInstallation(AddonInstallation.class);

@Override
protected void preAddonInstall(ManagerProvider managerProvider, AddonManager addonManager) {
// 初始化安裝器
MyExampleInstallationImpl installation = new MyExampleInstallationImpl();
// 添加安裝器
addonManager.customInstallation(MyExampleInstallation.class, installation);
// 安裝 guice module
addonManager.installModule(new MyExampleModule(installation));
}

@Override
protected void manageProvider(BukkitManagerProvider bukkitManagerProvider) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package tutorial.showcase;

import com.ericlam.mc.eld.bukkit.CommandNode;
import com.ericlam.mc.eld.bukkit.ComponentsRegistry;
import com.ericlam.mc.eld.registration.CommandRegistry;
import com.ericlam.mc.eld.registration.ListenerRegistry;
import org.bukkit.event.Listener;

public class TutorialRegistry implements ComponentsRegistry {


@Override
public void registerCommand(CommandRegistry<CommandNode> commandRegistry) {
// no commands
}

@Override
public void registerListeners(ListenerRegistry<Listener> listenerRegistry) {
// no listeners
}

}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package how.to.use.in.external;

import com.ericlam.mc.eld.BukkitManagerProvider;
import com.ericlam.mc.eld.ELDBukkit;
import com.ericlam.mc.eld.ELDBukkitPlugin;
import com.ericlam.mc.eld.ManagerProvider;
import com.ericlam.mc.eld.ServiceCollection;
import com.ericlam.mc.eld.annotations.ELDPlugin;
import tutorial.showcase.MyExampleInstallation;

/*
Expand All @@ -14,22 +14,23 @@
需要先掛接 api 再進行注入。
*/
@ELDPlugin(
@ELDBukkit(
lifeCycle = LifeCycle.class,
registry = Registry.class
)
public class JavaMain extends ELDBukkitPlugin {

@Override
protected void bindServices(ServiceCollection serviceCollection) {
public void bindServices(ServiceCollection serviceCollection) {
// 獲取 該擴充插件 的註冊器
MyExampleInstallation installation = serviceCollection.getInstallation(MyExampleInstallation.class);
installation.putSomeValue("hello", "world");
installation.putSomeValue("good", "work");
}


@Override
protected void manageProvider(ManagerProvider managerProvider) {
}
protected void manageProvider(BukkitManagerProvider bukkitManagerProvider) {

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package how.to.use.in.external;


import com.ericlam.mc.eld.ELDLifeCycle;
import com.ericlam.mc.eld.bukkit.ELDLifeCycle;
import org.bukkit.plugin.java.JavaPlugin;
import tutorial.showcase.ExampleService;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package how.to.use.in.external;

import com.ericlam.mc.eld.bukkit.CommandNode;
import com.ericlam.mc.eld.bukkit.ComponentsRegistry;
import com.ericlam.mc.eld.registration.CommandRegistry;
import com.ericlam.mc.eld.registration.ListenerRegistry;
import org.bukkit.event.Listener;

public class Registry implements ComponentsRegistry {

@Override
public void registerCommand(CommandRegistry<CommandNode> commandRegistry) {

}

@Override
public void registerListeners(ListenerRegistry<Listener> listenerRegistry) {

}
}
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>

<groupId>org.eldependenci</groupId>
<artifactId>Template-For-ELDependenci-Addon</artifactId>
<artifactId>example-tutorial-addon</artifactId>
<packaging>pom</packaging>
<version>0.1.1</version>
<modules>
<module>APIModule</module>
<module>PluginModule</module>
<module>example-tutorial-api</module>
<module>example-tutorial-plugin</module>
</modules>

<repositories>
Expand Down Expand Up @@ -41,14 +41,14 @@
</dependency>
<dependency>
<groupId>org.eldependenci</groupId>
<artifactId>eldependenci-framework</artifactId>
<version>0.1.6</version>
<artifactId>eldependenci-bukkit</artifactId>
<version>2.0.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eldependenci</groupId>
<artifactId>eldependenci-addon</artifactId>
<version>0.1.5</version>
<version>2.0.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down

0 comments on commit ea520d0

Please sign in to comment.