Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed Aug 26, 2021
1 parent f6941fc commit ba4f706
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
env:
version: 0.0.2 # 你的版本名稱
version: 0.1.1 # 你的版本名稱
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
plugin_name: ELD-GUI-plugin
plugin_name: ELDependenci-MVC-plugin

name: Publish Process

Expand Down
4 changes: 2 additions & 2 deletions ELDependenci-MVC-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<artifactId>ELDependenci-MVC-Module</artifactId>
<groupId>org.eldependenci</groupId>
<version>0.1.alpha-4</version>
<version>0.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ELDependenci-MVC-plugin</artifactId>
<version>${project.parent.version}-2</version>
<version>${project.parent.version}</version>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ericlam.mc.eldgui;

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

import javax.inject.Inject;
Expand All @@ -12,7 +13,6 @@ public class ELDGLifeCycle implements ELDLifeCycle {

@Override
public void onEnable(JavaPlugin javaPlugin) {

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void initIndexView(Object controller) {
if (indexMethod.isEmpty())
throw new IllegalStateException("cannot find index method from " + controllerCls);
Method index = indexMethod.get();
if (index.getGenericReturnType() == Void.class)
if (index.getGenericReturnType() == Void.class || index.getGenericReturnType() == void.class)
throw new IllegalStateException("index method cannot return void");
Object[] objects = methodParseManager.getMethodParameters(index, null);
Object result = index.invoke(controller, objects);
Expand Down Expand Up @@ -280,8 +280,6 @@ public void onInventoryOpen(InventoryOpenEvent e) {
if (this.currentView == null) return;
LOGGER.debug("on inventory open"); // debug
if (this.currentView.getNativeInventory() == e.getInventory()) return;
e.getPlayer().sendMessage("open other inventory while inputting, so destroyed the previous view");
e.getPlayer().sendMessage("destroying view: " + controllerCls + " " + currentView.getView());
destroy();
}

Expand Down
2 changes: 1 addition & 1 deletion ELDependenci-MVC-plugin/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ELDepdendenci-GUI
name: ELDepdendenci-MVC
main: com.ericlam.mc.eldgui.ELDGPlugin
version: ${project.version}
api-version: "1.16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.google.gson.JsonElement;
import org.bukkit.Material;
import org.junit.Assert;
import org.junit.Test;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
Expand All @@ -23,35 +22,14 @@
import java.util.stream.Collectors;

@UIController("1234")
public class HowToUse {
public class TestMain {


public static void main(String[] args) {
SelectionFactory selection = null;

Component c = selection
.icon(Material.PLAYER_HEAD)
.label("select a number")
.selectable(String.class, builder -> {

builder.insert("iron")
.icon(Material.IRON_INGOT)
.number(1)
.submit();

builder.insert("gold")
.icon(Material.GOLD_INGOT)
.number(2)
.submit();

})
.bindInput("go", "123")
.toDisplay(String::valueOf)
.then()
.create();
// check user controller to see how to use
}

@Test
// @Test
public void testGson() {
Gson gson = new Gson();
byte[] json = gson.toJson("123131").getBytes(StandardCharsets.UTF_8);
Expand All @@ -61,7 +39,7 @@ public void testGson() {
System.out.println(o.getClass());
}

@Test
// @Test
public void testJackson() throws Exception {
ObjectMapper mapper = new ObjectMapper();
byte[] bb = mapper.writeValueAsBytes(UUID.randomUUID());
Expand All @@ -71,7 +49,7 @@ public void testJackson() throws Exception {
System.out.println(o.getClass());
}

@Test
// @Test
public void testJacksonConvert() {
//ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule()).disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
Gson gson = new Gson();
Expand Down Expand Up @@ -111,13 +89,13 @@ private static Map<String, Object> generateNestedMap(String path, Object value)
generateNestedMap(path.substring(indexOfDot + 1), value));
}

@Test
// @Test
public void testFlatMap() {
}

@Test
//@Test
public void testAnnotation() {
UIController realAnnotation = HowToUse.class.getAnnotation(UIController.class);
UIController realAnnotation = TestMain.class.getAnnotation(UIController.class);
System.out.println(realAnnotation.annotationType());
System.out.println(realAnnotation.value());
UIController fakeAnnotation = new UIController() {
Expand All @@ -140,7 +118,7 @@ public String value() {
}


@Test
//@Test
public void testPrimitive() {
var student = new Student(
"studen1",
Expand All @@ -157,7 +135,7 @@ public void testPrimitive() {
return null;
}

@Test
//@Test
public void testClassCommonPackage() {
System.out.println(ELDGExceptionViewHandler.class.getClassLoader().getName());
System.out.println(ExceptionViewHandler.class.getClassLoader().getName());
Expand All @@ -168,7 +146,7 @@ public void testClassCommonPackage() {
System.out.println(UserController.class.getProtectionDomain().getCodeSource().hashCode());
}

@Test
//@Test
public void testClassInherit() {
System.out.println(B.class.isAnnotationPresent(UIController.class));
}
Expand Down
2 changes: 1 addition & 1 deletion eldependenci-mvc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ELDependenci-MVC-Module</artifactId>
<groupId>org.eldependenci</groupId>
<version>0.1.alpha-4</version>
<version>0.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ public interface InventoryService {

/**
* 獲取界面調度器
* @param controller controlelr id
* @param controller 控制器 id
* @return 界面調度器
* @throws UINotFoundException 找不到該 controller
* @throws UINotFoundException 找不到該 控制器
*/
UIDispatcher getUIDispatcher(String controller) throws UINotFoundException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface DateSelectorFactory extends ComponentFactory<DateSelectorFactor

/**
* 設置禁用
* @return
* @return this
*/
DateSelectorFactory disabled();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public interface SelectionFactory extends ComponentFactory<SelectionFactory> {

/**
* 選擇器設定
* @param <T>
* @param <T> 選擇元素類型
*/
interface SelectionSettings<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface TimeSelectorFactory extends ComponentFactory<TimeSelectorFactor
/**
*
* @param title 標題
* @return
* @return this
*/
TimeSelectorFactory label(String title);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

/**
* 標記爲 UIController (控制器)。
* <br></br>
* <br>
* 你需要定義一個名爲 index 的方法,參數自取所需,必須返回 {@link com.ericlam.mc.eldgui.view.BukkitView} 作爲控制器初始界面。
* <br></br>
* <br>
* 然後新增自定義方法用於處理界面互動,方法必須有 {@link com.ericlam.mc.eldgui.event } 内的標注,參數各取所需,可返回 {@link com.ericlam.mc.eldgui.view.BukkitView}
* 或者 void
* <br></br>
* <br>
* 可取參數詳情請到教學文件詳閱。
*/
@Target(ElementType.TYPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

/**
* 異常界面處理器。當界面執行時出現異常,將會調用這個類去渲染異常界面。
* <br></br>
* 你可以透過新增自定義方法並標注 {@link HandleException} 來特別處理指定的異常,但其方法參數必須與 {@link this#createErrorView(Exception, String, UISession, Player)} 一致
* <br>
* 你可以透過新增自定義方法並標注 {@link HandleException}
* 來特別處理指定的異常,但其方法參數必須與
* {@link ExceptionViewHandler#createErrorView(Exception, String, UISession, Player)}
* 一致
*/
public interface ExceptionViewHandler {

Expand Down
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.eldependenci</groupId>
<artifactId>ELDependenci-MVC-Module</artifactId>
<packaging>pom</packaging>
<version>0.1.alpha-4</version>
<version>0.1.1</version>
<modules>
<module>eldependenci-mvc</module>
<module>ELDependenci-MVC-plugin</module>
Expand Down Expand Up @@ -122,19 +122,20 @@
<configuration>
<links>
<link>https://hub.spigotmc.org/javadocs/spigot/</link>
<link>https://eldependenci.github.io/ELDependenci/</link>
</links>
<show>public</show>
<isOffline>false</isOffline>
<linksource>true</linksource>
<encoding>UTF-8</encoding>
<windowtitle>ELDependenci-Addon</windowtitle>
<doctitle>ELDependenci-Addon v${project.version}</doctitle>
<windowtitle>ELDependenci-MVC</windowtitle>
<doctitle>ELDependenci-MVC v${project.version}</doctitle>
<verbose>true</verbose>
<author>true</author>
<version>true</version>
<linksource>true</linksource>
<notimestamp>true</notimestamp>
<bottom><![CDATA[<b>© ELDependenci-GUI - 2021</b>]]></bottom>
<bottom><![CDATA[<b>© ELDependenci-MVC - 2021</b>]]></bottom>
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
<outputDirectory>../javadocs</outputDirectory>
<detectJavaApiLink>true</detectJavaApiLink>
Expand Down

0 comments on commit ba4f706

Please sign in to comment.