mirror of
https://github.com/CarmJos/EasyPlugin.git
synced 2026-06-05 09:01:47 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 429eb9c6ec | |||
| 05e2c8fad0 | |||
| a58fe4abd6 | |||
| 79a18f2669 | |||
| e5fc8acddc | |||
| fb125ee9bd | |||
| 376cde3529 |
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
## 内容
|
## 内容
|
||||||
|
|
||||||
项目初创不久,加 * 的仍在开发更新中...
|
项目初创不久,加 * 的仍在开发更新中...欢迎各路大佬帮助提供本项目的开发文档~
|
||||||
|
|
||||||
### 集合部分 (`/collection`)
|
### 集合部分 (`/collection`)
|
||||||
|
|
||||||
@@ -37,11 +37,25 @@
|
|||||||
### 主要部分 (`/base`)
|
### 主要部分 (`/base`)
|
||||||
|
|
||||||
- Main [`easyplugin-main`](base/main)
|
- Main [`easyplugin-main`](base/main)
|
||||||
|
- 主要接口模块,提供了方便的插件入口类与相关工具类。
|
||||||
- Command [`easyplugin-command`](base/command)
|
- Command [`easyplugin-command`](base/command)
|
||||||
- ~~Messages*~~ (已独立项目到 [**EasyMessages**](https://github.com/CarmJos/EasyMessages))
|
- 指令接口模块,便于快速进行子指令的实现,并提供单独的TabComplete方法。
|
||||||
- ~~Configuration~~ (已独立项目到 [**MineConfiguration**](https://github.com/CarmJos/MineConfiguration))
|
- 随本项目提供了 `SimpleCompleter` 类,用于快速创建补全的内容列表。
|
||||||
- ~~Database~~ (已独立项目到 [**EasySQL**](https://github.com/CarmJos/EasySQL))
|
|
||||||
- GUI [`easyplugin-gui`](base/main)
|
- GUI [`easyplugin-gui`](base/main)
|
||||||
|
- 简单便捷的箱子GUI接口,可以快速实现GUI中不同图标的点击功能。
|
||||||
|
- 随本项目提供了 `AutoPagedGUI` 等翻页GUI抽象类。
|
||||||
|
- Storage [`easyplugin-storage`](base/storage)
|
||||||
|
- 抽象存储管理器,便于实现不同的存储类型。
|
||||||
|
- 随本项目提供了 `FileBasedStorage`、`FolderBasedStorage` 等常用存储抽象方法。
|
||||||
|
|
||||||
|
> 以下项目均已独立出单独项目,仅仅是按照包名规则打包到EasyPlugin的子项目中。
|
||||||
|
>
|
||||||
|
> 如需使用,**强烈建议自行引用对应的项目**,以支持完整的Javadoc并获取源码内容!
|
||||||
|
|
||||||
|
- _Listener_ [`easyplugin-listener`](base/listener) (打包自 [**EasyListener**](https://github.com/CarmJos/EasyListener))
|
||||||
|
- _Configuration_ [`easyplugin-conf`](base/conf) (打包自 [**MineConfiguration**](https://github.com/CarmJos/MineConfiguration))
|
||||||
|
- _Database_ [`easyplugin-database`](base/database) (打包自 [**EasySQL**](https://github.com/CarmJos/EasySQL))
|
||||||
|
- _Messages*_ [`easyplugin-message`](base/message) (打包自 [**EasyMessages**](https://github.com/CarmJos/EasyMessages))
|
||||||
|
|
||||||
### 附属部分 (`/extension`)
|
### 附属部分 (`/extension`)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package cc.carm.lib.easyplugin.command;
|
package cc.carm.lib.easyplugin.command;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.permissions.Permissible;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ public interface NamedExecutor {
|
|||||||
|
|
||||||
List<String> getAliases();
|
List<String> getAliases();
|
||||||
|
|
||||||
default boolean hasPermission(Permissible permissible) {
|
default boolean hasPermission(CommandSender sender) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>easyplugin-parent</artifactId>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<version>1.4.13</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>${project.jdk.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${project.jdk.version}</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||||
|
</properties>
|
||||||
|
<artifactId>easyplugin-conf</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>EasyPlugin-Configuration</name>
|
||||||
|
<description>轻松插件配置文件接口模块,基于 MineConfiguration 项目。</description>
|
||||||
|
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<!-- https://github.com/CarmJos/MineConfiguration -->
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>mineconfiguration-bukkit</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cc.carm.lib.configuration.core</pattern>
|
||||||
|
<shadedPattern>cc.carm.lib.easyplugin.conf</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cc.carm.lib.mineconfiguration.common</pattern>
|
||||||
|
<shadedPattern>cc.carm.lib.easyplugin.conf</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cc.carm.lib.mineconfiguration.bukkit</pattern>
|
||||||
|
<shadedPattern>cc.carm.lib.easyplugin.conf</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>*:*</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||||
|
<exclude>META-INF/*.txt</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>easyplugin-parent</artifactId>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<version>1.4.13</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>${project.jdk.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${project.jdk.version}</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||||
|
</properties>
|
||||||
|
<artifactId>easyplugin-database</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>EasyPlugin-Database</name>
|
||||||
|
<description>轻松插件数据库接口模块,基于 EasySQL 项目。</description>
|
||||||
|
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<!-- https://github.com/CarmJos/EasySQL -->
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>easysql-beecp</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cc.carm.lib.easysql</pattern>
|
||||||
|
<shadedPattern>cc.carm.lib.easyplugin.database</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>*:*</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||||
|
<exclude>META-INF/*.txt</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -13,10 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class GUI {
|
public class GUI {
|
||||||
@@ -56,9 +53,9 @@ public class GUI {
|
|||||||
*/
|
*/
|
||||||
boolean cancelOnOuter = true;
|
boolean cancelOnOuter = true;
|
||||||
|
|
||||||
Map<String, Object> flags;
|
protected final Map<String, Object> flags = new LinkedHashMap<>();
|
||||||
|
|
||||||
GUIListener listener;
|
protected GUIListener listener;
|
||||||
|
|
||||||
public GUI(GUIType type, String name) {
|
public GUI(GUIType type, String name) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -131,24 +128,15 @@ public class GUI {
|
|||||||
this.cancelOnOuter = b;
|
this.cancelOnOuter = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFlag(String flag, Object obj) {
|
|
||||||
if (this.flags == null) this.flags = new HashMap<>();
|
|
||||||
this.flags.put(flag, obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getFlag(String flag) {
|
public Object getFlag(String flag) {
|
||||||
if (this.flags == null) return null;
|
return this.flags.get(flag);
|
||||||
else
|
|
||||||
return this.flags.get(flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlag(String flag, Object obj) {
|
public void setFlag(String flag, Object obj) {
|
||||||
if (this.flags == null) this.flags = new HashMap<>();
|
this.flags.put(flag, obj);
|
||||||
this.flags.replace(flag, obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFlag(String flag) {
|
public void removeFlag(String flag) {
|
||||||
if (this.flags == null) this.flags = new HashMap<>();
|
|
||||||
this.flags.remove(flag);
|
this.flags.remove(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +181,13 @@ public class GUI {
|
|||||||
public void onClose() {
|
public void onClose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GUIType getGUIType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGUIName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public static void setOpenedGUI(Player player, GUI gui) {
|
public static void setOpenedGUI(Player player, GUI gui) {
|
||||||
getOpenedGUIs().put(player.getUniqueId(), gui);
|
getOpenedGUIs().put(player.getUniqueId(), gui);
|
||||||
|
|||||||
@@ -37,12 +37,24 @@ public class GUIItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家点击GUI后执行的代码
|
* 玩家点击该物品后执行的代码
|
||||||
|
* 可以使用 {@link #onClick(Player, ClickType)} 操作点击者
|
||||||
*
|
*
|
||||||
* @param type 点击的类型
|
* @param type 点击的类型
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@SuppressWarnings("DeprecatedIsStillUsed")
|
||||||
public void onClick(ClickType type) {
|
public void onClick(ClickType type) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家点击GUI后执行的代码
|
||||||
|
*
|
||||||
|
* @param clicker 点击的玩家
|
||||||
|
* @param type 点击的类型
|
||||||
|
*/
|
||||||
|
public void onClick(Player clicker, ClickType type) {
|
||||||
|
this.onClick(type); // Deprecated method support
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addClickAction(GUIClickAction action) {
|
public void addClickAction(GUIClickAction action) {
|
||||||
@@ -58,7 +70,7 @@ public class GUIItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家点击GUI后执行的代码
|
* 自定义点击事件代码 (须自行触发)
|
||||||
*
|
*
|
||||||
* @param player 点击GUI的玩家
|
* @param player 点击GUI的玩家
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class GUIListener implements Listener {
|
|||||||
GUIItem clickedItem = getCurrentGUI().getItem(event.getSlot());
|
GUIItem clickedItem = getCurrentGUI().getItem(event.getSlot());
|
||||||
if (clickedItem != null) {
|
if (clickedItem != null) {
|
||||||
if (clickedItem.isActionActive()) {
|
if (clickedItem.isActionActive()) {
|
||||||
clickedItem.onClick(event.getClick());
|
clickedItem.onClick(player, event.getClick());
|
||||||
clickedItem.rawClickAction(event);
|
clickedItem.rawClickAction(event);
|
||||||
clickedItem.actions.forEach(action -> action.run(event.getClick(), player));
|
clickedItem.actions.forEach(action -> action.run(event.getClick(), player));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ public enum GUIType {
|
|||||||
SIX_BY_NINE(6, 54),
|
SIX_BY_NINE(6, 54),
|
||||||
CANCEL(0, 0);
|
CANCEL(0, 0);
|
||||||
|
|
||||||
int lines;
|
private final int lines;
|
||||||
int size;
|
private final int size;
|
||||||
|
|
||||||
GUIType(int lines, int size) {
|
GUIType(int lines, int size) {
|
||||||
this.lines = lines;
|
this.lines = lines;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class AutoPagedGUI extends CommonPagedGUI {
|
|||||||
setItem(previousPageSlot, new GUIItem(
|
setItem(previousPageSlot, new GUIItem(
|
||||||
previousPageUI == null ? getDefaultPreviousPage(user) : previousPageUI) {
|
previousPageUI == null ? getDefaultPreviousPage(user) : previousPageUI) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickType type) {
|
public void onClick(Player clicker, ClickType type) {
|
||||||
if (type == ClickType.RIGHT) {
|
if (type == ClickType.RIGHT) {
|
||||||
goFirstPage();
|
goFirstPage();
|
||||||
} else {
|
} else {
|
||||||
@@ -68,7 +68,7 @@ public class AutoPagedGUI extends CommonPagedGUI {
|
|||||||
setItem(nextPageSlot, new GUIItem(
|
setItem(nextPageSlot, new GUIItem(
|
||||||
nextPageUI == null ? getDefaultNextPage(user) : nextPageUI) {
|
nextPageUI == null ? getDefaultNextPage(user) : nextPageUI) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickType type) {
|
public void onClick(Player clicker, ClickType type) {
|
||||||
if (type == ClickType.RIGHT) {
|
if (type == ClickType.RIGHT) {
|
||||||
goLastPage();
|
goLastPage();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>easyplugin-parent</artifactId>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<version>1.4.13</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>${project.jdk.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${project.jdk.version}</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||||
|
</properties>
|
||||||
|
<artifactId>easyplugin-listener</artifactId>
|
||||||
|
|
||||||
|
<name>EasyPlugin-Listener</name>
|
||||||
|
<description>轻松插件监听器接口模块,基于 EasyListener 项目。</description>
|
||||||
|
<url>https://github.com/CarmJos/EasyPlugin</url>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>GNU LESSER GENERAL PUBLIC LICENSE</name>
|
||||||
|
<url>https://www.gnu.org/licenses/lgpl-3.0.html</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<!-- https://github.com/CarmJos/EasyListener -->
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>easylistener</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>cc.carm.lib.easylistener</pattern>
|
||||||
|
<shadedPattern>cc.carm.lib.easyplugin.listener</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
<filters>
|
||||||
|
<filter>
|
||||||
|
<artifact>*:*</artifact>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||||
|
<exclude>META-INF/*.txt</exclude>
|
||||||
|
</excludes>
|
||||||
|
</filter>
|
||||||
|
</filters>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -145,6 +145,13 @@ public abstract class EasyPlugin extends JavaPlugin {
|
|||||||
if (isDebugging()) print("&8[DEBUG] &r", messages);
|
if (isDebugging()) print("&8[DEBUG] &r", messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在主线程唤起一个事件,并支持获取事件的结果。
|
||||||
|
*
|
||||||
|
* @param event 同步事件 (isAsync=false)
|
||||||
|
* @param <T> 事件类型
|
||||||
|
* @return CompletableFuture
|
||||||
|
*/
|
||||||
public @NotNull <T extends Event> CompletableFuture<T> callSync(T event) {
|
public @NotNull <T extends Event> CompletableFuture<T> callSync(T event) {
|
||||||
CompletableFuture<T> future = new CompletableFuture<>();
|
CompletableFuture<T> future = new CompletableFuture<>();
|
||||||
getScheduler().run(() -> {
|
getScheduler().run(() -> {
|
||||||
@@ -154,11 +161,24 @@ public abstract class EasyPlugin extends JavaPlugin {
|
|||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在异步线程中唤起一个事件,并支持获取事件的结果。
|
||||||
|
*
|
||||||
|
* @param event 异步事件 (isAsync=true)
|
||||||
|
* @param <T> 事件类型
|
||||||
|
* @return CompletableFuture
|
||||||
|
*/
|
||||||
public @NotNull <T extends Event> CompletableFuture<T> callAsync(T event) {
|
public @NotNull <T extends Event> CompletableFuture<T> callAsync(T event) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<T> future = new CompletableFuture<>();
|
||||||
|
getScheduler().runAsync(() -> {
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event;
|
future.complete(event);
|
||||||
});
|
});
|
||||||
|
return future;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setMessageProvider(@NotNull EasyPluginMessageProvider provider) {
|
||||||
|
this.messageProvider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+30
-1
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.parent.groupId}</groupId>
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
<artifactId>easyplugin-main</artifactId>
|
<artifactId>easyplugin-main</artifactId>
|
||||||
@@ -67,6 +68,27 @@
|
|||||||
<artifactId>easyplugin-gui</artifactId>
|
<artifactId>easyplugin-gui</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
|
<artifactId>easyplugin-storage</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
|
<artifactId>easyplugin-listener</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
|
<artifactId>easyplugin-database</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
|
<artifactId>easyplugin-conf</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.parent.groupId}</groupId>
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
<artifactId>easyplugin-papi</artifactId>
|
<artifactId>easyplugin-papi</artifactId>
|
||||||
@@ -77,6 +99,13 @@
|
|||||||
<artifactId>easyplugin-vault</artifactId>
|
<artifactId>easyplugin-vault</artifactId>
|
||||||
<version>${project.parent.version}</version>
|
<version>${project.parent.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.parent.groupId}</groupId>
|
||||||
|
<artifactId>easyplugin-githubchecker</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -68,6 +68,14 @@
|
|||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-vault</artifactId>
|
<artifactId>easyplugin-vault</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>easyplugin-database</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>easyplugin-storage</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -15,12 +15,16 @@
|
|||||||
<groupId>cc.carm.lib</groupId>
|
<groupId>cc.carm.lib</groupId>
|
||||||
<artifactId>easyplugin-parent</artifactId>
|
<artifactId>easyplugin-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.4.11</version>
|
<version>1.4.13</version>
|
||||||
<modules>
|
<modules>
|
||||||
|
|
||||||
<module>base/main</module>
|
<module>base/main</module>
|
||||||
<module>base/command</module>
|
<module>base/conf</module>
|
||||||
<module>base/gui</module>
|
<module>base/gui</module>
|
||||||
|
<module>base/command</module>
|
||||||
|
<module>base/storage</module>
|
||||||
|
<module>base/listener</module>
|
||||||
|
<module>base/database</module>
|
||||||
|
|
||||||
<module>extension/papi</module>
|
<module>extension/papi</module>
|
||||||
<module>extension/vault</module>
|
<module>extension/vault</module>
|
||||||
@@ -29,7 +33,6 @@
|
|||||||
<module>collection/all</module>
|
<module>collection/all</module>
|
||||||
<module>collection/bom</module>
|
<module>collection/bom</module>
|
||||||
<module>collection/common</module>
|
<module>collection/common</module>
|
||||||
<module>base/storage</module>
|
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
@@ -141,6 +144,21 @@
|
|||||||
<artifactId>githubreleases4j</artifactId>
|
<artifactId>githubreleases4j</artifactId>
|
||||||
<version>1.3.1</version>
|
<version>1.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>easylistener</artifactId>
|
||||||
|
<version>2.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>mineconfiguration-bukkit</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.carm.lib</groupId>
|
||||||
|
<artifactId>easysql-beecp</artifactId>
|
||||||
|
<version>0.4.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user